DataPlugins can be used to read almost any file format into DIAdem or LabVIEW. Here are some tips and tricks for creating one in VBScript

April 5, 2007

How to create a waveform channel

First off, you may be wondering what a waveform channel is. To graph data you need two channels of data: one containing the x values and one containing the y values. In a lot of measurement applications, the x values can be generated with just a start value, an increment and a size. This kind of channel is called an implicit channel in DIAdem. Instead of putting these values in an implicit channel, you can also add these values as properties to the channel containing the y values. A channel with these values is called a waveform and is displayed in DIAdem like this:



The big advantage to a waveform is that starting with DIAdem 10.0, instead of having to choose two channels for a graph in VIEW, or REPORT you can choose one. This reduces the probability of error for you or your customer when creating simple reports. It also reduces the amount of special knowledge required to make sense of your data.

Making a channel into a waveform channel is also very easy. All you have to do is add a few properties. You could for example, copy the following function into your DataPlugin and call it on your channels where you would otherwise call AddImplicitChannel:

Sub MakeWaveform(Channel,Offset,Increment,XName,XUnit)
Call Channel.Properties.Add("wf_start_offset",CDbl(Offset))
Call Channel.Properties.Add("wf_increment",CDbl(Increment))
Call Channel.Properties.Add("wf_xname",XName)
Call Channel.Properties.Add("wf_xunit_string",XUnit)
Call Channel.Properties.Add("wf_samples",CLng(1))
Call Channel.Properties.Add("wf_time_pref","relative")
Call Channel.Properties.Add("wf_start_time",CreateTime(0,1,1))
End Sub

For a full documentation of what each of these properties mean, I suggest you read the DIAdem help. The really interesting properties are offset (ie start value) and increment.

(As a side note: Calling CreateTime with less than the full 9 arguments is supported starting with DataPlugin API version 1.5. If you don't wish to switch to this version then you can fill out the rest of the arguments with 0's.)

No comments: