AverageCh16

AverageCh16 (FB)

FUNCTION_BLOCK AverageCh16

Short description

Formation of an average from up to six weighted numerical input values Typical application: formation of an ambient temperature average from different sensors

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

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

Name
Data type
Value range
Initial value
Function

rOut

REAL

Average

xErr

BOOL

Aggregate fault

Setpoints / parameters

Name
Data type
Value range
Initial value
Function

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 with 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 thus obtained is finally available as the average rOut . 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 disabled (= 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 error is active (= TRUE) if at least one of the analog value inputs rInX is disabled ( xEnX = FALSE ). In all other cases the collective error is not active (= FALSE).\

CODESYS

InOut:

Scope
Name
Type
Initial

Input

rIn1

REAL

Input

rIn2

REAL

Input

rIn3

REAL

Input

rIn4

REAL

Input

rIn5

REAL

Input

rIn6

REAL

Input

rIn7

REAL

Input

rIn8

REAL

Input

rIn9

REAL

Input

rIn10

REAL

Input

rIn11

REAL

Input

rIn12

REAL

Input

rIn13

REAL

Input

rIn14

REAL

Input

rIn15

REAL

Input

rIn16

REAL

Input

xEn1

BOOL

Input

xEn2

BOOL

Input

xEn3

BOOL

Input

xEn4

BOOL

Input

xEn5

BOOL

Input

xEn6

BOOL

Input

xEn7

BOOL

Input

xEn8

BOOL

Input

xEn9

BOOL

Input

xEn10

BOOL

Input

xEn11

BOOL

Input

xEn12

BOOL

Input

xEn13

BOOL

Input

xEn14

BOOL

Input

xEn15

BOOL

Input

xEn16

BOOL

Input Const

iLoading16

INT

10

Input Const

iLoading15

INT

10

Input Const

iLoading14

INT

10

Input Const

iLoading13

INT

10

Input Const

iLoading12

INT

10

Input Const

iLoading11

INT

10

Input Const

iLoading10

INT

10

Input Const

iLoading9

INT

10

Input Const

iLoading8

INT

10

Input Const

iLoading7

INT

10

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