From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ASAM-ODS Unit definition

Solved!
Go to solution

Hello,

I'm creating a file converter that should fit the ASAM-ODS standard.

 

I'm using the advanced "Storage/Data plugin" vis, From the File I/O palette. For now my test are based on creating an ATF file on my computer. Later on the Oracle Server with the asam-ods database.

The *.atf files I create can be read from "Diadem" and "AVL Concerto" too. 

 

The problem i'm having is the association of a unit (rUnit) to my "MeasurementQuanties". I've understand that i have to pass a reference to the unit 

 

INSTELEM MeasurementQuantity
  Id = 67;
  iName = "P_CV_CEE";
  rMeasurement = 3;
  rUnit = UNDEFINED;
  rQuantity = UNDEFINED;
  iDataType = "DT_FLOAT";
  iDescription = UNDEFINED;
  iSize = UNDEFINED;
  iSystemName = UNDEFINED;
  iChannelMode = UNDEFINED;
  iInterpolationMode = UNDEFINED;
  iDelayTime = UNDEFINED;
  iDeadband = UNDEFINED;
  iLocalName = UNDEFINED;
  LocalColumn = 67;
ENDINSTELEM;

 

INSTELEM Unit
Id = 45;
iName = "hhmmss";
rPhysicalDimension = 35;
iGain = 1.;
iOffset = 0.;
iSystemName = "hhmmss";
iUser = "AlmaAutomotive";
iProject = "Common";
iLastUpdate = "20100304183325000000000";
MeasurementQuantity = UNDEFINED;
quantities = UNDEFINED;
ENDINSTELEM;

I have to change the rUnit = UNDEFINED to something similar to rUnit = UnitID

 

Any help is appreciated! Smiley Wink

 

0 Kudos
Message 1 of 6
(3,455 Views)

Hello,

are you using a specific example in Labview or your vi is similar to one of these? Can you tell me which one? 

0 Kudos
Message 2 of 6
(3,412 Views)

Hello Tina,

thank you for your help.

 

I'm not an expert of asam-ods standard, so I read this and other articles to understand the standard.

At this link NI explain how to read/write this kind of files with some good example too.

 

There is no example on writing units to the measurement quantities (AoMeasurementquantity). I can write all others properties but the unit. I guess because it's a reference to a component of the BaseModel (AoUnit).

 

The vi I'm using is from the examples at the link above: it is "ASAM-ODS Example.llb\Write Measurement.vi

 

Cattura.JPG

 

 

0 Kudos
Message 3 of 6
(3,398 Views)
Solution
Accepted by Davide_Galli

Hi Davide,

 

There are two cases to consider:

 

1) The unit you want to assign does not yet exist and has to be added to the unit catalog

2) The unit you want to assign already exists in the unit catalog

 

Here is some VBScript code that shows the main actions that need to happen.  In your case you already have the "Channel" references as your light green MeasurementQuantity reference array.

' determine subtypes of aounit and aophysicaldimension
dim unitEntity : set unitEntity = store.Model.Entities("aounit").SubTypes(1)
dim physdimEntity : set physdimEntity = store.Model.Entities("aophysicaldimension").SubTypes(1)

''''''''''''''''''''''''''''''''''''''''''
' I: unit does not exist and we have to create it in the unit catalog
dim channel : set channel = store.GetElementList("tdm_channel", "name=ch1", 1).Item(1)

dim mPhysDim : set mPhysDim = store.CreateElement(physdimEntity, "m")
mPhysDim.Properties("length_exp").Value = 1
mPhysDim.Properties("mass_exp").Value = 0
mPhysDim.Properties("time_exp").Value = 0
mPhysDim.Properties("current_exp").Value = 0
mPhysDim.Properties("temperature_exp").Value = 0
mPhysDim.Properties("molar_amount_exp").Value = 0
mPhysDim.Properties("luminous_intensity_exp").Value = 0

dim cmUnit : set cmUnit = store.CreateElement(unitEntity, "mm")
cmUnit.Properties("factor").Value = 0.001
cmUnit.Properties("offset").Value = 0
cmUnit.References("phys_dimension").Elements.AddReference(mPhysDim)

' now we have created the unit and can add it to the channel
channel.References("unit").Elements.AddReference(cmUnit)

store.Save

''''''''''''''''''''''''''''''''''''''''''
' II: Query the unit already added in case I
dim channel2 : set channel2 = store.GetElementList("tdm_channel", "name=ch2", 1).Item(1)

dim unitEntityName : unitEntityName = store.Model.Entities("aounit").SubTypes(1).Name
dim myUnit : set myUnit = store.GetElementList(unitEntityName, "name=mm",1).Item(1)
channel2.References("unit").Elements.AddReference(myUnit)

store.Save

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 6
(3,297 Views)

Thank you Brad.

I managed almost immediatly to write units in the correct way just following your tips.

 

Davide

0 Kudos
Message 5 of 6
(3,169 Views)

Ciao Davide,

I am trying to save data in atfx/atf file format (i have to save it in an ASAM ODS Database but i don't no anyting about asam ods standard.. so i think i have to save data as atfx file to save in asam ods database).

I have a problem, i don't find  "ASAM-ODS Example.llb\Write Measurement.vi"  used by you...where can i find it?

can you send me some vi as example?

0 Kudos
Message 6 of 6
(3,027 Views)