|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | FakeElodin |
Functions | |
| None | check (bool ok, str what) |
| bytes | frame (int hi, int lo, bytes body) |
| bytes | raw_body (int lo, float value, int ms=0) |
| subprocess.Popen | start_cal (str cal, Path work, int port) |
| None | stop (subprocess.Popen p) |
| Path | setup (Path root, int port, str extra="") |
| dict | store (Path work, str name) |
| list[float] | values (rows) |
| None | scenario_chain (str bridge, str cal, Path root) |
| None | scenario_cubic (str cal, Path root) |
| int | free_port (int kind=socket.SOCK_STREAM) |
| str|None | find_elodin_db (str|None given) |
| int | export_rows (str elodin, Path db, Path out, str component) |
| None | scenario_mixed (str bridge, str cal, str daq_bridge, str simulator, str elodin, Path root) |
| dict[str, str] | state (Path path) |
| None | scenario_restart (str bridge, Path root) |
| int | main () |
Variables | |
| int | T7 = 0x26 |
| int | SLOT = 1 |
| int | CJC_OFFSET = 0x0F |
| str | CONFIG |
| list | failures = [] |
| str | MIXED_EXTRA |
LabJack T7 end to end, hermetically: t7_bridge -> calibration_service -> calibrated tables.
Runs the real binaries against a stand-in Elodin that relays what t7_bridge publishes to
calibration_service, the way elodin-db's subscriptions do, and records what calibration_service
publishes back. Everything happens in a temporary directory with its own config and calibration
store, on OS-assigned ports: nothing here touches hardware, the live calibration store, or a
running stack (unlike test_integration.sh — see daq-server/CLAUDE.md).
1. chain t7_bridge --fake streams a PT (4-20 mA), a TC, an RTD (LJTick-Resistance) and an LC. calibration_service must
publish psi / °C / kg in the ranges the fake signals sit in, take Zero All and a
tare on the T7 inputs, and file them as microvolt channels / under T7<n>_Cal.AIN<a>.
2. cubic Packets injected directly, at exact voltages: two capture points per input put
2.5 V at 500 psi and 10 mV at 250 kg, and the fit survives a service restart.
3. restart t7_bridge --fake-state: kill -9 one bridge (its stand-in T7 keeps streaming, as a
real one does), start another; it must stop the leftover stream, reconfigure and
stream. A clean SIGTERM must leave the device idle.
4. mixed (needs elodin-db; skipped without it) The real database, an ESP32 PT board
(board_simulator -> daq_bridge) streaming, calibration_service subscribed, and only
THEN t7_bridge registering its tables. Elodin does not deliver a table that did not
exist at subscribe time, so the T7 tables must be re-subscribed — while ESP32 packets
keep arriving. Both boards' calibrated tables must be recorded, and the run exports.
Usage (ctest runs it with both paths):
t7_integration.py --bridge build/bin/t7_bridge --cal build/bin/calibration_service
| None t7_integration.check | ( | bool | ok, |
| str | what ) |
Definition at line 94 of file t7_integration.py.
Referenced by scenario_chain(), scenario_cubic(), scenario_mixed(), and scenario_restart().
| int t7_integration.export_rows | ( | str | elodin, |
| Path | db, | ||
| Path | out, | ||
| str | component ) |
Rows elodin-db holds for one component, via its own CSV export.
Definition at line 406 of file t7_integration.py.
References max.
Referenced by scenario_mixed().
| str | None t7_integration.find_elodin_db | ( | str | None | given | ) |
Definition at line 373 of file t7_integration.py.
Referenced by main().
| bytes t7_integration.frame | ( | int | hi, |
| int | lo, | ||
| bytes | body ) |
ElodinClient framing: u32 len (body + 4) | ty | id hi | id lo | req | body.
Definition at line 100 of file t7_integration.py.
Referenced by t7_integration.FakeElodin.command(), and scenario_cubic().
| int t7_integration.free_port | ( | int | kind = socket.SOCK_STREAM | ) |
Definition at line 365 of file t7_integration.py.
Referenced by scenario_mixed().
| int t7_integration.main | ( | ) |
Definition at line 539 of file t7_integration.py.
References find_elodin_db(), main(), scenario_chain(), scenario_cubic(), scenario_mixed(), and scenario_restart().
Referenced by main().
| bytes t7_integration.raw_body | ( | int | lo, |
| float | value, | ||
| int | ms = 0 ) |
Definition at line 105 of file t7_integration.py.
Referenced by scenario_cubic().
| None t7_integration.scenario_chain | ( | str | bridge, |
| str | cal, | ||
| Path | root ) |
Definition at line 238 of file t7_integration.py.
References check(), setup(), start_cal(), stop(), store(), and values().
Referenced by main().
| None t7_integration.scenario_cubic | ( | str | cal, |
| Path | root ) |
Definition at line 292 of file t7_integration.py.
References check(), frame(), raw_body(), setup(), start_cal(), stop(), and store().
Referenced by main().
| None t7_integration.scenario_mixed | ( | str | bridge, |
| str | cal, | ||
| str | daq_bridge, | ||
| str | simulator, | ||
| str | elodin, | ||
| Path | root ) |
Definition at line 416 of file t7_integration.py.
References check(), export_rows(), free_port(), setup(), start_cal(), and stop().
Referenced by main().
| None t7_integration.scenario_restart | ( | str | bridge, |
| Path | root ) |
A T7 keeps streaming after the bridge that started it dies, and refuses configuration until that stream is stopped. --fake-state makes the stand-in T7 a file that outlives the process, so kill -9 leaves it streaming exactly as a server torn down mid-run leaves a real one, and the next bridge has to take it over.
Definition at line 468 of file t7_integration.py.
References check(), count(), setup(), state, stop(), and time.time().
Referenced by main().
| Path t7_integration.setup | ( | Path | root, |
| int | port, | ||
| str | extra = "" ) |
Definition at line 220 of file t7_integration.py.
| subprocess.Popen t7_integration.start_cal | ( | str | cal, |
| Path | work, | ||
| int | port ) |
Definition at line 206 of file t7_integration.py.
Referenced by scenario_chain(), scenario_cubic(), and scenario_mixed().
| dict[str, str] t7_integration.state | ( | Path | path | ) |
The stand-in T7's state file: 'streaming 1', 'stops 0', ... as a dict.
Definition at line 455 of file t7_integration.py.
| None t7_integration.stop | ( | subprocess.Popen | p | ) |
Definition at line 212 of file t7_integration.py.
Referenced by scenario_chain(), scenario_cubic(), scenario_mixed(), and scenario_restart().
| dict t7_integration.store | ( | Path | work, |
| str | name ) |
Definition at line 227 of file t7_integration.py.
Referenced by scenario_chain(), and scenario_cubic().
| list[float] t7_integration.values | ( | rows | ) |
Definition at line 234 of file t7_integration.py.
Referenced by scenario_chain().
| int t7_integration.CJC_OFFSET = 0x0F |
Definition at line 45 of file t7_integration.py.
| str t7_integration.CONFIG |
Definition at line 47 of file t7_integration.py.
| list t7_integration.failures = [] |
Definition at line 91 of file t7_integration.py.
| str t7_integration.MIXED_EXTRA |
Definition at line 380 of file t7_integration.py.
| int t7_integration.SLOT = 1 |
Definition at line 44 of file t7_integration.py.
| int t7_integration.T7 = 0x26 |
Definition at line 43 of file t7_integration.py.