Rate of Change
medium
Reports how much an analog input changed over the last second, updating once per second.
What it teaches
Once per second, compare the input to where it was a second ago — the difference is the rate in units per second. Between ticks the output holds steady. A rising level gives a positive rate, a falling one negative; the faster the change, the bigger the number. The pattern behind rate alarms that catch a leak or a runaway heater before an absolute limit ever trips.
Inputs and outputs
| Tag | Type | Default | Description |
|---|---|---|---|
| In_Value | REAL | 50 | Analog input to watch |
| Out_Rate | REAL | — | Change over the last second, in units per second |
Required behavior
- Once per second, Out_Rate becomes the difference between In_Value now and In_Value one second ago.
- Between ticks, Out_Rate holds its last value.
- A rising input gives a positive rate, a falling input a negative one, and a steady input 0.
- The very first reading, one second after startup, compares against the value the input had at startup.