Trying to accumulate the number of seconds counted by a batch counter

101 views Asked by At

I am trying to accumulate the number of seconds counted by a 'batch counter'. Every new batch, the counter automatically resets to zero and starts to count until the batch stop. I can't control the batch counter. I can only read its count. What should be the best ladder logic to achieve my goal? I am using a Weintek PLC with Codesys. Thank you.

I have tried using function blocks that copy the total of seconds per batch and then add the new count per batch but I need to get the instantaneous accumulated count, and not to wait when every batch is done.

1

There are 1 answers

0
Modicon On

My issue was handled. I made use of the batch running state. The logic adds (accumulates) the current seconds tallied to the seconds saved from the previous batch when the batch is running (ON). When the batch is turned off (OFF), the logic adds the current seconds counted to the batch's seconds. To avoid infinite addition while the batch is not running, I have to include the rising edge detection function block.

enter image description here