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

Define more annotations as declarations #3448

Merged
merged 40 commits into from
Nov 6, 2024
Merged
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
52750bf
More consistent non-syntax variant of definining annotations.
HansOlsson Nov 21, 2023
7842e89
Need mathescape
HansOlsson Nov 21, 2023
efff72f
Remove bindings for these as well.
HansOlsson Nov 22, 2023
0d29c5f
Explain what annotation definitions mean.
HansOlsson Dec 1, 2023
65505e9
Apply it to the new annotations and some old.
HansOlsson Dec 1, 2023
b107f81
Reduce it further
HansOlsson Dec 1, 2023
d07b419
Apply suggestions from code review
HansOlsson Jan 5, 2024
5d43d23
Add description of what a default value in record means.
HansOlsson Jan 5, 2024
1aafeb5
Use constant instead of parameter for the time being.
HansOlsson Jan 23, 2024
61349fa
Add constant everywhere where applicable, and parameter for the speci…
HansOlsson Jan 23, 2024
32cc58d
Move how-to-interpret earlier in the chapter.
HansOlsson Jan 23, 2024
93d01eb
Add note about annotation-syntax in Introduction.
HansOlsson Jan 23, 2024
498839d
According to comments.
HansOlsson Feb 15, 2024
ddd8df9
According to decision, add comment in front.
HansOlsson Feb 22, 2024
8bc28a8
Apply suggestions from code review
HansOlsson Mar 12, 2024
4ef0f65
More advanced suggestions from code review.
HansOlsson Mar 12, 2024
65f4cf4
Update chapters/annotations.tex
HansOlsson Mar 12, 2024
0ccd6f4
Merge branch 'master' into AnnotationVars
HansOlsson Mar 12, 2024
c59e23b
Update chapters/annotations.tex
HansOlsson Mar 14, 2024
94b19aa
Rename new label.
HansOlsson Mar 14, 2024
3fdffb9
Apply suggestions from code review
HansOlsson Mar 14, 2024
73f5d9e
Cleanup based on comments.
HansOlsson Mar 14, 2024
d89907c
WSRemoval
HansOlsson Mar 15, 2024
8f5ca14
Update chapters/annotations.tex
HansOlsson Apr 8, 2024
e4ab6b7
Clarify missing values.
HansOlsson May 31, 2024
970ff5b
Merge branch 'master' into AnnotationVars
HansOlsson Jun 18, 2024
d17708f
Apply suggestions from code review
HansOlsson Jun 27, 2024
9fc1b4d
ReorderAsSuggested
HansOlsson Jun 27, 2024
81816cc
Apply suggestions from code review
HansOlsson Jul 1, 2024
93e6e96
DefaultForDocumentationClass
HansOlsson Jul 1, 2024
e0283ff
DefaultViewHandling
HansOlsson Jul 1, 2024
4e13161
DefaultValue
HansOlsson Jul 1, 2024
d6dd28f
SingleInstanceReformulation
HansOlsson Jul 1, 2024
aa6ce47
Remove the problematic defaults.
HansOlsson Sep 10, 2024
41f9c57
Apply suggestions from code review
HansOlsson Oct 6, 2024
f3ce16e
Update chapters/annotations.tex
HansOlsson Oct 6, 2024
d8ec36a
Update chapters/annotations.tex
HansOlsson Oct 7, 2024
de2bb83
Update chapters/annotations.tex
HansOlsson Oct 7, 2024
ff1af18
From review.
HansOlsson Oct 7, 2024
834c440
Merge branch 'master' into AnnotationVars
HansOlsson Nov 6, 2024
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
59 changes: 30 additions & 29 deletions chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ \section{Symbolic Processing}\label{annotations-for-symbolic-processing}\label{s
\end{center}

\begin{annotationdefinition}[Evaluate]
\begin{synopsis}[grammar]\begin{lstlisting}
"Evaluate" "=" ( false | true )
\begin{synopsis}\begin{lstlisting}
Boolean Evaluate;
\end{lstlisting}\end{synopsis}
\begin{semantics}
The annotation \lstinline!Evaluate! can occur in the component declaration, its type declaration, or a base class of the type-declaration.
Expand Down Expand Up @@ -478,8 +478,8 @@ \section{Simulations}\label{annotations-for-simulations}\label{simulations}
\end{annotationdefinition}

\begin{annotationdefinition}[HideResult]
\begin{synopsis}[grammar]\begin{lstlisting}
"HideResult" "=" ( false | true )
\begin{synopsis}\begin{lstlisting}
Boolean HideResult;
\end{lstlisting}\end{synopsis}
\begin{semantics}
\lstinline!HideResult = true! defines that the model developer proposes to not show the simulation results of the corresponding component.
Expand All @@ -495,8 +495,10 @@ \section{Simulations}\label{annotations-for-simulations}\label{simulations}
\end{annotationdefinition}

\begin{annotationdefinition}[TestCase]
\begin{synopsis}[grammar]\begin{lstlisting}
"TestCase" "(" "shouldPass" "=" ( false | true ) ")"
\begin{synopsis}\begin{lstlisting}
record TestCase
Boolean shouldPass;
end TestCase;
\end{lstlisting}\end{synopsis}
\begin{semantics}
If \lstinline!shouldPass! is \lstinline!false! it indicates that the translation or the simulation of the model should fail.
Expand All @@ -518,7 +520,7 @@ \subsection{Single Use of Class}\label{annotation-for-single-use-of-class}\label
For state machines it is useful to have single instances of local classes.
This can be done using:
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
\begin{lstlisting}[language=modelica]
annotation(singleInstance = true)
Boolean singleInstance = true;
\end{lstlisting}
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved

The annotation \fmtannotationindex{singleInstance} in a class indicates that there should only be one component instance of the class, and it should be in the same scope as the class is defined.
Expand All @@ -527,8 +529,8 @@ \subsection{Single Use of Class}\label{annotation-for-single-use-of-class}\label
\subsection{Connection Restrictions}\label{connection-restrictions}

A connector component declaration may have the following annotation:
\begin{lstlisting}[language=modelica]
annotation(mustBeConnected = "message");
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String mustBeConnected = "$\mathit{message}$";
\end{lstlisting}%
\annotationindex{mustBeConnected}

Expand All @@ -555,8 +557,8 @@ \subsection{Connection Restrictions}\label{connection-restrictions}
\end{example}

A connector component declaration may have the following annotation:
\begin{lstlisting}[language=modelica]
annotation(mayOnlyConnectOnce = "message");
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String mayOnlyConnectOnce = "$\mathit{message}$";
\end{lstlisting}%
\annotationindex{mayOnlyConnectOnce}

HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -1254,16 +1256,15 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte

This section describes the annotations that are used to define properties of the graphical user interface.

\begin{lstlisting}[language=modelica]
annotation(preferredView = $\mathit{view}$)
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String preferredView = $\mathit{view}$;
\end{lstlisting}

The \fmtannotationindex{preferredView} annotation defines the default view when selecting the class.
The $\mathit{view}$ is a \lstinline!String! literal where \lstinline!"info"! means class documentation (``information''), \lstinline!"diagram"! means diagram view, \lstinline!"icon"! means icon view, and \lstinline!"text"! means Modelica source code (``text'').

\begin{lstlisting}[language=grammar]
documentation-class-annotation:
annotation "(" DocumentationClass "=" true ")"
\begin{lstlisting}
Boolean DocumentationClass = true;
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
\end{lstlisting}%
\annotationindex{DocumentationClass}

Expand All @@ -1275,17 +1276,17 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte
of the class names, and if no icon is defined, a special information default icon may be displayed in the package browser.
\end{nonnormative}

\begin{lstlisting}[language=modelica]
annotation(defaultComponentName = "name")
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String defaultComponentName = "$\mathit{name}$";
\end{lstlisting}%
\annotationindex{defaultComponentName}

When creating a component of the given class, the recommended component name is \emph{name}.
If the default name cannot be used (e.g., since it is already in use), another name based on \lstinline!defaultComponentName! shall be derived automatically, except as described under \lstinline!defaultComponentPrefixes!.
When automatically deriving a name, any trailing `\lstinline!1!' in the \lstinline!defaultComponentName! shall be disregarded.

\begin{lstlisting}[language=modelica]
annotation(defaultComponentPrefixes = "prefixes")
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String defaultComponentPrefixes = "$\mathit{prefixes}$";
\end{lstlisting}%
\annotationindex{defaultComponentPrefixes}

Expand All @@ -1303,8 +1304,8 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte
and the default name cannot be used (e.g., since it is already in use) it is recommended to give a diagnostic.
\end{nonnormative}

\begin{lstlisting}[language=modelica]
annotation(missingInnerMessage = "message")
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String missingInnerMessage = "$\mathit{message}$";
\end{lstlisting}%
\annotationindex{missingInnerMessage}

Expand All @@ -1330,7 +1331,7 @@ \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]
annotation(absoluteValue = false);
Boolean absoluteValue;
\end{lstlisting}%
\annotationindex{absoluteValue}

Expand All @@ -1343,7 +1344,7 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte

A model or block definition may contain:
\begin{lstlisting}[language=modelica]
annotation(defaultConnectionStructurallyInconsistent = true)
Boolean defaultConnectionStructurallyInconsistent;
\end{lstlisting}%
\annotationindex{defaultConnectionStructurallyInconsistent}

Expand All @@ -1357,8 +1358,8 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte
\end{nonnormative}

A class may have the following annotation:
\begin{lstlisting}[language=modelica]
annotation(obsolete = "message");
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String obsolete = "$\mathit{message}$";
\end{lstlisting}%
\annotationindex{obsolete}

Expand All @@ -1367,12 +1368,12 @@ \section{Graphical User Interface}\label{annotations-for-the-graphical-user-inte
If that is not possible the current class can have also have an \lstinline!obsolete! annotation.

A component declaration may have the following annotation:
\begin{lstlisting}[language=modelica]
annotation(unassignedMessage = "message");
\begin{lstlisting}[language=modelica, mathescape=true]
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
String unassignedMessage = "$\mathit{message}$";
\end{lstlisting}%
\annotationindex{unassignedMessage}

When the variable to which this annotation is attached in the declaration cannot be computed due to the structure of the equations, the string \lstinline!"message"! can be used as a diagnostic message.
When the variable to which this annotation is attached in the declaration cannot be computed due to the structure of the equations, the string \lstinline!"$\mathit{message}$"! can be used as a diagnostic message.

\begin{nonnormative}
When using BLT partitioning, this means if a variable \lstinline!a! or one of its aliases \lstinline!b = a! or \lstinline!b = -a!
Expand Down