LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with using unit conversions in indicators

Solved!
Go to solution

I'm creating a 1-d simulation program where the customer would like to use metric or Imperial units.  Using the units feature of controls and indicators seems like a great solution, but I need to trust them.  As I started playing around, I saw an obvious mistake that makes me nervous about relying on them.  The enclosed VI has a block diagram constant of -3 degC that is wired to an indicator in the lower center front panel.  If I give the indicator degF units, I get -465.07 showing.  If I give it Fdeg units, it gives -5.4.  Neither of these values is correct!  

 

Closing and reopening the project didn't help.  Something seems corrupt, but I can't tell what.  If I have no indication of corruption, how can I trust my simulation?

0 Kudos
Message 1 of 5
(1,693 Views)

Just noticed an additional weirdness.  I changed the units of the block diagram constant to degF, and the value changed to -465.07, but the new value doesn't fit into the size of the constant box, and there doesn't seem to be a way to change the size of the box!  I'm using LV2019 on a Windows 7 computer.

0 Kudos
Message 2 of 5
(1,690 Views)

@PghFool wrote:

I'm creating a 1-d simulation program where the customer would like to use metric or Imperial units.  Using the units feature of controls and indicators seems like a great solution, but I need to trust them.  As I started playing around, I saw an obvious mistake that makes me nervous about relying on them.  The enclosed VI has a block diagram constant of -3 degC that is wired to an indicator in the lower center front panel.  If I give the indicator degF units, I get -465.07 showing.  If I give it Fdeg units, it gives -5.4.  Neither of these values is correct!  

 

Closing and reopening the project didn't help.  Something seems corrupt, but I can't tell what.  If I have no indication of corruption, how can I trust my simulation?


Are you sure your BD constant is degC and not Cdeg?

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 5
(1,674 Views)
Solution
Accepted by topic author PghFool

Yeah your constant is wrong (it's in Cdeg, the relative measurement). You also have a race condition when you change your UnitLabel.text; you don't know if that property node will run before or after the Temp In value gets read. That's probably causing issues.

 

degC and degF are absolute units. Cdeg and Fdeg are relative units.

 

-3 Cdeg (what's in your constant) = -3 * 1.8 = -5.4 Fdeg. This is correct.

 

Converting -3 Cdeg to degF is a nonsensical conversion, but it *is* correct. The base unit is Kelvin, so internally it goes:

-3 Cdeg = -3 K = -465.07 degF

-3 K = -5.4 Fdeg (and degF), so absolute zero F (-459.7) minus 3 degrees K (5.4 F) gets you -465.07 degF.

 

 

 

 

Regarding the size of the constant box- Ctrl+Drag a new box. The new one works. Not sure why the old one stays tiny.

0 Kudos
Message 4 of 5
(1,644 Views)

Oh, so that's the difference between those units!  Thank you!  

 

I see what you mean by the race condition, but it doesn't apply, because no matter the label, LabVIEW treats the number in SI units underneath.  I suppose there could be a split second when it's changing, but it seems unlikely.  

0 Kudos
Message 5 of 5
(1,637 Views)