Stop a test when a reading goes out of range
Give a channel a shutdown limit. The test stops on its own the moment a reading crosses it.
Before you start
- A Trellis setup open in Phloem Computer. See Trellis.
- The channel you want to watch shows on Live.
- Every output the setup commands has a
safe=value.
Steps
Open Trellis in the rail, open your setup, and switch to Code.
On the channel's
ch.read(...)line, addlimits=with the bounds. Addchecks=Trueto arm them:setup("heater") ch = channels() ch.read("/demo/temperature", unit="degC", range={"min": 0, "max": 100}, limits=limits(hi=70, hihi=80), checks=True) ch.write("/demo/heater_on", dtype="bool", safe=False) page("Heater test", layout=col(row(gauge(ch["/demo/temperature"]), alarms())))Bound Does hihistops the test at or above this value lolostops the test at or below this value hi/lowarns past this value; the test keeps running Press Deploy. The status chip reads running once the channel reports.
Check it worked
When the reading reaches hihi:
- The status chip turns tripped.
- An Interlock tripped card reads Outputs held at safe values. It names
the bound that fired, such as
/demo/temperature hihi. - Every output goes to its
safe=value.
The test stays stopped. Once the reading is back in range, press Reset to re-arm. Until then, Reset is disabled.
Note
Without checks=True, limits= only colours gauges and charts.
Nothing stops. To drive only some outputs, use an
interlock.
Stop conditionsThe stop-condition referenceInterlocksDrive chosen outputs safe on a conditionGet a Slack messageTell someone without stopping the test
Updated