LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing through a cluster of numeric data with different unit labels

Solved!
Go to solution

I am building a software where data production and data saving are done by two different actors in two separate libraries. For one acquisition line, Data is a collection of Digital values with different unit labels (GHz, V, degC, etc.). It is therefore not compatible with an array. I plan to collect the data in a cluster.

The actor responsible of saving the data in a file (number and unit) should cycle through the cluster, and should be able to do  that for different data providers, so with number of data and units not defined in advance.

 

The property node of a reference to a Numeric control is able to recover the Value and UnitLabel.Txt. Above the propert node, data is recognized as "DigNum (strict)". If I cast the reference with "to more specific class" with "Digital", the displayed value is actually what is displayed in the box, not the real value with hidden digits, and there is no easy way to extract the unit.

Similarly, indexing a cluster with a reference does not allow to make a strict typecast do DigNum. Are there tools in Labview that I am missing? Are there easy way to do that?

 

 

 

Download All
0 Kudos
Message 1 of 14
(1,180 Views)

Hi fb,

 


@fb35 wrote:

Are there tools in Labview that I am missing? Are there easy way to do that?


Did you try the GetNumericInformation function in the DataTypeParsing palette?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(1,159 Views)

Units don't pass through wires, but physical quantities do.

You might find the attached files somewhat useful.

Unfortunately, the description out gives everything in terms of fundamental units;

so 'voltage' comes out as:   (Length^2 * Mass) / (Time^3 * Electric Current)

 

 

 

0 Kudos
Message 3 of 14
(1,119 Views)

It would help us help you if you simply posted a VI...

 

And if you post images, embed them:

FrontPanel

BlockDiagram

You're not really stating what your goal is...

 

I suppose you have a few options if you do something like this:

wiebeCARYA_0-1693211693603.png

 

Message 4 of 14
(1,079 Views)

From the FP I can infer somethings.

 

Yes, the Unit MHz lost the Prefix (choosing a format specifier as "%u" an a unit of Hz would help there)

 

The Temperature... Changes from DegC to the base CDeg. That will require adding some code to r8ecast the value.  Not sure how to do that 🤔  You might try adding or subtracting 0CDeg.

 

There are some wildcard unit specifiers (I Read about them in the Help File! Years ago!!!)  They worked for the limited case I need a working solution for.   Then I PROMPTLY filled up the office "swear jar" and tried to forget Units for a while.

 

Regardless,  you need to recover not 1, but 2 data values.  The Unit as String and the Unit Prefix as string.  Then reapply the Unit Label for a simplex Unit Label.  A working solution will take longer if you're working with mW/M^3*sec (That'll be a "moment"  <groan at bad pun>)  so, you really need Units[] Prefixes[] Operands[] and Constants[]


"Should be" isn't "Is" -Jay
Message 5 of 14
(1,060 Views)
Solution
Accepted by topic author fb35

I found a solution using OpenG. Variants with type "double float with unit" are known also as "Double precision physical quantity" is the "type descriptors" in labview online documentation.

It is possible to extract the value and the units. Units can be simplified (for examples "lm" instead of "sr cd", "W" instead of "s^-3 m^-2 kg^-1).

Conversions from Cdeg to degC still to be done.

Library with tools and test files attached.

Message 6 of 14
(1,010 Views)

@fb35 wrote:

I found a solution using OpenG. Variants with type "double float with unit" are known also as "Double precision physical quantity" is the "type descriptors" in labview online documentation.

It is possible to extract the value and the units. Units can be simplified (for examples "lm" instead of "sr cd", "W" instead of "s^-3 m^-2 kg^-1).

Conversions from Cdeg to degC still to be done.

Library with tools and test files attached.


So it's not the unit but the quantity ("physical group") that's in the wire.

 

The unit (e.g. kg, m) is how the quantity (weight, length) is visualized.

wiebeCARYA_0-1693380985664.png

To get the unit you'd need a reference to the control or indicator, because the unit simply is not in the data type ('wire'). The quantity is. And it's the quantity what makes the wire break if it doesn't match, not the unit.

 

Still not sure what the end goal is (as you never told us)...

0 Kudos
Message 7 of 14
(981 Views)

For a variant of "double precision physical quantity" (also double with unit) has a type that is indeed in the type.

To visualise the type, with right click on the variant display select "show type".

fb35_1-1693405031074.png

 

The unit is visible in the "type descriptor". This is also stated in the "type descriptor" page : the type descriptor for a double is a length, "xx1A" (reserved), the number of base units (rad, sr, s, m, kg, A, K, mol, cd) in the unit, and a sequence of units with power, as seen by the OpenG "Get PhysicalUnits_ogtk.vi". Since the variant knows only the unit in base units, this is the display that is capable of reconstructing a "standard" unit. Unfortunately this capability is not offered to the standard labview user :

fb35_2-1693405139243.png

Different numerical values with different units have therefore different types, hence the "wire breaking" when ones tries to connect to such quantities.

 

 

 

0 Kudos
Message 8 of 14
(943 Views)

I’m sorry to not have made the goal clearer.

In my application, I have objects that provide the data (measurements) in form of values with units.

The data provider should not care of what is the data to be saved, in which format, etc.

Thus a measurement is a collection of numbers, gathered in a cluster (in an array, all data should have the same unit), for example :

fb35_0-1693405678482.png

That data should be read as a variant, with no a-priori on the number of data and units.

 

0 Kudos
Message 9 of 14
(939 Views)

@fb35 wrote:

 Unfortunately this capability is not offered to the standard labview user :


That's one reason why nobody ever uses units 😁 .

 

I actually use them to convert the prefix (/1000, X1000, X1000000 etc.), the user fills in mm, m are stored. The unit could as well be mg, it's just the factor that I use. Although I use it at one place to show inches and store meters.

 

Using units like this, I don't need to programmatically access the units at all. It saves me the hassle of manually scaling the user input though.

0 Kudos
Message 10 of 14
(937 Views)