04-30-2013 05:58 AM
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.
04-30-2013 06:08 AM - edited 04-30-2013 06:09 AM
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...
04-30-2013 07:52 AM
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).
04-30-2013 07:54 AM