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

Initialization of clocked variables in algorithms. #3602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ \subsection{An Algorithm in a Model}\label{execution-of-an-algorithm-in-a-model}
A continuous-time variable is initialized with the value of its \lstinline!start!-attribute.
\item
A discrete-time variable \lstinline!v! is initialized with \lstinline!pre(v)!.
\item
A clocked variable \lstinline!v! in a discrete-time sub-partition, \cref{clocked-and-discretized-partition}, is initialized with \lstinline!previous(v)!.
\item
If at least one element of an array appears on the left hand side of the assignment operator, then the complete array is initialized in this algorithm section.
\item
Expand All @@ -45,6 +47,8 @@ \subsection{An Algorithm in a Model}\label{execution-of-an-algorithm-in-a-model}
Initialization is performed, in order that an algorithm section cannot introduce a ``memory'' (except in the case of discrete-time variables assigned in the algorithm), which could invalidate the assumptions of a numerical integration algorithm.
Note, a Modelica tool may change the evaluation of an algorithm section, provided the result is identical to the case, as if the above conceptual processing is performed.

For a clocked variables it is important to skip this initialization when not needed, in order to avoid an excessive amount of clocked states, \cref{clocked-state-variables}.

An algorithm section is treated as an atomic vector-equation, which is sorted together with all other equations.
For the sorting process (BLT), every algorithm section with N different left-hand side variables, is treated as an atomic N-dimensional vector-equation containing all variables appearing in the algorithm section.
This guarantees that all N equations end up in an algebraic loop and the statements of the algorithm section remain together.
Expand Down