Specifications

Chapter 1 - AsconACLib
13
1-3-8 AVG_RUNNING
FB Prototype
AVG_RUNNING
Input parameters
Output parameters
Description
This function block performs a running average calculation of the AI input valid value.
A “valid value” means the AI input value is inside the range defined by LOW_LIM
and HIGH_LIM parameters, otherwise it will be not computed. The function block
returns a continuous averaged value up to the NR_DATA amount of samples,
accordingly to the sampling time defined by the T_SAMP parameter and then
stops. The BUFF_FULL status indicates when the average calculation reaches
the desired amount of samplings (NR_DATA value).
Default Values Table
Reference Table
Label Type Description Range
ENABLE BOOL Command to enable average calculation
AI REAL Analogue input value [e.u.]
LOW_LIM... HIGH_LIM
T_SAMP REAL
Analogue input sampling time value [ss] 0.1... 3600.0
NR_DATA REAL
Number of samples to be computed [num]
1... 255
HIGH_LIM REAL High limit for the AI channel value
-3.4E
-38
... 3.4E
+38
LOW_LIM REAL Low limit for the AI channel value
-3.4E
-38
... 3.4E
+38
Label Type Description Range
ERROR BOOL Error status
ERR_CODE DWORD Error code [bit mask]
16#00 00 00 00 …
16#FF FF FF FF
BUFF_FULL BOOL Buffer fulfil status indication
1 = NR_DATA value
reached
AVG_VALUE REAL Averaged calculated value [e.u.] LOW_LIM... HIGH_LIM
ENABLE
AI
T_SAMP
NR_DATA
HIGH_LIM
LOW_LIM
BOOL
REAL
REAL
USINT
REAL
REAL
¡
¡
¡
¡
¡
¡
BOOL
DWORD
BOOL
REAL
ERROR
ERR_CODE
BUFF_FULL
AVG_VALU
E
¡
¡
¡
¡
Input Default Value
ENABLE FALSE
AI 0.0
T_SAMP 0.5
NR_DATA 120
HIGH_LIM 999.0
LOW_LIM -99.0
Output Description
ERR_CODE.0 Sampling time lower than the admitted value
ERR_CODE.1 Sampling time higher than the admitted value
ERR_CODE.2 Number of sampling lower than the admitted value
ERR_CODE.3 Number of sampling higher than the admitted value
ERR_CODE.4 AI value lower than the admitted value