cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Units issue

CurlyBen
1-Newbie

Units issue

Hi all

Apologies if this is covered elsewhere, I've done some searching but not found anything that quite covers what I'm looking at. I'm brand new to Mathcad, I started using it on Friday (v14 at work, trial copy of Prime 3 at home) and I'm trying to enter a fairly simple equation into it. The equation gives the output torque of a hydraulic motor:

T=(displacement * change in pressure)/ 20 * pi

Displacement is in cc, deltaP in bar and torque in Nm. If I just enter the numbers, all is fine. However, if I add units the result is divided by 10, and I can't figure out why. I realise Mathcad must think the units are inconsistent if left at face value, but they're not. Is there any way I can correct this behaviour, or at the very least be notified of it? I'm reluctant simply to leave out units, and I don't want to modify the equation as if somebody came along later and checked my numbers with a calculator it would appear I'd made an error.

Cheers

Ben

25 REPLIES 25

Please post your worksheet so we see what you have done and also state which result (including units) you had expected as opposed to the result Mathcad gave you.

CC = 10^-6 m^3 and bar = 10^5 N/m^2

Mathcad works in the underlying units so you should probably only divide by 2 for consistency!

Alan

Thanks for the replies. I have attached a worksheet with the equation in - once with units and once without. The equation without units gives the correct answer (the motor in question exists and is used on a winch - if the equation with units in was correct it would only be able to lift about a quarter of a ton, and I've seen it lift over two tons!).

Alan that makes sense, but the factor 10 is included in the equation and I would like to leave it that way so if somebody comes along and looks at it later it doesn't appear as a mistake - if I print it out and hand it to someone and they check it with their calculator they should get the same numbers. With Mathcad adding it's own unit conversion factor in that's not the case. I hate to say it but if I can't produce calculations which clearly show assumptions and working with units then the units functionality is worse than useless to me.

As displacement actally is cm^3 per revolution it also makes sense to divide by 2*pi (and not 20*pi). I did a quick search in the net and only find 2*pi, e.g. here: http://www.engineershandbook.com/Tables/fluidpowerformulas.htm

It i scorrect that the formula you were given results the value in Nm, but ONLY if you use it without any units and you must put in the measured values of exactly the units given. Its kind of an epirical formula which were used for convenience before we had such tools as Mathcad 😉

A similar example for better understanding: Someone tells you that A = x * y /1000 is the formula for the area of a rectangle - x must be in cm, y must be in dm and you get the result in m^2. This is true and it works.

2 cm * 3 dm IS 6*10^-3 m^2, but if you use the very same formula with units you would get the wrong 6*10^-6 m^2 of course.

The equation is really:

T = (displacement/revolution) * (working pressure change) * 1 revolution/(2*pi radians) * (unit correction factor)

where the last term = 1/10 when displacement is in cc's and pressure is in bar to get a resultant in N-m.

The error is including the unit correction factor into an equation when the software correctly evaluates units and doesn't need the correction factor. Your worries about calculator slingers are well founded, but the slingers should also be concerned with the units and should realize they have to use a correction factor. If they aren't, they should not be performing calculations of this type.

Substitute the pressure in psi and your original equation will fail, but the units enabled version should work OK.

RichardJ
19-Tanzanite
(To:CurlyBen)

As others have said, the factor of 10 is a unit conversion factor that someone already included in the equation. The best solution is to educate the Luddites about unit aware software. Failing that, you could treat it as an empirical equation, which is the only way you can include a manually inserted unit conversion factor and have Mathcad handle the units. To do this divide each variable by the expected units for that variable, and multiply the entire expression by the expected output units. This will give you an expression that includes the factor of 10, and will work for any input units.

Thanks for all the replies, it's much appreciated. I'll have to have a think about how best to approach this - the reason for carrying out these calculations is as a design verification process, to show that we comply with the relevant standards. This particular equation isn't likely to be put under much scrutiny, but others I'm going to be working through soon potentially are more significant. For that reason I'm a bit reluctant to deviate from the published equations, in this case from Sauer Danfoss (for example on page 12 of this PDF http://powersolutions.danfoss.com/stellent/groups/publications/documents/product_literature/520l0926.pdf ), particularly as it may well be viewed in hard copy and its origin in Mathcad may not be apparent. I'm already varying a little bit, as the spec sheet for the particular motor I am using (still Sauer) doesn't quote 20*pi but approximates it as 62.8 I may well use Richard Jackson's approach, so thanks for that. I suppose the ideal solution from my point of view would be to use units and have Mathcad insert a (visible) correction factor at the end of the equation - this could then dynamically update dependant on the input units, but maintain the transparency of the calculation. I don't suppose this is possible?

You just need to comment the calculation and note the reason it's differentfrom the Danfoss example with units enabled. Note that in the Sauer Danfoss calc for English units it is simply 2pi because the pressure and volume calcs both use inches; however if the result was to be lbf-ft instead of lbf-in, then it would be 24pi. Sigh.

Look on pg 12 of your pdf; they give equations in metric and English units.

The reason for the 20 in the metric equation is that 1 mL times 1 bar equals 0.1 Newton meter.

1 cubic inch times 1psi equals 1 inch pound, so the English formula has a 2.

Are you sure the 20 isn't 2.0?

see attached

Thanks for the effort - however the displacement term is really displacement per revolution, so that's where the 2*pi comes from. The displacement per revolution can be measured or calculated fairly easily (and dependent on the type of motor may not even be constant!) and is very different from the volume of the housing. The factor 10 is simply required because 1 bar is 10^5 Pascals (approximately atmospheric pressure). I'm clear on all this now. The remaining problem for me is how to handle Mathcad's internal units conversion. I'd really like to use units and just have Mathcad display the correction factor it applies, but I haven't found a way to do this. It might be that I'm terrible at maths (for an engineer at least) but I like each step to be laid out in a clear and logical way - which so far (in my very limited experience) Mathcad does very well, other than this units issue. Having 'hidden' steps, such as this unit conversion, was one of the reasons I was trying to get away from Excel. I'll have to have a think as to how I'm going to handle it.

multiply the LHS of your equation by (mL bar)/(N m), leave the 20, it'll come out right.

Fred Kohlhepp wrote:

multiply the LHS of your equation by (mL bar)/(N m),

Isn't it the other way round? Basically thats what Richard suggested.

@Ben: You wanted Mathcad to show its correction factor, but its not Mathcad applying that kind of factor but the equation you want to use. So basically all you can do if you work with units (and IMHO you should do so) and nevertheless use the 20 in that formula is to get rid of the units temporarily and immedeatly add them again.

This can be done as Richard suggested by dividing each variable by its supposed unit or, as Fred suggested, by adding the same variables as a factor at the end of the equation (see attached). Basically you use your equation with the corrections factor 1/10 and get rid of it again by the adding that factor consisting of units.

In which way you thought the equation and calculation should be displayed when using variables with units?

In Mathcad 15 and below we could hide the keywords "explicit,ALL" and change the arrow to a normal equal sign which makes for a much better display. Unfortunately we can't do that in Prime.

10.03.png

10.03b.png

RichardJ
19-Tanzanite
(To:Werner_E)

or, as Fred suggested, by adding the same variables as a factor at the end of the equation (see attached).

That works for this equation, because the only operators are multiplication and division, but it will not work if other operators or functions are involved. My description of how to handle this problem was deliberately generic.

Yes, thats true. I elaborated on this because Ben wrote that he wants MC to show a correction factor - it will not be just a factor for other equations, though.

I wouldn't bother with the 20 pi and would use the correct euqation (2pi) but it may probably be hard for Ben to convince some peoples that this still complies with the relevant standards.

I'd be quite happy to change the equation from 20*pi to 2*pi, so long as the factor 10 conversion factor was shown elsewhere in the equation - I've mocked up the type of thing I mean. Ideally the 1/10 would be dynamically updated by Mathcad dependent on the input units. Mathcad's doing it anyway, I'd just like to see it! I realise some will consider it unnecessary as it could be extrapolated from inspecting the units used, but it would be good to at least have the option.

I'm on Mathcad 14 at work so I'll have a bit of a play around with the explicit, all command and see if I can get something I like the look of.

RichardJ
19-Tanzanite
(To:CurlyBen)

There is no way to get Mathcad to display the 1/10. It is not possible. The equation has 20*pi instead of 2*pi because the person that wrote it did so for specific input units and specific output units. Mathcad has no way to know what units any particular worksheet user has in mind, and therefore no way to display any appropriate factor. It would have to able to read the worksheet users mind (this is a feature I have requested several times, but so far no luck).

It would have to able to read the worksheet users mind (this is a feature I have requested several times, but so far no luck).

I could image its scheduled for Prime 5, PTC marketing already busy working on the promotion 😉

As Disp and DeltaP are assigned with units thes formula you want a see simply would be wrong.

You want Disp and DeltaP in that equations be quantities without units corresponding to units bar and mL. To Mathcad they are values with dimension, Disp=0.016 L and DeltaP=2.5*10^7 Pa. To get the unitless dimensions you have to divide it by the appropriate units which is what Richard suggested.

EDIT:

See here a "solution" - but it really hurts! You will lose Mathcads ability to calculate with units and check units for consistency that way and so its rather error prone. Its for display only and in my opinion its showing wrong, too, because Disp*DeltaP/(20*pi) IS 63.66 Nm and not 636.6 Nm. I would not recommend it.

11.03.png

forcing all units to be 1 (thereby removing units) was a favorite ploy of Jean (JmG). I didn't like it then, still don't. Unit balance is one of Mathcad's best features (IMO), and this "fix" for an empirical equation has caused many past problems.

(I'll get off the soapbox now.)

I agree entirely with Fred,

Mathcad 'knows' how to convert between units -

Capture.PNG

So adding a *12 multiplier doesn't give inches just 12 ft.

If your users 'know' that there should be a 1/10 multiplier factor, one option is to add an explanatory line e.g.

Plus text to explain the explanation if you need to double dot the I's & double cross the T's.

Capture.PNG

I know that culture change is difficult, I will not write sheets without units (IMO its madness!)

BUT, my colleagues who have many sheets without units will still spend many hours multipling results (e.g.by 10^9 & adding nH as text) to give meaningful results & of course that gives rise to too many areas for error...

there is no simple way around it & there will be many that will just refuse to see any benefit no matter what you say.

Keep at it , but best not to worry...

Regards

Andy

I understand your point, but I'd suggest it's only wrong because at the point the equation is defined Mathcad knows the input units but not the output units. If all units are known, either by defining the output units with the rest of the equation or (shock horror!) looking forward to where you want the result of the equation. Saying that, I realise that could cause its own issues, not least of which if you asked for the result of the equation twice, and selected different units.

I'm still undecided really. I do see the merit in using units and letting Mathcad take care of them, but at the same time I'd like the steps Mathcad is taking to be more obvious (perhaps a placeholder to indicate unit conversion - though I suppose arguably that too would be wrong!), even if they can't be explicit. It may in part be down to my weakness when it comes to maths - I'm much happier with a schematic or a spanner! I suppose one option would be a template with a footer carrying a short note explaining that the working shown was generated in Mathcad and that Mathcad is unit aware. As much as anything I'm quite conscious that showing the equation 'correctly' is identical to the equation quoted for Imperial units but different to that for SI units, so it would appear the wrong equation had been used when compared to the data sheet (I work pretty much exclusively in SI or derivatives).

Anyway I do at least feel I've got a reasonable understanding of what Mathcad is up to and the advantages and disadvantages of the different approaches, so I'll try and work out which approach to take. Thanks again!

Many of the equations in the (old) engineering texts (Mark's Handbook, Machinery's Handbook) give equations with numerical constants that are merely unit conversion factors. (Ever see 1.414, 0.707, or 6.28 instead of 1/ sqrt(2), sqrt(2) or 2 pi?) Mathcad will ALWAYS fail in computing those equations because the program does the unit conversion and the built-in numerical constants do it again.

A pure equation (F - m a) will compute properly regardless of what units you put in, and allow you to have the results in any legal unit. (You can't ask Newtons to be g's, but you can ask for lbf and the numerical value will be right.

So my simple derivation of your equation (several posts ago) that resulted in 2 pi instead of 20 pi will be valid since you leave the unit conversion to Mathcad, since it's (a simplistic) "pure" equation.

RichardJ
19-Tanzanite
(To:CurlyBen)

Put in the correct equation (i.e. 2*pi). If you put in 20*pi all you are doing is propagating an outdated methodology. As suggested, add a note next to it explaining why it differs to the literature equation.

Then if your boss says it's wrong, explain it to him. If he still tells you it's wrong, tell him that he obviously hasn't noticed that the engineering revolution is already here, and incompetent old fools like him will be the first up against the wall. I bet he won't even know what to say!

Can I quote you?

LOL

Top Tags