NI Home > Community > NI Discussion Forums

DIAdem

Showing results for 
Search instead for 
Do you mean 
Reply
Trusted Enthusiast
Brad_Turpin
Posts: 2,920
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi Stagsden,

I would be happy to look at your ASCII file, but unfortunately I can't seem to detach it-- I keep getting an empty IE screen whenever I try.  Would you just paste the first 20 or so lines of the ASCII file into the body of your reply?  Then I can make a *.txt file out of that and use it instead.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

Trusted Enthusiast
Brad_Turpin
Posts: 2,920
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi StagsDen,

A colleague was able to download your txt file for me.  I created a DataPlugin that works perfectly on my computer for this one file.  Your file starts with 3 null strings and a final character («) with ASCII code 171.  I went ahead and required this to always be the case in the DataPlugin and to fast forward to the 5th character in the file to use as the beginning of the first channel name.  Note that I pushed the unit strings in each channel name into the unit property of each channel in the Data Portal.  I think you will find that this makes it easier to use that information in DIAdem, particularly once you upgrade to DIAdem 11 with its new built-in unit handling.

See what you think,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

Trusted Enthusiast
Brad_Turpin
Posts: 2,920
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Woops, sorry for the teaser.  Here's the DataPlugin.
Member
Stagsden
Posts: 34
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Thanks Brad,
 
Works perfectly.
 
Stagsden
Member
smoothdurban
Posts: 197
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hey Brad.

 

I have a similar problem.

 

  How would I manually add channel units to the channels when importing a text file? 

Tim
Member
Renée
Posts: 67
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

smoothdurban,

 

What Brad was helping the previous customer with was importing a text file and managing the names and units. If you look back at the attached text file from the third post in this thread, there are columns of data with headers. Make sure you format your text file in this way before trying Brad's solution at the end of this thread.

 

If you'd like, you can attach your text file and I will help you examine the difference between yours and the one discussed earlier in this thread.

 

 

Regards,

Renée M
Applications Engineer
National Instruments
Member
smoothdurban
Posts: 197
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi

 

I Have attached a copy of a piece of data.  The first column is time and the second is a voltage which will be converted to a load later on.

 

I am simply trying to add units to this data when it is imported into DIAdem.

Tim
Trusted Enthusiast
Brad_Turpin
Posts: 2,920
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi smoothdurban,

 

By manually, do you mean that it's something that can be hardcoded or IF THEN case statemented in the DataPlugin, or are you asking how to change a channel unit in the Data Portal with mouse and keyboard?  Do you also need to scale your data values to engineering units, say from Volts to Newtons?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Member
smoothdurban
Posts: 197
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hey Brad

 

Yes I would like to hardcode this in the IF THEN statements in the DataPlugin.  I know how to change the channel units once the are included into the channel.  I also know how to scale the units using the calculator.

 

Tim
Trusted Enthusiast
Brad_Turpin
Posts: 2,920
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi smoothdurban,

 

I wrote a DataPlugin that loads the one *.txt data file you posted.  You just need to detach the ZIP file, unzip it somewhere, then double-click on the *.uri file to register the DataPlugin, after which you will be able to drag this file and any others like it into the Data Portal.  The part of the DataPlugin that adds the unit is the following:

 

Select Case LCase(Trim(Cols(1)))
  Case "voltage" : Unit = "V"
  Case ELSE      : Unit = ""
End Select
Channels(j).Properties.Add "Unit_String", Unit

The DataPlugin assumes the first channel is the Time channel and contains the number of elapsed seconds since 1904 (LabVIEW standard).  The unit "s" is hardcoded for the first channel.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments