Skip to content
Get started

Quantities and units

Language overview

Write a physical dimension after : and an explicit unit after a number in square brackets. A dimension alias names a physical dimension; it does not rescale a value.

units.eqi
dimension Pressure = kg / (m * s ^ 2);
model UnitInputs() {
parameter pressure: Pressure = 210[GPa];
parameter duration: s = 10[ms];
parameter resistance: Ohm = 2[kOhm];
variable measured: Pressure;
relation specified { measured = pressure; }
}
Open the complete example source

These inputs are 210,000,000,000 Pa, 0.01 s, and 2000 ohms in coherent SI units. parameter duration: s = 0.01; describes the same duration as 10[ms].

Products, quotients, and exact rational powers of the SI base symbols describe dimensions. The base symbols are kg, m, s, A, K, mol, and cd; 1 is dimensionless. Common derived units give shorter equivalent spellings.

Quantity Derived unit Base dimensions
Force N kg * m / s^2
Pressure or stress Pa kg / (m * s^2)
Energy J kg * m^2 / s^2
Power W kg * m^2 / s^3
Voltage V kg * m^2 / (s^3 * A)
Resistance Ohm kg * m^2 / (s^3 * A^2)
Dynamic viscosity Pa * s kg / (m * s)

Symbols are case-sensitive: A is electric current, K is temperature, and s is time. For temperature values in these examples use kelvin.

Bare numeric declaration initializers inherit the declaration’s coherent SI unit. Instance bindings and general expressions do not inherit units:

eqi
instance resistor: electrical.Resistor(resistance = 2[kOhm]);

This fragment uses the electrical import from the electrical package example. 2 alone would be dimensionless in this binding.

Addition, subtraction, and the two sides of an equation must have matching dimensions. Multiplication combines dimensions; differentiation with respect to time divides by seconds. Thus derivative(temperature) has dimension K / s when temperature is a continuous state in kelvin.

A bare exact zero may take the other side’s dimension in an equation, so current = 0 is valid. Explicit 0[A] is often clearer.

vector<m / s, 2> describes two velocity components. It is distinct from both a scalar speed m / s and a three-component vector vector<m / s, 3>. Spatial operators also carry support information: a boundary trace is attached to a boundary of the original field’s body.

Continue with quantities, dimensions, and units for worked dimensional reasoning, or equations and state for periodic-clock time literals.