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

Move and add reference to rule about constants having declaration equation #2960

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions chapters/classes.tex
Expand Up @@ -358,6 +358,10 @@ \subsection{Component Variability Prefixes discrete, parameter, constant}\label{
not differentiable.
\end{itemize}

Components declared as \lstinline!constant! shall have an associated declaration equation with a constant expression, if the constant is directly in the simulation model, or used in the simulation model.
The value of a constant can be modified after it has been given a value, unless the constant is declared \lstinline!final! or modified with a \lstinline!final! modifier.
A constant without an associated declaration equation can be given one by using a modifier.

If a \lstinline!Real! variable is declared with the prefix \lstinline!discrete!\indexinline{discrete} it must in a simulation model be assigned in a \lstinline!when!-clause, either by an assignment or an equation.
The variable assigned in a \lstinline!when!-clause shall not be defined in a sub-component of \lstinline!model! or \lstinline!block! specialized class.
(This is to keep the property of balanced models.)
Expand Down
10 changes: 6 additions & 4 deletions chapters/equations.tex
Expand Up @@ -722,6 +722,7 @@ \section{Events and Synchronization}\label{events-and-synchronization}
verification already at compile time.
\end{nonnormative}


\section{Initialization, initial equation, and initial algorithm}\label{initialization-initial-equation-and-initial-algorithm}

Before any operation is carried out with a Modelica model (e.g., simulation or linearization), initialization takes place to assign consistent values for all variables present in the model.
Expand Down Expand Up @@ -772,16 +773,17 @@ \section{Initialization, initial equation, and initial algorithm}\label{initiali
Implicitly by using the \lstinline!start!-attribute for variables with \lstinline!fixed = true!. With \lstinline!start! given by \lstinline!startExpression!:
\begin{itemize}
\item
For a non-discrete-time \lstinline!Real! variable \lstinline!vc!, the equation \lstinline!vc = startExpression! is added to the initialization equations.
For a variable declared as \lstinline!constant! or \lstinline!parameter!, no equation is added to the initialization equations.
\item
For a discrete-time variable \lstinline!vd!, the equation \lstinline!pre(vd) = startExpression! is added to the initialization equations.
\item
For a variable declared as \lstinline!constant! or \lstinline!parameter!, no equation is added to the initialization equations.
For a non-discrete-time \lstinline!Real! variable \lstinline!vc!, the equation \lstinline!vc = startExpression! is added to the initialization equations.
\end{itemize}
\end{enumerate}

For constants and parameters, the attribute \lstinline!fixed! defaults to \lstinline!true!, which is the only allowed value for a constant. For other variables,
\lstinline!fixed! defaults to \lstinline!false!.
Constants shall be determined by declaration equations (see \cref{component-variability-prefixes-discrete-parameter-constant}), and \lstinline!fixed = false! is not allowed.
For parameters, \lstinline!fixed! defaults to \lstinline!true!.
For other variables, \lstinline!fixed! defaults to \lstinline!false!.

\lstinline!start!-values of variables having \lstinline!fixed = false! can be used as initial guesses, in case iterative solvers are used in the initialization phase.

Expand Down
2 changes: 0 additions & 2 deletions chapters/operatorsandexpressions.tex
Expand Up @@ -1436,8 +1436,6 @@ \subsection{Constant Expressions}\label{constant-expressions}
\end{itemize}
\end{itemize}

Components declared as \lstinline!constant! shall have an associated declaration equation with a constant expression, if the constant is directly in the simulation model, or used in the simulation model. The value of a constant can be modified after it has been given a value, unless the constant is declared \lstinline!final! or modified with a \lstinline!final! modifier. A constant without an associated declaration equation can be given one by using a modifier.

\subsection{Parameter Expressions}\label{parameter-expressions}

Parameter expressions\index{parameter expression}\index{expression variability!parameter}\index{parametric variability|see{parameter expression}} are:
Expand Down