Skip to content

Commit

Permalink
Sentence-based line breaks and basic formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 6, 2021
1 parent 547d8c9 commit d617ab8
Showing 1 changed file with 29 additions and 50 deletions.
79 changes: 29 additions & 50 deletions chapters/unitexpressions.tex
@@ -1,20 +1,12 @@
\chapter{Unit Expressions}\label{unit-expressions}

Unless otherwise stated, the syntax and semantics of unit expressions in
Modelica conform with the international standards
\emph{International System of Units (SI)} by BIPM superseding parts of
ISO 31/0-1992
\emph{General principles concerning quantities, units and symbols} and ISO
1000-1992 \emph{SI units and recommendations for the use of their multiples
and of certain other units}.
Unfortunately, these standards do not define a formal syntax for
unit expressions. There are recommendations and Modelica exploits them.

Note that this document uses the American spelling meter, whereas the SI specification from BIPM uses the British spelling metre.

Examples for the syntax of unit expressions used in Modelica: \lstinline!"N.m"!,
\lstinline!"kg.m/s2"!, \lstinline!"kg.m.s-2"! \lstinline!"1/rad"!,
\lstinline!"mm/s"!.
Unless otherwise stated, the syntax and semantics of unit expressions in Modelica conform with the international standards \emph{International System of Units (SI)} by BIPM superseding parts of ISO 31/0-1992 \emph{General principles concerning quantities, units and symbols} and ISO 1000-1992 \emph{SI units and recommendations for the use of their multiples and of certain other units}.
Unfortunately, these standards do not define a formal syntax for unit expressions.
There are recommendations and Modelica exploits them.

Note that this document uses the American spelling \emph{meter}, whereas the SI specification from BIPM uses the British spelling \emph{metre}.

Examples for the syntax of unit expressions used in Modelica: \lstinline!"N.m"!, \lstinline!"kg.m/s2"!, \lstinline!"kg.m.s-2"!, \lstinline!"1/rad"!, \lstinline!"mm/s"!.

\section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}

Expand All @@ -29,11 +21,9 @@ \section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}
unit_factor | "(" unit_expression ")"
\end{lstlisting}

The unit of measure of a dimension free quantity is denoted by \lstinline!"1"!. The
SI standard does not define any precedence between multiplications and
divisions. The SI standard does not allow multiple units to the right of the
division-symbol (\lstinline!/!) since the result is ambiguous; either the divisor shall be enclosed in parentheses,
or negative exponents used instead of division, for example, \lstinline!"J/(kg.K)"! may be written as \lstinline!"J.kg-1.K-1"!.
The unit of measure of a dimension free quantity is denoted by \lstinline!"1"!.
The SI standard does not define any precedence between multiplications and divisions.
The SI standard does not allow multiple units to the right of the division-symbol (\lstinline!/!) since the result is ambiguous; either the divisor shall be enclosed in parentheses, or negative exponents used instead of division, for example, \lstinline!"J/(kg.K)"! may be written as \lstinline!"J.kg-1.K-1"!.

\begin{lstlisting}[language=grammar]
unit_factors:
Expand All @@ -43,12 +33,11 @@ \section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}
"."
\end{lstlisting}

The SI standard specifies that a multiplication operator symbol is written as space
or as a dot. The SI standard requires that this \emph{dot} is a bit above the base line: `·', which is not part of ASCII.
The SI standard specifies that a multiplication operator symbol is written as space or as a dot.
The SI standard requires that this \emph{dot} is a bit above the base line: `·', which is not part of ASCII.
The ISO standard also prefers `·', but Modelica supports the ISO alternative `.', which is an ordinary \emph{dot} on the base line.

For example, Modelica does not support \lstinline!"Nm"! for newton-meter,
but requires it to be written as \lstinline!"N.m"!.
For example, Modelica does not support \lstinline!"Nm"! for newton-meter, but requires it to be written as \lstinline!"N.m"!.

\begin{lstlisting}[language=grammar]
unit_factor:
Expand All @@ -59,10 +48,8 @@ \section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}
\end{lstlisting}

The SI standard uses super-script for the exponentation, and does thus not define any operator symbol for exponentiation.
A \lstinline!unit_factor! consists of a \lstinline!unit_operand! possibly suffixed by a
possibly signed integer number, which is interpreted as an exponent.
There must be no spacing between the \lstinline!unit_operand! and a possible
\lstinline!unit_exponent!.
A \lstinline!unit_factor! consists of a \lstinline!unit_operand! possibly suffixed by a possibly signed integer number, which is interpreted as an exponent.
There must be no spacing between the \lstinline!unit_operand! and a possible \lstinline!unit_exponent!.

\begin{lstlisting}[language=grammar]
unit_operand:
Expand All @@ -72,34 +59,26 @@ \section{The Syntax of Unit Expressions}\label{the-syntax-of-unit-expressions}
Y | Z | E | P | T | G | M | k | h | da | d | c | m | u | n | p | f | a | z | y
\end{lstlisting}

A \lstinline!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 \lstinline!"Ohm"!.
A \lstinline!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 \lstinline!"Ohm"!.

A \lstinline!unit_operand! should first be interpreted as a \lstinline!unit_symbol! and only
if not successful the second alternative assuming a prefixed operand
should be exploited. There must be no spacing between the \lstinline!unit_symbol!
and a possible \lstinline!unit_prefix!. The values of the prefixes are according to
the ISO standard. The letter \lstinline!u! is used as a symbol for the prefix
micro.
A \lstinline!unit_operand! should first be interpreted as a \lstinline!unit_symbol! and only if not successful the second alternative assuming a prefixed operand should be exploited.
There must be no spacing between the \lstinline!unit_symbol! and a possible \lstinline!unit_prefix!.
The values of the prefixes are according to the ISO standard.
The letter \lstinline!u! is used as a symbol for the prefix micro.

\begin{nonnormative}
A tool may present \lstinline!Ohm! as $\Omega$ and the prefix \lstinline!u! as $\mu$, and similarly \lstinline!m2! as $m^2$.
A tool may present \lstinline!Ohm! as $\Omega$ and the prefix \lstinline!u! as $\mu$, and similarly \lstinline!m2! as m\textsuperscript{2}.
\end{nonnormative}

\section{Examples}\label{examples2}

The unit expression \lstinline!"m"! means meter and not milli
(10\textsuperscript{-3}), since prefixes cannot be used in isolation.
For millimeter use \lstinline!"mm"! and for square meter, m\textsuperscript{2}, write
\lstinline!"m2"!.
The unit expression \lstinline!"m"! means meter and not milli (10\textsuperscript{-3}), since prefixes cannot be used in isolation.
For millimeter use \lstinline!"mm"! and for square meter, m\textsuperscript{2}, write \lstinline!"m2"!.

The expression \lstinline!"mm2"! means (10\textsuperscript{-3}m)2 =
10\textsuperscript{-6}m\textsuperscript{2}. Note that exponentiation
includes the prefix.
The expression \lstinline!"mm2"! means (10\textsuperscript{-3}m)\textsuperscript{2} = 10\textsuperscript{-6}m\textsuperscript{2}.
Note that exponentiation includes the prefix.

The unit expression \lstinline!"T"! means tesla, but note that the letter \lstinline!T! is
also the symbol for the prefix tera which has a multiplier value of
10\textsuperscript{12}.
The unit expression \lstinline!"T"! means tesla, but note that the letter \lstinline!T! is also the symbol for the prefix tera which has a multiplier value of 10\textsuperscript{12}.

0 comments on commit d617ab8

Please sign in to comment.