Calculating the average of a variable over a period of time using RTES
|
Variables |
Analog Input : LEVEL Registers : AVERAGE, TOTAL, RUN, PERIOD, SAMPLES |
|
Rules |
RULE AVERAGE=TOTAL/SAMPLES |
|
Task |
001 LET TOTALS=0 |
|
Notes |
Say INTERVAL is set at 10 (seconds) and RUN is set at 6. AVERAGE is the average of LEVEL since the start of the 60 (10*6) second period. LASTAV will contain the average for the previous 60 seconds. |