RSLogix 5000 averaging help

DarrenG

Member
Join Date
Dec 2016
Location
London
Posts
74
Hi folks,

First and foremost, credit where credit's due, thank you daba for the averaging sample provided in a separate post back in 2013.

I've used this sample to try and get an average for our Nox output every minute, hour, day and month. I'm not sure what frequency the averages need to be taken at just yet, it may only be every hour but for now I've been asked to do it by minute until we get more information.

This is my first bit of programming with RSLogix so I'm just looking for some advice relating to the FAL instruction and just a sanity check on what I've done so far. Is there anything glaringly obvious that I'm missing or does it look ok? I am a little confused with the FAL block, I have read the help file relating to it but because I haven't used it before I'm lacking in confidence.

In the sample provided by daba, which I have screenshotted below, the destination and expression are: LogData[Day,FAL_Control.POS] and Date[FAL_Control.POS] respectively. My understanding of this is that each element of array "Date" is copied to the array "Logdata". What purpose does the "Day" part in that string serve then?

The idea here is that we will log, store and print off in a report the averages for the Nox output. I have attached 4 pictures below of what has been done so far. If it all looks good then great, I would just like an experienced eye to have a look over it before I move on, if there is perhaps a better way of going about it etc.

Thanks in advance for your help.:site:

average 1.jpg average 2.jpg average 3.jpg average 4.jpg original sample.jpg
 
Blimey ! 2013.... just about remember putting that code together.

Yes, LogData is a two dimensional array, I made it [370,4], but should, technically, have been [365,4].

The first dimension is the day of the year, and each of those entries contains 4 data fields, for storing Date and Average.

Note the ""Mode" of the FAL, ALL. That means once triggered, the instruction will do all elements required, before the next instruction executes.

So the FAL's .POS indexes 0,1,2 (for a length of 3), and copies the Year, Month, and Day values from the Date[] array, into LogData[Day,0], LogData[Day,1], and LogData[Day,2]. Then the calculated average is MOVed into LogData[Day,3].

LogData is never cleared, so at anytime there will be a "history" going back a full year.
 
I just realised that those pictures are barely readable so I attached the averaging part of the project.

Haha well this is very handy indeed :) thanks guys, it's starting to make more sense to me now. So if the length of the FAL was 2 instead of 3 let's say, would only the day and month be stored?

So you mentioned LogData is a 2 dimensional array and that the first dimension is the day of the year, I presume the FAL's .POS is the second dimension then? Can any array be 2 dimensional if laid out like that so or is LogData just known for being 2 dimensional.

Thanks for your help!
 
An array can be any shape you like, and from 1 to 3 dimensions.

LogData is just a name I gave to the 370x4 array that I created for the example code, and has no special properties.

To "visualise" what I did better, consider that you have multiple assembly lines, or machines, and you want to log the data for all of them. You could achieve this by adding a third dimension to the LogData tag.

And arrays don't have to be atomic data-types, they can be arrays of any pre-defined or user-defined data-types, which makes keeping track of production data quite easy.

There are limits, of course, a single tag cannot be more than 2MBytes of memory, which allows for some hefty data-storage.
 

Similar Topics

Hello, I am working with a laser encoder that is providing the speed of a fiber strand to our AB 1756-L61 PLC. In order to calculate the amount...
Replies
3
Views
3,145
Can Anyone tell me if this is correct in RsLogix 5000 for averaging the last 30 seconds of data? I’m missing anything else?
Replies
13
Views
7,352
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
151
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
572
Back
Top Bottom