DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading ATFx data files into a submatrix with ASAM

Hello, I am attempting to load data from an ATFx file into the data portal with a script.  I've gotten far enough to load the data store (the ATFx file) into the ASAM Data Service (Using ODSATFLoad).  I have also gotten far enough to find the names of the only instance of type "Measurement".  The problem, is that I cannot load the instances of type "MeasurementQuantity" that are children of the "Measurement" instance. 

 

For reference, manually loading the data with the ASAM Data Service goes like this:  Load the data store -> Navigate through the data store until you find the "Measurement" -> Check the Checkbox next to the "Measurement" -> Push the "Import Selected Data into the Data Portal" button -> Import the data with an import mode of "Submatrix". 

 

I would like to automate the above actions, with the exception of having the user select the ATFx file.  As I said, I've gotten that far, I can select the file to load, but I can get any farther.

 

Summary: How do I Import "Measurement Quantities" with an import mode of "Submatrix" from the ASAM data service?

 

Any help is appreciated.

0 Kudos
Message 1 of 10
(5,400 Views)

The load process inside the ASAM Data Service is done by a vbs script.

 

C:\Program Files (x86)\National Instruments\DIAdem 2010\Libr\Documents\Ods2Dia.vbs

 

This script can be modified or you can assign an modified script to one of the 3 script buttons

in the ASAM Data Service.

 

Would this help?

0 Kudos
Message 2 of 10
(5,387 Views)

No, for once, I'm completely lost...  I can find the names of my data and the instance keys, but I can't get it into the Data Portal.

 

I'm just going to put in a ticket and hopefully NI will do it for me.  I'll review the code if they do and try to learn then...

 

Thanks anyway.

0 Kudos
Message 3 of 10
(5,382 Views)

Hi Mr. Spark Plug,

 

What version of DIAdem do you have?  If all you want to do is load the ATFX file into the Data Portal, you should just create a Data Store out of that ATFX file (right-click in the NAVIGATOR) and then drag the aomeasurements or aomeasurementquantities you want into the Data Portal...

 

Or we also have an example ATFX DataPlugin that indexes the ATFX files with 3 TDM levels of hierarchy, so you can query them with the DataFinder.

 

Unless you're using a creepy-old version of DIAdem, I don't see any reason to use the ASAM DataService.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 10
(5,371 Views)

Brad, I'm using 11.1, and I have the ATFx plugin, but that actually does not work.  For some reason I get the error that the channels cannot be found.  In the ASAM Data Service dialog, When I click to load the data, I have to select submatrix instead of default load mode.  This submatrix seems to be what has given me a headache with the script.The data is coming from the PUMA software off an AVL dyno (if that matters). 

 

It's possible that we don't have the AVL software setup properly to output the data in a familiar way.  (This just occured to me, so I will look into it tomorrow). 

 

Brandon Vaughan, an application engineer, is helping me out with this.  He has a file if you find this interesting. 🙂

 

Thanks. 

0 Kudos
Message 5 of 10
(5,369 Views)

Hello Mr. Spark Plug

 

I have created a simple script asking for an atfx filename and load all measurements inside by their submatrices.

It would be nice if you could provide an example file of your configuration to do some checks.

 

Greetings

Andreas

 

'-------------------------------------------------------------------------------
'-- VBS script file
'-- Created on 10/13/2011 08:48:19
'-- Author: Andreas Krantz
'-- Comment: Load the submatrices of all measurements in a given atfx file
'-------------------------------------------------------------------------------
Option Explicit  'Forces the explicit declaration of all the variables in a script.

If (FileNameGet ("ANY", "FileRead", DataReadPath & "*.atfx", "ATFX File (*.atfx),*.atfx") = "IDOk") Then 
  
  dim fileNamePath : fileNamePath = FileDlgFileName
  dim store : set store = Navigator.ConnectDataStoreByParameter("ATFX", "<filename readonly=""yes"">" & replace(replace(fileNamePath, "&", "&amp;"), "<", "&lt;") & "</filename>")
  
  dim aoMeasurementE : set aoMeasurementE = store.Model.Entities.Item("aomeasurement").SubTypes.Item(1)
  dim measurements : set measurements = store.GetElementList(aoMeasurementE.Name, "", false)
  dim measurement : for each measurement in measurements
  
    dim submatrices : set submatrices = measurement.References.Item("submatrices").Elements
    dim submatrix : for each submatrix in submatrices
      navigator.LoadData submatrix, "Load", nothing
    next
  next
  
end if

 

0 Kudos
Message 6 of 10
(5,361 Views)

Thank you for the effort Andreas, however, I get an error on line 15.  "Object doesn't support this property or method: 'GetElementList' "

 

My object oriented programming skills are fairly weak, but I believe I see what you are doing.  I could not find in the help file the "ConnectDataStoreByParameter" method for the Navigator object.  Perhaps this is the issue?  The closest method I could find is "ConnectDataFinder", but I don't think that's quite right. 

 

Anyway, I'll be happy to send you an example file, but I don't want to post in on the forums.  Do you have an email or FTP I could send it to? 

0 Kudos
Message 7 of 10
(5,348 Views)

Is the ConnectDataStoreByParameter method for Navigator only in Diadem 2011?  We have not upgraded to 2011 yet b/c our PC with the scripting license only has windows 2000....   If this is the cause, I'll push our IT to upgrade that PC.

 

Thanks. 

0 Kudos
Message 8 of 10
(5,346 Views)

Hi Mr. Spark Plug,

 

I believe that command was added in DIAdem 2010.  You can use the DIAdem 11.1 commands instead and keep the rest of that script.  Opening the data store is the easiest part of the whole exercise.  It may be with 11.1, though that you will not be able to use the file dialog and will intead have to create the data stores by hand ahead of time and choose the data store name to load.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 9 of 10
(5,344 Views)

The load of submatrices with the new API was introduced in 2010 (11.2). I misread your version information.

So you have to replace the few lines of code by a huge script.

 

I modified the Ods2Dia.vs to do your job and attached it.

I would recommend to update the DIAdem version to be able to use the new API.

 

Greetings

Andreas

 

 

 

 

0 Kudos
Message 10 of 10
(5,340 Views)