The units library comes with two sets of units predefined. They are all located in src/units/unit_definitions.hpp. The definitions come in two flavors a precise_unit and a regular unit. All the precise units are defined in the namespace units::precise
All the units are defined as a constexpr values. The choice of which units to define is somewhat arbitrary and guided by the authors experience and the origins of the library in power systems and electrical engineering in the US. Units that the author has actually encountered in work or life are included and in cases where there might be conflicts depending on the location preference was given to the US customary definition, though international systems take priority.
Listing of Units¶
The most common units are defined in the namespace units::precise and others are defined in subnamespaces.
Most base units have two definitions that are equivalent
Some specialized units are defined for use in conversion applications or for making handling string conversions a little easier
defunit - special unit that signifies conversion to any other units is possible
invalid - special unit that conversion has failed
error - an error unit
Sometimes it is useful to have pure numerical units, often for multiplication with other units such as hundred*kg or something like that which becomes a single unit with 100 kg.
Also included in this category are SI prefixes milli, micro, nano, pico, femto, atto, zepto, yocto, kilo, mega, giga, tera, peta, exa, hecto, zetta, yotta
and SI data prefixes kibi, mebi, gibi, tebi, pebi, exbi, zebi, yobi
Derived SI Units¶
There are many units that used in combination with the SI system that are derived from the base units
Pa (pascal, on some systems this is defined as something else so the definition(pascal) is skipped)
The CGS system is a variant on the metric system. Units from the CGS system are included under the namespace units::precise::cgs.
Conventional Electrical Units¶
defined in namespace units::precise::conventional
Meter Gram Force System¶
defined in namespace units::precise::gm
Meter Tonne Second system¶
Defined in namespace units::precise::MTS
Additional Time units¶
Defined in namespace units::precise::time, units marked with * are also defined in the units::precise.
yr* (8760 hr)
sday - sidereal day
syr - sidereal year
at - mean tropical year
aj - mean julian year
ag - mean gregorian year
year - aliased to mean julian year (which seems to be most common usage)
mos - synodal (lunar) month
moj - mean julian month
mog - mean gregorian month
International customary Units¶
These are traditional units that have some level of international definition Defined in namespace units::precise::i
A few units have short symbols defined in unit::precise in, ft, yd, mile. These alias to the international definition.
Avoirdupois units are another common international standard of units for weight and volumes. The units are defined in units::precise::av
A few common units have symbols defined in units::precise lb, ton, oz, lbf and these alias to the Avoirdupois equivalent.
Most commonly for precious metals a few units are defined in units::precise::troy, with a basis in the international grain.
United States Customary Units¶
These are traditional units defined in the United States, for survey or common usage. Defined in unit::precise::us.
flbarrel - liquid barrel
A few US customary units are defined in specific namespaces to distinguish them from other forms US customary dry measurements are defined in units::precise::us::dry
Some grain measures used in markets and commodities are defined in units::precise::us::grain. When commodities are a little more developed this will be defined with appropriate commodity included.
Some survey units are defined in units::precise::us::engineers to distinguish them from others
The unit gallon is also defined in units::precise since that is pretty common to use.
FDA and metric measures¶
The food and drug administration has defined some customary units in metric terms for use in medicine. These are defined in units::precise::metric Also included are some other customary units that have a metric definition.
Some Canadian definitions of customary units defined in units::precise::canada
Traditional Australian units defined in units::precise::australia
Imperial or British Units¶
Traditional british or imperial units, defined in units::precise::imp.
Used in pharmaceutical contexts the apothecaries system of units is defined in units::precise::apothecaries.
floz ( same as imperial version )
Some units defined in context of marine travel defined in units::precise::nautical
Japanese traditional Units¶
Some traditional Japanese units are included for historical interest in units::precise::japan
Chinese Traditional Units¶
Some traditional Chinese units are included for historical interest in units::precise::chinese
Units used in typesetting and typography are included in units::precise::typographic Subsets of the units depending on the location are in subnamespaces
Some additional distance units are defined in units::precise::distance
Some additional units defining an area units::precise::area
Some additional units defining a mass units::precise::mass
Some additional units defining a volume units::precise::volume
A few units defining angles are defined in units::precise::angle.
brad - binary radian (1/256 of a circle)
A few directional units are defined in units::precise::direction, these make use of the i_flag and a numerical value
A few units related to temperature systems, defined in units::precise::temperature
Some units related to pressure are defined in units::precise::pressure
atm - standard atmosphere
att - technical atmosphere
Some units related to power are defined in units::precise::power
hpE - electric Horsepower
hpI - international horsepower
hpS - steam horesepower
hpM - mechanical horsepower
the unit hp is aliased in the units::precise namespace to power::hpI
Some units related to energy are defined in units::precise::energy
cal_4 - calorie at 4 deg C
cal_15 - calorie at 15 deg C
cal_28 - calorie at 28 deg C
cal_mean - mean calorie
cal_it - international table calorie
cal_th - thermochemical calorie
btu_th - thermochemical BTU
btu_39 - BTU at 39 deg C
btu_59 - BTU at 59 deg C
btu_60 - BTU at 60 deg C
btu_mean - mean BTU
btu_it - international table BTU
btu_iso - rounded btu_it
tonc - cooling ton
EER - energy efficiency ratio
SG - specific gravity
boe - barrel of oil equivalent
tce - ton of coal equivalent
lge - liter of gasoline equivalent
in the units::precise namespace
btu = energy::but_it
cal = energy::cal_th
kWh = energy::kWh
MWh = energy::MWh
Power system Units¶
Some additional units related to power systems and electrical engineering in units::precise::electrical namespace
VAR - W*i_flag
Equation type Units¶
Equation units are explained more thoroughly in Equation Units Some of the specific common equation units are defined in the namespace units::precise::log.
logE - natural logarithm
neperA - neper of amplitude unit
neperP - neper of a power unit
belP - bel of a power based unit
belA - bel of an amplitude based unit
dBA - dB of an amplitude based unit
dB_Z - radar reflectivity
Bz - radar reflectivity
Units related to clinical medicine in namespace units::precise::clinical.
Units used in laboratory settings in namespace units::precise::laboratory.
arbU - arbitrary unit
IR - index of reactivity
Lf - Limit of flocculation
Units related to computer data and storage in units::precise::data
bit_s - Shannon bit for information theory
Units related to computation units::precise::computation.
Some special units that were not otherwise characterized in namespace units::precise::special.
ASD - amplitude spectral density
moment_magnitude - moment magnitude for earthquake scales (related to richter scale)
sshws - saffir simpson hurricane wind scale
beaufort - Beaufort wind scale
fujita - Fujita scale for tornados
mach - mach number(multiplier of the speed of sound)
rootHertz - square root of Hertz, this is a special handling unit that triggers some specific behavior to handle it.
rootMeter - square root of meter, this is a special handling unit that triggers some specific behavior to handle it.
General purpose other units not otherwise categorical in namespace units::precise::other
ppm - part per million
ppb - part per billion
rpm* - revolution per minute
MegaBuck - $1,000,000
GigaBuck - $1,000,000,000
Units related to climate in namespace units::precise::climate
gwp - global warming potential
gtp - global temperature potential
Units in the units namespace¶
Regular units are defined in the units namespace. The general rule is that any units with a definition directly in units::precise has an analog nonprecise unit in the units namespace. One addition is that any unit defined in precise::electrical also is defined in units this has to do with the origins of the library in power systems.