LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate the number of the last X minute peaks

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.

 

0 Kudos
Message 1 of 8
(2,466 Views)

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

0 Kudos
Message 2 of 8
(2,458 Views)

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.

0 Kudos
Message 3 of 8
(2,427 Views)

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 :

pulsemean.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 8
(2,420 Views)

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(...)

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 8
(2,418 Views)

Thanks.

I didnt finish to go over it deeply.

In the meanwhile, can you save the VI in LV 2011?

 

Thanks

0 Kudos
Message 6 of 8
(2,415 Views)

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 ....

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 8
(2,404 Views)

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.

0 Kudos
Message 8 of 8
(2,389 Views)