Skip to content

Commit

Permalink
Clarify that a when-clause cannot activate multiple reinit for the sa…
Browse files Browse the repository at this point in the history
…me variable
  • Loading branch information
henrikt-ma committed Sep 27, 2022
1 parent 0f1ed88 commit 5ac4773
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions chapters/equations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ \subsection{reinit}\label{reinit}
\lstinline!x! is a \lstinline!Real! variable (or an array of \lstinline!Real! variables) that must be selected as a state (resp., states), i.e.\ \lstinline!reinit! on \lstinline!x! implies \lstinline!stateSelect = StateSelect.always! on \lstinline!x!.
\lstinline!expr! needs to be type-compatible with \lstinline!x!.
For any given variable (possibly an array variable), \lstinline!reinit! can only be applied (either to an individual variable or to a part of an array variable) in one \lstinline!when!-equation (applying \lstinline!reinit! to a variable in several \lstinline!when!- or \lstinline!elsewhen!-clauses of the same \lstinline!when!-equation is allowed).
Multiple \lstinline!reinit! for a variable inside the same \lstinline!when!- or \lstinline!elsewhen!-clause must appear in different \lstinline!if!-equation branches (in order that at most one \lstinline!reinit! for the variable is active at any event).
In case of \lstinline!reinit! active during initialization (due to \lstinline!when initial()!), see \cref{initialization-initial-equation-and-initial-algorithm}.

\lstinline!reinit! does not break the single assignment rule, because \lstinline!reinit(x, expr)! in equations evaluates \lstinline!expr! to a value,
Expand Down

0 comments on commit 5ac4773

Please sign in to comment.