03-05-2008 09:42 AM
03-06-2008 09:46 AM
Hi SethRow187,
You can edit the DataPlugin created by the DataPlugin Wizard, but it's not obvious where to do that as the auto-generated code is long and difficult to read, since it has to be ready to handle any posisble format permutation that the DataPlugin Wizard covers.
If you look on line 259 or thereabouts, you should find a line of code that reads:
ChannelNames = Array()
If you change this line to declare your static channel names, then save the edited DataPlugin script, your DataPlugin will load the data files with the correct channel names:
ChannelNames = Array("Time", "Speed", "Revs", "Torque")
But this doesn't help you with the units, and I believe the simplest way to get what you want would be for you to send me an example data file and let me create a quick 15 line DataPlugin that uses the right channel names and units. This would be a lot easier for you to understand. You'll also have to tell me what the correct channel names and unit strings are for each column in the data file.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-06-2008 10:03 AM
Brad-
Here is an example data file.
The channel names are: Timestamp, Voltage, Current, Inlet Temp, Exit Temp, Air Flow Rate, Air Flow Rate1, H2 Flow Rate, H2 Consumption, Power, Total Run Time, Cycle Count, Start-Stop Data Filter
The units are: Seconds, Volts, Amps, C, C, LPM, Stoics, LPM, %, Watts, Hours, Cycles, Binary
Thanks!
(FYI, the file extension I want is .tsd, however it would not let me post the file with this extension, so I had to change it to .txt)
03-07-2008 10:38 AM
Hi SethRow187,
The file you sent has a header line with the ChannelName(ChannelUnit) information for each column. Does this really exist in your data files? If so, then there's no point in using static channel names and channel units, I can parse the correct information from the first line of each file. Let me know, I'll get everything else knocked out and will be waiting on your reply to finish. If the data files really don't have that first header line, or they sometimes do and sometimes don't, then I'll need to have the hardcoded names and units in the DataPlugin after all.
Brad Turpin
DIAdem Product Support Engineer
National Instuments
03-07-2008 10:49 AM
03-07-2008 11:11 AM
Hi SethRow187,
Well, the real DataPlugin itself only took 15 lines, but the way I chose to hardcode the static channel names and units took another 20 lines. Anyway, this should be much easier to read than the boiler-plate code the DataPlugin Wizard spits out. Also, the alignment looks much better in SCRIPT than it does in an internet browser-- just copy this code over your existing DataPlugin code and save the changed VBScript file. Note that I assumed that your timestamp was the number of seconds since 1900 (Excel's timestamp). The offset for the first channel adds the number of seconds from 0 AD (DIAdem's timestamp) to 1900 to each value in that channel, the "displaytype" property tells DIAdem to display this number of seconds as a timestamp.
Let me know if you have questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
OPTION EXPLICIT
Sub ReadStore(File)
Dim i, Block, Group, Channel, ChanNames, ChanUnits
File.Formatter.Delimiters = vbTAB
File.Formatter.LineFeeds = vbCRLF
Call GetHdrInfo(ChanNames, ChanUnits)
Set Group = Root.ChannelGroups.Add(File.Info.FileName)
Set Block = File.GetStringBlock()
FOR i = 1 TO UBound(ChanNames)
Set Channel = Block.Channels.Add(ChanNames(i), eR64)
Channel.Properties.Add "unit_string", ChanUnits(i)
IF i = 1 THEN
Channel.Offset = 3600*24*693958
Channel.Properties.Add "displaytype", "Time"
END IF
Call Group.Channels.AddDirectAccessChannel(Channel)
NEXT ' i
End Sub
Sub GetHdrInfo(ChanNames, ChanUnits)
Dim i, iMax
iMax = 14
ReDim ChanNames(iMax)
ReDim ChanUnits(iMax)
i = i + 1 : ChanNames(i) = "Timestamp" : ChanUnits(i) = "Sec"
i = i + 1 : ChanNames(i) = "Voltage" : ChanUnits(i) = "Volts"
i = i + 1 : ChanNames(i) = "Current" : ChanUnits(i) = "Amps"
i = i + 1 : ChanNames(i) = "Input Temp" : ChanUnits(i) = "C"
i = i + 1 : ChanNames(i) = "Exit Temp" : ChanUnits(i) = "C"
i = i + 1 : ChanNames(i) = "Air Flow Rate" : ChanUnits(i) = "SLPM"
i = i + 1 : ChanNames(i) = "Air Flow Rate" : ChanUnits(i) = "Stoics"
i = i + 1 : ChanNames(i) = "H2 Flow Rate" : ChanUnits(i) = "SLPM"
i = i + 1 : ChanNames(i) = "H2 Consumption" : ChanUnits(i) = "%"
i = i + 1 : ChanNames(i) = "Power" : ChanUnits(i) = "Watts"
i = i + 1 : ChanNames(i) = "Total Run Time" : ChanUnits(i) = "Hrs"
i = i + 1 : ChanNames(i) = "Cycle Count"
i = i + 1 : ChanNames(i) = "Start/Stop Data Filter"
i = i + 1 : ChanNames(i) = "Comments"
End Sub ' GetHdrInfo()
03-07-2008 12:23 PM
03-07-2008 12:29 PM
03-07-2008 02:10 PM
05-21-2008 07:19 AM
Dear Brad,
I am having similar problems with my data. I just need to get the header line incorporated into the channel names.
Would you be able to generate a dataplugin to read the following data?
I only have the one line, but it is dificult to undertsand the VBS script.
I also cannot get rid off the << symbol next to the time data.
The data files produced do not have an extension usually, therefore I added txt just to be able to send it.
Thanks
Stagsden