PhloemDocs
Markdown

Trellis

Write a short program that runs your test on live channels. It reads sensors, sets stop conditions and safety limits, and lays out a live page. Then you Deploy it. If a limit trips, Phloem drives outputs safe on its own, within milliseconds.

Two views: Code (the editor) and Panel (the live page it builds).

setup("heater")

ch = channels()
ch.read("/demo/temperature", unit="degC", range={"min": 0, "max": 100},
        limits=limits(hihi=80), checks=True)
ch.write("/demo/heater_on", dtype="bool", safe=False)

interlock(
    name="overtemp",
    when=lambda: ch["/demo/temperature"] > 90,
    then=[set(ch["/demo/heater_on"], False)],
)

page("Heater test",
     layout=col(row(gauge(ch["/demo/temperature"]), toggle(ch["/demo/heater_on"])),
                row(alarms(), log())))

Deploy arms it. Stop (or Shift+Esc) drives every output to its safe value. After a trip, press Reset to re-arm.

Three kinds of document

The first statement sets the kind. The kind decides what the document can do.

First statementKindCan
setup("name")Setup: your test setup. One is deployed at a timedeclare channels, stop conditions, interlocks, safe values, procedures, the page
recipe("name", setup="…", unit="…")Recipe: judges one unit, running on the deployed setupsteps, measurements, bounds. Never an interlock
noneNotebook: analysis on live datacompute and chart. It can never drive an output

Parts

Updated