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
Clarify elsewhen initial #2647
Clarify elsewhen initial #2647
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -748,7 +748,7 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali | |||||||
(such as simulation or linearization). | ||||||||
|
||||||||
The equations of a when-clause are active during initialization, if and only if they are explicitly enabled with \lstinline!initial()!, and only in one of the two forms | ||||||||
\lstinline!when initial() then! or \lstinline!when {$\ldots$, initial(), $\ldots$} then! (and similarly for algorithms see below). In this case, the when-clause equations remain active during the | ||||||||
\lstinline!when initial() then! or \lstinline!when {$\ldots$, initial(), $\ldots$} then! (and similarly for \lstinline!elsewhen! and algorithms see below). In this case, the when-clause equations remain active during the | ||||||||
whole initialization phase. In case of a \lstinline!reinit(x, expr)! being active during initialization (due to being inside \lstinline!when initial()!) this is interpreted as adding | ||||||||
\lstinline!x = expr! (the \lstinline!reinit!-equation) as an initial equation. | ||||||||
|
||||||||
|
@@ -762,6 +762,15 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali | |||||||
\lstinline!when initial() then! or \lstinline!when {$\ldots$, initial(), $\ldots$} then!. In this case, the algorithmic statements within the when-statement remain active during the whole | ||||||||
initialization phase. | ||||||||
|
||||||||
An active when-clause inactivates the following \lstinline!elsewhen! (similarly as for when-clauses during simulation), but apart from that | ||||||||
the first \lstinline!elsewhen initial() then! or \lstinline!elsewhen {$\ldots$, initial(), $\ldots$} then! is similarly active during initialization as | ||||||||
\lstinline!when initial() then! or \lstinline!when {$\ldots$, initial(), $\ldots$} then!. | ||||||||
Comment on lines
+765
to
+767
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, maybe this was also included among the intended references of the see below above? I think we can say this more directly, if we go back to the first sentence:
|
||||||||
|
||||||||
\begin{nonnormative} | ||||||||
That means that any subsequent \lstinline!elsewhen initial()! has no effect, | ||||||||
similarly as \lstinline!when false then!. | ||||||||
Comment on lines
+770
to
+771
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we go as far as to speak of warnings?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I considered it, but there are (as indicated) other similar cases as well, and to me it looks odd if we discuss warnings for the obscure cases - and not for the simple ones; and thought it sufficed to say that it has no effect. |
||||||||
\end{nonnormative} | ||||||||
|
||||||||
\begin{nonnormative} | ||||||||
There is no special handling of inactive when-statements during initialization, instead | ||||||||
variables assigned in when-statements are initialized using \lstinline!v := pre(v)! | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose there should be an
elsewhen
clarification here as well, preserving the symmetry with the when-equations?