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

Classes

struct  Reading

Functions

double counts_to_ma (uint32_t counts)
double ma_to_percent_open (double ma)
 % open, clamped to 0-100 (a loop a little outside 4-20 mA is still the end of travel).
Reading from_counts (uint32_t counts)

Variables

constexpr double kAdcMaxCounts = 4095.0
constexpr double kAdcRefVolts = 3.3
constexpr double kShuntOhms = 100.0
constexpr double kLoopMinMa = 4.0
constexpr double kLoopMaxMa = 20.0
constexpr double kNoSignalMa = 2.0
 Below this the loop is open or unpowered: no position, not "fully closed".
constexpr uint8_t kStatusOk = 1
 cal_status values published beside the position.
constexpr uint8_t kStatusNoSignal = 2

Function Documentation

◆ counts_to_ma()

double fsw::calibration::valve_position::counts_to_ma ( uint32_t counts)
inline

Definition at line 40 of file ValvePosition.hpp.

References kAdcMaxCounts, kAdcRefVolts, and kShuntOhms.

Referenced by from_counts(), and main().

◆ from_counts()

Reading fsw::calibration::valve_position::from_counts ( uint32_t counts)
inline

Definition at line 57 of file ValvePosition.hpp.

References counts_to_ma(), kNoSignalMa, kStatusNoSignal, kStatusOk, and ma_to_percent_open().

Referenced by main(), and main().

◆ ma_to_percent_open()

double fsw::calibration::valve_position::ma_to_percent_open ( double ma)
inline

% open, clamped to 0-100 (a loop a little outside 4-20 mA is still the end of travel).

Definition at line 45 of file ValvePosition.hpp.

References kLoopMaxMa, and kLoopMinMa.

Referenced by from_counts().

Variable Documentation

◆ kAdcMaxCounts

double fsw::calibration::valve_position::kAdcMaxCounts = 4095.0
constexpr

Definition at line 20 of file ValvePosition.hpp.

Referenced by counts_to_ma().

◆ kAdcRefVolts

double fsw::calibration::valve_position::kAdcRefVolts = 3.3
constexpr

Definition at line 21 of file ValvePosition.hpp.

Referenced by counts_to_ma().

◆ kLoopMaxMa

double fsw::calibration::valve_position::kLoopMaxMa = 20.0
constexpr

Definition at line 24 of file ValvePosition.hpp.

Referenced by ma_to_percent_open().

◆ kLoopMinMa

double fsw::calibration::valve_position::kLoopMinMa = 4.0
constexpr

Definition at line 23 of file ValvePosition.hpp.

Referenced by ma_to_percent_open().

◆ kNoSignalMa

double fsw::calibration::valve_position::kNoSignalMa = 2.0
constexpr

Below this the loop is open or unpowered: no position, not "fully closed".

Anything from here up to 4 mA is a closed valve, rounded to 0 % open.

Not 3.5 mA (or NAMUR's 3.6): the ESP32's ADC1 at 11 dB, read raw as counts / 4095 * 3.3 V, reads about 0.1 V low at this end, about 1 mA of loop current. On 2026-11-05 the Ox Vent valve, physically closed, read a steady 353-356 counts = 2.86 mA by this formula, and was shown as NO SIGNAL; the same valve read 0 counts while its loop was unpowered. 2 mA sits clear of both.

Definition at line 34 of file ValvePosition.hpp.

Referenced by from_counts().

◆ kShuntOhms

double fsw::calibration::valve_position::kShuntOhms = 100.0
constexpr

Definition at line 22 of file ValvePosition.hpp.

Referenced by counts_to_ma().

◆ kStatusNoSignal

uint8_t fsw::calibration::valve_position::kStatusNoSignal = 2
constexpr

Definition at line 38 of file ValvePosition.hpp.

Referenced by from_counts(), and main().

◆ kStatusOk

uint8_t fsw::calibration::valve_position::kStatusOk = 1
constexpr

cal_status values published beside the position.

Definition at line 37 of file ValvePosition.hpp.

Referenced by from_counts(), and main().