Skip to content

Namespace espos::formulas

Namespace List > espos > formulas

Classes

Type Name
struct CurveSample

Public Types

Type Name
enum uint8_t BatteryChemistry

Public Attributes

Type Name
constexpr CurveSample kAgmSoc12v = /* multi line expression */
constexpr std::size_t kAgmSoc12vCount = /* multi line expression */
constexpr float kBuckB = 18.678f
constexpr float kBuckC = 257.14f
constexpr float kBuckD = 234.5f
constexpr CurveSample kLifepo4Soc12v = /* multi line expression */
constexpr std::size_t kLifepo4Soc12vCount = /* multi line expression */
constexpr CurveSample kThermistorUs240_33 = /* multi line expression */
constexpr std::size_t kThermistorUs240_33Count = /* multi line expression */
constexpr CurveSample kThermistorVdo180_10 = /* multi line expression */
constexpr std::size_t kThermistorVdo180_10Count = /* multi line expression */

Public Functions

Type Name
float air_density (float temp_k, float pressure_pa, float rh_ratio)
float angle_offset (float rad, float offset_rad, float min=0.0f)
float battery_soc (float volts, BatteryChemistry chem, float nominal_v=12.0f)
std::optional< float > curve_eval (const CurveSample * samples, std::size_t count, float x)
float curve_eval_or (const CurveSample * samples, std::size_t count, float x, float fallback)
bool curve_is_sorted (const CurveSample * samples, std::size_t count)
void curve_sort (CurveSample * samples, std::size_t count)
std::optional< float > dew_point_k (float temp_k, float rh_ratio)
std::optional< float > divider_r1 (float v_out, float v_in, float r2)
std::optional< float > divider_r2 (float v_out, float v_in, float r1)
float divider_scale (float v_out, float r1, float r2)
std::optional< float > frequency_hz (uint32_t count, float period_s, float pulses_per_unit=1.0f)
float heat_index_effect_k (float temp_k, float rh_ratio)
float heat_index_k (float temp_k, float rh_ratio)
std::optional< float > ntc_beta_k (float resistance_ohm, float r0_ohm, float t0_k, float beta)
float saturation_vapour_pressure_pa (float temp_k)
float tank_level (float reading, float empty, float full)
float vapour_pressure_pa (float temp_k, float rh_ratio)
float wrap_angle (float rad, float min=0.0f)

Public Types Documentation

enum BatteryChemistry

enum espos::formulas::BatteryChemistry {
    kLifepo4,
    kAgm
};

Public Attributes Documentation

variable kAgmSoc12v

constexpr CurveSample espos::formulas::kAgmSoc12v[];

variable kAgmSoc12vCount

constexpr std::size_t espos::formulas::kAgmSoc12vCount;

variable kBuckB

constexpr float espos::formulas::kBuckB;

variable kBuckC

constexpr float espos::formulas::kBuckC;

variable kBuckD

constexpr float espos::formulas::kBuckD;

variable kLifepo4Soc12v

constexpr CurveSample espos::formulas::kLifepo4Soc12v[];

variable kLifepo4Soc12vCount

constexpr std::size_t espos::formulas::kLifepo4Soc12vCount;

variable kThermistorUs240_33

constexpr CurveSample espos::formulas::kThermistorUs240_33[];

variable kThermistorUs240_33Count

constexpr std::size_t espos::formulas::kThermistorUs240_33Count;

variable kThermistorVdo180_10

constexpr CurveSample espos::formulas::kThermistorVdo180_10[];

variable kThermistorVdo180_10Count

constexpr std::size_t espos::formulas::kThermistorVdo180_10Count;

Public Functions Documentation

function air_density

inline float espos::formulas::air_density (
    float temp_k,
    float pressure_pa,
    float rh_ratio
) 

function angle_offset

inline float espos::formulas::angle_offset (
    float rad,
    float offset_rad,
    float min=0.0f
) 

function battery_soc

inline float espos::formulas::battery_soc (
    float volts,
    BatteryChemistry chem,
    float nominal_v=12.0f
) 

function curve_eval

inline std::optional< float > espos::formulas::curve_eval (
    const CurveSample * samples,
    std::size_t count,
    float x
) 

function curve_eval_or

inline float espos::formulas::curve_eval_or (
    const CurveSample * samples,
    std::size_t count,
    float x,
    float fallback
) 

function curve_is_sorted

inline bool espos::formulas::curve_is_sorted (
    const CurveSample * samples,
    std::size_t count
) 

function curve_sort

inline void espos::formulas::curve_sort (
    CurveSample * samples,
    std::size_t count
) 

function dew_point_k

inline std::optional< float > espos::formulas::dew_point_k (
    float temp_k,
    float rh_ratio
) 

function divider_r1

inline std::optional< float > espos::formulas::divider_r1 (
    float v_out,
    float v_in,
    float r2
) 

function divider_r2

inline std::optional< float > espos::formulas::divider_r2 (
    float v_out,
    float v_in,
    float r1
) 

function divider_scale

inline float espos::formulas::divider_scale (
    float v_out,
    float r1,
    float r2
) 

function frequency_hz

inline std::optional< float > espos::formulas::frequency_hz (
    uint32_t count,
    float period_s,
    float pulses_per_unit=1.0f
) 

function heat_index_effect_k

inline float espos::formulas::heat_index_effect_k (
    float temp_k,
    float rh_ratio
) 

function heat_index_k

inline float espos::formulas::heat_index_k (
    float temp_k,
    float rh_ratio
) 

function ntc_beta_k

inline std::optional< float > espos::formulas::ntc_beta_k (
    float resistance_ohm,
    float r0_ohm,
    float t0_k,
    float beta
) 

function saturation_vapour_pressure_pa

inline float espos::formulas::saturation_vapour_pressure_pa (
    float temp_k
) 

function tank_level

inline float espos::formulas::tank_level (
    float reading,
    float empty,
    float full
) 

function vapour_pressure_pa

inline float espos::formulas::vapour_pressure_pa (
    float temp_k,
    float rh_ratio
) 

function wrap_angle

inline float espos::formulas::wrap_angle (
    float rad,
    float min=0.0f
) 


The documentation for this class was generated from the following file espos_formulas/include/espos_formulas/curve.hpp