1 2 3 Previous Next 378 Replies Latest reply: May 31, 2011 4:29 AM by A.Non

# Working with numbers or variables with Units

I am well familiar with MathCad numerical calculations and programming. However, I got accustumed to work my solutions without alphanumerical dimensions next to the number or variable. It is clean an easier for me to keep track of units and conversion in my mind than assigning units to numbers and varaibles at the beguining of calculations or programming with MathCad.

I tried otherwise recently but with problems. My question is to anybody: What is the best way not to get bugdown with error messages becuase units have not been defined properly at the beguining of any problem set-up or during calculations?

I am a structural enginer and work often with Kips, U.S. Tons, Yards, ft., inch.,etc. How do you mix these units in calculation and get the correct answer without keeping track of their different units? Help is appreciated. Thanks.
• ###### 1. Working with numbers or variables with Units
One of the things I have done is build a new template file. This file has a colapsed area at the very top with the constants and units I usually use (rpm = Hza/60, psf = psi/144) that aren't native to mathcad. This area does not appear in the worksheet, yet the definitions are in place without having to input them each time and worry about getting it right.

In your case kip = 1000 lbf, etc.

Fred Kohlhepp
fkohlhepp@sikorsky.com
• ###### 2. Working with numbers or variables with Units
A problem in thermodynamics can give a solved result that can be either British Thermal Units (BTU) or Centigrade Heat Units (CHU) equally. In other cases it is best to plan the solution in one system or the other and define the answer at the end. No use in carrying units in equations. Irrational fractions cannot be made whole if units are carried in the process.
• ###### 3. Working with numbers or variables with Units
Please note (after a second look) that many of the units you specify (ft, in, yard (yd) are already in Mathcad and do not require definition. Mathcad will automatically convert to make the numbers correct.
Fred Kohlhepp
fkohlhepp@sikorsky.com
• ###### 4. Working with numbers or variables with Units
You just define all the units you will need, excepting those you know are already defined by Mathcad, at the top of the sheet. I recommend a collapsed area that contains all the units you need. You can then copy that into sheets that need it, or if most sheets need it add it to the template.

Once you consistently apply units to your input values (including constants in equations) you don't have to (and, largely, cannot) keep track of units. Mathcad simply stores a representation of the quantity which you can then display in any units you want (using the units placeholder, Mathcad does have default units for all types of quantities). Thus in Mathcad there is absolutely no difference between the value 1ft and the value 12in. Both are exactly the same length. The internal representation will vary depending on the current units system and the Mathcad version, but that should be irrelevant to their use.

� � � � Tom Gutman
• ###### 5. Working with numbers or variables with Units

One of my hopes for future releases is a way of handling units with the solvers - even some sort of 'wrapper' that can remove & replace the units as it passes to/from the solver.

One of the [much] less talked about engineering methods is that of 'Per Unit', where all equations are converted to a relative scale so Full_Power = 1, etc. where all the constants of proportionality in equations become 1. F=m.a, V=I.R, etc.

It is a method used in the electrical power industry because all the transformers make the [volts & amps] numbers change but the power delivered is fixed, as is [nearly] the frequency, while results in SI have widely varying exponents, so per-unit measures work well, and they match the numerical stability criteria quite well!

Philip
• ###### 6. Working with numbers or variables with Units
If you are using text book formulae which expect values in certain units then getting the units correct takes care. The formulae almost always have 'special constants' in them.

One method is to divide each variable in the equation by the units the text book stated, and then multiply the overall equation by the units of the final answer. This can look quite intuitive if the (var/units) are nicely bracketted.

Another approach is to find the 'special constants' (usually real number in the equation) and using known values, or the first method, find the units of those special constants and just apply the units there.
Watch for Log, Exp, Sin, Cos etc. in the equations which require unitless or radian measures and may hide a 'special constant'.

Philip
• ###### 7. Working with numbers or variables with Units
It is wise never use units ,
only dimension the intrants as per the design of the formula(s).
Think in terms of "what is what" and "what is not what" ... solvers...etc.

Only append the "UnitResult" .

Formulas evolve in the course, they may reach an unsuspected state of simplicity.

jmG
• ###### 8. Working with numbers or variables with Units
Life would be truly miserable if Mathcad couldn't do its thing with units. We get mixed units all the time; trying to reconcile and convert them to do a trivial calculation would triple the work load.

TTFN,
Eden
• ###### 9. Working with numbers or variables with Units
Jean (jmG) is as staunch an opponent of units as I am of using them. I agree that they are one of the best features of Mathcad and have caught a lot of my mistakes.

That said, improperly defined units will cause more problems than they find; and there are a number of Mathcad constructs (the differential equation solvers for example) where they can be particularly troublesome.

Both sides have strong arguments.

Fred Kohlhepp
fkohlhepp@sikorsky.com
• ###### 11. Working with numbers or variables with Units
"Uconeer" is for those who don't have Mathcad at the end level, for instance Technicians plugging things in a Control system.
Among the so many converters Uconeer is quite complete vis the inconsistency in units used in real life as many users must stick to an original system for consistency ... a coal fired power plant designed in 1958 (steam properties and so and so ...).

Few more pages complete the work sheet (not included) with a solver . No need to preach including units in this kind of task . The formula is designed+dimensioned, just enter the correct values (converted if required).

The formula comes out from the Toricelli principle, yes it takes a bit of caution to make it work . You are right, at the design stage Mathcad with units would have helped but not anymore . The same principle applies to all engineering formulas developed without Mathcad . That's why I maintain that units in Mathcad are useless, at least most collabs can survive without units in Mathcad . Units were added to help the beginners, but not added to be used .

jmG
• ###### 12. Working with numbers or variables with Units
... nearly all (if not) the collabs with units were and are still in the disciplines of "Structural", "Civil Engineering" ... Maybe because those Engineering disciplines don't really involve non geometrical Units ?

jmG
• ###### 13. Working with numbers or variables with Units
On 10/11/2006 11:57:39 AM, eden_mei wrote:
== That's where Mathcad can cut to the chase. You don't need Uconeer or another units converter with Mathcad. The ideal gas equation will work with any combination of units from the different choices transparently.
== You seem to want to go out of your way to complicate your life with a separate units conversion when Mathcad does the unit conversion transparently and without having to transfer numbers from one program to another.

Agreed. I'm not a units user, but there would seem to be little point in using A N Other product merely to do unit conversions on calculations otherwise done in Mathcad, and then copy/paste them.

It also introduces yet another configuration problem when (the almost inevitable) changes are made to a worksheet or the user wants different values.

If Mathcad is short of a particular unit (expressible in terms of the base quantities), then it's not too difficult to add that unit.

AFAICT, the major problem with using units in Mathcad is not the basic functionality, but some of the difficulties that occur in the flow of information through a document, for example, the need to remove/add units for certain operations, and the lack of mixed units in arrays.

Stuart
• ###### 14. Working with numbers or variables with Units
Luckily, I don't have many of those situations.

I would expect, though, that stripping and reinserting units can be made automatic once the calculation is set up and it can, again, be transparent at the input side of thing.

TTFN,
Eden
1 2 3 Previous Next