24 .table_name =
"pt_chamber_raw",
25 .table_id = {0x20, 0x00},
27 .location =
"chamber"};
31 .table_name =
"pt_fuel_inlet_raw",
32 .table_id = {0x20, 0x01},
34 .location =
"fuel_inlet"};
38 .table_name =
"pt_ox_inlet_raw",
39 .table_id = {0x20, 0x02},
41 .location =
"ox_inlet"};
46 .table_name =
"tc_exhaust_raw",
47 .table_id = {0x21, 0x00},
49 .location =
"exhaust"};
53 .table_name =
"tc_chamber_raw",
54 .table_id = {0x21, 0x01},
56 .location =
"chamber"};
61 .table_name =
"rtd_fuel_raw",
62 .table_id = {0x22, 0x00},
68 .table_name =
"rtd_ox_raw",
69 .table_id = {0x22, 0x01},
76 .table_name =
"lc_thrust_raw",
77 .table_id = {0x23, 0x00},
79 .location =
"thrust"};
91 uint8_t channel_id)
const {
92 std::string key =
make_key(sensor_type, channel_id);
95 return it->second.table_id;
102 std::string key =
make_key(sensor_type, channel_id);
105 return it->second.table_name;
107 return "unknown_" + sensor_type +
"_" + std::to_string(channel_id);
112 uint64_t receive_timestamp_ns)
const {
117 std::array<uint8_t, 2> pkt_id = {0x20,
static_cast<uint8_t
>(sample.channel_id)};
120 msg.
setField<0>(receive_timestamp_ns);
121 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
122 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
123 msg.
setField<3>(sample.raw_adc_counts);
124 msg.
setField<4>(sample.sample_timestamp_ms);
125 msg.
setField<5>(sample.status_flags);
127 messages.emplace_back(pkt_id, msg);
135 uint64_t receive_timestamp_ns,
136 uint8_t pt_board_slot)
const {
147 std::array<uint8_t, 2> pkt_id = {0x20,
static_cast<uint8_t
>(0x10 + sample.channel_id)};
149 int32_t adc_code =
static_cast<int32_t
>(sample.raw_adc_counts);
151 pt_board_slot,
static_cast<uint8_t
>(sample.channel_id));
152 double pressure_psi =
pt_calibration_->calculate_pressure(log_ch, adc_code);
153 uint8_t calibration_status =
pt_calibration_->is_calibrated(log_ch) ? 1 : 0;
156 msg.
setField<0>(receive_timestamp_ns);
157 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
158 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
159 msg.
setField<3>(
static_cast<float>(pressure_psi));
160 msg.
setField<4>(sample.raw_adc_counts);
161 msg.
setField<5>(calibration_status);
163 messages.emplace_back(pkt_id, msg);
171 uint64_t receive_timestamp_ns)
const {
175 std::array<uint8_t, 2> pkt_id = {0x21,
static_cast<uint8_t
>(sample.channel_id)};
178 msg.
setField<0>(receive_timestamp_ns);
179 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
180 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
181 msg.
setField<3>(sample.raw_adc_counts);
182 msg.
setField<4>(sample.sample_timestamp_ms);
183 msg.
setField<5>(sample.status_flags);
185 messages.emplace_back(pkt_id, msg);
193 uint64_t receive_timestamp_ns)
const {
197 std::array<uint8_t, 2> pkt_id = {0x22,
static_cast<uint8_t
>(sample.channel_id)};
200 msg.
setField<0>(receive_timestamp_ns);
201 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
202 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
203 msg.
setField<3>(sample.raw_resistance_counts);
204 msg.
setField<4>(sample.sample_timestamp_ms);
205 msg.
setField<5>(sample.status_flags);
207 messages.emplace_back(pkt_id, msg);
215 uint64_t receive_timestamp_ns)
const {
219 std::array<uint8_t, 2> pkt_id = {0x23,
static_cast<uint8_t
>(sample.channel_id)};
222 msg.
setField<0>(receive_timestamp_ns);
223 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
224 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
225 msg.
setField<3>(sample.raw_adc_counts);
226 msg.
setField<4>(sample.sample_timestamp_ms);
227 msg.
setField<5>(sample.status_flags);
229 messages.emplace_back(pkt_id, msg);
238 uint64_t receive_timestamp_ns)
const {
247 std::array<uint8_t, 2> pkt_id = {0x21,
static_cast<uint8_t
>(0x10 + sample.channel_id)};
248 int32_t raw =
static_cast<int32_t
>(sample.raw_adc_counts);
250 uint8_t status =
tc_calibration_->is_calibrated(sample.channel_id) ? 1 : 0;
253 msg.
setField<0>(receive_timestamp_ns);
254 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
255 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
256 msg.
setField<3>(
static_cast<float>(temp_c));
257 msg.
setField<4>(sample.raw_adc_counts);
259 messages.emplace_back(pkt_id, msg);
267 uint64_t receive_timestamp_ns)
const {
276 std::array<uint8_t, 2> pkt_id = {0x22,
static_cast<uint8_t
>(0x10 + sample.channel_id)};
277 int32_t raw =
static_cast<int32_t
>(sample.raw_resistance_counts);
279 uint8_t status =
rtd_calibration_->is_calibrated(sample.channel_id) ? 1 : 0;
282 msg.
setField<0>(receive_timestamp_ns);
283 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
284 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
285 msg.
setField<3>(
static_cast<float>(temp_c));
286 msg.
setField<4>(sample.raw_resistance_counts);
288 messages.emplace_back(pkt_id, msg);
296 uint64_t receive_timestamp_ns)
const {
305 std::array<uint8_t, 2> pkt_id = {0x23,
static_cast<uint8_t
>(0x10 + sample.channel_id)};
306 int32_t raw =
static_cast<int32_t
>(sample.raw_adc_counts);
308 uint8_t status =
lc_calibration_->is_calibrated(sample.channel_id) ? 1 : 0;
311 msg.
setField<0>(receive_timestamp_ns);
312 msg.
setField<1>(
static_cast<uint8_t
>(sample.channel_id));
313 msg.
setField<2>(std::array<uint8_t, 3>{0, 0, 0});
314 msg.
setField<3>(
static_cast<float>(force));
315 msg.
setField<4>(sample.raw_adc_counts);
317 messages.emplace_back(pkt_id, msg);
323 return sensor_type +
":" + std::to_string(channel_id);
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawLCMessage > > route_lc_samples(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawRTDMessage > > route_rtd_samples(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawTCMessage > > route_tc_samples(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
std::array< uint8_t, 2 > get_table_id(const std::string &sensor_type, uint8_t channel_id) const
Get table ID for a sensor channel.
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawPTMessage > > route_pt_samples(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
Convert a sensor batch into Elodin messages.
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedPTMessage > > route_pt_samples_calibrated(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns, uint8_t pt_board_slot=1) const
Convert PT samples to calibrated messages.
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedRTDMessage > > route_rtd_samples_calibrated(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
const calibration::PTCalibrationManager * pt_calibration_
const calibration::SensorCalibrationManager * tc_calibration_
const calibration::SensorCalibrationManager * rtd_calibration_
std::unordered_map< std::string, SensorChannelConfig > channel_map_
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedTCMessage > > route_tc_samples_calibrated(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
std::string get_table_name(const std::string &sensor_type, uint8_t channel_id) const
Get table name for a sensor channel (for debugging).
bool load_config(const std::string &config_path)
Load routing configuration from TOML file.
std::string make_key(const std::string &sensor_type, uint8_t channel_id) const
void add_channel(const SensorChannelConfig &config)
Add a sensor channel configuration manually.
std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedLCMessage > > route_lc_samples_calibrated(const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const
const calibration::SensorCalibrationManager * lc_calibration_
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, uint32_t, uint32_t, uint8_t > RawTCMessage
Raw Thermocouple sample message for Elodin CRITICAL: Includes padding bytes to ensure uint32_t fields...
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, float, uint32_t, uint8_t > CalibratedRTDMessage
Calibrated RTD message for Elodin.
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, float, uint32_t, uint8_t > CalibratedLCMessage
Calibrated Load Cell message for Elodin.
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, float, uint32_t, uint8_t > CalibratedTCMessage
Calibrated Thermocouple message for Elodin.
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, uint32_t, uint32_t, uint8_t > RawRTDMessage
Raw RTD sample message for Elodin CRITICAL: Includes padding bytes to ensure uint32_t fields are 4-by...
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, float, uint32_t, uint8_t > CalibratedPTMessage
Calibrated Pressure Transducer message for Elodin.
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, uint32_t, uint32_t, uint8_t > RawLCMessage
Raw Load Cell sample message for Elodin CRITICAL: Includes padding bytes to ensure uint32_t fields ar...
CommsMessage< uint64_t, uint8_t, std::array< uint8_t, 3 >, uint32_t, uint32_t, uint8_t > RawPTMessage
Raw Pressure Transducer sample message for Elodin.
uint8_t pt_logical_calibration_channel(uint8_t board_slot_number, uint8_t local_connector)
PT board slot (1–10, from board_id % 10 with 0→10) + local connector (1–10) → factory/JSON logical ch...
Motorized ball valve position: raw ADC counts -> % open.
void setField(ValueType &&value)
std::vector< RawTCSample > tc_samples
std::vector< RawPTSample > pt_samples
std::vector< RawLCSample > lc_samples
std::vector< RawRTDSample > rtd_samples
Configuration for sensor channel routing.