|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Routes decoded sensor frames to Elodin tables. More...
#include <SensorRouter.hpp>
Public Member Functions | |
| SensorRouter () | |
| ~SensorRouter ()=default | |
| bool | load_config (const std::string &config_path) |
| Load routing configuration from TOML file. | |
| void | add_channel (const SensorChannelConfig &config) |
| Add a sensor channel configuration manually. | |
| 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::string | get_table_name (const std::string &sensor_type, uint8_t channel_id) const |
| Get table name for a sensor channel (for debugging). | |
| 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. | |
| void | set_pt_calibration (const calibration::PTCalibrationManager *cal_manager) |
| Set PT calibration manager (legacy). | |
| void | set_tc_calibration (const calibration::SensorCalibrationManager *m) |
| Set calibration managers for each sensor type. | |
| void | set_rtd_calibration (const calibration::SensorCalibrationManager *m) |
| void | set_lc_calibration (const calibration::SensorCalibrationManager *m) |
| 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::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::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::CalibratedTCMessage > > | route_tc_samples_calibrated (const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const |
| 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 |
| 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 |
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedRTDMessage > > | route_rtd_samples_pt100 (const daq_comms::protocol::SensorBatch &batch, uint64_t receive_timestamp_ns) const |
| RTD Pt100 temperature conversion — no calibration manager required. | |
Private Member Functions | |
| std::string | make_key (const std::string &sensor_type, uint8_t channel_id) const |
Private Attributes | |
| std::unordered_map< std::string, SensorChannelConfig > | channel_map_ |
| const calibration::PTCalibrationManager * | pt_calibration_ = nullptr |
| const calibration::SensorCalibrationManager * | tc_calibration_ = nullptr |
| const calibration::SensorCalibrationManager * | rtd_calibration_ = nullptr |
| const calibration::SensorCalibrationManager * | lc_calibration_ = nullptr |
Routes decoded sensor frames to Elodin tables.
Maps sensor channels to Elodin table IDs based on configuration. This allows adding/removing sensors without code changes.
Definition at line 36 of file SensorRouter.hpp.
| fsw::routing::SensorRouter::SensorRouter | ( | ) |
Definition at line 11 of file SensorRouter.cpp.
|
default |
| void fsw::routing::SensorRouter::add_channel | ( | const SensorChannelConfig & | config | ) |
Add a sensor channel configuration manually.
Definition at line 85 of file SensorRouter.cpp.
References channel_map_, and make_key().
Referenced by load_config().
| std::array< uint8_t, 2 > fsw::routing::SensorRouter::get_table_id | ( | const std::string & | sensor_type, |
| uint8_t | channel_id ) const |
Get table ID for a sensor channel.
| sensor_type | "PT", "TC", "RTD", or "LC" |
| channel_id | Channel identifier |
Definition at line 90 of file SensorRouter.cpp.
References channel_map_, and make_key().
| std::string fsw::routing::SensorRouter::get_table_name | ( | const std::string & | sensor_type, |
| uint8_t | channel_id ) const |
Get table name for a sensor channel (for debugging).
Definition at line 101 of file SensorRouter.cpp.
References channel_map_, and make_key().
| bool fsw::routing::SensorRouter::load_config | ( | const std::string & | config_path | ) |
Load routing configuration from TOML file.
| config_path | Path to TOML configuration file |
Definition at line 17 of file SensorRouter.cpp.
References add_channel().
|
private |
Definition at line 322 of file SensorRouter.cpp.
Referenced by add_channel(), get_table_id(), and get_table_name().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawLCMessage > > fsw::routing::SensorRouter::route_lc_samples | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Definition at line 214 of file SensorRouter.cpp.
References daq_comms::protocol::SensorBatch::lc_samples, and comms::CommsMessage< Fields >::setField().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedLCMessage > > fsw::routing::SensorRouter::route_lc_samples_calibrated | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Definition at line 295 of file SensorRouter.cpp.
References lc_calibration_, daq_comms::protocol::SensorBatch::lc_samples, and comms::CommsMessage< Fields >::setField().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawPTMessage > > fsw::routing::SensorRouter::route_pt_samples | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Convert a sensor batch into Elodin messages.
| batch | Decoded sensor batch |
Definition at line 111 of file SensorRouter.cpp.
References daq_comms::protocol::SensorBatch::pt_samples, and comms::CommsMessage< Fields >::setField().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedPTMessage > > fsw::routing::SensorRouter::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.
| batch | Decoded sensor batch |
Definition at line 134 of file SensorRouter.cpp.
References pt_calibration_, fsw::calibration::pt_logical_calibration_channel(), daq_comms::protocol::SensorBatch::pt_samples, and comms::CommsMessage< Fields >::setField().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawRTDMessage > > fsw::routing::SensorRouter::route_rtd_samples | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Definition at line 192 of file SensorRouter.cpp.
References daq_comms::protocol::SensorBatch::rtd_samples, and comms::CommsMessage< Fields >::setField().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedRTDMessage > > fsw::routing::SensorRouter::route_rtd_samples_calibrated | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Definition at line 266 of file SensorRouter.cpp.
References rtd_calibration_, daq_comms::protocol::SensorBatch::rtd_samples, and comms::CommsMessage< Fields >::setField().
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedRTDMessage > > fsw::routing::SensorRouter::route_rtd_samples_pt100 | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
RTD Pt100 temperature conversion — no calibration manager required.
Applies Callendar-Van Dusen (Pt100, R0=100Ω, A=3.9083e-3, B=-5.775e-7): resistance_ohm = raw_resistance_counts * 0.001 T = (-R0*A + sqrt((R0*A)^2 - 4*R0*B*(R0 - R))) / (2*R0*B)
Outputs CalibratedRTDMessage at packet_id {0x22, 0x10 + channel_id + 1} (matching the RTD_Cal VTable registered in DatabaseConfig).
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::RawTCMessage > > fsw::routing::SensorRouter::route_tc_samples | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Definition at line 170 of file SensorRouter.cpp.
References comms::CommsMessage< Fields >::setField(), and daq_comms::protocol::SensorBatch::tc_samples.
| std::vector< std::pair< std::array< uint8_t, 2 >, comms::messages::sensor::CalibratedTCMessage > > fsw::routing::SensorRouter::route_tc_samples_calibrated | ( | const daq_comms::protocol::SensorBatch & | batch, |
| uint64_t | receive_timestamp_ns ) const |
Definition at line 237 of file SensorRouter.cpp.
References comms::CommsMessage< Fields >::setField(), tc_calibration_, and daq_comms::protocol::SensorBatch::tc_samples.
|
inline |
Definition at line 98 of file SensorRouter.hpp.
References lc_calibration_.
|
inline |
Set PT calibration manager (legacy).
Definition at line 87 of file SensorRouter.hpp.
References pt_calibration_.
|
inline |
Definition at line 95 of file SensorRouter.hpp.
References rtd_calibration_.
|
inline |
Set calibration managers for each sensor type.
Definition at line 92 of file SensorRouter.hpp.
References tc_calibration_.
|
private |
Definition at line 144 of file SensorRouter.hpp.
Referenced by add_channel(), get_table_id(), and get_table_name().
|
private |
Definition at line 149 of file SensorRouter.hpp.
Referenced by route_lc_samples_calibrated(), and set_lc_calibration().
|
private |
Definition at line 146 of file SensorRouter.hpp.
Referenced by route_pt_samples_calibrated(), and set_pt_calibration().
|
private |
Definition at line 148 of file SensorRouter.hpp.
Referenced by route_rtd_samples_calibrated(), and set_rtd_calibration().
|
private |
Definition at line 147 of file SensorRouter.hpp.
Referenced by route_tc_samples_calibrated(), and set_tc_calibration().