Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run vacuum-gaugeThe procedure
procedure.yaml
name: Vacuum Gauge Controllerversion: 1.0.0plugs: - key: gauge name: Vacuum gauge controller python: plugs.vacuum_gauge:VacuumGaugemain: - key: pumpdown name: Pump down python: phases.vacuum_gauge:pump_down measurements: - key: test_pressure name: Chamber pressure at the end of pump-down unit: "Pa" validators: - operator: "<=" expected_value: 0.00133 ui: panel: panels/gauge.htmlThe panel
panels/gauge.html
<div class="inst"><svg viewBox="0 0 320 210" role="img"><defs><linearGradient id="fp" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3a4048"/><stop offset="1" stop-color="#262b31"/></linearGradient><linearGradient id="win" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#000" stop-opacity=".55"/><stop offset=".14" stop-color="#000" stop-opacity="0"/></linearGradient></defs><rect x="1" y="1" width="318" height="208" rx="10" fill="url(#fp)" stroke="#14171b" stroke-width="2"/><circle cx="12" cy="12" r="3.2" fill="#1b1f24" stroke="#14171b"/><circle cx="308" cy="12" r="3.2" fill="#1b1f24" stroke="#14171b"/><circle cx="12" cy="198" r="3.2" fill="#1b1f24" stroke="#14171b"/><circle cx="308" cy="198" r="3.2" fill="#1b1f24" stroke="#14171b"/><text x="18" y="24" text-anchor="start" style="font: 700 7.5px system-ui, sans-serif; letter-spacing: .14em; fill: #d5dbe1">VACUUM GAUGE CONTROLLER</text><text x="302" y="24" text-anchor="end" style="font: 600 7px ui-monospace, Menlo, monospace; letter-spacing: .04em; fill: #9aa8b6">2 CH · Pa</text><rect x="16" y="32" width="288" height="136" rx="6" fill="#030504" stroke="#0c0e10" stroke-width="2"/><rect x="16" y="32" width="288" height="136" rx="6" fill="url(#win)"/><g class="ledd"><text x="28" y="50" text-anchor="start" style="font: 700 7px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #62ff8f">1 PKR</text><g class="d7" data-bind="ui.c1_0" transform="translate(82.0 44.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c1_1" transform="translate(111.6 44.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c1_2" transform="translate(141.3 44.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c1_3" transform="translate(170.9 44.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c1_4" transform="translate(200.6 44.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c1_5" transform="translate(230.2 44.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="dp on" transform="translate(104.0 44.0) skewX(-7)"><rect x="0" y="33.4" width="4.6" height="4.6" rx="1.5"/></g><text x="294" y="82" text-anchor="end" style="font: 700 13px system-ui, sans-serif; letter-spacing: 0; fill: #62ff8f">Pa</text><path d="M26 100H294" stroke="#122818"/><text x="28" y="118" text-anchor="start" style="font: 700 7px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #62ff8f">2 TPR</text><g class="d7" data-bind="ui.c2_0" transform="translate(82.0 112.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c2_1" transform="translate(111.6 112.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c2_2" transform="translate(141.3 112.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c2_3" transform="translate(170.9 112.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c2_4" transform="translate(200.6 112.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="d7" data-bind="ui.c2_5" transform="translate(230.2 112.0) skewX(-7)"><rect class="sa" x="3.2" y="0.0" width="14.1" height="4.6" rx="2.3"/><rect class="sd" x="3.2" y="33.4" width="14.1" height="4.6" rx="2.3"/><rect class="sg" x="3.2" y="16.7" width="14.1" height="4.6" rx="2.3"/><rect class="sf" x="0.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="se" x="0.0" y="19.9" width="4.6" height="14.8" rx="2.3"/><rect class="sb" x="16.0" y="3.2" width="4.6" height="14.8" rx="2.3"/><rect class="sc" x="16.0" y="19.9" width="4.6" height="14.8" rx="2.3"/></g><g class="dp" data-bind="ui.c2dp" transform="translate(104.0 112.0) skewX(-7)"><rect x="0" y="33.4" width="4.6" height="4.6" rx="1.5"/></g><text x="294" y="150" text-anchor="end" style="font: 700 13px system-ui, sans-serif; letter-spacing: 0; fill: #62ff8f">Pa</text></g><g class="led" data-bind="ui.sp1" style="--led: #38e07a"><circle cx="24" cy="182" r="3.3" stroke="#0c0e10"/></g><text x="31" y="184.5" text-anchor="start" style="font: 700 6.5px system-ui, sans-serif; letter-spacing: .08em; fill: #d5dbe1">SP1 10 Pa</text><g class="led" data-bind="ui.sp2" style="--led: #38e07a"><circle cx="108" cy="182" r="3.3" stroke="#0c0e10"/></g><text x="115" y="184.5" text-anchor="start" style="font: 700 6.5px system-ui, sans-serif; letter-spacing: .08em; fill: #d5dbe1">SP2 1.33E-03 Pa</text><text x="18" y="201" text-anchor="start" style="font: 600 6.5px system-ui, sans-serif; letter-spacing: .1em; fill: #9aa8b6">PKR 1E+05 … 5E-07 Pa · TPR PIRANI 1E+05 … 5E-02 Pa</text></svg></div><style> .inst { width: min(560px, 100%); margin: 0 auto; } .inst svg { display: block; width: 100%; height: auto; } .inst text { font-family: system-ui, sans-serif; } .dp rect { fill: var(--off); } .dp.on rect, .dp[data-value=true] rect { fill: var(--on); } .led circle { fill: #2a2f35; transition: fill .15s; } .led[data-value=true] circle { fill: var(--led, #38e07a); } .ann text { fill: var(--off); transition: fill .15s; } .ann[data-value=true] text { fill: var(--on); } .d7 rect { fill: var(--off); transition: fill .08s; } .d7[data-value="0"] :is(.sa, .sb, .sc, .sd, .se, .sf) { fill: var(--on); } .d7[data-value="1"] :is(.sb, .sc) { fill: var(--on); } .d7[data-value="2"] :is(.sa, .sb, .sd, .se, .sg) { fill: var(--on); } .d7[data-value="3"] :is(.sa, .sb, .sc, .sd, .sg) { fill: var(--on); } .d7[data-value="4"] :is(.sb, .sc, .sf, .sg) { fill: var(--on); } .d7[data-value="5"] :is(.sa, .sc, .sd, .sf, .sg) { fill: var(--on); } .d7[data-value="6"] :is(.sa, .sc, .sd, .se, .sf, .sg) { fill: var(--on); } .d7[data-value="7"] :is(.sa, .sb, .sc) { fill: var(--on); } .d7[data-value="8"] :is(.sa, .sb, .sc, .sd, .se, .sf, .sg) { fill: var(--on); } .d7[data-value="9"] :is(.sa, .sb, .sc, .sd, .sf, .sg) { fill: var(--on); } .d7[data-value="-"] :is(.sg) { fill: var(--on); } .d7[data-value="E"] :is(.sa, .sd, .se, .sf, .sg) { fill: var(--on); } .d7[data-value="U"] :is(.sb, .sc, .sd, .se, .sf) { fill: var(--on); } .d7[data-value="r"] :is(.se, .sg) { fill: var(--on); } .ledd { --on: #62ff8f; --off: #0f2416; }</style>The phase
phases/vacuum_gauge.py
"""Pumps the thermal vacuum chamber down and reads the gauge controller.`ui.c1_*` and `ui.c2_*` drive the two channels' digits in E-notation, thePirani showing Ur below its range; `ui.sp1` and `ui.sp2` light the setpointrelays at 10 Pa and at 1.33e-3 Pa, the test vacuum of NASA GEVS. The runrecords the pressure at the end of pump-down."""import mathimport timedef show(ui, prefix, text): """One 7-segment glyph per character, decimal points left to the panel.""" for k, ch in enumerate(c for c in text if c != "."): setattr(ui, f"{prefix}{k}", "_" if ch == " " else ch)SP1_PA, SP2_PA = 10.0, 1.33e-3def e_notation(pa): exponent = math.floor(math.log10(pa)) mantissa = pa / 10 ** exponent if round(mantissa, 1) >= 10: mantissa, exponent = mantissa / 10, exponent + 1 return f"{mantissa:3.1f}E{'-' if exponent < 0 else ' '}{abs(exponent):02d}"def pump_down(ui, measurements, gauge): pa = 1e5 for _ in range(gauge.length()): pa, pirani = gauge.read() show(ui, "c1_", e_notation(pa)) if pirani is None: show(ui, "c2_", " Ur ") ui.c2dp = False else: show(ui, "c2_", e_notation(pirani)) ui.c2dp = True ui.sp1 = pa < SP1_PA ui.sp2 = pa < SP2_PA time.sleep(0.1) measurements.test_pressure = float(f"{pa:.3g}") time.sleep(1.5)The mocked instrument
plugs/vacuum_gauge.py
"""Mock vacuum gauge controller: a full-range gauge (PKR) and a Pirani (TPR)through a chamber pump-down with an outgassing burst when the shroud heats.Replace it with your gauge controller's driver."""import mathclass VacuumGauge: def __init__(self): self.k = 0 def length(self): return 200 def read(self): """[PKR pressure in Pa, TPR pressure in Pa or None below its range]""" x = min(self.k, 199) / 199 self.k += 1 if x < 0.3: log_p = 5 - 5 * (1 - math.exp(-4.5 * x / 0.3)) / (1 - math.exp(-4.5)) else: log_p = -4.7 * (1 - math.exp(-4 * (x - 0.3) / 0.7)) / (1 - math.exp(-4)) if 0.62 < x < 0.8: log_p += 1.0 * math.sin(math.pi * (x - 0.62) / 0.18) pa = 10 ** (log_p + 0.02 * math.sin(self.k * 1.3)) return [pa, pa * (1 + 0.04 * math.sin(self.k * 0.4)) if pa >= 5e-2 else None]