The function returns an arithmetic average of values. It can
be used for the object of Eval tag type.
Declaration
REAL %AvgFloat(
REAL in value,
INT in deepTime,
UNIVAL in calcTrigger,
INT in maxValues
)
Parameters
value
The value that is included to the average.
deepTime
Time depth of values in seconds. The value must be
valid and > 0.
calcTrigger
Calculating trigger - an object of any type. Its
change causes a recalculation of the function.
maxValues
Maximum values that are accepted by the function.
The value must be valid and > 0.
Description
For purpose of calculation of average value, the function
holds an internal list of values. After each recalculation, it includes the value
that is defined by the parameter value into the list under following
conditions:
the value must be valid and
its time stamp is grater than the last value in the list.
Before calculating the arithmetic average, the values that are out of
time depth (they are older than SysTime - deepTime) are removed from the
list. Then, the arithmetic average is calculated. If the list does not
contain any value, the final average is an invalid value.
The function returns an invalid value, if:
the limitation for deepTime and
maxValues are not fulfilled or
0 komentárov