Skip to content

Commit

Permalink
Make absoluteValue inferred by default
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Jan 29, 2025
1 parent c507fb1 commit d7e0c29
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1476,16 +1476,20 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte

A simple type or component of a simple type may have:
\begin{lstlisting}[language=modelica]
/*literal*/ constant Boolean absoluteValue = true;
/*literal*/ constant Boolean absoluteValue;
\end{lstlisting}%
\annotationindex{absoluteValue}

If \lstinline!false!, then the variable defines a relative quantity, and if \lstinline!true! an absolute quantity.
If \lstinline!false!, then the component defines a relative quantity, and if \lstinline!true! an absolute quantity.
By default, the \lstinline!absoluteValue! status is inferred by the tool.

When converting between units (e.g., in plots and where parameters are edited), the unit offset must be ignored for relative quantities.
If the \lstinline!absoluteValue! of a component is neither determined by annotation nor inference, unit conversions that would differ depending on \lstinline!absoluteValue! cannot be performed.

\begin{nonnormative}
When converting between units (in the user-interface for plotting and entering parameters), the unit offset must be ignored for a variable defined with annotation \lstinline!absoluteValue = false!.
This annotation is used in the Modelica Standard Library, for example in \lstinline!Modelica.Units.SI! for the type definition \lstinline!TemperatureDifference!.
For most types there is no unit offset and the annotation is not needed for them.
For most quantities there are no units with offset, and the annotation is not needed.
For a component where unit conversions involving offsets could be of interest (mainly temperatures), ensuring that \lstinline!absoluteValue! is determined by an annotation (typically by means of using a type where it has been specified) may reduce impact of quality-of-implementation in tool ability to infer \lstinline!absoluteValue!.
Example applications of this annotation can be found among the type definitions in the \lstinline!Modelica.Units! package of the Modelica Standard Library, such as \lstinline!TemperatureDifference!.
\end{nonnormative}

A model or block definition may contain:
Expand Down

0 comments on commit d7e0c29

Please sign in to comment.