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

@fb35 wrote:

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


But you can read the values. And you should be able to do (correct) math with the values, because you should know the quantity when reading the quantity.

 

It's only when you serialize (store\load) (to text) that things go bad... And only if you want to store with the correct unit.

0 Kudos
Message 11 of 14
(235 Views)

Actually, using OpenG tools, it is possible to recover both the value and the unit of a variant of type "double float with unit".

For recovering the value:

fb35_0-1693406453508.png

and to recover the unit :

fb35_2-1693406543984.png

The VarPQ block is to put back "classical" chains of units in standard units:

fb35_3-1693406616417.png

with the table:

fb35_4-1693406638424.png

so i have a tool like labview indicators to reconstruct the possible units.

Temperatures are always stored in K (or Cdeg), there is some trouble also for weights as the "k" prefix is already in the base unit. Some other conversions factors can be taken into account.

In the end I obtain:

fb35_5-1693406821007.png

which is what I wanted to achieve.

 

0 Kudos
Message 12 of 14
(231 Views)
Solution
Accepted by topic author fb35

Here I join the actual version of the software.

 

I simulate acquisition with random numbers. These numbers are then read to get an ascii line for each acquisition.

 

There is some possibilty to escape the "base units", for example one can ask to get weigths in g, flows in l/s, etc. These possible transformations are hard coded in the "unit change.vi".

 

There are not timestamps on the in the data files right now.

 

0 Kudos
Message 13 of 14
(226 Views)

@fb35 wrote:

Actually, using OpenG tools, it is possible to recover both the value and the unit of a variant of type "double float with unit".


It looks to me it takes the quantity, and normalizes it.

 

It won't detect prefixes, and probably won't distinguish between degK and degC. If you're using SI units, you only loose the prefix. If you have imperial units, you still get SI units.

 

I don't see why units would be in the data type. It doesn't really belong there, much like the radix isn't in an integer's data type.

 

In fact, I see that the data type is the same for a double with degC and degF.

wiebeCARYA_0-1693407781131.png

The toolkit probably just translates the stored SI to human readable SI (e.g. s^-1 to Hz). Which it nice, but not the used unit in the control that isn't stored in the wire.

 

If it does what you want, that's great. If you are using SI you probably be OK (except the prefix). But I don't think you're getting the unit.

0 Kudos
Message 14 of 14
(224 Views)