AverageCh
AverageCh (FB)
AverageCh (FB)FUNCTION_BLOCK AverageCh
Short description
Formation of an average from up to six weighted numerical input values Typical application: formation of a room temperature average from different sensors
Representation

Interfaces
Inputs
rIn1
REAL
Analog value input 1
rIn2
REAL
Analog value input 2
rIn3
REAL
Analog value input 3
rIn4
REAL
Analog value input 4
rIn5
REAL
Analog value input 5
rIn6
REAL
Analog value input 6
xEn1
BOOL
Enable analog value input 1
xEn2
BOOL
Enable analog value input 2
xEn3
BOOL
Enable analog value input 3
xEn4
BOOL
Enable analog value input 4
xEn5
BOOL
Enable analog value input 5
xEn6
BOOL
Enable analog value input 6
Outputs
rOut
REAL
Average
xErr
BOOL
Aggregate fault
Setpoints / parameters
iLoading6
INT
10
Weighting - analog value input 6
iLoading5
INT
10
Weighting - analog value input 5
iLoading4
INT
10
Weighting - analog value input 4
iLoading3
INT
10
Weighting - analog value input 3
iLoading2
INT
10
Weighting - analog value input 2
iLoading1
INT
10
Weighting - analog value input 1
Function description
Average rOut
The average is formed by multiplying the analog value inputs rInX by their individual weighting iLoadingX and then summing all products (dividend). The sum of the weightings is formed by adding the individual weightings (= divisor). The quotient obtained in this way is finally available as the average rOut available. The individual weighting of an analog value input X always has the value 0.0 as long as the enable for analog value input X xEnX is locked (= FALSE). If the sum of the weightings (divisor) = zero, then the output rOut constantly outputs the value 0.0. Legend: X = 1 to 6
Aggregate fault xErr
The collective fault is active (= TRUE) if at least one of the analog value inputs rInX is locked (xEnX = FALSE). In all other cases the collective fault is not active (= FALSE).
CODESYS
InOut:
Input
rIn1
REAL
Input
rIn2
REAL
Input
rIn3
REAL
Input
rIn4
REAL
Input
rIn5
REAL
Input
rIn6
REAL
Input
xEn1
BOOL
Input
xEn2
BOOL
Input
xEn3
BOOL
Input
xEn4
BOOL
Input
xEn5
BOOL
Input
xEn6
BOOL
Input Const
iLoading6
INT
10
Input Const
iLoading5
INT
10
Input Const
iLoading4
INT
10
Input Const
iLoading3
INT
10
Input Const
iLoading2
INT
10
Input Const
iLoading1
INT
10
Output
rOut
REAL
Output
xErr
BOOL
Last updated

