13constexpr double kNaN = std::numeric_limits<double>::quiet_NaN();
21double cjc_temp_c(
double ain14_v,
double device_offset_k,
double cjc_offset_k) {
26 double lo = 0, hi = 0;
27 if (
ch.signal ==
"0-5V") {
29 }
else if (
ch.signal ==
"0.5-4.5V") {
31 }
else if (
ch.signal ==
"1-5V") {
33 }
else if (
ch.signal ==
"0-10V") {
35 }
else if (
ch.signal ==
"4-20mA") {
37 lo = 0.004 *
ch.shunt_ohms, hi = 0.020 *
ch.shunt_ohms;
41 if (!(hi > lo) || !(
ch.full_scale > 0))
43 return (
volts - lo) / (hi - lo) *
ch.full_scale;
47 const double rated_v =
ch.sensitivity_mv_per_v / 1000.0 *
ch.excitation_v;
48 if (!(rated_v > 0) || !(
ch.full_scale > 0))
50 return volts / rated_v *
ch.full_scale;
72 return "pressure_psi";
73 if (kind ==
"TC" || kind ==
"RTD")
74 return "temperature_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 type_k_mv_from_c(double c)
EMF (mV, referenced to 0 C) a type K produces at c.
double type_k_c_from_mv(double mv)
Temperature (C) for a type K EMF in mV, referenced to 0 C.
double cjc_device_offset_k(double device_temp_k, double ain14_v)
AIN14 offset (K) that makes slope*ain14_v land on the device's own temperature reading.
constexpr double kAin14SlopeKPerV
The T7's internal temperature sensor (an LM94021 on AIN14) reads "Device temperature K =volts * -92....
double lc_kg(double volts, const config::T7Channel &ch)
LC: a bridge's output is sensitivity x excitation at rated load.
double rtd_ohms(double volts, const config::T7Channel &ch)
RTD on an LJTick-Resistance: the divider's output volts -> the RTD's ohms.
const char * calibrated_field(const std::string &kind)
The Elodin field a calibrated channel of this kind publishes ("pressure_psi", ...),...
double tc_c(double volts, double cold_junction_c)
Type K thermocouple: the measured EMF plus the EMF the cold junction subtracts.
double cjc_temp_c(double ain14_v, double device_offset_k, double cjc_offset_k)
Cold-junction temperature (C) from a streamed AIN14 reading.
double pt_psi(double volts, const config::T7Channel &ch)
PT: linear between the signal's zero and full-scale outputs.
double rtd_c(double volts, const config::T7Channel &ch)
RTD: ohms -> C on the IEC 60751 curve (full Callendar-Van Dusen, C term below 0 C).
Motorized ball valve position: raw ADC counts -> % open.
One streamed analog input.
static double volts(uint32_t code)
Shunt volts for a code, as calibration_main's convert_hp_pt_to_pressure computes it.
static std::string ch(int ain, const std::string &kind, const std::string &extra="", const std::string &board="lj")