Sliding window average of a variable over a period of time using RTES
|
Variables |
Analog Input : LEVEL Registers : R0017 LEVEL0 R0028 AVERAGE R0029 LEVELSX R0030 LEVELS |
|
Rules |
RULE AVERAGE=(LEVEL0+LEVEL1+LEVEL2+LEVEL3+LEVEL4+LEVEL5)/6 |
|
Notes |
This example uses the SHIFT function. Whenever the expression associated with SHIFT changes from false to true, the registers referenced by the next two registers are shifted one position down. AVERAGE contains the average value of LEVEL over the last 6 readings. Registers LEVEL0 through LEVEL5 must be consecutive. |