From 2cedebf023a45600d78122597b1da0a9d23e8b45 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Wed, 27 Apr 2022 21:03:49 +0200 Subject: [PATCH] Illustrate potential implicit nature of discrete-time Real variable equations --- chapters/dae.tex | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/chapters/dae.tex b/chapters/dae.tex index 2d15b6a1c..830c78c88 100644 --- a/chapters/dae.tex +++ b/chapters/dae.tex @@ -84,6 +84,32 @@ \chapter{Modelica DAE Representation}\label{modelica-dae-representation} Further, each of the original model equations behind \eqref{eq:dae-discrete-valued} must be given in solved form, at most requiring flipping sides of the equation to obtain the used assignment form. The interpretation of the non-solved form of \eqref{eq:dae-discrete-real} at events, on the other hand, is that at events, the discrete-time \lstinline!Real! variables $z$ are solved together with the continuous-time variables using \eqref{eq:dae} and \eqref{eq:dae-discrete-real}. +\begin{example} +The following model demonstrates that \cref{eq:dae-discrete-real} does not imply that all discrete-time \lstinline!Real! variables are given by equations in solved form, as also the discrete-time \lstinline!Real! variables are included in $z$: +\begin{lstlisting}[language=modelica] +model M + discrete Real x(start = 1.0, fixed = true); +equation + when sample(1.0, 1.0) then + x = 3 * pre(x) - x^2; // Valid equation for discrete-time Real variable x. + end when; +end M; +\end{lstlisting} + +Another way that a discrete-time \lstinline!Real! variable can end up becoming determined by a nonlinear equation is through coupling with other variables. +The other variables may be discrete-time, or continuous-time as in the following example: +\begin{lstlisting}[language=modelica] +model M + discrete Real x(start = 1.0, fixed = true); + Real y; +equation + y = x ^ 2 + 2 * exp(-time); + when sample(1.0, 1.0) then + x = 3 * pre(x) - y; // OK, forming nonlinear equation system with y. + end when; +end M;\end{lstlisting} +\end{example} + \begin{example} The following model is illegal since there is no equation in solved form that can be used in \eqref{eq:dae-discrete-valued} to solve for the discrete-valued variable \lstinline!y!: \begin{lstlisting}[language=modelica]