Skip to content

Parameterized quantities #475

@JohelEGP

Description

@JohelEGP

Parameterized quantities

I have identified 2 kinds of parameterized quantities.

Same quantity name for different quantities

This kind of quantity shares its name between different quantities in the parts of ISO 80000.
For example:

QUANTITY_SPEC(power, force* velocity, quantity_character::scalar);

// QUANTITY_SPEC(power, voltage* electric_current); // TODO conflicts with mechanical power

Same quantity, actually parameterized

Some quantities from ISO 80000-7:2019 (light and radiation)
are parameterized on a photometric condition.

Amount of substance is parameterized on “elementary entity” (ISO 80000-9:2019 9.2).
And thus many quantities in part 9 are equally parameterized.
The standard has some remarks on the structure of an “elementary entity”.
Like #35 (comment),

It would also help to have the input from people familiar with the domain.

Previous work

I had previously started a code specification for the quantities,
and this is how I did it.

struct context { };
inline constexpr context mechanics;
inline constexpr context thermodynamics;
inline constexpr context electromagnetism;
inline constexpr context light_and_optical_radiation;
inline constexpr context radiometry;
inline constexpr context acoustics;
inline constexpr context in_a_mixture;
inline constexpr context in_a_solution;
inline constexpr context pressure_basis;
inline constexpr context concentration_basis;
inline constexpr context atomic_physics;
inline constexpr context ionizing_radiation;

struct photometric_condition { };
inline constexpr photometric_condition photopic_vision = {};
inline constexpr photometric_condition scotopic_vision = {};
inline constexpr photometric_condition mesopic_vision  = {};

template<const context&> extern const quantity efficiency;
template<const context&> extern const quantity power;
template<const photometric_condition&> extern const quantity luminous_efficacy_of_radiation;
template<const photometric_condition&> extern const quantity maximum_luminous_efficacy;
template<const context& = light_and_optical_radiation> extern const quantity reflectance;
template<const context& = light_and_optical_radiation> extern const quantity transmittance;
template<const context&> extern const quantity linear_attenuation_coefficient;
template<const context&> extern const quantity mass_attenuation_coefficient;
template<const context&> extern const quantity standard_absolute_activity;
template<const context&> extern const quantity equilibrium_constant;
template<const context&> extern const quantity magnetic_dipole_moment;
template<const context&> extern const quantity radiant_energy;

// ### ISO 80000-4:2019, Part 4: Mechanics.
template<> inline constexpr auto power<mechanics> = defn<"𝘗", "𝘗 = 𝙁 ⋅ 𝙫", force("𝙁"), velocity("𝙫")>();

// ### IEC 80000-6:2008, Part 6: Electromagnetism.
inline constexpr auto power<electromagnetism> = defn<"𝘱", "𝘱 = 𝘶𝘪", voltage("𝘶"), electric_current("𝘪")>();

// ### ISO 80000-9:2019, Part 9: Physical chemistry and molecular physics.
inline constexpr auto number_of_entities   = defn<"𝘕(X)", "dim 𝘕(X) = 1">();
inline constexpr auto amount_of_substance  = defn<"𝘯(X)", "𝘯(X) = 𝘕(X)/𝘕_A", number_of_entities("𝘕(X)"), Avogadro_constant("𝘕_A")>();

template<> inline constexpr auto standard_absolute_activity<in_a_mixture> = defn<"𝜆_X^⊝", "𝜆_X^⊝ = 𝜆 ⃰_X(𝘱^⊝)", "𝘱^⊝ = 10⁵ Pa", absolute_activity("𝜆_X"), pressure("𝘱")>();

template<> inline constexpr auto standard_absolute_activity<in_a_solution> = defn<"𝜆_B^⊝", "𝜆_B^⊝ = lim_{∑𝘣_B→0}[𝜆_B((𝘱^⊝)𝘣^⊝/𝘣_B)]", "𝘱^⊝ = 10⁵ Pa", molality("𝘣"), absolute_activity("𝜆_B"), pressure("𝘱")>();

template<> inline constexpr auto equilibrium_constant<pressure_basis>      = defn<"𝘒_𝘱", "𝘒_𝘱 = ∏_B(𝘱_B)^{𝘷_B}", partial_pressure("𝘱"), stoichiometric_number_of_substance("𝘷_B")>();
template<> inline constexpr auto equilibrium_constant<concentration_basis> = defn<"𝘒_𝘤", "𝘒_𝘤 = ∏_B(𝘤_B)^{𝘷_B}", particle_concentration("𝘤"), stoichiometric_number_of_substance("𝘷_B")>();
  • The quantity above is not mp_units::quantity.
  • Those quantity templates are forward declarations.
    If it's parameterized on a context, it's later explicitly specialized.
    If it's parameterized on a photometric_condition,
    it's because it's used before it's defined by another parameterized quantity.
  • As is evident, I didn't get around implementing the structure of an “elementary entity” X.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions