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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Remove/Specify Units for Empirical Equations

mpropp
1-Visitor

Remove/Specify Units for Empirical Equations

I'm using MathCAD Prime 3.0 and when I try to use the following equation, the units show incorrectly.

Capture.PNG

MathCAD is displaying the units correctly, as f'c has units as MPa and MathCAD is showing (MPa)^(1/2), but this is incorrect for that equation.

The equation is emprical and should have a result in MPa.

How can I remove the units (and just insert some text in their place), or specify units for this equation.

Thank you!

13 REPLIES 13
RichardJ
19-Tanzanite
(To:mpropp)

The problem with empirical equations is that each variable in the equation has some assumed unit, and the result has some assumed unit, but the units in the equation do not necessarily balance. You can fix this in Mathcad by dividing every input variable by it's assumed unit, and multiplying the entire equation on the rhs by the assumed result unit. If that's not clear, please post a worksheet.

mpa.png

This method works great, except that I had troubles with temperatures. Basically, K is the only temperature that actually works. If you manipulate other kind of temperatures, you will get in trouble because of the offset. To make your variable unitless, you shoud use instead :

(MyVariableInCelsius - 0°C) / (1K)

(might be slightly different for Fahrenheit, I haven't tried)

I have only seenthe problem with temperature, but there might be some other cases where the unit you use has an offset compared to the SI unit.

Temperature has strange properties, due primarily to earlier developers responding to user complaints. There are two absolute scales, Kelvin (K) and Rankine (R). One degree Kelvin equates to one degree Celsius, one degree Rankine equates to one degree Fahrenheit. In the early days we had to be content with that.

People complained, and MathSoft responded. (Rremember MathSoft?) We got degrees centigrade and degrees Fahrenheit, but they came with a price, functions that are "post fix" operators.

People complained again, "We need to address a difference in temperatures--'The temperature rise is 5 deg F'." And we got temperature difference units. I rarely type a temperature unit in anymore (unless it's "K" or "R",) it's safer to pull down the units tab and find the right one.

I see in one Web Reference book that lambda (thermal conductivity - 10^-3*W/m/K) one substance is equal 0.44+0.29 t, where t is in °C:

http://twt.mpei.ac.ru/ochkov/TTMI/21/21.02.png

I would like to insert this formula in Mathcad:

http://twt.mpei.ac.ru/ochkov/TTMI/21/21.03.png

Raiko
17-Peridot
(To:mpropp)

Hello Michael,

I ran into a similar problem some time ago. My solution was to work entirely without units when using empirical equations. For pressure vessel calculations en extensive code of empirical units exists and, for documentation, I have to use it.

On to the solution: in order to give it the appearance of a variable with units, I mix text and mathematical regions. The naming of the variable is done as a text-region. Then I hit <space> and <Tab> followed by <ctrl/shift/A> combination. That inserts a "math" region into the text field. This is followed by another <space> (which turns off the math region) and then I write the unit.

So any body reading the calculations sees the name, the variable and its unit. The calculation however runs unitless and should provide the correct results.

Hope this helps

Raiko

Raiko
17-Peridot
(To:mpropp)

Hello Michael,

I ran into a similar problem some time ago. My solution was to work entirely without units when using empirical equations. For pressure vessel calculations en extensive code of empirical units exists and, for documentation, I have to use it.

On to the solution: in order to give it the appearance of a variable with units, I mix text and mathematical regions.

  • Write name of variable; e.g. diamter. Type <space>, >tab>
  • type <ctrl.>, <shift>, >A> to insert a math-region
  • Define variable and its value; e.g. do:=100
  • Type <space> this terminates the math-region
  • Type the unit; e.g. mm

That's it. Thze calculation runs unitless. To a reviewer however it appears as if the variable has a unit which facilitates error checking.

Hope this helps

Raiko

P.S.

For some region the website stalled, hence this post might be inserted twice.

athurin
12-Amethyst
(To:Raiko)

I would certainly not recommend to do that, especially if the people you share the files with can edit them. What happens if they replace the 100mm by 10cm (by editing both the test and variable value) ? The whole calcultation goes crazy, your sheet is "broken", and you don't even know it.

At least, if you work with units, you are reasonably safe from this kind of issue : best case scenario, Mathcad rescales everything and it works fine, worse case scenario you get an error for unit mismatch. Whereas, in your case, you could end up with an apparence of math that makes sense, but is actually broken.

An error for something that works is always preferable to the risk of no error for something broken...

Raiko
17-Peridot
(To:athurin)

Hello Adrien,

you're right if one is sharing the sheet. In my case however, the people checking the calculations get a pdf file or a hardcopy so that there isn't the problem of changing both value and unit.

...An error for something that works is always preferable to the risk of no error for something broken...

An incorrect remains incorrect even if repeatble. I don't see any value in that.

Raiko

athurin
12-Amethyst
(To:Raiko)

I mean a "mathcad error" (the red boxes of Mathcad that doesn't compute). It is preferable that Mathcad gives you wrong warning (you can always ignore or work around them) rather than the opposite, trusting Mathcad and get a wrong result after inputing data not formated properly.

If you are the only one to edit your sheets, why not. It's certainly not the way i would do it, but why not...

Fred_Kohlhepp
23-Emerald I
(To:mpropp)

The equation is emprical and should have a result in MPa.

How can I remove the units (and just insert some text in their place), or specify units for this equation.

You can assign units to the emperical constant. Mathcad will then return correct units and perform unit conversion properly.

It works nicely in this case, but in many cases that I encounter, you are better off stripping the units off the variables, and assigning the right unit at the end, like Valery did.

Example : the power losses in the magnetic core of a transformer.

P(f,B)=k f^x B^y

f in Hz

B in T

P in W.m^-3

k, x and y material-dependant coefficients, and x and y can be anywhere between 1 and 5 (1.9 and 2.35 are perfectly normal values, for instance).

With this kind of equation, you are much better of assigning W.m^-3 to k, and using (f/1Hz) and (B/1T). Otherwise, not only is it difficult to work out the unit of K, due to the fractional exponent on the frequency and magnetic field, but it also means that you need to re-check and re-type all the units when calculating for a different material.

Personally, I would strongly recommend Valery's method, that is more generic,allows for error checking (includes units), and more re-usable in complex cases (stupid exponents on units, exponents that can be variables, etc).

I agree, each case must be handled seperately. But the preservation of unit conversion needs to be preserved.

Announcements

Top Tags