|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | SensorTypeInfo |
| class | UDPSensorReceiver |
| class | CalibrationOrchestrator |
Functions | |
| float | adc_to_voltage (int adc_signed) |
| Dict[str, SensorTypeInfo] | _build_sensor_types () |
| main () | |
Variables | |
| level | |
| INFO | |
| format | |
| logger = logging.getLogger(__name__) | |
| bool | _cfg_loaded = True |
| bool | ROBUSTNESS_AVAILABLE = True |
| bool | ACTUATOR_COMM_AVAILABLE = True |
| str | PACKET_HEADER_FORMAT = "<BBI" |
| int | PACKET_HEADER_SIZE = 6 |
| str | SENSOR_DATA_PACKET_FORMAT = "<BB" |
| int | SENSOR_DATA_PACKET_SIZE = 2 |
| str | SENSOR_DATA_CHUNK_FORMAT = "<I" |
| int | SENSOR_DATA_CHUNK_SIZE = 4 |
| str | SENSOR_DATAPOINT_FORMAT = "<BI" |
| int | SENSOR_DATAPOINT_SIZE = 5 |
| int | PACKET_TYPE_SENSOR_DATA = 3 |
| int | MAX_PACKET_SIZE = 512 |
| float | ADC_REF_VOLTAGE = 2.5 |
| int | ADC_FULL_SCALE = 2**31 |
| Dict[str, SensorTypeInfo] | SENSOR_TYPES = _build_sensor_types() |
| int | N_PARAMS = 9 |
Unified Calibration Orchestrator
=================================
Two-phase calibration lifecycle for all sensor types (PT, TC, RTD, LC)
backed by the full mathematical framework from the paper:
▸ Environmental-robust basis functions φ(v, e) [Eq 66-72]
▸ Total Least Squares (TLS) calibration [Eq 112-118]
▸ Bayesian regression with hierarchical priors [Eq 126-149]
▸ Recursive Least Squares with forgetting [Eq 162-166]
▸ Generalised Likelihood Ratio drift detection [Eq 235-248]
▸ Empirical Bayes population prior evolution
▸ Active learning — system requests recalibration when quality degrades
▸ Transfer learning across sensors and sessions
Phase 1 – CALIBRATION (human-in-the-loop)
User supplies known reference values. The orchestrator collects raw ADC
via UDP, converts to voltage, runs TLS + Bayesian update, validates
quality, and saves coefficients.
Phase 2 – MONITORING / SELF-RECALIBRATION (autonomous, runs forever)
After Phase 1 the orchestrator enters a continuous monitoring loop:
▸ RLS online parameter updates per channel (with forgetting factor)
▸ GLR drift detection (proper log-likelihood ratio)
▸ Bayesian full-recalibration when drift detected
▸ Empirical Bayes population prior propagation across all channels
▸ Active learning: system raises recalibration alerts
▸ Automatic periodic saves of coefficients + learned priors
Everything is config-driven — board IPs, ports, sensor counts, and
calibration paths are read from config/config.toml.
Usage:
python3 calibration_orchestrator.py # Full lifecycle
python3 calibration_orchestrator.py --skip-phase1 # Monitor only
python3 calibration_orchestrator.py --phase1-only # Calibrate & exit
python3 calibration_orchestrator.py --sensors PT TC # Specific types
|
protected |
Definition at line 150 of file calibration_orchestrator.py.
| float calibration_orchestrator.adc_to_voltage | ( | int | adc_signed | ) |
Convert signed 32-bit ADC code to voltage.
Definition at line 127 of file calibration_orchestrator.py.
Referenced by calibration_orchestrator.CalibrationOrchestrator._adc_uncertainty(), calibration_orchestrator.CalibrationOrchestrator._print_live(), and calibration_orchestrator.CalibrationOrchestrator._print_status().
| calibration_orchestrator.main | ( | ) |
Definition at line 1501 of file calibration_orchestrator.py.
References main().
Referenced by main().
|
protected |
Definition at line 70 of file calibration_orchestrator.py.
| bool calibration_orchestrator.ACTUATOR_COMM_AVAILABLE = True |
Definition at line 105 of file calibration_orchestrator.py.
| int calibration_orchestrator.ADC_FULL_SCALE = 2**31 |
Definition at line 124 of file calibration_orchestrator.py.
| float calibration_orchestrator.ADC_REF_VOLTAGE = 2.5 |
Definition at line 123 of file calibration_orchestrator.py.
| calibration_orchestrator.format |
Definition at line 52 of file calibration_orchestrator.py.
| calibration_orchestrator.INFO |
Definition at line 52 of file calibration_orchestrator.py.
| calibration_orchestrator.level |
Definition at line 52 of file calibration_orchestrator.py.
| calibration_orchestrator.logger = logging.getLogger(__name__) |
Definition at line 54 of file calibration_orchestrator.py.
| int calibration_orchestrator.MAX_PACKET_SIZE = 512 |
Definition at line 120 of file calibration_orchestrator.py.
| int calibration_orchestrator.N_PARAMS = 9 |
Definition at line 183 of file calibration_orchestrator.py.
| str calibration_orchestrator.PACKET_HEADER_FORMAT = "<BBI" |
Definition at line 111 of file calibration_orchestrator.py.
| int calibration_orchestrator.PACKET_HEADER_SIZE = 6 |
Definition at line 112 of file calibration_orchestrator.py.
| int calibration_orchestrator.PACKET_TYPE_SENSOR_DATA = 3 |
Definition at line 119 of file calibration_orchestrator.py.
| bool calibration_orchestrator.ROBUSTNESS_AVAILABLE = True |
Definition at line 97 of file calibration_orchestrator.py.
| str calibration_orchestrator.SENSOR_DATA_CHUNK_FORMAT = "<I" |
Definition at line 115 of file calibration_orchestrator.py.
| int calibration_orchestrator.SENSOR_DATA_CHUNK_SIZE = 4 |
Definition at line 116 of file calibration_orchestrator.py.
| str calibration_orchestrator.SENSOR_DATA_PACKET_FORMAT = "<BB" |
Definition at line 113 of file calibration_orchestrator.py.
| int calibration_orchestrator.SENSOR_DATA_PACKET_SIZE = 2 |
Definition at line 114 of file calibration_orchestrator.py.
| str calibration_orchestrator.SENSOR_DATAPOINT_FORMAT = "<BI" |
Definition at line 117 of file calibration_orchestrator.py.
| int calibration_orchestrator.SENSOR_DATAPOINT_SIZE = 5 |
Definition at line 118 of file calibration_orchestrator.py.
| Dict[str, SensorTypeInfo] calibration_orchestrator.SENSOR_TYPES = _build_sensor_types() |
Definition at line 180 of file calibration_orchestrator.py.