Running average in Cscape

shockwave78

Member
Join Date
Jun 2023
Location
TX
Posts
4
I am working on a program in Cscape to take a pulse input from a flow meter and output an average of the last 5 minutes of flow and total flow to a display. Everything works except I cannot figure out how to store values in the program for the average. Attached is what I have so far, the rung under the header Flow Data Storage is the issue. The value for R00018 is moved into all other registers at once, which I should have seen coming, but I do not know of another way to go about it.

Thanks

1.png 2.png 3.png
 
Ladder logic instructions are usually evaluated left-to-right and top-to bottom.

So when you MOV the value that was in R00026 to R00028 in the final MOV on that rung, the value in R00026 at the time of that MOV has already been overwritten by the value in R00024 by the previous MOV on the rung. And the same goes for all of the MOVs on that rung except the first.

PLC programming is primarily about time, i.e. about controlling when things happen, what happens first, what happens second, etc. And in this case, the code is erasing (overwriting) the old value in R00026 before it copies that old value you wanted to R00028. So the problem is the order of instruction evaluation.

I think you can find way to fix that, don't you?
 

Similar Topics

I need to keep a running pass/fail yield of the previous 5,000 parts produced. I have used this formula before to calculate average: AvgValue =...
Replies
6
Views
2,163
Just updated my customer from 984 to Quantum. We have an analogue I/P which jumps around somewhat and I need to do a running average on it. I seem...
Replies
15
Views
4,616
I want to monitor the cycle times of some of our stations (the process, not the CPU cycle time). We had a case recently where throughput was down...
Replies
6
Views
4,088
This is with 500 I use an eye to see when a product is in front of it which triggers a RTO and then when the eye is uncovered moves the value into...
Replies
10
Views
2,325
I am trying to implement a running average function using ladder logic in an AB PLC5. I have a digital input that pulses. Every minute I need to...
Replies
5
Views
21,450
Back
Top Bottom