DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

"Diadem" AND "DataPlugin"

Hello everyone:
 
I have data logged on binary files. Each binary data file (*.cvd) has its corresponding xml header file (*.cvx) which describe the data on the binary file plus other Logging information.
 
I have written a short Dataplugin for Diadem 10.0 to read these binary files into the Data Portal.
 
The binary files contain data from Real (32-bit floating point) channels, Integer (32-bit) Channels and Boolean (1 bit) Channels.
Boolean channels are all packed into a 32-bit DW (type U32).
On the header file (xml formated - can be read with Worpad) there is a description for each channel (Channel Id No, channel name, type, size ect...)
 
Once I got the Real, Integer and Packed Boolean channels loaded into the Diadem Data Portal I need to extract each individual "bit" from each Packed Boolean channel and create new channels (U8) on the data portal for each of the Boolean channels.
 
Please find attached the data plugin (Read_M80-M_data.vbs), an example binary data file (1823310_00_00_47.cvd) and its corresponding header file (1823310_00_00_47.cvx).
 
When you load the data using the given data Pluging in Diadem. you can see that the Double Word 101 has been imported as a "Packed DW 101" instead of a  specific channel name given on the header file. This is because each bit on that 32-bit DW represents a digital or boolean channel from the PLC (Process Controller).
 
Data store on channel "Packed DW101"  contains the data for 32 digital/boolean channels which are described on the header file (from Channel id =101 to Channel id = 132).
 
Since the data file could have 100s of Packed Boolean channels with > 3000 samples each.
 
The  $1M Dollar Question is:
How do we "Efficiently" extract each bit of each Packed Boolean Channel sample and load it in to Diadem Portal (This will not be Direct Access Channels I gess, but created channels after we load the data file).
 
Any help on this will be highly appreciated
 
Kind Regards
 
Felix.
 
 
 

BSc. MSc. Felix Beltran MIEE

Control & Instrumentation Engineer

CONVERTEAM Ltd.

formerly ALSTOM Power Conversion

Process Industries Department

Rugby CV21 1BU

United Kingdom

 

0 Kudos
Message 1 of 7
(3,900 Views)
Hi Felix,

I'm not sure how efficient it would be but you could probably use the GetB() function to get the value of a particular bit. You would have to use this function in a couple of loops to step through all the bits in your data. I am working on an example of this and will post it up when I've finished.

Regards

Jon B
Applications Engineer
NIUK
0 Kudos
Message 2 of 7
(3,852 Views)
Hi Jon:
Thank you for the replay.
 
When you use the GetB() function on a 32-bit Direct Access Channel that has been created on the Data Portal, does it return all the samples of the Direct Access Channel masked at the specified bit or just returns the first sample masked at that bit.
 
For example if we have:
 
100 of 32-bit Packed Boolean channels with 3000 samples each this will make :
 
32*3000*100 = 9,600,000 Loops
 
OR
 
32*100 = 3200 Loops
 
_________________________________________________________
 
The other question Jon is:
 
Why many of the functions that you find on the "Diadem Script" Help file like for example:
 
Call FormulaCalc(formula)
 
can not be used straight away on the "Data plugin" scripts. I get the Message: "variable is undefined 'FormulaCalc'".
 
Do you know if there is a way how we can access this "higher level" functions in a "Data Plugin" script?
 
Your comments will be highly appreciated.
Thanks a lot.
 
Regards
Felix
0 Kudos
Message 3 of 7
(3,850 Views)
Felix,
 
I looked at your plugins and did a few edits to do what I think you want to do. First, its possible to split the digital channel while reading the data from file. You can use bitmasks to retrieve single bits. The "trick" is to define one channel for each digital channel. One thing is not obvious : As the base data types for dataplugins don't support "bit" you need to use e.g. U32. Now you have several of those you need at the same position in the file. This can be achieved by using one binary block for each channel.
The block need to be set up so that the block "knows" that in between the values of the channel you use, there are gaps. Those gaps result from the fact that the file has a layout where you have chn1, chn2, chn3 and so forth. This is configured by setting the "BlockWidth" property
 
In addition to the bit handling I added a few lines of code to show how you can create waveforms. Waveforms are channels with attached timing information. You can use them as long as deltaT in the time channel is constant. I used delta T from the XML header and added a dummy statement to calculate the offset (Tzero) This calculation probably needs adjustment (See line ""Base_Offset = Base_Rate*100.*(-1.))
 
I have attached the updated code below.
 
Please let me know if this works for you.
 
Andreas
 
0 Kudos
Message 4 of 7
(3,837 Views)

Felix,

Sorry I posted the wrong version. Please try teh one below

Andreas

0 Kudos
Message 5 of 7
(3,836 Views)
Andreas:
 
Thank you very much for your replay. I'll try asap.
 
Could you please advise me on the following question as well?
 
Why many of the functions that you find on the "Diadem Script" Help file like for example:
 
Call FormulaCalc(formula)
 
can not be used straight away on the "Data plugin" scripts. I get the Message: "variable is undefined 'FormulaCalc'".
 
Do you know if there is a way how we can access this "higher level" functions in a "Data Plugin" script?
 
Your comments will be highly appreciated.
Thanks a lot.
 
Regards
Felix
0 Kudos
Message 6 of 7
(3,825 Views)

Felix,

Most of the DIAdem commands are not available in the DataPlugin environment. The DataPlugin are running several levels below the DIAdem script level. The best way not to mix up the two levels is to specifically to the DataPlugin documentation only when writing the plugin. We tried to provide all the functionality you may need when dealing with the file in the DataPlugin API. If you find that something is missing, please le ust know what you are trying to do and we wil try to provide a solution or review the request when working on the next release. As you can see from the ni.com/dataplugins page, we were able to develop quite a diversity of different plugin with the current functionality.

Just as an FYI : While the API is kind of limited, we were able to keep the whole DataPlugin environment pretty lightweight which is a major advantage when the DataPlugins are used in the DataFinder to index your files.

Andreas

0 Kudos
Message 7 of 7
(3,820 Views)