STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
anonymous_namespace{calibration_main.cpp} Namespace Reference

Enumerations

enum class  PtModel { Cubic , Robust , Blend , Physics }
 Which model a PT streams: operator/factory cubic, the robust learner, the 75/25 blend, or the datasheet physics conversion (ratiometric for 0-5 V boards, 4-20 mA for current-loop). More...
enum class  LcModel { Linear , Cubic , Physics }
 Which model an LC streams: a straight-line fit through the operator's captured points, a cubic fit through them, or the datasheet physics conversion (sensitivity/PGA-gain formula). More...

Variables

std::map< uint8_t, std::array< uint8_t, 11 > > g_hp_ma_live
 Hysteresis: 0 = treat as below loop, 1 = in 4–20 mA band (stops 3.99↔4.01 PSI chatter).
fsw::calibration::PtSmoother g_pt_smoother
 Per-sensor PT output smoothing (ESP32 and T7), seeded with each sensor's first reading.
std::unordered_map< uint16_t, PtModel > g_pt_model
 uid (board_id*100 + connector) -> streaming model.
std::unordered_map< uint16_t, std::string > g_uid_role
 uid -> role name (from [sensor_roles_*]).
std::unordered_map< uint16_t, double > g_pt_full_scale
 Per-sensor physics-mode parameters (from [calibration_full_scale_*] / [calibration_sense_resistor_*], falling back to the board defaults).
std::unordered_map< uint16_t, double > g_pt_sense_resistor
std::optional< PtModel > g_env_override
 Set once at startup: when a CAL_USE_* PT env var is present it forces every sensor, else nullopt and the per-sensor config governs.
std::unordered_map< uint16_t, LcModel > g_lc_model
 uid -> LC streaming model.
std::unordered_map< uint16_t, double > g_lc_full_scale
 Per-sensor LC physics-mode parameters (from [calibration_full_scale_*] / [calibration_sensitivity_*] / [calibration_pga_*], falling back to [calibration.lc] globals).
std::unordered_map< uint16_t, double > g_lc_sensitivity
std::unordered_map< uint16_t, double > g_lc_pga_gain
std::set< uint16_t > g_lc_uids
 Every LC uid, populated at startup — the discriminant apply_capture/apply_clear/ reload_live_store use to route a shared uid-keyed cubic_store entry to lc_calibration instead of pt_calibration/robust_manager (PT and LC uids share the store; their board_id ranges never collide, but nothing else tags which kind a uid is).
std::set< uint8_t > g_lc_board_ids
 Board ids of every LC board, so a connector outside active_connectors still routes as LC.
std::map< uint8_t, double > g_t7_cold_junction_c
 Latest thermocouple cold-junction temperature (°C) per T7 slot, from t7_bridge's CJC table {0x26, (slot-1)*0x20 + 0x0F}.

Enumeration Type Documentation

◆ LcModel

enum class anonymous_namespace{calibration_main.cpp}::LcModel
strong

Which model an LC streams: a straight-line fit through the operator's captured points, a cubic fit through them, or the datasheet physics conversion (sensitivity/PGA-gain formula).

No robust/blend — load cells don't need drift-learning. Chosen per sensor from [calibration_model_<lc_board>] in config; absent from the map means Linear (see lc_model_for).

Why linear is the default: a load cell is linear to a few hundredths of a percent, and its zero drifts. A tare is taken as an ADC code and evaluated through the live curve, so on a line it cancels a pure zero shift exactly, wherever the zero has wandered. A cubic fitted over 400-500k and evaluated at a 200k zero extrapolates a full span past its data and bends, so the same tare leaves a load-dependent error. Until a linear sensor has two captured points it streams physics — exactly what an unconfigured LC streamed before this model existed — so a rig with no LC captures reads the same as before.

Enumerator
Linear 
Cubic 
Physics 

Definition at line 127 of file calibration_main.cpp.

◆ PtModel

enum class anonymous_namespace{calibration_main.cpp}::PtModel
strong

Which model a PT streams: operator/factory cubic, the robust learner, the 75/25 blend, or the datasheet physics conversion (ratiometric for 0-5 V boards, 4-20 mA for current-loop).

Chosen per sensor from [calibration_model_<board>] in config.toml (see main); a CAL_USE_* env var, when set, overrides all LP sensors via g_env_override.

Enumerator
Cubic 
Robust 
Blend 
Physics 

Definition at line 91 of file calibration_main.cpp.

Variable Documentation

◆ g_env_override

std::optional<PtModel> anonymous_namespace{calibration_main.cpp}::g_env_override

Set once at startup: when a CAL_USE_* PT env var is present it forces every sensor, else nullopt and the per-sensor config governs.

Definition at line 111 of file calibration_main.cpp.

Referenced by main(), and select_pt_psi().

◆ g_hp_ma_live

std::map<uint8_t, std::array<uint8_t, 11> > anonymous_namespace{calibration_main.cpp}::g_hp_ma_live

Hysteresis: 0 = treat as below loop, 1 = in 4–20 mA band (stops 3.99↔4.01 PSI chatter).

Keyed by board slot so one board's channel going live cannot unlatch another board's same-numbered channel.

Definition at line 80 of file calibration_main.cpp.

Referenced by main().

◆ g_lc_board_ids

std::set<uint8_t> anonymous_namespace{calibration_main.cpp}::g_lc_board_ids

Board ids of every LC board, so a connector outside active_connectors still routes as LC.

Definition at line 145 of file calibration_main.cpp.

Referenced by main().

◆ g_lc_full_scale

std::unordered_map<uint16_t, double> anonymous_namespace{calibration_main.cpp}::g_lc_full_scale

Per-sensor LC physics-mode parameters (from [calibration_full_scale_*] / [calibration_sensitivity_*] / [calibration_pga_*], falling back to [calibration.lc] globals).

Only present for uids the config/board provides.

Definition at line 135 of file calibration_main.cpp.

Referenced by lc_full_scale_for(), and main().

◆ g_lc_model

std::unordered_map<uint16_t, LcModel> anonymous_namespace{calibration_main.cpp}::g_lc_model

uid -> LC streaming model.

A uid absent from this map defaults to Linear (see lc_model_for).

Definition at line 130 of file calibration_main.cpp.

Referenced by lc_model_for(), and main().

◆ g_lc_pga_gain

std::unordered_map<uint16_t, double> anonymous_namespace{calibration_main.cpp}::g_lc_pga_gain

Definition at line 137 of file calibration_main.cpp.

Referenced by lc_pga_gain_for(), and main().

◆ g_lc_sensitivity

std::unordered_map<uint16_t, double> anonymous_namespace{calibration_main.cpp}::g_lc_sensitivity

Definition at line 136 of file calibration_main.cpp.

Referenced by lc_sensitivity_for(), and main().

◆ g_lc_uids

std::set<uint16_t> anonymous_namespace{calibration_main.cpp}::g_lc_uids

Every LC uid, populated at startup — the discriminant apply_capture/apply_clear/ reload_live_store use to route a shared uid-keyed cubic_store entry to lc_calibration instead of pt_calibration/robust_manager (PT and LC uids share the store; their board_id ranges never collide, but nothing else tags which kind a uid is).

Definition at line 143 of file calibration_main.cpp.

Referenced by main().

◆ g_pt_full_scale

std::unordered_map<uint16_t, double> anonymous_namespace{calibration_main.cpp}::g_pt_full_scale

Per-sensor physics-mode parameters (from [calibration_full_scale_*] / [calibration_sense_resistor_*], falling back to the board defaults).

full_scale is PSI at full ADC / at 20 mA; sense_resistor Ω is the 4-20 mA shunt. Only present for uids the config/board provides.

Definition at line 106 of file calibration_main.cpp.

Referenced by main(), and pt_full_scale_for().

◆ g_pt_model

std::unordered_map<uint16_t, PtModel> anonymous_namespace{calibration_main.cpp}::g_pt_model

uid (board_id*100 + connector) -> streaming model.

Non-default resolutions are stored (4-20 mA boards default to Physics, 0-5 V to Cubic); an absent uid means Cubic.

Definition at line 95 of file calibration_main.cpp.

Referenced by main(), and pt_model_for().

◆ g_pt_sense_resistor

std::unordered_map<uint16_t, double> anonymous_namespace{calibration_main.cpp}::g_pt_sense_resistor

Definition at line 107 of file calibration_main.cpp.

Referenced by main(), and pt_sense_resistor_for().

◆ g_pt_smoother

fsw::calibration::PtSmoother anonymous_namespace{calibration_main.cpp}::g_pt_smoother

Per-sensor PT output smoothing (ESP32 and T7), seeded with each sensor's first reading.

Definition at line 83 of file calibration_main.cpp.

Referenced by main().

◆ g_t7_cold_junction_c

std::map<uint8_t, double> anonymous_namespace{calibration_main.cpp}::g_t7_cold_junction_c

Latest thermocouple cold-junction temperature (°C) per T7 slot, from t7_bridge's CJC table {0x26, (slot-1)*0x20 + 0x0F}.

Absent until the first one arrives; a T7 TC sample with no junction yet is not published rather than converted against a guess.

Definition at line 150 of file calibration_main.cpp.

Referenced by main().

◆ g_uid_role

std::unordered_map<uint16_t, std::string> anonymous_namespace{calibration_main.cpp}::g_uid_role

uid -> role name (from [sensor_roles_*]).

Durable calibration is filed under the role, so it follows the sensor when its connector changes (see re-file-by-role in the stores). Empty for connectors with no configured role.

Definition at line 100 of file calibration_main.cpp.

Referenced by main().