386 Rockwell Automation Publication 1756-RM006K-EN-P - November 2018
Output
Parameter
Data Type Description
EnableOut BOOL Indicates if instruction is enabled. Cleared to false if Out
overflows.
Out REAL The calculated output of the algorithm.
Status DINT Status of the function block.
InstructFault
(Status.0)
BOOL The instruction detected one of the following execution
errors. This is not a minor or major controller error. Check
the remaining status bits to determine what occurred.
InFaulted (Status.1) BOOL In health is bad (InFault is set).
NumberOfSampInv
(Status.2)
BOOL NumberOfSamples invalid or not compatible with array
size.
See Structured Text Syntax for more information on the syntax of expressions
within structured text.
Description
The MAVE instruction calculates a weighted or non-weighted moving average of
the input signal. The NumberOfSamples specifies the length of the moving
average span. At every scan of the block when Sample Enable is set, the instruction
moves the value of In into the storage array and discards the oldest value. Each Inn
has a user-configured Weightn, which is used if UseWeights is set.
Condition Action
Weighted averaging method
UseWeights is set.
Uniform averaging method
UseWeights is cleared.
The instruction will not place an invalid In value (NAN or ± INF) into the
storage array. When In is invalid, the instruction sets Out = In and logs an
overflow minor fault, if this reporting is enabled. When In becomes valid, the
instruction initializes the averaging algorithm and continues executing.
You can make runtime changes to the NumberOfSamples parameter. If you
increase the number, the instruction incrementally averages new data from the
current sample size to the new sample size. If you decrease the number, the
instruction recalculates the average from the beginning of the sample array to the
new NumberOfSamples value.