Detecting if a weigh scale is stabilized or not with RTES

Variables

Analog Input : WEIGHT

Registers :

R0017 W0
R0018 W1
R0019 W2
R0020 W3

R0028 STABLE

R0029 WEIGHTSX

R0030 WEIGHTS
R0031 WEIGHTTOP
R0032 WEIGHTVAR

Rules

RULE STABLE=((W0=W1)&(W1=W2)&(W2=W3))d3
RULE W0=WEIGHT
RULE WEIGHTSX=WEIGHTSd0.5
SHIFT WEIGHTS=WEIGHTSX’d0.5
RULE WEIGHTTOP=17
RULE WEIGHTVAR=4

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.

Registers W0 through W3 must be consecutive.
Registers .WEIGHTS, WEIGHTTOP and WEIGHTSX must be consecutive.
WEIGHTTOP is set at register number for WEIGHT0 (17)
WEIGHTVAR is set to the quantity of registers to be shifted

The delays (0.5 seconds+0.5 second) add up to a one second sampling period. When all 4 values are identical, and the situation is continuously maintained for 3 seconds, STABLE becomes true.

In case the scale cannot come to full immobility within the resolution of its output, you could make the rule for STABLE more complex to include a range for each comparison.