09-20-2011 01:35 PM
I think I have found another problem in LV2011 today.
Basic math doesn't work with temperature units:
Gives me this:
Changing the unit labels on the controls from degC to degF gave me this:
Solved! Go to Solution.
09-20-2011 01:44 PM
Wow, this bug sounds very similar to the one in Mathcad, which it has a work around for.
09-20-2011 02:00 PM
I went all the way back to LV 8.6 with the same behavior. Then I changed to this:
Changed one degC to Cdeg.
According to LV help, LabVIEW uses K as the base unit, and degC is a derived SI unit. degF, Cdeg, and Fdeg are all non-SI derived units.
It states that degC and degF are temperature (absolute) units and Fdeg and Cdeg are temperature difference (relative units).
I guess I don't understand the need for relative and absolute temperature units. Also, how can I add two absolute temperatures and have one convert to K, and then the other stay at 1? In my original post, 1 degC + 1 degC = 275.15 degC. It appears that 1 value got converted to Kelvin, then the second value was added as-is. I still think there is a problem with degC and degF math. No matter what, if I add two values with the same unit, the result shouls still be the sum in the same units, right?
09-20-2011 02:09 PM
Now that I think about and put it in my code that wasn't working, I do understand the need for absolute and relative temperature units.
I guess I have always worked where the temperature has been multiplied and not added.
For those of you wondering, because all the temperatures have different absolute zeros (i.e. offsets), when you have an absolute temperature, the temperature needs to be converted back to its absolute and converted over to the other temperature.
However, when you need to add a temperature offset, you only need to convert the difference from 1 degree to the next (slope).
I still don't know about the 2 absolute temperatures being added together, though. I still think that math is wrong.
But, ultimately, I do need to "mix" units here for the internal conversions to know how to add the numbers.
09-20-2011 02:12 PM - edited 09-20-2011 02:15 PM
No. They both converted to Kelvin in your 1 degC + 1 degC example. 1 deg C =274 K. 274 K plus 274 K = 548 K. Convert the result back and that is 275 deg C.
With 1 degC + 1 Cdeg that is equal to 274 K + 1 K (because Cdeg is the delta temp. for Celsius). That is 275 K = 2 deg C.
Without having the other "relative" units, the math falls apart. It converts units to their base values. And 1 deg C is equal to (1 K +273 K). So when you add another 1 degC, you are adding (1K +273K). The "offset" constant in the math effectively is used twice, although that is not actually what you want. But the language really can't determine when you should add it or when it shouldn't.
09-20-2011 02:16 PM
Ah, now it all makes sense.. Thank you.
09-20-2011 11:02 PM
that's a great explaination.