LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 04/26/2010

The Convert Unit function is an easy way to convert data from one unit value to another:

 

convert_unit.png

 

If you're not sure what the symbol for a particular unit is, you can right-click the Convert Unit function and choose Build Unit String....

 

build_unit_string_dialog.png

 

Here, you can pick from a variety of categories (time, distance, etc.) to find the symbols for the units you wish to convert. And as you can see in the screenshot, you can also combine units...for example, I have created a unit string that will generate an accelleration value (in km/s^2).

Message 1 of 11
(9,972 Views)

Thanks, Darren. I've been befuddled as to how to use this function. The fog is beginning to clear. Question for you: Why does this work:

 unit_math_ok.png

But this doesn't:

 unit_math_broken.png

 

?

 

 

It seems unit math is a bit lacking. I'm can understand arbitrary exponents not working since the power wouldn't be known until runtime, but it seems functions like x^2 should handle converting the units.

 

Message Edited by RandyP on 04-27-2010 09:32 AM
-Randy
-=--=-=-=-=-=-=-
Nothing like a good dose of LabVIEW to cure what ails ya'.
Message 2 of 11
(9,788 Views)

RandyP wrote:

Thanks, Darren. I've been befuddled as to how to use this function. The fog is beginning to clear. Question for you: Why does this work:

 unit_math_ok.png

But this doesn't:

 unit_math_broken.png

 

?

 

 

It seems unit math is a bit lacking. I'm can understand arbitrary exponents not working since the power wouldn't be known until runtime, but it seems functions like x^2 should handle converting the units.

 

Message Edited by RandyP on 04-27-2010 09:32 AM

 

There are bugs in the unit functions that prevents it from handling squaring a unit like you did.

 

So far as using the unit functions...

 

Since my apps typically monitor many different types of physical units and the data is acquired as arrays, the unit functions are of little use since all elements in an array can differ only in value. If the units for an array could be specified on a element by element basis they could be useful, but that would require a major re-write of arrays.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 11
(9,773 Views)
Message Edited by Ravens Fan on 04-27-2010 09:52 AM
0 Kudos
Message 4 of 11
(9,759 Views)

I showed this to someone this morning and grabbed an expression node by mistake.  It looks exactly the same as the convert unit function and even has the build unit string option.  But it does not work with the example.  The expression node is probably looking for a variable, which is why it did not work (LV 2009, no service pack).

 

Why do they look the same, yet do 2 different things?    

Message 5 of 11
(9,701 Views)

_Bryan wrote:
I showed this to someone this morning and grabbed an expression node by mistake. 

You know, if you used Quick Drop, that mistake wouldn't happen... 😉

 

Seriously, though, I agree that they need some sort of visual differentiator.  I also don't know why we show the "Build Unit String..." right-click menu option on an Expression Node.  I filed CAR# 223245 on these issues.

0 Kudos
Message 6 of 11
(9,679 Views)

The praise first. I've never used convert unit and I can see where this can clean up some of my code. I took the basic, intermediate and advanced classes and this function was never covered, so thanks.

 

The negative: It took me way too long to duplicate your examples by clicking on help.  I really had to hack around to get the BUILD UNIT STRING menu to come up. Maybe a future nugget will give a walk through from step A on how to use this function. I've figured it out, but there are probably other users that have skipped this thread because they can't get past step A.

 

0 Kudos
Message 7 of 11
(9,621 Views)
Did you accidentally drop the Expression Node instead of the Convert Units function?  See my latest post above...they look identical in the palettes, but they don't work the same.  As I mentioned, I filed a CAR on this issue.
0 Kudos
Message 8 of 11
(9,526 Views)

The converting of units is a neat idea.  But...  My attempts at using them in a generic test system were very short lived.  I can see where they could work well in a specific application, but it's not possible to array numerics of different units, so a simple array of test metrics generates broken wires.

 

Tim

 

Message 9 of 11
(9,388 Views)

I have wanted to use this for years.

 

I am scared away by the reports of bugs and the limited unit choices (why no percent (%)).

 

I think this tool could be enhanced if you could create you own units.

Dan Shangraw, P.E.


   

0 Kudos
Message 10 of 11
(9,243 Views)