DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Importing LabVIEW VIs for signal processing in DIAdem

Hello,

 

 I need to import a LabVIEW VI with signal processing functionality say peak/valley detection into DIAdem. DIAdem doesn't have waveform data type. How could I give my input waveform for peak detection in DIAdem. Could anyone brief me the procedure for importing LabVIEW VIs into DIAdem?

 

Thanks,

Abinaya

0 Kudos
Message 1 of 8
(4,613 Views)

Hi Abinaya,

 

DIAdem actually does have waveform channels, which I suggest you use prior to calling the VI.  I also recommend that you save those channels to a temporary TDMS file before calling a wrapper VI and pass it the TDMS file path.  Then your wrapper VI can load the channels from TDMS as waveforms and call the analysis VI.  I'd also recommend sending the result back to DIAdem the same way if your'e going to be creating output channels from the analysis VI.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 8
(4,609 Views)

Hi Brad,

 

DIAdem has waveform channels. But my question is how to give waveforms as input/output in VB Script. Whenever a LabVIEW subvi has to be run from DIAdem, a VB script has to be written to give the inputs and call LV RTE etc., If the input is numeric, it can be defined as VI.SetControlValue "Input", 10 (say). How could the same be done for waveforms?

 

Thanks,

Abinaya 

0 Kudos
Message 3 of 8
(4,592 Views)

Hi Abinaya,

 

DIAdem has waveform channels, but VBScript does not have a "waveform array" concept, and there is no way to send the waveform channel in the Data Portal through the VI object into LabVIEW.  Your only option there is to pull off the numeric array of Y values, the start time and the delta time and send those 3 parameters through to the VI inputs.

 

This is why I suggested a wrapper VI and using a temporary TDMS file.  Additionally, if the waveform channel in the Data Portal is at all large, sending it through file I/O is actually much faster than converting the waveform channel into a numeric array of variants in VBScript and sending that to LabVIEW.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 8
(4,577 Views)

Hi Brad,

 

Is this possible as well?

 

1) Convert waveform to Varient

2) Read the value of the Varient type control as the default datatype of VI.GetControlValue -> Name as string, Value as Varient

3) Use the varient value to create a new channel with start time and dt properties set using this , and Y values as values of the channel

 

Cheers,

RAO

0 Kudos
Message 5 of 8
(4,575 Views)

Yes RAO,

 

Exactly that is possible as well.  I typed up this option as an answer this morning, but I must not have sent it, because it's not there now.  I would caution, though, that the temporary TDMS file approach with the wrapper VI will perform faster for larger arrays than building the VBScript Y value array to pass to the VI.  Even so, you don't have to build the VBScript array in a loop, there is a native "Channel.GetValuesBlock" method in DIAdem 2015 and later, and there should be older commands we can use as well in pre-2015 versions.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 8
(4,567 Views)

Hi,

 

Thanks for the valuable suggestions. I have used TDMS files to input waveforms. Its working.

 

Yet another doubt I have is regarding automated script generation. Say I generate a script that calculates FFT of a signal. While recording I might have used a particular channel for which FFT might be found. Now whenever I run that script will it find FFT of that particular channel or is there a way by which the script can be made generic?Also if I call this script from LabVIEW using DIAdem run script VI, it will always calculate FFT of the channel for which the script was generated right. So how could I generate a generic script?

 

I am pretty new to DIAdem. Sorry if my questions are silly.

 

Thanks,

Abinaya

0 Kudos
Message 7 of 8
(4,541 Views)

Hi Abinaya,

 

You can set the "ChnNoStr" variable prior to running your DIAdem VBScript, which should then use the following syntax:

 

Call ChnFFT1("", ChnNoStr)

If you're calling your recorded script from another DIAdem VBScript, you can pass a channel variable to it and use that instead of the global "ChnNoStr" variable, but if you're calling your recorded script from LabVIEW, you can only set a global variable with standard ActiveX calls.

 

Brad Turpin

DIAdem Product Support Engineer

National Intruments

0 Kudos
Message 8 of 8
(4,537 Views)