02-11-2021 02:15 PM
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?
Solved! Go to Solution.
02-11-2021 02:20 PM
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.
02-11-2021 02:50 PM
@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?
02-11-2021 04:16 PM
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.
02-11-2021 05:31 PM
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.