|  |
 |
 |
|

3HTi, LLC is a full sales and service provider that focuses on helping companies maximize value from their investments in technology. This newsletter is in keeping with 3HTi’s goal of putting customers first to create products better, faster, and cheaper.
[FULL STORY]
|
|
Using Units in Mathcad
The ability to track and balance units is one of the primary reasons that people choose Mathcad for their engineering calculation work.
by Leslie Bondayrk
This image shows a
nasty tank implosion because a design engineer slipped the units on the yield
strength of the steel in a pressure calculation.
|
The ability to track
and balance units is one of the primary reasons that people choose Mathcad
for their engineering calculation work. Using units in Mathcad helps you
avoid messy, dangerous, or costly mistakes, like the one shown above. But in
my travels I see many worksheets that document units in text regions
alongside equations, or worse yet, leave them out entirely. This is a shame,
since it means that lots of Mathcad users don't take advantage of this
ever-present correction and documentation mechanism.
|
Here's a simple
example of what you can do:
|
A couple of things
happen for you automatically. First, you know what the quantity is that
you're calculating, in this case, force. That sounds like a small and very
obvious thing, but if your result comes out of 4 pages of equations, all in
symbols that are used to calculate other intermediate values, it's comforting
to know that you combined everything correctly to produce a force, and not,
say, a pressure, a force density, or some meaningless combination of units.
|
Mathcad combines the
common unit signatures for you into a single unit when it can, unless you ask
it not to. Format > Results, Unit Display tab has an option called
"Simplify Units when Possible." Turn this off and see the
difference in the above result.
|
Mathcad even
balances units through systems of equations solved with solve blocks, which
can frustrate even the most experienced unit balancer.
|
Note that as in the
above expression it is possible to solve for variables with different
quantities, you just have to assign and display the names of the results
independently, since you can't mix quantities in a matrix.
|
The next important
thing you can do with results with units, is to rescale your value in
different units. Click on the result for a calculation, then type a different
unit on the black placeholder at the end, like lbf for the force calculation
above, and press [Enter]. Now you've got:
|
You could also
double-click on that black placeholder to see a dialog that lists the
matching quantity, and all the units Mathcad knows about that reasonably
convert the quantity.
|
Another benefit of
including units in this analysis is that it helps you avoid unit
errors. For example, there's often a confusion between pounds-force,
and pounds, which is a mass. Even the literature is sometimes fuzzy on this
point. Mathcad's unit definitions are based around the NIST standard values,
so your conversions are verified for you. If you include your units in calculations,
the correct unit falls out on its own. If you were to try to add the force
calculated above to a pressure, by accident, Mathcad tells you that's not
allowed, and even tells you that a Pressure can't be added to a Force.
|

|

|

|
There is, of course,
an overhead in using units - you must use them everywhere in a calculation
once you start. Mathcad will do its job and begin nudging you to fix up your
units everywhere. You'll have to remember to use MPa instead of Pa, mm
instead of cm, and microfarads instead of Farads. But isn't that really the
reason you bought a computer tool in the first place - to error check,
enforce consistency, and enforce (as far as any tool can) some level of
documentation?
|
You'll also have to
remember to scale your inputs in graphs so that 1 ft plots as 1, and not as
0.305 m - or you can customize your unit system so you always get your
answers in the scale you prefer - but again, taking a few moments to cross
your t's and dot your i's is part of the documentary point of Mathcad.
|
Finally, not all
calculations in Mathcad support units, largely because Mathcad produces
results for some things, like ODEs and regressions, in vectors, which can't
have mixed units. We recognize how important it is to hold on to that kg at
the end of the number, as it means something entirely different from mg. For
these calculations, you can always use SIUnitsOf(x) or just the known
scaling unit to divide out the units from any value as you pass it through
those functions that don't accept units. Then, multiply the units back in
once you have your result. It'll be just as successful in ensuring you don't
miss an order of magnitude, or come out with the wrong quantity.
|
Divide these units
out of the fit functions linearly collected terms and out of the inputs to
linfit:
|
Now it only remains
to multiply each parameter by its correct units to take temperature in and
return units of power.
|
|
Right-click, choose Save Target As, and change the extension to XMCD and File
Type to All to download Mathcad file. (Mathcad 14)
|
[PRINTER FRIENDLY VERSION]
|
|
|