12-09-2016 05:25 AM - edited 12-09-2016 05:36 AM
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
Solved! Go to Solution.
12-09-2016 08:55 AM - edited 12-09-2016 08:57 AM
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.
12-10-2016 08:51 AM
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
12-12-2016 03:45 AM - edited 12-12-2016 03:57 AM
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:
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.
12-12-2016 04:02 AM
Ok. Thank you.
I would try the function.