Skip to content

Commit

Permalink
Improve start-value priority by considering parameters.
Browse files Browse the repository at this point in the history
And add example.
Closes modelica#3008
  • Loading branch information
HansOlsson committed Oct 15, 2021
1 parent 547d8c9 commit 530ea2f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions chapters/equations.tex
Expand Up @@ -887,4 +887,31 @@ \subsection{Recommended selection of start values}\label{recommended-selection-o
The model component hierarchy level number is used to give \lstinline!start!-attribute a confidence number, where a lower number means that the \lstinline!start!-attribute is more confident.
Loosely, if the \lstinline!start!-attribute is set or modified on level $i$ then the confidence number is $i$.
If a \lstinline!start!-attribute is set by a possibly hierarchical modifier at the top level, then this \lstinline!start!-attribute has the highest confidence, namely 1 irrespectively on what level, the variable itself is declared.
In case this process is \emph{tied} and at least one of the \lstinline!start!-attributes is equal to a parameter, which may be equal to another parameter (etc), the confidence number is propagated through these bindings and used to break the tie.
Note that this is only applied if the expression is exactly the parameter - not an expression depending on one or more parameters.

\begin{example}
\begin{lstlisting}[language=modelica]
model M1
Real x(start = 4.0);
Real y(start = 5.0);
equation
x=y;
end M1;
model M2
parameter Real xStart = 4.0;
parameter Real yStart = 5.0;
Real x(start = xStart);
Real y(start = yStart);
equation
x=y;
end M2;
M1 m1(x(start = 3.0));
// Using m1.x.start = 3.0 with confidence number 1
// over m1.y.start = 5.0 with confidence number 2.
M2 m2(xStart = 3.0);
// Using m2.x.start = m2.xStart = 3.0 with confidence number 2, and tie-breaker 1
// over m2.y.start = m2.yStart = 5.0 with confidence number 2, and tie-breaker 1
\end{lstlisting}
\end{example}
\end{nonnormative}

0 comments on commit 530ea2f

Please sign in to comment.