DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

dataplugin help

hi
 
This is related to dataplugin.i wrote a dataplugin for a binarydata file.now the problem is i dont want to read all the values for a channel. for eg if the channel contains 0 to 100 values.i need to get only values between 40 to 80. is it possible to set the starting and ending position using  DirectAccessChannel method.
 
Regards
RCalicut
0 Kudos
Message 1 of 4
(4,163 Views)

Hi RCalicut,

Yes you can.  Is this something you're willing to have hard-coded in the DataPlugin, or do you really want to pass the DataPlugin start and end parameters each time you use it?

When you create your binary Block object in the DataPlugin, it takes the current File.Position as the starting byte for the whole Block.  You can either change the File.Position prior to creating the Block object or create the Block object and then change the Block.Position property to modify which value to start with.  Below is an excerpt from the DIAdem 10 Help system on DataPlugins:

The following example reads channel values from a binary file. Because the file pointer is repositioned in the BinaryBlock, the first 25 values (200 / 2 channels / 4 bytes) in this file are ignored.

Dim oBlock : Set oBlock = File.GetBinaryBlock()
oBlock.Position = 200
Dim oChn1 : Set oChn1 = oBlock.Channels.Add("FirstChannel", eI32)
Dim oChn2 : Set oChn2 = oBlock.Channels.Add("SecondChannel", eI32)
Dim oMyGrp: Set oMyGrp= Root.ChannelGroups.Add("MyChannelGroup")
oMyGrp.Channels.AddDirectAccessChannel(oChn1)
oMyGrp.Channels.AddDirectAccessChannel(oChn2)

Similarly, you can set the Block.Length property to set the maximum value in the Block to read into its channels.  Note that the Block.Length counts values, whereas the Block.Position counts bytes.

Let us know if you need further assistance,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(4,155 Views)
I have a question along the same lines.  I would like to read my binary data from time X to time Y.  The start and stop times will need to come from a SUD.  Is this possible?  My ultimate goal is to be able to select multiple binary data files and selcect a time range for the data I want to view.  The data range will most likely span two or more data files.  I am using DIAdem 9.1
 
Thanks,
 
AJL
0 Kudos
Message 3 of 4
(4,140 Views)
Hi AJL,
 
Yes, you can do this, but you have to use a back door hack method.  The good news is that I have already prototyped and tested this approach, and you can just copy what I have done.  The idea is to have the DataPlugin associated with the real file extension of the binary file BUT also with a second *.RED file extension.  If the DataPlugin is invoked to "read" a *.RED file, then it knows to look for the binary file of the same name but apply the time window information found in the *.RED file.  It's easy enough to declare the binary Block object in the DataPlugin to start and stop at the correct places in the binary file once you have passed the time window information into the DataPlugin.  We are working on making this sort of thing much easier, so this could be a temporary measure until the "real" feature comes along, although it seems to work just fine for me and there's no reason you would HAVE to change in the future.
 
Cheers,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
0 Kudos
Message 4 of 4
(4,122 Views)