FB_BA_MultiCalcREAL08

The function block FB_BA_MultiCalcREAL08 calculates the following values from the 8 input values f01...f08 in the enabled state(bEn = TRUE):
- the maximum value of all inputs fMax
- the input at which this maximum value is applied nMaxActv
- the minimum value of all inputs fMin
- the input at which this minimum value is applied nMinActv
- the average of all inputs fAvrg
- the sum of all inputs fSum
- the difference between the maximum and minimum value fDiff
If not all inputs are used for the calculation, the number can be limited via an entry at nNum: nNum = 6, for example, can be used to limit the calculations to inputs f01...f06.
Any entry greater than 8 is automatically limited to 8, any entry less than 1 is automatically set to 1.
Sample:
Inputs | Output |
---|---|
bEn = TRUE | fMax = 32 |
f01 = 32 | nMaxActv = 1 |
f02 = 17 | fMin = 5 |
f03 = 5 | nMinActv = 3 |
f04 = 9 | fAvrg = 18.5 |
f05 = 16 | fSum = 111 |
f06 = 32 | fDiff = 27 |
f07 = 25 |
|
f08 = 44 |
|
nNum = 6 |
|
Inputs
VAR_INPUT
bEn : BOOL;
f01…f08 : REAL;
nNum : USINT(1..8);
END_VAR
Name | Type | Description |
---|---|---|
bEn | BOOL | Activation of the block function. |
f01...f08 | REAL | Input values to be used for the calculation. |
nNum | USINT | Number of input values to be used for the calculation. |
Outputs
VAR_OUTPUT
fMax : REAL;
nMaxActv : USINT;
fMin : REAL;
nMinActv : USINT;
fAvrg : REAL;
fSum : REAL;
fDiff : REAL;
END_VAR
Name | Type | Description |
---|---|---|
fMax | REAL | Maximum value of all inputs. |
nMaxActv | USINT | Input at which the maximum value is present. |
fMin | REAL | Minimum value of all inputs. |
nMinActv | UDSNT | Input at which the minimum value is present. |
fAvrg | REAL | Average value of all inputs |
fSum | REAL | Sum of all inputs |
fDiff | REAL | Difference between maximum and minimum value. |
Prerequisites
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.62 | Tc3_BA2 from v5.5.14.0 |