Calculating the rate of change of a variable using RTES

Variables

Analog Input : PRESSURE

Registers :

R0017 P0
R0018 P1
R0019 P2
R0020 P3
R0021 P4
R0022 P5

R0028 RATE

R0029 PSX

R0030 PS
R0031 PTOP
R0032 PVAR

Rules

RULE RATE=100*(P0+P1+P2-P3-P4-P5)/P2
RULE P0=PRESSURE
RULE PSX=PSd1
SHIFT PS=PSX’d1
RULE PTOP=17
RULE PVAR=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. RATE contains the rate of change of PRESSURE - in % - over the last 6 readings. A positive value means that is increasing, a negative value means that it is decreasing.

Registers P0 through P5 must be consecutive.
Registers .PS, PTOP and PSX must be consecutive.
PTOP is set at register number for P0 (17)
PVAR is set to the quantity of registers to be shifted
The delays (1 seconds+1 second) add up to a two second sampling period.