Specifications

Chapter 1 - AsconACLib
11
1-3-7 AVG_MOVING
FB Prototype
AVG_MOVING
Input parameters
Output parameters
Description
This function block performs a moving 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 of the last NR_DATA amount of samples, accordingly
to the sampling time defined by the T_SAMP parameter (basically it uses a FIFO
technique), since the last activation by the ENABLE command. The BUFF_FULL
status indicates when the average calculation is performed really on the desired
amount of samplings (NR_DATA value).
Default Values
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 No. of samples to be computed [num] 1... 24
HIGH_LIM REAL
High limit for the AI channel value [e.u.]
-3.4E
-38
... 3.4E
+38
LOW_LIM REAL
Low limit for the AI channel value [e.u.]
-3.4E
-38
... 3.4E
+38
Label Type Description Range
ERROR BOOL Error status
ERR_CODE DWORD Error status
BUFF_FULL BOOL Error code [bit mask]
16#00 00 00 00…
16#FF FF FF FF
AVG_VALUE REAL Buffer fulfil status indication 1 = NR_DATA value reached
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 12
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