11-10-2009 12:47 AM
A simple problem..I acquire data from DAQ assist and am reading it back to plot using read from measurement file.
My signal will be with just one peak (see attached fig)
I need to find the time duration for which my waveform value is greater than 150.
I'm able to find the time waveform first crosses threshold...however the second point where waveform comes below the threshold..i'm not able to find
second attachement is part of the vi created..
If I can find the second time where waveform goes below the threshold, I can calculate the time using dt..
Solved! Go to Solution.
11-10-2009 01:26 AM
11-10-2009 02:10 AM
Hi Palkin,
Like mentioned here, you can use the Threshold Peak detector.vi function. Get its indices or count, use dt of you waveform to find the time duration of the threshold.
Another solution which I donot recommend but since you have already started off with express VIs, use the Mask and Limit Testing function, and set it for Lower limit masking with lower limit constant=150.
I still recommend you to use the first method.
11-10-2009 02:29 AM
Vsh,
With threshold peak detector, I can get the first point... But second point where signal goes below threshold is not given by indicies..
I was thinking of what muks has suggested... wanted to see if there's any other easier way to get the second point..
11-10-2009 03:05 AM
Palkin,
Have you tried reversing the array and repeating threshold 1D array?
After that you will have two 1D array thresholds and you know the size of the array. Subtract the two threshold values from the size of the array. The remainder is the size of the pulse in terms of array elements then multiply that with your dt to get the pulse width.
cheers
David
11-10-2009 03:10 AM
Hi palkin,
Actually you can achive your program by making use of event structure.Here i had done small program where i simulated one sine signal and compared with a threshold of 1.5.Now whenever the sinesignal crosses 1.5 ,an event will be generated and i am catching that event and calculating the time at which that event has been generated and next again ,i am waiting for the sine to come down below 1.5 and it again generated another event and time,so i am taking the difference of both of those times.I am attaching the VI,please let me know if i had mistaken.
Thanks and regards,
srikrishnaNF
11-10-2009 03:15 AM
Your graph was showing the threshold cross only once for one set of data. So the last indice of threshold peak detector.vi is your below crossing point right?
If your one span of data goes multiple times above 150 (threshold limit) after it has fallen below, lets say in your previous attachment of graph.jpg, T is between 20-22.5, if the same T also occurs in between lets say 30- 32.5, then u might want to look into other solutions. (Probably masking).
11-11-2009 12:43 AM
This actually turned out to be simpler than i thought..Thanks to srikrishnaNF...I started using his suggested way and found that 'Read from measurement file' doesn't need a while loop!! it reads the whole file in one shot...All I had to do is search the array of Y for value 150 twice and then multiply the indices with dt..attached is the modified version..
thankyou all...
Vsh, the threshold peak detector only gives -quote from help "Indices contains the beginning index of all valid peaks" So i could get the begining point where the waveform crossed the 150 value but it does not recod when the peak comes down below 150..
11-11-2009 08:29 AM
11-11-2009 09:16 AM
As David and VSH have hinted at, you can use threshold peaks. I've done this on multiple occasions.. See the attached VI.