LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I turn off unit-checking?

I would like to turn off unit checking so that I can use the built-in physical constants (c, e_0, etc.) along with numbers that have non-SI units.

For example, I'm using atomic masses in eV per c^2, manually converting that to kg, and passing the result to a sub-VI. I don't want to label any of the items as having the incorrect units, and I'd rather not manually enter the various constants or change to a different set of units. Is there any way I can turn off the feature?

Thanks.
0 Kudos
Message 1 of 6
(4,079 Views)
Hello,

When you refer to units, are you referring to the Format & Precision property of numerics and the fact that those can be specified with SI notation? Or are you referring to wanting to enter in strings that indicate physical constants (e.g. c, e_0, etc) in the same control field as the numeric? If you question is regarding the first case, then you will just want to specify a custom format for the numeric by going to the Format&Precision property field and selecting the “Advanced editing mode” radio button on the bottom. You can specify a custom format string here to make sure that all of your inputs are accepted as valid.

Otherwise, if you are wanting to allow both numerics and strings (indicating physical constants) in a front panel control, you’ll probably just want to have a string control on the front panel and then parse the string for the numerics and various string inputs. There are various string parsing/scanning VIs available from the functions palette that will help you on that end.

Hope this helps and thanks!

Kileen
0 Kudos
Message 2 of 6
(4,054 Views)
Actually, niether's the case of interest... The issue's not on the Front Panel, but on the block diagram. Put a float-format (single, double, or extended precision) constant on the block diagram and right-click on it; under "visible items", one of the things that can be shown is the "Unit Label." The default value is unitless / pure number. The physical constants under Functions Palette -> Numeric -> Additional Numeric Constants have hard-wired SI units. (m/s for c, C for e_0, J /(mol K) for R, etc.) LabVIEW will only let you wire these constants (or their products, ratios, etc.) to a sub-VI if the units work out right. Also, it won't let you do something like wire e_0 and c into the input terminals of the same "Add" node because the units don't match.

This sort of thing makes sense as a general restriction, but I'd like the option to override it. The closest thing I've found is the "Convert Unit" node (Functions Palette->Numeric->Conversion->Convert Unit), which'll let you map anything to dimensionless or vice versa. However, that VI has the added "feature" of converting quantities to SI before it strips off their dimensions. (So if you write a VI that deals with lengths in cm, and pipe a 1 cm length through the "Convert Unit" node, it'll come out the other end as 0.01)

This can be inconvenient if your handbook / memorized table of constants & formulae is in something other than SI.... I have several texts which normalize out Planck's constant, the speed of light, the ionization potential of the hydrogen atom, and so on. Rather than converting everything into units that I don't use, then converting back to units I do use at the end of the calculation, I'd like to treat everything as a pure number, and use LabVIEW's numeric constants when I need those SI values.
0 Kudos
Message 3 of 6
(4,042 Views)
Hm, I wasn’t aware of the unit label property for numerics, but it looks like you can use the Convert Unit.vi to convert a physical number to a pure number. It looks like if you wire the conversion of the number to a numeric indicator and set the formatting and precision of the indicator to be non-SI, the conversion should work alright. If you don’t want this indicator to show, you can right-click on the indicator on the block diagram and select Hide Indicator.

I actually found an example program that demonstrates unit conversion along with a KB. Not sure if it’ll help at all, but I’m attaching it in case it might.

“ target=_blank>KB 35DBA21E: How Do I Disable the Unit Label On A Control?

Kileen
0 Kudos
Message 4 of 6
(4,024 Views)
Since KeelenC link is not working, I'll add my 2 cents here :
Unit conversion can be effected using to LV functions :
- Convert Unit, specific to a change from one unit to no unit or in the reverse direction
- Cast Unit Bases, of more general use
See the attached example, since Convert U it can be confusing...

CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 6
(4,013 Views)
Wow, my apologies on that previous post.

Then correct link to the KB:
KB 35DBA21E

And the program is also attached.
0 Kudos
Message 6 of 6
(3,999 Views)