Skip to content

Commit

Permalink
More rephrasing of operator mentions
Browse files Browse the repository at this point in the history
Following the style recentry introduced in stream.tex.
  • Loading branch information
henrikt-ma committed Jun 2, 2020
1 parent 2bcbe16 commit e923755
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 49 deletions.
2 changes: 1 addition & 1 deletion chapters/derivationofstream.tex
Expand Up @@ -255,7 +255,7 @@ \subsection{Connection of 3 stream connectors where two mass flow rates are posi
mathematical solution does not exist. This specification only requires
that a solution fulfills the balance equations. Additionally, a
recommendation is given to compute all unknowns in a unique way, by
providing an explicit formula for the \lstinline!inStream! operator. Due to the
providing an explicit formula for \lstinline!inStream!. Due to the
definition, that only flows where the corresponding \lstinline!min! attribute is
neither zero nor positive enter this formula, a meaningful physcial
result is always obtained, even in case of zero mass flow rate. As a
Expand Down
11 changes: 5 additions & 6 deletions chapters/equations.tex
Expand Up @@ -416,8 +416,7 @@ \subsubsection{Application of the Single-assignment Rule to When-Equations}\doub

\subsection{reinit}\doublelabel{reinit}

The \lstinline!reinit! operator can only be used in the body of a when-equation. It
has the following syntax:
\lstinline!reinit! can only be used in the body of a when-equation. It has the following syntax:
\begin{lstlisting}[language=modelica]
reinit(x, expr);
\end{lstlisting}
Expand All @@ -444,12 +443,12 @@ \subsection{reinit}\doublelabel{reinit}
If a higher index system is present, i.e., constraints between
state variables, some state variables need to be redefined to non-state
variables. During simulation, non-state variables should be chosen in
such a way that variables with an applied \lstinline!reinit! operator are
such a way that variables with an applied \lstinline!reinit! are
selected as states at least when the corresponding when-clauses become
active. If this is not possible, an error occurs, since otherwise the
\lstinline!reinit! operator would be applied on a non-state variable.
active. If this is not possible, an error occurs, since otherwise
\lstinline!reinit! would be applied on a non-state variable.

Example for the usage of the \lstinline!reinit! operator (bouncing ball):
Example for the usage of \lstinline!reinit! (bouncing ball):
\begin{lstlisting}[language=modelica]
der(h) = v;
der(v) = if flying then -g else 0;
Expand Down
75 changes: 34 additions & 41 deletions chapters/operatorsandexpressions.tex
Expand Up @@ -375,7 +375,7 @@ \section{Built-in Intrinsic Operators with Function Syntax}\doublelabel{built-in
Note that when the specification references a function having the name
of a built-in function it references the built-in function, not a
user-defined function having the same name, see also \autoref{built-in-functions}. With
exception of built-in operator \lstinline!String(..)!, all operators in this section
exception of the built-in \lstinline!String! operator, all operators in this section
can only be called with positional arguments.

\subsection{Numeric Functions and Conversion Functions}\doublelabel{numeric-functions-and-conversion-functions}
Expand Down Expand Up @@ -637,17 +637,17 @@ \subsection{Derivative and Special Purpose Operators with Function Syntax}\doubl
\hline

% inStream
\lstinline!inStream(v)! & The operator \lstinline!inStream(v)! is only allowed on stream
variables v defined in stream connectors, and is the value of the stream
variable v close to the connection point assuming that the flow is from
\lstinline!inStream(v)! & \lstinline!inStream(v)! is only allowed for stream
variables \lstinline!v! defined in stream connectors, and is the value of the stream
variable \lstinline!v! close to the connection point assuming that the flow is from
the connection point into the component. This value is computed from the
stream connection equations of the flow variables and of the stream
variables. The operator is vectorizable. For more details see \autoref{stream-operator-instream-and-connection-equations}.\\
\hline

% actualStream
\lstinline!actualStream(v)! & The \lstinline!actualStream(v)! operator returns the actual value
of the stream variable v for any flow direction. The operator is
\lstinline!actualStream(v)! & \lstinline!actualStream(v)! returns the actual value
of the stream variable \lstinline!v! for any flow direction. The operator is
vectorizable. For more details, see \autoref{stream-operator-actualstream}.\\
\hline

Expand All @@ -659,8 +659,7 @@ \subsection{Derivative and Special Purpose Operators with Function Syntax}\doubl
\lstinline! initialPoints=...,!\\
\lstinline! initialValues=...)!
\end{tabular} &
The \lstinline!spatialDistribution(...)! operator allows approximation of
variable-speed transport of properties, see \autoref{spatialdistribution}.\\
\lstinline!spatialDistribution! allows approximation of variable-speed transport of properties, see \autoref{spatialdistribution}.\\
\hline

% getInstanceName
Expand All @@ -675,7 +674,7 @@ \subsection{Derivative and Special Purpose Operators with Function Syntax}\doubl
\subsubsection{delay}\doublelabel{delay}

\begin{nonnormative}
The \lstinline!delay()! operator allows a numerical sound
\lstinline!delay! allows a numerical sound
implementation by interpolating in the (internal) integrator
polynomials, as well as a more simple realization by interpolating
linearly in a buffer containing past values of expression expr. Without
Expand All @@ -689,7 +688,7 @@ \subsubsection{delay}\doublelabel{delay}
integrators are used, this information is sufficient to allocate the
necessary storage for the internal buffer before the simulation starts.
For variable step size integrators, the buffer size is dynamic during
integration. In principle, a \lstinline!delay! operator could break algebraic
integration. In principle, \lstinline!delay! could break algebraic
loops. For simplicity, this is not supported because the minimum delay
time has to be give as additional argument to be fixed at compile time.
Furthermore, the maximum step size of the integrator is limited by this
Expand All @@ -705,15 +704,13 @@ \subsubsection{spatialDistribution}\doublelabel{spatialdistribution}
system is to approximate it by an ODE, but this requires a large number
of state variables and might introduce either numerical diffusion or
numerical oscillations. Another option is to use a built-in operator
that keeps track of the spatial distribution of z(x, t), by suitable
that keeps track of the spatial distribution of $z(x, t)$, by suitable
sampling, interpolation, and shifting of the stored distribution. In
this case, the internal state of the operator is hidden from the ODE
solver.
\end{nonnormative}

The \lstinline!spatialDistribution!() operator allows to approximate efficiently the
solution of the infinite-dimensional problem

\lstinline!spatialDistribution! allows to approximate efficiently the solution of the infinite-dimensional problem
\begin{align*}
\frac{\partial z(y,t)}{\partial t}+v(t)\frac{\partial z(y,t)}{\partial y} &= 0.0\\
z(0.0, t) &= \mathrm{in}_0(t) \text{ if $v\ge 0$}\\
Expand Down Expand Up @@ -751,8 +748,7 @@ \subsubsection{spatialDistribution}\doublelabel{spatialdistribution}
This allows to directly compute the solution based on interpolating the
boundary conditions.

The \textbf{spatialDistribution} operator can be described in terms of
the pseudo-code given as a block:
\textbf{spatialDistribution} can be described in terms of the pseudo-code given as a block:
\begin{lstlisting}[language=modelica]
block spatialDistribution
input Real in0;
Expand Down Expand Up @@ -822,8 +818,8 @@ \subsubsection{spatialDistribution}\doublelabel{spatialdistribution}
der(x) = v;
(,out1) = spatialDistribution(in0, 0, x, true, initialPoints, initialValues);
\end{lstlisting}
Technically relevant use cases for the use of the
\lstinline!spatialDistribution! operator are modeling of electrical
Technically relevant use cases for the use of
\lstinline!spatialDistribution! are modeling of electrical
transmission lines, pipelines and pipeline networks for gas, water and
district heating, sprinkler systems, impulse propagation in elongated
bodies, conveyor belts, and hydraulic systems. Vectorization is needed
Expand All @@ -834,8 +830,7 @@ \subsubsection{spatialDistribution}\doublelabel{spatialdistribution}
\subsubsection{cardinality (deprecated)}\doublelabel{cardinality-deprecated}

\begin{nonnormative}
The cardinality operator is deprecated for the following
reasons and will be removed in a future release:
\lstinline!cardinality! is deprecated for the following reasons and will be removed in a future release:
\begin{itemize}
\item
Reflective operator may make early type checking more difficult.
Expand All @@ -847,8 +842,7 @@ \subsubsection{cardinality (deprecated)}\doublelabel{cardinality-deprecated}
\end{nonnormative}

\begin{nonnormative}
The \lstinline!cardinality()! operator allows the definition of
connection dependent equations in a model, for example:
\lstinline!cardinality! allows the definition of connection dependent equations in a model, for example:
\begin{lstlisting}[language=modelica]
connector Pin
Real v;
Expand All @@ -867,7 +861,7 @@ \subsubsection{cardinality (deprecated)}\doublelabel{cardinality-deprecated}
The cardinality is counted after removing conditional components. and
may not be applied to expandable connectors, elements in expandable
connectors, or to arrays of connectors (but can be applied to the scalar
elements of array of connectors). The cardinality operator should only
elements of array of connectors). \lstinline!cardinality! should only
be used in the condition of assert and if-statements -- that do not
contain connect (and similar operators -- see \autoref{clocked-discrete-time-and-clocked-discretized-continuous-time-partition}).

Expand Down Expand Up @@ -900,24 +894,24 @@ \subsubsection{homotopy}\doublelabel{homotopy}
respective non-linear algebraic equation systems. The reason is that the
following structure can be present:
\begin{lstlisting}[language=modelica, mathescape=true]
w= $f_1$(x) // has homotopy operator
w = $f_1$(x) // has homotopy
0 = $f_2$(der(x), x, z, w)
\end{lstlisting}

Here, a non-linear equation system $f_2$
is present. The homotopy operator is, however used on a variable
is present. \lstinline!homotopy! is, however used on a variable
that is an ``input'' to the non-linear algebraic equation system, and
modifies the characteristics of the non-linear algebraic equation
system. The only useful way is to perform the homotopy iteration over
$f_1$ and $f_2$ together.

The suggested approach is ``conceptual'', because more efficient
implementations are possible, e.g. by determining the smallest iteration
loop, that contains the equations of the first BLT block in which a
homotopy operator is present and all equations up to the last BLT block
loop, that contains the equations of the first BLT block in which
\lstinline!homotopy! is present and all equations up to the last BLT block
that describes a non-linear algebraic equation system.

A trivial implementation of the homotopy operator is obtained by
A trivial implementation of \lstinline!homotopy! is obtained by
defining the following function in the global scope:
\begin{lstlisting}[language=modelica]
function homotopy
Expand All @@ -933,8 +927,8 @@ \subsubsection{homotopy}\doublelabel{homotopy}
\textbf{Example 1.} In electrical systems it is often difficult to solve non-linear
algebraic equations if switches are part of the algebraic loop. An
idealized diode model might be implemented in the following way, by
starting with a ``flat'' diode characteristic and then move with the
homotopy operator to the desired ``steep'' characteristic:
starting with a ``flat'' diode characteristic and then move with
\lstinline!homotopy! to the desired ``steep'' characteristic:
\begin{lstlisting}[language=modelica]
model IdealDiode
...
Expand Down Expand Up @@ -986,7 +980,7 @@ \subsubsection{homotopy}\doublelabel{homotopy}
end PressureLoss;
\end{lstlisting}

\textbf{Example 4.} Note that the homotopy operator \textbf{shall not} be used to
\textbf{Example 4.} Note that \lstinline!homotopy! \textbf{shall not} be used to
combine unrelated expressions, since this can generate singular systems
from combining two well-defined systems.
\begin{lstlisting}[language=modelica]
Expand Down Expand Up @@ -1161,7 +1155,7 @@ \subsection{Event-Related Operators with Function Syntax}\doublelabel{event-rela
\lstinline!pre(y)! & Returns the \emph{left limit} $y(t\textsuperscript{pre})$ of
variable $y(t)$ at a time instant $t$. At an event instant,
$y(t\textsuperscript{pre})$ is the value of y after the last event
iteration at time instant $t$ (see comment below). The \lstinline!pre()! operator can
iteration at time instant $t$ (see comment below). \lstinline!pre! can
be applied if the following three conditions are fulfilled
simultaneously: (a) variable $y$ is either a subtype of a simple type or
is a record component, (b) $y$ is a discrete-time expression (c) the
Expand All @@ -1174,24 +1168,23 @@ \subsection{Event-Related Operators with Function Syntax}\doublelabel{event-rela

% edge
\lstinline!edge(b)! & Is expanded into \lstinline!(b and not pre(b))! for Boolean variable
\lstinline!b!. The same restrictions as for the \lstinline!pre()! operator apply (e.g. not to be
\lstinline!b!. The same restrictions as for \lstinline!pre! apply (e.g. not to be
used in function classes).\\ \hline

% change
\lstinline!change(v)! & Is expanded into \lstinline!(v<>pre(v))!. The
same restrictions as for the \lstinline!pre()! operator apply.\\ \hline
\lstinline!change(v)! & Is expanded into \lstinline!(v<>pre(v))!. The same restrictions as for \lstinline!pre! apply.\\ \hline

% reinit
\lstinline!reinit(x, expr)! & In the body of a when clause, reinitializes \lstinline!x! with
\lstinline!expr! at an event instant. \lstinline!x! is a scalar or array \lstinline!Real! variable that is implicitly defined to have \lstinline!StateSelect.always!.
\begin{nonnormative}
It is an error if the variable cannot be selected as a state.
\end{nonnormative}
\lstinline!expr! needs to be type-compatible with \lstinline!x!. The
reinit operator can only be applied once for the same variable - either
\lstinline!expr! needs to be type-compatible with \lstinline!x!.
\lstinline!reinit! can only be applied once for the same variable --- either
as an individual variable or as part of an array of variables. It can
only be applied in the body of a when clause in an equation section. See
also \autoref{reinit} .\\ \hline
also \autoref{reinit}.\\ \hline

\end{longtable}

Expand Down Expand Up @@ -1224,9 +1217,9 @@ \subsubsection{pre}\doublelabel{pre}

\subsubsection{noEvent and smooth}\doublelabel{noevent-and-smooth}

The \lstinline!noEvent! operator implies that real elementary relations/functions
\lstinline!noEvent! implies that real elementary relations/functions
are taken literally instead of generating crossing functions, \autoref{events-and-synchronization}.
The \lstinline!smooth! operator should be used instead of \lstinline!noEvent!, in order to
\lstinline!smooth! should be used instead of \lstinline!noEvent!, in order to
avoid events for efficiency reasons. A tool is free to not generate
events for expressions inside \lstinline!smooth!. However, \lstinline!smooth! does not guarantee
that no events will be generated, and thus it can be necessary to use
Expand Down Expand Up @@ -1383,7 +1376,7 @@ \subsection{Discrete-Time Expressions}\doublelabel{discrete-time-expressions}
test.

\begin{nonnormative}
This restriction guarantees that the \lstinline!noEvent()! operator cannot be applied to \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String!, or \lstinline!enumeration!
This restriction guarantees that \lstinline!noEvent! cannot be applied to \lstinline!Boolean!, \lstinline!Integer!, \lstinline!String!, or \lstinline!enumeration!
equations outside of a \lstinline!when!-clause, because then one of the two expressions is not discrete-time.
\end{nonnormative}

Expand Down
2 changes: 1 addition & 1 deletion chapters/revisions.tex
Expand Up @@ -1278,7 +1278,7 @@ \subsection{Contributors to the Modelica Language, Version 3.2}\doublelabel{cont
The global name lookup was proposed by Stefan Vorkoetter.

The support for Unicode was initiated by Rui Gao and Hoyoun Kim.\\
The \lstinline!homotopy! operator was proposed by Martin Otter, Michael Sielemann
\lstinline!homotopy! was proposed by Martin Otter, Michael Sielemann
and Francesco Casella. Michael Sielemann demonstrated with benchmark
problems that non-linear solvers are not able to solve reliably
initialization problems and that the homotopy operator is therefore
Expand Down

0 comments on commit e923755

Please sign in to comment.