LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

incompatible units with math library functions

So I tried out the "units" feature in Labview.

 

I applied my units to one of the inputs on my VI, then I took that wire and went through some very basic manipulations (adding, subtracting, stuff like that) in a for loop and created an array of values.  The array has the same units as the original input into the VI.

 

Then I tried to calculate an RMS value by running that array into the "RMS" vi in the Mathematics -> Prob & Stat" pallette, and I get an error that I can't do that because I've connected numeric data types that have incompatible unites.

 

How do I solve this problem?

a)  Why would a method like "RMS" care about units?  It should simply pass the units through.

b)  If I must pass a unitless value to RMS, how do I convert my data to be unitless and then put units back on the resulting wire?

c)  If I must continually remove and then replace units on my block diagram in order to use the "units" functionality in labview, then why in the world would anyone ever do it?  Seems like an ugle hassle.

 

Thanks!

0 Kudos
Message 1 of 4
(3,883 Views)

Hi rothloup,

 

c)  Seems like an ugle hassle.

Yes.

 

- most math functions don't support numbers with units

- some functions, which support units, use them plain WRONG (best example: square function calculates "1m×1m = 1m")

 

You may use units for special controls to ease the user experience. But I recommend to convert those "numbers with units" to plain numbers as soon as possible using the "unit conversion" node (to answer your question b)…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,877 Views)

Thanks, Gerd.  Seems like NI would want to improve this functionality or remove the units feature altogether.  Especially since it introduces errors, as you pointed out.  sheesh!

0 Kudos
Message 3 of 4
(3,861 Views)

Probably NI wrote themselves into a corner on this one.  They don't know how to fix it, yet they don't want to eliminate it to maintain backwards compatibility.  Perhaps it was this issue that led them to wisely not include Unicode support as an official feature.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 4
(3,847 Views)