Unless otherwise stated, the syntax and semantics of unit expressions in Modelica are conform with the international standards ISO 31/0-1992 ”General principles concerning quantities, units and symbols” and ISO 1000-1992 ”SI units and recommendations for the use of their multiples and of certain other units”. Unfortunately, neither these two standards nor other existing or emerging ISO standards define a formal syntax for unit expressions. There are recommendations and Modelica exploits them.
Examples for the syntax of unit expressions used in Modelica: ”N.m”, ”kg.m/s2”, ”kg.m.s-2” ”1/rad”, ”mm/s”.
The unit of measure of a dimension free quantity is denoted by ”1”. The ISO standard does not define any precedence between multiplications and divisions. The ISO recommendation is to have at most one division, where the expression to the right of ”/” either contains no multiplications or is enclosed within parentheses. It is also possible to use negative exponents, for example, ”J/(kg.K)” may be written as ”J.kg-1.K-1”.
The ISO standard allows that a multiplication operator symbol is left out. However, Modelica enforces the ISO recommendation that each multiplication operator is explicitly written out in formal specifications. For example, Modelica does not support ”Nm” for newtonmeter, but requires it to written as ”N.m”.
The preferred ISO symbol for the multiplication operator is a ”dot” a bit above the base line: ”·”. Modelica supports the ISO alternative ”.”, which is an ordinary ”dot” on the base line.
The ISO standard does not define any operator symbol for exponentiation. A unit_factor consists of a unit_operand possibly suffixed by a possibly signed integer number, which is interpreted as an exponent. There must be no spacing between the unit_operand and a possible unit_exponent.
A unit_symbol is a string of letters. A basic support of units in Modelica should know the basic and derived units of the SI system. It is possible to support user defined unit symbols. In the base version Greek letters is not supported, but full names must then be written, for example ”Ohm”.
A unit_operand should first be interpreted as a unit_symbol and only if not successful the second alternative assuming a prefixed operand should be exploited. There must be no spacing between the unit_symbol and a possible unit_prefix. The values of the prefixes are according to the ISO standard. The letter ”u” is used as a symbol for the prefix micro.
The unit expression ”m” means meter and not milli (10-3), since prefixes cannot be used in isolation. For millimeter use ”mm” and for squaremeter, m2, write ”m2”.
The expression ”mm2” means mm2 = (10-3m)2 = 10-6m2. Note that exponentiation includes the prefix.
The unit expression ”T” means Tesla, but note that the letter ”T” is also the symbol for the prefix tera which has a multiplier value of 1012.