ControlLogix Moving Average (MAVE)

ControlLogix Moving Average (MAVE)

The ControlLogix Moving Average (MAVE) allows you to smooth out a noisy process variable. In other words, if your signal is bouncing around, the MAVE instruction will smooth it out. For example, let’s consider a flow rate. Because of disturbances in the flow of a liquid, the sensor might read different values at any given time. The ControlLogix Moving Average (MAVE) instruction will simply average these results over the past few processor scans. Therefore, the operator will see a more smooth flow rate reading of the sensor. Remember, the MAVE instruction is only available in Function Block (and Structured Text) routines. If you don’t have function block or structured text ability, you can look at the example using a FIFO instruction.

In this case, I’ll simulate a process variable with a 60-second timer. Obviously, we do not normally need to average a timer, but I’m just using this for a sample signal. Later on, we’ll configure the MAVE instruction to take an average of the samples from the timer. Since the timer is always increasing, the output of the MAVE instruction should follow slightly behind the accumulated value of the timer.

Set up the ControlLogix Moving Average (MAVE) Instruction

To start, we’ll create the following tags as arrays. Notice the data type for the array is REAL[10]. In this example, we’ll take 10 samples. The Storage array will store the samples. The weighted array (if used) is a multiplier for each sample. This gives a “weight” to each entry.

Now, lets add the MAVE Instruction to logic. We’ll feed the process variable into the MAVE instruction. The output will go to a tag that will store the result of the moving average calculation.

Press the Ellipsis (three dots) to configure the instruction.

Let’s be sure our samples are enabled. Likewise, set the number of samples to 10, since our array has the size of 10.

If you choose a weighted calculation, you must set a multiplier for each element of the weighted array. In this case, we’ll just use the uniform method, so we’ll set the “UseWeights” bit to 0.

At this point, we’ll download and test our work. The output of the instruction is the result of the last 10 scan samples.

For more information on ControlLogix, visit the Category Page!

— Ricky Bryce

Leave a comment

Your email address will not be published. Required fields are marked *