LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter System

I have a system requirement to determine if an event has occurred 5 or more times in the last hour.  This event occurs when input signal conditions logic goes true.  This would imply that there is a mechanism to record events on a queue and remove them when they become more than 1 hour old.  Unfortunately, I think in C++ style of programming and want to use a structure.  Given that LV is a signal flow description, maybe there is a lean and elegant block to handle this task?   The more likely answer is that there are a combination of other blocks and that I must learn change the way I think.

 

Constructive and actionable guidance is appreciated.  An example would be ideal.  Thank you.

0 Kudos
Message 1 of 4
(2,270 Views)

Hi gator,

 

you could:

- add the current timestamp to an array of timestamps, when an event occurs

- after adding the new timestamp you should check for "old" timestamps in the array and remove them

- now all you need to do is to check the size of the array: when there are 5 or more elements in the array your counting detected 5 events in the last hour...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,267 Views)

I noticed that there is a delay block so that when the event's signal line goes true, it could trip the delay block and have the event removed from the event counter 3600 seconds later.  I'm trying to get the mind to think in terms of signals, as opposed to commands (C++ \ Assembly).

0 Kudos
Message 3 of 4
(2,244 Views)

Hi gator,

 

yes, that might be possible.

I still think my array of timestamps approach is easier...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,242 Views)