.. namespace:: units The International System of Units (SI) ====================================== The :term:`SI` system is defined in the [SIBrochure]_ and standardizes units for quantities provided in the :term:`ISQ` system: The SI is a consistent system of units for use in all aspects of life, including international trade, manufacturing, security, health and safety, protection of the environment, and in the basic science that underpins all of these. The system of quantities underlying the SI and the equations relating them are based on the present description of nature and are familiar to all scientists, technologists and engineers. As the :term:`SI` is defined on top of the :term:`ISQ` the C++ namespace for all of its definitions is ``units::isq::si``. Base units ---------- Even though from 2019 the :term:`SI` system is defined in terms of the `Defining constants`_, base units still are really important. As the [SIBrochure]_ states: Prior to the definitions adopted in 2018, the SI was defined through seven base units from which the derived units were constructed as products of powers of the base units. Defining the SI by fixing the numerical values of seven defining constants has the effect that this distinction is, in principle, not needed, since all units, base as well as derived units, may be constructed directly from the defining constants. Nevertheless, the concept of base and derived units is maintained because it is useful and historically well established, noting also that the ISO/IEC 80000 series of Standards specify base and derived quantities which necessarily correspond to the SI base and derived units defined here. The base units and quantities of the :term:`SI` system are defined as follows:: namespace units::isq::si { struct second : named_unit {}; struct dim_time : isq::dim_time {}; template U, Representation Rep = double> using time = quantity; struct metre : named_unit {}; struct dim_length : isq::dim_length {}; template U, Representation Rep = double> using length = quantity; struct gram : named_unit {}; struct kilogram : prefixed_unit {}; struct dim_mass : isq::dim_mass {}; template U, Representation Rep = double> using mass = quantity; struct ampere : named_unit {}; struct dim_electric_current : isq::dim_electric_current {}; template U, Representation Rep = double> using electric_current = quantity; struct kelvin : named_unit {}; struct dim_thermodynamic_temperature : isq::dim_thermodynamic_temperature {}; template U, Representation Rep = double> using thermodynamic_temperature = quantity; struct mole : named_unit {}; struct dim_amount_of_substance : isq::dim_amount_of_substance {}; template U, Representation Rep = double> using amount_of_substance = quantity; struct candela : named_unit {}; struct dim_luminous_intensity : isq::dim_luminous_intensity {}; template U, Representation Rep = double> using luminous_intensity = quantity; } Derived units ------------- The [SIBrochure]_ states: Derived units are defined as products of powers of the base units. When the numerical factor of this product is one, the derived units are called coherent derived units. The base and coherent derived units of the SI form a coherent set, designated the set of coherent SI units. The word “coherent” here means that equations between the numerical values of quantities take exactly the same form as the equations between the quantities themselves. Some of the coherent derived units in the SI are given special names. ... Together with the seven base units they form the core of the set of SI units. All other SI units are combinations of some of these 29 units. Unit prefixes ------------- According to [SIBrochure]_: Prefixes may be used with any of the 29 SI units with special names with the exception of the base unit kilogram. Here is a complete list of all the :term:`SI` prefixes supported by the library:: namespace si { struct yocto : prefix()> {}; struct zepto : prefix()> {}; struct atto : prefix()> {}; struct femto : prefix()> {}; struct pico : prefix()> {}; struct nano : prefix()> {}; struct micro : prefix()> {}; struct milli : prefix()> {}; struct centi : prefix()> {}; struct deci : prefix()> {}; struct deca : prefix()> {}; struct hecto : prefix()> {}; struct kilo : prefix()> {}; struct mega : prefix()> {}; struct giga : prefix()> {}; struct tera : prefix()> {}; struct peta : prefix()> {}; struct exa : prefix()> {}; struct zetta : prefix()> {}; struct yotta : prefix()> {}; } Other definitions for names units --------------------------------- For all of the above units the library also provides: - prefixed versions using SI prefixes:: namespace units::isq::si { struct millisecond : prefixed_unit {}; } - :ref:`framework/quantities:Quantity References (Experimental)`:: namespace units::isq::si { namespace time_references { inline constexpr auto s = reference{}; } namespace references { using namespace time_references; } - :ref:`framework/quantities:Unit-Specific Aliases (Experimental)`:: namespace units::aliases::isq::si::inline time { template using s = units::isq::si::time; } - :ref:`framework/quantities:User Defined Literals (Experimental)`:: namespace units::isq::si::inline literals { constexpr auto operator"" _q_s(unsigned long long l) { gsl_ExpectsAudit(std::in_range(l)); return time(static_cast(l)); } constexpr auto operator"" _q_s(long double l) { return time(l); } } For some of the units, when accepted by the :term:`SI`, other non-standard scaled versions are also provided:: namespace units::isq::si { struct minute : named_scaled_unit(), second> {}; struct hour : named_scaled_unit(), minute> {}; struct day : named_scaled_unit(), hour> {}; } Defining constants ------------------ [SIBrochure]_ states that: The definition of the SI units is established in terms of a set of seven defining constants. The complete system of units can be derived from the fixed values of these defining constants, expressed in the units of the SI. Those constants are provided in the *units/isq/si/constants.h* header file as:: namespace units::isq::si::si2019 { template inline constexpr auto hyperfine_structure_transition_frequency = frequency(Rep{9'192'631'770}); template inline constexpr auto speed_of_light = speed(299'792'458); template inline constexpr auto planck_constant = energy(6.62607015e-34) * time(1); template inline constexpr auto elementary_charge = electric_charge(1.602176634e-19); template inline constexpr auto boltzmann_constant = energy(1.380649e-23) / thermodynamic_temperature(1); template inline constexpr auto avogadro_constant = Rep(6.02214076e23) / amount_of_substance(1); template inline constexpr auto luminous_efficacy = luminous_flux(683) / power(1); } .. note:: Please note the nested `si2019` namespace. It is introduced in case those constants were changed/updated by the :term:`SI` in the future.