07-07-2024 10:55 AM
Hi,
Is there a way to find the individual peak values [ highlighted in red] of each cycle pressure and store all peak values in new channel.
Also want to record its corresponding crank angle in an another new channel.
sample image below:
X: crank angle
Y: pressure
something like,
Index | Peak values channel | Crank angle channel |
1 | y1 | x1 |
2 | y2 | x2 |
3 | y3 | x3 |
4 | y4 | x4 |
thanks,
Durai
08-09-2024 03:18 AM - edited 08-09-2024 03:18 AM
Hi,
You can try this line of code:
' Calculate the interval size PeakWdwPct, as a % of the recording duration (input to ChnEnvelopes function)
Dim RecordingDuration, PeakWdwPct
RecordingDuration = (oChn.Size-1) * oChn.Properties("wf_increment").Value
PeakWdwPct = PeakWdwDuration/RecordingDuration*100 ' [%]
Call ChnEnvelopes("",oChn,Grp_Name & "/UpperX_" & Chn_Name,Grp_Name & "/UpperY_" & Chn_Name,Grp_Name & "/LowerX_" & Chn_Name,Grp_Name & "/LowerY_" & Chn_Name,PeakWdwPct)
Where PeakWdwDuration is the expected period between 2 peaks, in seconds.
oChn is a waveform channel object
Jacques