Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make absoluteValue inferred by default #3645

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1529,12 +1529,17 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte
\end{lstlisting}\end{synopsis}
\begin{semantics}
Allowed for simple types and components of a simple types.
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.
When converting between units (e.g., in plots and where parameters are edited), the unit offset must be ignored for relative quantities.
The annotation is inherited in the sense that when \lstinline!absoluteValue! is defined for a simple type, it also applies to components declared with the type, as well as derived classes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we use inheritance for the base-class relation (the latter part of this) not for "instantiating" a component, so couldn't we find a better word than "inherited" here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, here is a simple rewrite with a bit of repetition instead:

Suggested change
The annotation is inherited in the sense that when \lstinline!absoluteValue! is defined for a simple type, it also applies to components declared with the type, as well as derived classes.
The annotation is inherited in the sense that when \lstinline!absoluteValue! is defined for a simple type, it also applies derived classes.
When \lstinline!absoluteValue! is defined for a simple type, it also applies to components declared with the type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drawback of not calling it inheritance in both cases is that we then lose the ability to refer to both mechanisms in a compact manner such as (possibly through inheritance). In view of this, I would actually prefer to call it inheritance in both cases. After all, we are defining what inheritance means separately for each annotation where some sort of inheritance takes place.


When \lstinline!absoluteValue! of a component is not determined by an annotation (possibly through inheritance), the \lstinline!absoluteValue! status may be inferred by the tool.
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}
\end{semantics}
\end{annotationdefinition}
Expand Down