06-02-2013 03:17 PM
Hi.
I am working on a SW which counts the peaks comes from a sensor.
Using Producer/Consumer method , one in aquiring the data and the second is finding the peaks using peak detector VI.
I was wondering if there is a simple way to calculate and show the number of peaks in the last X minutes . For example, in heartbeat there is average heart bear and the most updated last minute count of beats.
Thanks.
06-02-2013 03:42 PM
Are you keeping all the raw data from the sensor over the X minute period? If so, simply feed the subset of the array of data representing X minutes to the Peak Detector.vi from the Signal Processing palette. It has an output for number of peaks.
Another approach is to keep a running count in a shift register. Every time you find a new peak, add one to the count. Reset after X minutes.
Lynn
06-03-2013 02:13 AM
Dear Lynn.
Thanks for your quick answer.
The number of peaks should include only the last 1minute interval counts. like a dynamic 1 minute that always moves according to the time which includes only the counts in the last 1 minute interval. For example,
Absolute running Time =60 sec.
time range to search for peaks - 0-60seconds.
Absolute running Time =150 sec.
time range to search for peaks - 90-150seconds.
and so on....
Thanks.
06-03-2013 04:31 AM
I would try it with a ring buffer only holding the time of a peak/pulse.
Buffer size would be max_pulserate (200 🙂 ) times max_time.
Calculating pulses per time frame would be a compare and add array 🙂
A picture tells more :
06-03-2013 04:39 AM - edited 06-03-2013 04:40 AM
Point to add: Maybe it's wise to use the actual time for the time comparison 😛
In case of no pulse the display would stay at the last value 😄
Beep .. beep ..... beeeeeeeeeeeeeeeeeee(...)
06-03-2013 04:47 AM
Thanks.
I didnt finish to go over it deeply.
In the meanwhile, can you save the VI in LV 2011?
Thanks
06-03-2013 05:35 AM - edited 06-03-2013 05:41 AM
here we go...
another possible improvement: Since the array of timestamps is sorted you could get a more precise value if you use the time between first and last pulse of a integration time ....
06-03-2013 06:54 AM
Dear Henrik
I put your code into my VI but with no sucess to retrieve the time for the pulse.
Attached, the VI . What am I missing?
Thanks.