Unit of mesurement converter. More...

#include <UnitEngine.h>

Public Types

typedef std::map< std::string, Dimension * > dictionary_t
 

Public Member Functions

 UnitEngine (int)
 
void addDimension (std::string desc, std::string SIu, int kmol, int rad, int A, int m, int cd, int kg, int K, int s, int eur=0)
 
void addUnit (std::string desc, std::string unit, double factor, double offset=0)
 
double fromSI (double v, const std::string &source_unit) const
 
double toSI (double v, const std::string &destination_unit, UnitArray &unit) const
 
const Dimensionpdimension (std::string unit) const
 return a pointer to the Dimension based on the unit More...
 
dictionary_t::const_iterator begin (void) const
 
dictionary_t::const_iterator next (void) const
 
dictionary_t::const_iterator end (void) const
 
void printUnits (void) const
 diagnostic print More...
 

Detailed Description

Unit of mesurement converter.

only integer SI exponents only multiplicative linear conversion (no offsets)

Supported units of measurement:

  • amount: kmol mol
  • angle: rad
  • current: A
  • length: m ft km dm cm mm um in
  • luminous intensity: cd
  • mass: kg mg t lb g
  • temperature: K degC degF
  • time: s min h d yr
  • money: $ EUR
  • acceleration: m/s2
  • amount flow: kmol/s kmol/h lbmol/h mol/h mol/s Nm3/h Nm3/d Nl/min
  • amount specific electric charge: C/kmol
  • amount specific energy: J/kmol kJ/kmol BTU/lbmol kcal/kmol
  • amount specific entropy: J/(kmol*K) J/kmol/K kJ/kmol/K
  • area: m2 dm2 ft2 cm2 mm2
  • areic current: A/m2 A/dm2 A/ft2 A/cm2 A/mm2 mA/cm2
  • areic electric resistance: ohm*m2 ohm*cm2
  • capacitance: F
  • conductance: S
  • density: kg/m3 mg/m3 g/m3 lb/ft3
  • diffusivity: m2/s
  • dynamical viscosity: Pa*s cP mPa*s
  • electric charge: C
  • electric potential: V mV
  • electric resistance: ohm
  • entropy: J/K
  • entropy power: W/K BTU/h/F
  • flow coefficient: kg/m7
  • force: N
  • frequency: Hz
  • heat transfer coefficient: W/(m2*K) kcal/(h*m2*K) BTU/(h*ft2*F) W/m2/K
  • heat transfer resistance: m2*K/W
  • inductance: H
  • inverse of length: 1/m
  • inverse of molecular weight: kmol/kg mol/kg
  • inverse of temperature: 1/K
  • length*time: m*s
  • magnetic flux: Wb
  • magnetic flux density: T
  • mass flow: kg/s kg/h kg/d g/d t/h t/d t/yr lb/h
  • mass per unit work: kg/J
  • mass specific energy: J/kg kcal/kg BTU/lb MJ/kg kJ/g kJ/kg m2/s2
  • mass specific power: W/kg kW/kg
  • mass specific heat capacity: J/(kg*K) kcal/(kg*K) BTU/lb/F kcal/kg/K J/kg/K kJ/kg/K
  • mass specific volume: m3/kg
  • molar concentration: kmol/m3 mol/m3 lbmol/ft3 mmol/dm3 mol/dm3
  • molar volume: m3/kmol
  • volume specific energy: J/m3 kJ/m3 J/l kWh/m3 kcal/m3 kcal/l BTU/ft3
  • molecular weight: kg/kmol mg/Nm3 g/Nm3 lb/lbmol
  • permeance: kmol/kg/m GPU
  • power: W BTU/h kW kcal/s kcal/h GW MW TW mW
  • power density: W/m2
  • pressure: Pa MPa atm bar barg mbar hPa kPa mmHg Torr mmH2O kg/cm2 psi
  • pressure*molar volume squared: Pa*m6/kmol2
  • resistivity: ohm*m ohm*cm
  • second temperature derivative of density: kg/(m3*K2)
  • second temperature derivative of pressure: Pa/K2
  • second temperature derivative of specific heat: J/(kg*K3)
  • surface tension: N/m
  • temperature derivative of density: kg/(m3*K)
  • temperature derivative of pressure: Pa/K
  • temperature derivative of specific heat: J/(kg*K2)
  • temperature squared/pressure: K2/Pa
  • temperature/pressure: K/Pa
  • thermal conductivity: W/(m*K) W/m/K
  • thermal resistivity: m*K/W
  • thermal resistivity squared: m2*K2/W2
  • VdW a: N*m4*kmol-2
  • VdW a*n*n: N*m4
  • velocity: m/s
  • volume: m3 ft3 dm3 cm3 mm3 ul ml l bbl
  • volume flow: m3/s m3/h ft3/h l/h ccm
  • energy: J BTU mmBTU MWh kcal kWh
  • energy price: EUR/J EUR/mmBTU $/mmBTU $/J EUR/kWh EUR/MWh EUR/kcal

#include <libpf/value/UnitEngine.h>

Remarks
Warning
Thread safe:
Extendable:
Platform dependencies:

Member Typedef Documentation

◆ dictionary_t

typedef std::map<std::string, Dimension*> UnitEngine::dictionary_t

Constructor & Destructor Documentation

◆ UnitEngine()

UnitEngine::UnitEngine ( int  )
explicit

Member Function Documentation

◆ addDimension()

void UnitEngine::addDimension ( std::string  desc,
std::string  SIu,
int  kmol,
int  rad,
int  A,
int  m,
int  cd,
int  kg,
int  K,
int  s,
int  eur = 0 
)

◆ addUnit()

void UnitEngine::addUnit ( std::string  desc,
std::string  unit,
double  factor,
double  offset = 0 
)

◆ begin()

dictionary_t::const_iterator UnitEngine::begin ( void  ) const

◆ end()

dictionary_t::const_iterator UnitEngine::end ( void  ) const

◆ fromSI()

double UnitEngine::fromSI ( double  v,
const std::string &  source_unit 
) const

◆ next()

dictionary_t::const_iterator UnitEngine::next ( void  ) const

◆ pdimension()

const Dimension * UnitEngine::pdimension ( std::string  unit) const

return a pointer to the Dimension based on the unit

◆ printUnits()

void UnitEngine::printUnits ( void  ) const

diagnostic print

◆ toSI()

double UnitEngine::toSI ( double  v,
const std::string &  destination_unit,
UnitArray unit 
) const

The documentation for this class was generated from the following file: