OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Public Attributes | List of all members
Units Class Reference

Class used to convert units using a standard convention. More...

#include <fcst_units.h>

Static Public Member Functions

static double convert (double unitToConvert, double to, double from)
 The conversion routine convert(unitToConvert, X, Y) should be read as: More...
 
static double convert (double unitToConvert, int specificCase)
 Convert using on a case by case basis. More...
 

Static Public Attributes

static const unsigned int KJ_to_BTU =1
 
static const unsigned int BTU_to_KJ =2
 
static const unsigned int ATM_to_PA =3
 
static double PER_K_UNIT
 
static double PER_UNIT
 
static double PER_C_UNIT
 
static double PER_MILLI_UNIT
 
static double PER_MICRO_UNIT
 
static double PER_N_UNIT
 
static double PER_P_UNIT
 
static double PER_UNIT2
 
static double PER_C_UNIT2
 
static double PER_MILLI_UNIT2
 
static double PER_MICRO_UNIT2
 
static double PER_N_UNIT2
 
static double PER_P_UNIT2
 
static double PER_UNIT3
 
static double PER_C_UNIT3
 
static double PER_MILLI_UNIT3
 
static double PER_MICRO_UNIT3
 
static double PER_N_UNIT3
 
static double PER_P_UNIT3
 
static double K_UNIT
 
static double UNIT
 
static double C_UNIT
 
static double MILLI_UNIT
 
static double MICRO_UNIT
 
static double N_UNIT
 
static double P_UNIT
 
static double UNIT2
 
static double C_UNIT2
 
static double MILLI_UNIT2
 
static double MICRO_UNIT2
 
static double N_UNIT2
 
static double P_UNIT2
 
static double UNIT3
 
static double C_UNIT3
 
static double MILLI_UNIT3
 
static double MICRO_UNIT3
 
static double N_UNIT3
 
static double P_UNIT3
 

Detailed Description

Class used to convert units using a standard convention.

All routines are static, therefore, there is no need to create an object of this class, simply use the Units::convert() to call the class and add the .h file to your header file.

The converstion routine convert(unitToConvert, X, Y) should be read as:

convert quantity unitToConvert to X from Y.

Usage details

* FcstUtilities::log << "Tests" << std::endl;
* FcstUtilities::log << "1/m^2 to 1/cm^2: " << Units::convert(1, Units::PER_C_UNIT2, Units::PER_UNIT2)<<std::endl;
* FcstUtilities::log << "1/cm^3 to 1/m^3: " <<Units::convert(1, Units::PER_UNIT3, Units::PER_C_UNIT3)<< std::endl;
* FcstUtilities::log << "m^2/a to cm^2/a: " << Units::convert(1, Units::C_UNIT2, Units::UNIT2)<<std::endl;
* FcstUtilities::log << "cm^3/a to m^3/a: " <<Units::convert(1, Units::UNIT3, Units::C_UNIT3)<< std::endl;
*
Author
P. Wardlaw
Date
2013

Member Function Documentation

static double Units::convert ( double  unitToConvert,
double  to,
double  from 
)
inlinestatic
static double Units::convert ( double  unitToConvert,
int  specificCase 
)
inlinestatic

Convert using on a case by case basis.

In this case, the function should be read as: Convert unitToConvert from KJ to BTU.

References ATM_to_PA, BTU_to_KJ, and KJ_to_BTU.

Member Data Documentation

const unsigned int Units::ATM_to_PA =3
static
const unsigned int Units::BTU_to_KJ =2
static

Referenced by convert().

double Units::C_UNIT
static
double Units::C_UNIT2
static
double Units::C_UNIT3
static
double Units::K_UNIT
static
const unsigned int Units::KJ_to_BTU =1
static

Referenced by convert().

double Units::MICRO_UNIT
static
double Units::MICRO_UNIT2
static
double Units::MICRO_UNIT3
static
double Units::MILLI_UNIT
static
double Units::MILLI_UNIT2
static
double Units::MILLI_UNIT3
static
double Units::N_UNIT
static
double Units::N_UNIT2
static
double Units::N_UNIT3
static
double Units::P_UNIT
static
double Units::P_UNIT2
static
double Units::P_UNIT3
static
double Units::PER_C_UNIT
static
double Units::PER_C_UNIT2
static
double Units::PER_C_UNIT3
static
double Units::PER_K_UNIT
static
double Units::PER_MICRO_UNIT
static
double Units::PER_MICRO_UNIT2
static
double Units::PER_MICRO_UNIT3
static
double Units::PER_MILLI_UNIT
static
double Units::PER_MILLI_UNIT2
static
double Units::PER_MILLI_UNIT3
static
double Units::PER_N_UNIT
static
double Units::PER_N_UNIT2
static
double Units::PER_N_UNIT3
static
double Units::PER_P_UNIT
static
double Units::PER_P_UNIT2
static
double Units::PER_P_UNIT3
static
double Units::PER_UNIT
static
double Units::PER_UNIT2
static
double Units::PER_UNIT3
static
double Units::UNIT
static
double Units::UNIT2
static
double Units::UNIT3
static

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