
adccommunitymod (AutomationDirect) asked a question.
Counting events from the previous hour?
Created Date: November 11,2019
Created By: bjamison
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I need to count events that occurred in the previous hour. For minutes 1-60, I would look at the counter output. At minute 61 I want to see the count from minutes 1-61. At 65 minutes, the count from minutes 5-65, etc. Any ideas? Shift register? CLICK C0-10DRE-D low frequency counting
Created Date: November 11,2019
Created by: bjamison
I need to count events that occurred in the previous hour. For minutes 1-60, I would look at the counter output. At minute 61 I want to see the count from minutes 1-61. At 65 minutes, the count from minutes 5-65, etc. Any ideas? Shift register?
CLICK C0-10DRE-D
low frequency counting
Created Date: November 11,2019
Created by: MikeN
I would use a shift register setup where every minute it moves the counter value into a new register. Then get your total by adding the value of all the registers together. Only have 60 so that as you fill it up it shifts out the oldest value from an hour ago as you put a new one in.
If Click doesnt have a specific pre-built shift register function then you would do it by simply using a block of 60 memory addresses and a pointer to keep feeding data in. Trigger the move off a 1 minute timer.
Created Date: November 12,2019
Created by: kewakl
CLICK has a BIT shift register. No NUMERIC shift register.
Have a look HERE for an old example.
Questions? ask. I'll try to answer. It has been a while since I posted that (with Bernie's help.)
It appears that you could use the task 'shift data down ' for the shifting of the quantities and then
use (with some modification) the task 'Copy using pointer ' to select the subset of data you desire to totalize.
The 'some modification ' may include changing the hard-coded '100 ' value in the for-loop, the '1 ' and the other '100 ' in the math instructions to addresses (variables) so that you have a bit more control of the 'range ' of 'copied ' values.