rslogix 5 60 register array + moving average

mattjsayers

Member
Join Date
Jul 2011
Location
Maryland
Posts
14
Hello all,

The task at hand is a little tricky for me... a novice at best...
This is all about an alarm and storing data into rs batch.

I have an air flow instrument (AI). I have a setpoint on this flow instrument = value of 1440 +/- 175. + is high - is low.

I currently have a simple compare set up for High and low alarm..simple enough...NOW....

I need to add a moving average of that flow instrument input (AI)into a 60 register array by collecting that data every second for 60 seconds. Once I have the data (60 seconds worth) I need to calculate the average. Once the average has been calculated I need to begin storing the min and max of the average. And continue do so every second after the first 60 seconds.
Classic case of I know what I need to do....I just have no direction to do it.. Any help would be awesome..step by step would be great.
Oh yeah.. I only have 990 words left out of 101410 in my memory, so I need this to be a simple has possable..lol..
 
I will see if I can write a routine for you to average your Flow data for 60 seconds.

To gain a little more memory, In RSLogix5, you can click "Tools, Database, Delete Unused Addr". Then click "Tools, Delete Unused Memory". Before doing either step, make sure you have a saved copy of the program as it is now, in case something goes wrong.
I only have 990 words left out of 101410 in my memory,
Having over 101,000 words of memory seems to make your PLC some version of a PLC5/80 instead of a 60. I believe that the 60 only had 65535 word of memory, unless you have some type of add-on module.

The attached program does the first part, computes the average over 60 seconds. Then you have to add rungs, after each additional second, to subtract the oldest reading from the total flow and add the new flow (or alternatively delete the oldest reading and copy all other points down 1 word, then add a new 60th reading), then find the new total flow and divide by 60 to get the new 1-minute Moving Average Flow.
 
Last edited:
Take a look at this post. It has two examples for averaging large arrays, one using a FIFO and one using a circular queue. By using a queue and keeping a running sum it is not necessary to sum the entire array every time, saving on scan time. This post was written for a SLC.

http://www.plctalk.net/qanda/showpost.php?p=260919&postcount=5

If you don't have logix500 post back and I'll convert it to Logix 5.

Also be aware that the PLC/5 has an AVE instruction that will do file average for you.
 
Last edited:

Similar Topics

I would like to copy register N61:131 thru N61:147 into ST252:0 I keep failing What happens is I copy into ST252:0,1, 2 etc. What am i missing...
Replies
18
Views
493
Good morning (EST), I am trying to implement the code below in on an S7-1200. It's barely half a dozen instructions, but I am stuck; I have not...
Replies
26
Views
5,535
Hello All! I am having difficulties mapping register values. In the TURCK register there are 24 unique register bytes corresponding to different...
Replies
2
Views
2,564
Hey. I need some input on how to solve this task i am struggeling with. In the picture I attatched to this post, i tried to display what my task...
Replies
40
Views
16,256
What's happening is, when running the lid picker is coming up one short and while the rest of the machine is functioning in sequence as normal...
Replies
5
Views
4,050
Back
Top Bottom