STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fsw::calibration::rtd Namespace Reference

Classes

struct  CVDCoeffs

Functions

double temp_to_resistance_cvd (double t_c, const CVDCoeffs &cvd=CVDCoeffs{})
 Resistance (Ω) at temperature (°C), IEC 60751 Callendar-Van Dusen, the C term below 0 °C.
double resistance_to_temp_cvd_full (double resistance_ohms, const CVDCoeffs &cvd=CVDCoeffs{})
 The full CVD inverse: exact above 0 °C (the quadratic), Newton on the C term below it.
double rtd_board_adc_to_temp_c (int32_t adc_raw, double adc_ref_voltage, double excitation_ua, double r0_ohms)
 An ESP32 RTD board's reading -> °C: the ADC code (2^31 = adc_ref_voltage) is the voltage across the element carrying excitation_ua, so R = V / I, then the full CVD inverse.
double resistance_to_temp_cvd (double resistance_ohms, const CVDCoeffs &cvd=CVDCoeffs{})
 Convert resistance (Ω) to temperature (°C) using iterative CVD inverse.
double counts_to_resistance (int32_t counts, double gain, double offset)
 Convert ADC counts to resistance (assuming linear relationship).

Function Documentation

◆ counts_to_resistance()

double fsw::calibration::rtd::counts_to_resistance ( int32_t counts,
double gain,
double offset )
inline

Convert ADC counts to resistance (assuming linear relationship).

Definition at line 215 of file SensorCalibration.hpp.

◆ resistance_to_temp_cvd()

double fsw::calibration::rtd::resistance_to_temp_cvd ( double resistance_ohms,
const CVDCoeffs & cvd = CVDCoeffs{} )
inline

Convert resistance (Ω) to temperature (°C) using iterative CVD inverse.

Definition at line 205 of file SensorCalibration.hpp.

Referenced by main().

◆ resistance_to_temp_cvd_full()

double fsw::calibration::rtd::resistance_to_temp_cvd_full ( double resistance_ohms,
const CVDCoeffs & cvd = CVDCoeffs{} )
inline

The full CVD inverse: exact above 0 °C (the quadratic), Newton on the C term below it.

resistance_to_temp_cvd() drops the C term and reads cold below 0 °C: 0.2 °C at -100 °C, 1.76 °C at -183 °C (LOX), 2.25 °C at -196 °C. NaN when the resistance is off the curve or the temperature is outside the standard's -200..850 °C (5 °C of slack each side): an open element reads a huge resistance and a shorted one about -242 °C, and neither is a temperature.

Definition at line 161 of file SensorCalibration.hpp.

Referenced by main(), rtd_board_adc_to_temp_c(), and fsw::t7::rtd_c().

◆ rtd_board_adc_to_temp_c()

double fsw::calibration::rtd::rtd_board_adc_to_temp_c ( int32_t adc_raw,
double adc_ref_voltage,
double excitation_ua,
double r0_ohms )
inline

An ESP32 RTD board's reading -> °C: the ADC code (2^31 = adc_ref_voltage) is the voltage across the element carrying excitation_ua, so R = V / I, then the full CVD inverse.

NaN when there is no temperature to report, so the caller publishes nothing rather than a plausible one:

  • open element: the current source drives the input to the rail and the ADC saturates. That is still on the curve (2.5 V / 1 mA = 2500 ohm, ~395 C on a Pt1000), so a code within 0.1 % of full scale is refused outright;
  • shorted element: ~0 ohm, about -242 C, outside -200..850 C (resistance_to_temp_cvd_full).

Definition at line 192 of file SensorCalibration.hpp.

References fsw::calibration::rtd::CVDCoeffs::R0, and resistance_to_temp_cvd_full().

Referenced by convert_rtd_adc_to_temp_c(), main(), and read().

◆ temp_to_resistance_cvd()

double fsw::calibration::rtd::temp_to_resistance_cvd ( double t_c,
const CVDCoeffs & cvd = CVDCoeffs{} )
inline

Resistance (Ω) at temperature (°C), IEC 60751 Callendar-Van Dusen, the C term below 0 °C.

Definition at line 149 of file SensorCalibration.hpp.

Referenced by code_at(), anonymous_namespace{t7_bridge_main.cpp}::fake_signal(), and main().