LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV 2011 Temperature unit bug

Solved!
Go to solution

I think I have found another problem in LV2011 today.

 

Basic math doesn't work with temperature units:

 

ScreenHunter_04 Sep. 20 14.33.jpg

 

Gives me this:

 

ScreenHunter_05 Sep. 20 14.33.jpg

 

Changing the unit labels on the controls from degC to degF gave me this:

 

ScreenHunter_06 Sep. 20 14.33.jpg

0 Kudos
Message 1 of 7
(3,620 Views)

Wow, this bug sounds very similar to the one in Mathcad, which it has a work around for.  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 7
(3,616 Views)

I went all the way back to LV 8.6 with the same behavior.  Then I changed to this:

 

ScreenHunter_09 Sep. 20 14.52.jpg

 

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?

 

 

0 Kudos
Message 3 of 7
(3,610 Views)

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.

0 Kudos
Message 4 of 7
(3,605 Views)
Solution
Accepted by topic author Matthew_Kelton

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.

Message 5 of 7
(3,604 Views)

Ah, now it all makes sense..  Thank you.

0 Kudos
Message 6 of 7
(3,600 Views)

that's a great explaination.  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 7 of 7
(3,579 Views)