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

Detailed when #3532

Merged
merged 8 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 4 additions & 0 deletions chapters/equations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ \subsubsection{Equations within When-Equations}\label{restrictions-on-equations-
end when;
\end{lstlisting}
Here, variable \lstinline!y! is held constant when the \lstinline!when!-equation is deactivated and \lstinline!x! is computed from the first equation using the value of \lstinline!y! from the previous event instant.
Note that during event iterations \lstinline!y! will be solved from a system of two equations.
\end{nonnormative}

\begin{example}
Expand Down Expand Up @@ -793,6 +794,9 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali

Before the start of the integration, it must be guaranteed that for all variables \lstinline!v!, \lstinline!v = pre(v)!.
If this is not the case for some variables \lstinline!vi!, \lstinline!pre(vi) := vi! must be set and an event iteration at the initial time must follow, so the model is re-evaluated, until this condition is fulfilled.
In detail this means that during initialization initial equations and normal equations are solved with \lstinline!v! and \lstinline!pre(v)! as unknowns without any event iterations.
Then only the normal equations are solved repeatedly (each time after \lstinline!v! is copied to \lstinline!pre(v)!) until \lstinline!v = pre(v)!.
Tools may optimize this to not compute unnecessary \lstinline!pre(v)! and only perform the event iteration if necessary.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved

A Modelica translator may first transform the continuous equations of a model, at least conceptually, to state space form.
This may require to differentiate equations for index reduction, i.e., additional equations and, in some cases, additional unknown variables are introduced.
Expand Down
6 changes: 3 additions & 3 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ \section{Pure Modelica Functions}\label{pure-modelica-functions}
Binding equations for external objects.
\end{itemize}

For initial equations, initial algorithms, and bindings it is an error
if the function calls are part of systems of equations and thus have to
be called multiple times.
It is an error if an impure function call is part of a systems of equations (including linear systems), even if called in agreement with the restrictions above.
The reason is that solving systems of equations generally require expressions to be evaluated an unknown number of times.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
This includes the special handling of \lstinline!when initial()! during initialization.

\begin{nonnormative}
A tool is not allowed to perform any optimizations on function
Expand Down