DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DataPlugin - populate channel min and max value so that they show in NAVIGATOR

Solved!
Go to solution

Hi,

 

I've written a DataPlugin for DIAdem 2015 to load my data, based on the example code here: http://zone.ni.com/reference/en-XX/help/370858M-01/dataplugin/methods/dataplugin_method_adddirectacc...

 

If I load data to the internal portal the channel min and max value properties are populated, however, in NAV they are NOVALUE. This prevents me searching data for channel min and max values.

There are two methods that I may need to use in the dataplugin: "AddCharacteristics for Channel" and "AddCharacteristics for DirectAccessChannel" but I don't know which to use or why. How do I obtain the min and max values anyway? Do I have to iterate through all the data? This seems counter intuitive.

 

Can you shed any light?

Thanks,

Craig

0 Kudos
Message 1 of 9
(4,292 Views)

Hi Craig,

 

You've put your finger on exactly the functions you want.  You need to call the AddCharacteristics method exactly once from each channel that you want to see the min and max properties in, like this:

 

Call MyChannelObject.AddCharacteristics()

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 9
(4,263 Views)

Hi Brad,

 

Thanks for your reply.

I tried using your example verbatim 'Call MyChannelObject.AddCharacteristics()' but this produces an error that the arguments are not optional. I've added a loop to receive each value from the channel and find the min, like so:

        ChannelMinVal = DirectAccessChannel.Values(1)
        For ValueCount = 2 to DirectAccessChannel.Size
          If DirectAccessChannel.Values(ValueCount) < ChannelMinVal Then
            ChannelMinVal = DirectAccessChannel.Values(ValueCount)
          End If
        Next
        Call DirectAccessChannel.AddCharacteristics(ChannelMinVal,0,1,1)

I'll add a similar loop for the max but for now it's set to 0.

I can't help but think there must be a better way to do this because when I load the file the min and max are (re)calculated in the blink of an eye.

 

Regards,

Craig

0 Kudos
Message 3 of 9
(4,256 Views)
Solution
Accepted by topic author UKCraig

Hi Craig,

 

I apologize, I answered too quickly and gave you incorrect information.  This method is new in DIAdem 2015, and I haven't used it at all, since I normally create DataPlugins so they work in multiple previous DIAdem versions.  Upon further review, you are absolutely correct that this method only automates the writing of the characteristic properties, but it requires you to provide all those property values yourself.  So you're absolutely correct that you would still need to loop over all the channel values and calculate the minimum and maximum values yourself before calling this method to write those properties to the channel.

 

When you load the data file into the Data Portal, it is the DIAdem application and not the DataPlugin that calculates those characteristic properties.  With current technology, the only ways to get minimum and maximum channel properties are to either loop over the values in the DataPlugin or to load the file into DIAdem and rewrite it as a TDM or TDMS file.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 9
(4,246 Views)

Thanks for the info Brad.

How would you aproach this problem in earlier version?

I'm not stuck with 2015.

0 Kudos
Message 5 of 9
(4,220 Views)

Hi Craig,

 

The new command in DIAdem 2015 and later just combines 4 other commands into one, so it doesn't really add any new functionality, just convenience.  Here's the new command:

MyChannelObject.AddCharacteristics(MinVal, MaxVal, eMonotonyNo, eNoValueKeyNo)
 

And here's what it would need to look like in versions older than DIAdem 2015:

MyChannelObject.Properties.Add "Minimum", MinVal
MyChannelObject.Properties.Add "Maximum", MaxVal
MyChannelObject.Properties.Add "Monotony", "Not monotone"
MyChannelObject.Properties.Add "NoValueKey", "No"

Brad Turpin

DIAdem Product Support Engineer

National  Instruments

0 Kudos
Message 6 of 9
(4,201 Views)

Hello Craig,

 

At the risk of stating the obvious, here's how the DataPlugin works when it indexes a file with the DataFinder.

 

The DataPlugin has basically two sections, one tells it where to find meta data (channel names, descriptions, units, min/max values, etc.) and one that tells it how the data is stored inside the actual data file. If the file format you are reading contains meta data for each channel (hopefully at least a name), that gets pulled into the DataFinder index. Some file formats write additional meta data into the header, the TDM(S) file format when written correctly will add the minimum and maximum values to the meta data segment. That's what we pull into the DataFinder index, so these DataPlugins don't actually calculate the min/max during the indexing process, they are just pulled in if available.

 

That said, how can we address your particular question. There are two ways that I can see that will allow you to add the min/max values for your data files. One is the option Brad has described, which will loop through each channel and determine the mix/max values for your data. That makes the DataPlugin indexing process slower, because it will have to do more than just extract meta data from your file - depending on the size and format of your files this might take several minutes.

 

Option two is to use your existing DataPlugin to load the data into DIAdem, then immediately save the data to a TDM(S) file, which will add the min/max values to the TDM(S) header. The TDM(S) version of the file can then be added to the DataFinder index, and you might end up with smaller data files, and definitely with files that will load fast in DIAdem and have your min/max values. The downside of this approach is that you will end up with two data files, one original file and the TDMS copy.

 

Both options have pros and cons, and we can help determine what might be the best approach if we have a little more background on how the data is stored in the original files and what your overall architecture for this project looks like.

 

I hope this adds some more background for you,

 

      Otmar

Otmar D. Foehner
0 Kudos
Message 7 of 9
(4,192 Views)

Hi Brad and Otmar,

 

Thanks for your replies and additional information.

I had hoped that the optimised function that calculates the min and max values when data is loaded into the data portal would be available from the plugin, rather than having to iterate through the data 'manually'. As Otmar points out using this method is rather slow, the only blessing being that it's a one-time operation.

I've considered saving the data in the TDM format and although there are benefits I've decided not to go down this route for now. Primarily this is due to the necessity to keep the original files because we have existing tools that expect the original data format, but also not all of us are using DIAdem and would not receive the benefits.

 

Thanks again,

Craig

0 Kudos
Message 8 of 9
(4,138 Views)

My company takes produces data files in the TDMS format.  I have a script that opens all the data files in a given folder and saves them in TDM format so that the metadata is searchable.  The program is not saving the metadata to the tdm files.  I went back and just opened the TDMS files and saved them manually to TDM format.  I am still getting NOVALUES in when I go to the Navigator Pane or try to do searches.  Has something changed between DIAdem 2015 to 2017?

0 Kudos
Message 9 of 9
(3,098 Views)