DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Peak value of a channel for specific durations

Solved!
Go to solution

Hi

I am very new to DIAdem and need help in scripting.

I have attached the screenshot of my data for which i am trying to find out the peak values for the time period.

Could someone help me to frame the script for this.

the idea is to sort the data w.r.t time and then process to find the peaks.

I just expect some handholding to get this. Thanks

0 Kudos
Message 1 of 5
(3,674 Views)

Hi,

 

Attached you can find one possible solution using channel event functions and the example data file in DIAdem 2015.

You can also use the "find peaks" function in DIAdem Analysis module but this function is looking for max values in the complete channel, so you have to remove uninteresting data first.

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 5
(3,627 Views)

Thank you Christian for the soluation

I ran the code as below

Option Explicit 'Forces the explicit declaration of all the variables in a script.

 dim TimeChn, DataChn, StartTime, EndTime, MaxValue, MinValue,ChnEventList1,ChnEventList2

  

Call MsgBox("Import from TC1 to TC8 to compute limits for DC content")

  'define time range to find max inside

StartTime = 4.5

EndTime = 5.5

 call Data.Root.Clear()

call DataFileload("C:\Users\ravi\Desktop\Tdata201\RAW DATA SHOTS COLD\RAWfile.tdms")

 'get channel references

set DataChn = Data.GetChannel("Log:Event Data 4300 RAW DATA SHOT/IP 230V PHA CURR")

set TimeChn = Data.GetChannel(WfChnToChn(DataChn, 1, "WfXRelative")(0)) 'extract time channel from waveform

 'extract interesting time range from time channel

  ChnEventList1 = ChnEventDetectionWindow(, TimeChn, StartTime, EndTime)

 'find max in data channel within the time range

MaxValue = ChnEventStatMax(DataChn, ChnEventList1)

 'find min in data channel within the time range

'MinValue = ChnEventStatMin(DataChn, ChnEventList1)

 call msgbox(MaxValue)

 

But i get error as attached.

I am using 2014 version. May you suggest alternate code

0 Kudos
Message 3 of 5
(3,591 Views)
Solution
Accepted by topic author Ravi_yadav

Hi,

 

the ChnEvent... functions with this syntax are available since 2015.

I think if you're using 2014 it should be easier to use the descriptive statistics function from Analysis module to calculate Min / Max in a specified range:

http://zone.ni.com/reference/en-XX/help/370858L-01/dlgmaths/calc_statistics_dlg/dlgstatblockcalc_dia...

Here you can find information about how to use it in script:

http://zone.ni.com/reference/en-XX/help/370858L-01/comoff/statblockcalc/

 

Also it is very helpful to use Ctrl+Shift+C Hotkey to copy analysis function settings to clipboard when the dialog is open and paste it to your script later.

Christian
CLA, CTA, CLED
0 Kudos
Message 4 of 5
(3,566 Views)

Ok. Thank you.

I would try the function.

0 Kudos
Message 5 of 5
(3,555 Views)