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 experiment using a record. #2999

Merged
merged 13 commits into from
Nov 21, 2023
25 changes: 15 additions & 10 deletions chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -383,20 +383,25 @@ \section{Annotations for Simulations}\label{annotations-for-simulations}
\end{center}

\begin{annotationdefinition}[experiment]
% henrikt-ma 2021-04: Seems strange to allow 'experiment' completely without list of options -- what would it mean?
\begin{synopsis}[grammar]\begin{lstlisting}
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
"experiment"
[ "(" [ experimentOption { "," experimentOption } ] ")" ]

experimentOption:
"StartTime" "=" [ "+" | "-" ] UNSIGNED-NUMBER
| "StopTime" "=" [ "+" | "-" ] UNSIGNED-NUMBER
| "Interval" "=" UNSIGNED-NUMBER
| "Tolerance" "=" UNSIGNED-NUMBER
annotation "experiment" "(" experimentModifiers ")"
\end{lstlisting}\end{synopsis}
\begin{semantics}
The \lstinline{experiment} annotation defines the default start time (\lstinline!StartTime!) in {[}s{]}, the default stop time (\lstinline!StopTime!) in {[}s{]}, the suitable time resolution for the result grid (\lstinline!Interval!) in {[}s{]}, and the default relative integration tolerance (\lstinline!Tolerance!) for simulation experiments to be carried out with the model or block at hand.
The modifiers are for the following record.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
\begin{lstlisting}[language=modelica]
record experiment
Real StartTime(unit = "s") = 0;
Real StopTime(unit = "s");
Real Interval(unit = "s") = $\ldots{}$;
Real Tolerance = $\ldots{}$;
end experiment;
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
\end{lstlisting}
The \lstinline!experiment! annotation defines the start time (\lstinline!StartTime!) in {[}s{]}, the stop time (\lstinline!StopTime!) in {[}s{]}, the suitable time resolution for the result grid (\lstinline!Interval!) in {[}s{]}, and the relative integration tolerance (\lstinline!Tolerance!) for simulation experiments to be carried out with the model or block at hand.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
Tools should use appropriate defaults for \lstinline!Interval! and \lstinline!Tolerance! instead of the $\ldots{}$.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
If \lstinline!StartTime! is not specified it is assumed to be \lstinline!0.0!.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved

If \lstinline!StopTime! is set the model should be a simulation model.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
Tools can allow users to override these settings without modifying the model.
\end{semantics}
\end{annotationdefinition}

Expand Down