Trying to stack Yesterday's Totalizer

ahaanwar2

Member
Join Date
Jan 2020
Location
Sanaa
Posts
19
Hi all,

I am having trouble trying to stack Yesterday Totalizer.

I need to view three values in my HMI (Accumolative Totalizer, Today Totalizer, Yesterday Totalizer).

As you view in the image of PLC Ladder;

Previous accumolative totalizer start when each day ends at 0 hours 0 minutes 0 seconds.

Today Totalizer = Totalizer - Previous accumulative Totlaizer.

However, when I try to get yesterday's Totalizer it always goes to 0. Because, at the end of each day; today totalizer = 0.

How can I stack today's totalizer to yesterday's totalizer before it goes to 0.

Is there any way other than deducting 1 second for the operation.


Thanks in advance

TOT_Issue.jpg
 
You need a one shot in the rung looking at the hours minutes and seconds. The processor cycle is likely something along the lines of 20 to 30 ms (or much less) and that rung remains true for one full second. That will create issues unless you make sure it's only true for one cycle.
 
[update: second! whoops, third!;-]


With scan times typically measured in milliseconds, that code will execute many times during the first second (00:00:00; 0h0m0s) of each day.

So it is not the first execution of that code of the first scan in the first second of the day that puts a 0 into yesterday's total; it is the executions of scan during that same first second of the day that cause the behavior you see. Please do not do anything else until you understand this, and why you see that problematic result; if you have trouble understanding, just ask and this fundamental behavior of PLCs can be explained. Seriously, it can be dangerous for yourself and others if you do not understand this.

Once you do understand, read on ...

Do you know how a one-shot works (see below)? You need something similar, but that executes exactly once across a midnight boundary. E.g. detect when the hour of the previous scan (e.g. 23) is greater than the hour of the current scan (e.g. 0)? Note that such an algorithm is more robust than a test for 0h AND 0min AND 0s, i.e. what happens to the 0-0-0 test if the PLC is switched off between 23:59:59 and 00:00:01?

PLC-Programming-One-Shot-Operation-300x250.png
 
Last edited:
See below.

The new third rung is the key to make this work

The first and last rungs are the same.

The second rung is functionally the same as the second rung from the first post of this thread, and even though this is a more robust approach, there is still an accuracy problem if the PLC is not in RUN mode at midnight.


xxx.png
 

Similar Topics

I can't seem to get the Panel View Plus 7 standard edition to downgrade to V_11, when I check the AB downloads and compatibility websites for this...
Replies
1
Views
123
Hi I used to be able to launch PLCsim without any problem. Now it tells me " STEP 7 Professional Licence is required to simulate this PLC"...
Replies
15
Views
511
Hello! When trying to load the hardware configuration I get error 0050-133 2 2458, check the diagnostic buffer. When checking the buffer, it says...
Replies
4
Views
178
We have a keg check weigher that that lost a fight to a forklift. The scale was previously a Systec IT3000, which was the only PROFIBUS slave...
Replies
5
Views
667
Back
Top Bottom