Showing results for 
Search instead for 
Did you mean: 

ChnEventDetectionDifference Function: Incorrectly Locating X-Values



I am trying to search for certain triggers in a TDMS file using the ChnEventDetectionDifference() built-in DIAdem function, but it is unable to locate some of my desired triggers.


I am using the following code:

ChnEventList2 = ChnEventDetectionDifference(oTimeChn, signalTwoChn, deltaTwo, deltaTypeTwo, oTempX2.Maximum + 500, oTempX2.Maximum + 1000)

Where oTimeChn is the time, signalTwoChn is the user inputted channel to be analyzed, deltaTwo is the user inputted delta change that is to be located, deltaTypeTwo is the user inputted delta change type, and oTempX2.Maximum sets the window in which DIAdem needs to look for the trigger. oTempX2 is the location of the previous trigger, so the window is set between 500 and 1000 ms after the event of the first trigger.


When I try to run this function, the returned trigger point is outside of the specified range.


For example, here is the graph I am trying to analyze:

PeytonS_2-1707328433355.png y-axis = Voltage


The blue highlighted line is the first trigger that is being properly identified, and the second trigger I am trying to locate is in green, where the voltage goes back to 0.


The first trigger was located properly at 1300 ms, so with the specified range DIAdem should only be looking for instances of this specified change from 1800-2300ms. When reading the first instance of this trigger returned from this function, I am reading two problems:


1. There are two returned instances of this trigger, even though I am only trying to gather the first instance. See code below that I use to only gather information for the 1st instance of the returned trigger.

for iiLoop = 1 to ChnEventCount(ChnEventList2)
if (iiLoop = 1) then
set oTempX3 = oResGroupChns.Add("X_trigger_coordinate_1", DataTypeChnFloat64)
set oVTempY3 = oResGroupChns.Add("VY_trigger_coordinate_1", DataTypeChnFloat64)
set oITempY3 = oResGroupChns.Add("IY_trigger_coordinate_1", DataTypeChnFloat64)
call ChnEventCopyValues(oTimeChn, oVoltage, oTempX3, oVTempY3, ChnEventList2, iiLoop)
call ChnEventCopyValues(oTimeChn, oCurrent, oTempX3, oITempY3, ChnEventList2, iiLoop)
end if

2. The two points of time that are returned are 2338 ms and 2340 ms, which are incorrect (as the graph shows this should be at ~2190 ms) and are outside of the specified range.



Could this be due to the amount of data points within this TDMS file? The product I am working with gathers ~65,000 data points per file. When I run the same script with a different product, that only gathers ~15000 data points, with slightly varied parameters, the script properly identifies the trigger.


If this is the case, is there a way to do the exact same trigger analysis without using the built-in DIAdem function? Or a work-around way using a different function that would generate more accurate results?

0 Kudos
Message 1 of 1