Skip to content
Get started

Quantities and units

Language overview · Install this source revision

Write a physical dimension after :. Products, quotients and exact rational powers of SI base symbols describe dimensions; numerical declaration values use the corresponding coherent SI units. The symbols are kg, m, s, A, K, mol and cd; 1 is dimensionless. A dimension alias abbreviates a dimension, not a value conversion.

units.eqi
dimension Pressure = kg / (m * s ^ 2);
model PressureInput(parameter pressure: Pressure = 210e9) {
variable measured: Pressure;
relation specified { measured - pressure = 0; }
}

Here 210e9 is 210,000,000,000 Pa, or 210 GPa. The alias Pressure does not rescale the number. To enter 10 ms, write parameter duration: s = 10 [ms];, or use the coherent value 0.01. Explicit compatible units convert to the declared dimension. Bare numeric declaration initializers inherit its coherent unit; arbitrary expressions and instance bindings do not inherit units.

Physical quantity Dimension spelling
Pressure or stress, Pa kg / (m * s ^ 2)
Voltage, V kg * m ^ 2 / (s ^ 3 * A)
Resistance, ohm kg * m ^ 2 / (s ^ 3 * A ^ 2)
Dynamic viscosity, Pa·s kg / (m * s)

The standard declarations use these dimensions. Case matters: A is electric current and s is time. Addition and subtraction require matching dimensions. The declaration example keeps voltage and resistance distinct even though both are scalar numbers.

Periodic clocks use their separate exact rational-time spelling; see Equations and state.

Example source · dimension checker · Next: Equations and state