Description
Original instructions
Function description
The function block creates a moving average from a fixed number of input values (inputX). The output is the average of all values between the current X value and the oldest X value (N-1). Up to 50 input values can be stored (N).
The function block has both a manual and automatic mode.
NOTE: This function block performs an internal initialization in the first program cycle after a warm start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In case of inkoving the function block in a later program cycle, the internal initialization will not be performed and the ouputs may deliver wrong values.
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EN and ENO can be configured as additional parameters.
Formula
For RDY = 1:
or
Explanation of the variables
Variable
Description
Y(new)
Y Value in current program cycle
Y (old)
Y Value from the last program cycle
N
Window size (number of values in the buffer)
X(N-1)
oldest X value in the buffer
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL AVGMV_Instance (MAN:=Mode, X:=InputValue, 
    N:=WindowSize, YMAN:=ManualValue, Y=>Average,
    RDY=>BufferReady)
Representation in ST
Representation:
AVGMV_Instance (MAN:=Mode, X:=InputValue,
    N:=WindowSize, YMAN:=ManualValue, Y=>Average,
    RDY=>BufferReady) ;
Parameter description
Description of input parameters:
Parameter
Data type
Description
MAN
"0" = Automatic operating mode
"1" = Manual operating mode
X
Input
N
Window size (number of input values that are loaded in the buffer; max. 50)
YMAN
REAL
Manual value
Description of output parameters:
Parameter
Data type
Description
Y
REAL
Average value
RDY
BOOL
"1" = n Value in buffer, i.e. buffer is ready
"0" = Buffer not ready
Runtime error
An error message is returned if
NOTE: For a list of all block error codes and values, see Measurement.