Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run bourdon-gaugeThe procedure
procedure.yaml
name: Bourdon Pressure Gaugeversion: 1.0.0plugs: - key: leak_tester name: Leak tester python: plugs.leak_tester:LeakTestermain: - key: leak name: Leak test python: phases.bourdon_gauge:leak_test measurements: - key: test_pressure name: Test pressure unit: "bar" validators: - operator: ">=" expected_value: 5.8 - operator: "<=" expected_value: 6.2 - key: decay_rate name: Pressure decay unit: "Pa/min" validators: - operator: "<=" expected_value: 50 ui: panel: panels/gauge.htmlThe panel
panels/gauge.html
<div class="inst"><svg viewBox="0 0 320 210" role="img"><defs><radialGradient id="face" cx=".45" cy=".4" r=".7"><stop offset="0" stop-color="#ffffff"/><stop offset="1" stop-color="#dfe3e7"/></radialGradient><linearGradient id="rim" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#e6e9ec"/><stop offset=".5" stop-color="#8a9198"/><stop offset="1" stop-color="#d0d4d8"/></linearGradient></defs><rect x="1" y="1" width="318" height="208" rx="10" fill="#0d1014" stroke="#20262c" stroke-width="1.5"/><circle cx="160" cy="105" r="100" fill="url(#rim)"/><circle cx="160" cy="105" r="93" fill="#2a2f35"/><circle cx="160" cy="105" r="90" fill="url(#face)"/><path d="M213.9 41.9A83 83 0 0 1 218.7 163.7" fill="none" stroke="#e5383b" stroke-width="5" opacity=".75"/><path d="M107.7 157.3L99.2 165.8" stroke="#1b1f24" stroke-width="1.8"/><text x="115.5" y="153.5" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">0</text><path d="M98.4 156.0L93.7 159.8" stroke="#1b1f24" stroke-width="0.8"/><path d="M93.8 150.0L88.9 153.3" stroke="#1b1f24" stroke-width="0.8"/><path d="M89.9 143.5L84.6 146.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M86.6 136.8L81.1 139.2" stroke="#1b1f24" stroke-width="0.8"/><path d="M89.6 127.9L78.2 131.6" stroke="#1b1f24" stroke-width="1.8"/><text x="100.1" y="128.5" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">1</text><path d="M81.9 122.5L76.1 123.8" stroke="#1b1f24" stroke-width="0.8"/><path d="M80.6 115.0L74.7 115.8" stroke="#1b1f24" stroke-width="0.8"/><path d="M80.0 107.5L74.0 107.7" stroke="#1b1f24" stroke-width="0.8"/><path d="M80.2 100.0L74.2 99.6" stroke="#1b1f24" stroke-width="0.8"/><path d="M86.9 93.4L75.1 91.5" stroke="#1b1f24" stroke-width="1.8"/><text x="97.8" y="99.1" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">2</text><path d="M82.5 85.1L76.7 83.6" stroke="#1b1f24" stroke-width="0.8"/><path d="M84.7 77.9L79.1 75.9" stroke="#1b1f24" stroke-width="0.8"/><path d="M87.6 70.9L82.2 68.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M91.1 64.3L86.0 61.2" stroke="#1b1f24" stroke-width="0.8"/><path d="M100.1 61.5L90.4 54.5" stroke="#1b1f24" stroke-width="1.8"/><text x="109.0" y="72.0" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">3</text><path d="M100.0 52.1L95.5 48.1" stroke="#1b1f24" stroke-width="0.8"/><path d="M105.2 46.7L101.1 42.3" stroke="#1b1f24" stroke-width="0.8"/><path d="M111.0 41.8L107.3 37.0" stroke="#1b1f24" stroke-width="0.8"/><path d="M117.1 37.5L113.9 32.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M126.4 39.1L121.0 28.4" stroke="#1b1f24" stroke-width="1.8"/><text x="131.4" y="52.9" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">4</text><path d="M130.6 30.6L128.3 25.0" stroke="#1b1f24" stroke-width="0.8"/><path d="M137.7 28.2L136.0 22.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M145.0 26.4L143.9 20.5" stroke="#1b1f24" stroke-width="0.8"/><path d="M152.5 25.4L151.9 19.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M160.0 31.0L160.0 19.0" stroke="#1b1f24" stroke-width="1.8"/><text x="160.0" y="46.0" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">5</text><path d="M167.5 25.4L168.1 19.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M175.0 26.4L176.1 20.5" stroke="#1b1f24" stroke-width="0.8"/><path d="M182.3 28.2L184.0 22.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M189.4 30.6L191.7 25.0" stroke="#1b1f24" stroke-width="0.8"/><path d="M193.6 39.1L199.0 28.4" stroke="#1b1f24" stroke-width="1.8"/><text x="188.6" y="52.9" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">6</text><path d="M202.9 37.5L206.1 32.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M209.0 41.8L212.7 37.0" stroke="#1b1f24" stroke-width="0.8"/><path d="M214.8 46.7L218.9 42.3" stroke="#1b1f24" stroke-width="0.8"/><path d="M220.0 52.1L224.5 48.1" stroke="#1b1f24" stroke-width="0.8"/><path d="M219.9 61.5L229.6 54.5" stroke="#1b1f24" stroke-width="1.8"/><text x="211.0" y="72.0" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">7</text><path d="M228.9 64.3L234.0 61.2" stroke="#1b1f24" stroke-width="0.8"/><path d="M232.4 70.9L237.8 68.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M235.3 77.9L240.9 75.9" stroke="#1b1f24" stroke-width="0.8"/><path d="M237.5 85.1L243.3 83.6" stroke="#1b1f24" stroke-width="0.8"/><path d="M233.1 93.4L244.9 91.5" stroke="#1b1f24" stroke-width="1.8"/><text x="222.2" y="99.1" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">8</text><path d="M239.8 100.0L245.8 99.6" stroke="#1b1f24" stroke-width="0.8"/><path d="M240.0 107.5L246.0 107.7" stroke="#1b1f24" stroke-width="0.8"/><path d="M239.4 115.0L245.3 115.8" stroke="#1b1f24" stroke-width="0.8"/><path d="M238.1 122.5L243.9 123.8" stroke="#1b1f24" stroke-width="0.8"/><path d="M230.4 127.9L241.8 131.6" stroke="#1b1f24" stroke-width="1.8"/><text x="219.9" y="128.5" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">9</text><path d="M233.4 136.8L238.9 139.2" stroke="#1b1f24" stroke-width="0.8"/><path d="M230.1 143.5L235.4 146.4" stroke="#1b1f24" stroke-width="0.8"/><path d="M226.2 150.0L231.1 153.3" stroke="#1b1f24" stroke-width="0.8"/><path d="M221.6 156.0L226.3 159.8" stroke="#1b1f24" stroke-width="0.8"/><path d="M212.3 157.3L220.8 165.8" stroke="#1b1f24" stroke-width="1.8"/><text x="204.5" y="153.5" text-anchor="middle" style="font: 600 12px "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; fill: #1b1f24">10</text><text x="160" y="75" text-anchor="middle" style="font: 600 11px system-ui, sans-serif; fill: #1b1f24">bar</text><text x="160" y="143" text-anchor="middle" style="font: 600 6.5px system-ui, sans-serif; fill: #4a5058">Cl. 1.0 · EN 837-1</text><g class="hand drag" data-bind="ui.peak"><path d="M160 105L160 27" stroke="#e5383b" stroke-width="1.6"/><circle cx="160" cy="33" r="2.2" fill="#e5383b"/></g><g class="hand" data-bind="ui.bar"><path d="M157.6 119L160 24L162.4 119Z" fill="#14171b"/></g><circle cx="160" cy="105" r="6" fill="#2a2f35"/><circle cx="160" cy="105" r="2" fill="#8a9198"/></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); } .hand { transform-origin: 160px 105px; transform: rotate(calc(-135deg + clamp(0, var(--value, 0), 10) * 27deg)); transition: transform .12s linear; }</style>The phase
phases/bourdon_gauge.py
"""Runs a pressure-decay leak test and shows it on the Bourdon gauge: `ui.bar`turns the needle, `ui.peak` the red drag pointer. The run records the testpressure and the decay rate over the 10 s test."""import timeTEST_S = 10def leak_test(ui, measurements, leak_tester): peak, held, decay = 0.0, 0.0, 0.0 for _ in range(leak_tester.length()): step, bar, decay_pa = leak_tester.read() peak = max(peak, bar) ui.bar = round(bar, 3) ui.peak = round(peak, 3) if step == "test": held, decay = bar, decay_pa time.sleep(0.1) measurements.test_pressure = round(held, 2) measurements.decay_rate = round(decay / TEST_S * 60, 1) time.sleep(1.5)The mocked instrument
plugs/leak_tester.py
"""Mock pressure-decay leak tester: fills the part to 6 bar, lets it settle,measures the decay over 10 s, then vents. Replace it with your tester'sdriver."""import mathclass LeakTester: def __init__(self): self.k = 0 def length(self): return 130 def read(self): """[step, gauge pressure in bar, decay in Pa so far]""" u = self.k * 0.1 self.k += 1 if u < 0.6: return ["vented", 0.0, 0.0] if u < 3: s = (u - 0.6) / 2.4 bar = 6 * (1 - math.exp(-4 * s)) / (1 - math.exp(-4)) + (0.22 * math.sin(math.pi * s) if s > 0.6 else 0) return ["fill", bar, 0.0] if u < 6: return ["settle", 6 - 0.04 * (1 - math.exp(-(u - 3))), 0.0] if u < 11: return ["test", 5.96, 2.1 * (u - 6) / 5] if u < 12.2: return ["vent", 5.96 * (1 - (u - 11) / 1.2), 2.1] return ["vented", 0.0, 2.1]