Porovnávané verzie
porovnané s
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
%AvgFloat function
Function
The function returns an arithmetic average of values. It can be used for the object of Eval tag type.
Declaration
Blok kódu | ||||
---|---|---|---|---|
| ||||
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 the following conditions:
- the value must be valid and
- its time stamp timestamp is grater greater 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
- the list of values does not contain any value