Support substances
Summary
Some units, such as moles of material, require the unit system to track not only the unit (mole) but the substance as well since mol(H2)
≠ mol(CH4)
.
We could treat each substance (i.e., a unique string token that is otherwise opaque to the units library) as its own dimension. That would make mol
not a unit, but a unit "template" that could be applied to any dimension.
Details
Dimension templates
Some dimensions – most importantly substance (e.g., the number of molecules of a particular composition) – are not really a single dimension but a template for any number of dimensions. The dimension-template takes a parameter specifying the nature to be measured; in our example of substance, the parameter is the composition of the substance.
These dimensions must then be measured with unit scales that are themselves templates. One cannot write "mol" in unit expressions; the substance must be included: mol<H2O>
or mol<NaCl>
.
Thus, we need a way to declare the extant set of parameters being tracked (e.g., H2O
, NaCl
, NaOH
, and so on). We also want to group parameters by the "space" they are members of. The substances above are might live in a substance
space but a different dimension might be parameterized on currencies and have parameters such as $
, ₤
, ₣
, and so on. Thus, when we declare a dimension template, we want to specify
a name for the parameter-space and as we instantiate the template we want to add the parameters to the parameter-space.
Unit templates
Once we have dimension templates, we obviously want unit templates. A unit template parameter might be passed on to the dimension (as with moles of substance) or it might be consumed by the unit itself. An example of this is the Bel scale (see #4); it is not technically a unit itself but instead a transformation that can be applied to another unit (be it acoustic pressure, electrical flux density, or power).
Examples
Specific dimension templates we wish to consider:
-
substance
(parameterized on molecular composition). -
state
(parameterized on thermodynamic equations of state).- For example, one might provide density for an ideal gas at a particular thermodynamic state:
10 kg/m³ @ 25⁰C
. - Another example: specify a reaction rate at a given temperature
mol<H₂O>/L/s @ 100⁰C
.
- For example, one might provide density for an ideal gas at a particular thermodynamic state:
-
currency
(parameterized on standard of value) -
epoch
(time differences parameterized on a particular "zero" time):10 min<since 1970>
.
Specific unit templates we wish to support:
-
Bel<T>
(parameterized on another unit whose dimension it assumes) with dimensionT
-
katal<T>
(parameterized on molecular composition) with dimensionsubstance<T> / time
-
mol<T>
(parameterized on molecular composition) with dimensionsubstance<T>