Skip to content

Commit

Permalink
Use definition of 'component expression' in the normal way
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Nov 24, 2020
1 parent 1d32502 commit 460e221
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions chapters/synchronous.tex
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,18 @@ \subsection{Argument Restrictions (Component Expression)}\label{argument-restric
following term is used.

\begin{definition}[Component expression]\label{def:component-expression}
A Component Reference which is an Expression, i.e.\ does not refer to models or blocks with equations. It is an instance of a (a) base type, (b) derived type, (c) record, (d) an array of such an
instance (a-c), (e) one or more elements of such an array (d) defined by index expressions which are parameter expressions (see below), or (f) an element of records.
A component expression is a \lstinline[language=grammar]!component-reference! which is a valid expression, i.e., not referring to models or blocks with equations.
% "an element of records" below looks strange...
In detail, it is an instance of a (a) base type, (b) derived type, (c) record, (d) an array of such an instance (a-c), (e) one or more elements of such an array (d) defined by index expressions which are parameter expressions (see below), or (f) an element of records.
\begin{nonnormative}
The essential features are that one or several values are associated with the instance, that start values can be defined on these values, and that no equations are associated with the instance.
A Component Expression can be constant or can vary with time.
A component expression can be constant or can vary with time.
\end{nonnormative}
\end{definition}

In the following sections, when defining an operator with function calling syntax, there are some common restrictions being used for the input arguments (operands). For example, an input argument to the operator may be required to be a component expression (\cref{def:component-expression}) or parameter expression (\cref{variability-of-expressions}). To emphasize that there are no such restrictions, an input argument may be said to be just an \emph{expression}.
In the following sections, when defining an operator with function calling syntax, there are some common restrictions being used for the input arguments (operands).
For example, an input argument to the operator may be required to be a component expression (\cref{def:component-expression}) or parameter expression (\cref{variability-of-expressions}).
To emphasize that there are no such restrictions, an input argument may be said to be just an \emph{expression}.

\begin{nonnormative}
The reason for restricting an input argument to be a component expression is that the start value of the input argument is returned before the first tick of the clock of the input argument and this
Expand All @@ -285,8 +288,8 @@ \subsection{Argument Restrictions (Component Expression)}\label{argument-restric
y2 = previous(u2); // fine
y3 = previous(u2[2]); // fine
y4 = previous(c.im); // fine
y5 = previous(2 * u); // error (general expression, no Component Expression)
y6 = previous(R); // error (component, no Component Expression)
y5 = previous(2 * u); // error (general expression, not component expression)
y6 = previous(R); // error (component, not component expression)
\end{lstlisting}
\end{example}

Expand Down Expand Up @@ -349,7 +352,7 @@ \section{Clock Constructors}\label{clock-constructors}
\end{lstlisting}\end{synopsis}
\begin{semantics}
\firstuse{Rational interval clock}.
The first input argument, $\mathit{intervalCounter}$, is a clocked Component Expression (see \cref{argument-restrictions-component-expression}) or a parameter expression of type \lstinline!Integer! with \lstinline!min = 0!.
The first input argument, $\mathit{intervalCounter}$, is a clocked component expression (\cref{def:component-expression}) or a parameter expression of type \lstinline!Integer! with \lstinline!min = 0!.
The optional second argument $\mathit{resolution}$ (defaults to 1) is a parameter expression of type \lstinline!Integer! with \lstinline!min = 1! and \lstinline!unit = "Hz"!.
If $\mathit{intervalCounter}$ is a parameter expression with value zero, the period of the clock is derived by clock inference, see \cref{sub-clock-inferencing}.
The result is of base type \lstinline!Clock! that ticks when \lstinline!time! becomes $t_{\mathrm{start}}$, $t_{\mathrm{start}} + \mathit{interval}_{1}$, $t_{\mathrm{start}} + \mathit{interval}_{1} + \mathit{interval}_{2}$, \@\ldots{}
Expand Down Expand Up @@ -397,7 +400,7 @@ \section{Clock Constructors}\label{clock-constructors}
\end{lstlisting}\end{synopsis}
\begin{semantics}
\firstuse{Real interval clock}.
The input argument, $\mathit{interval}$, is a clocked Component Expression (see \cref{argument-restrictions-component-expression}) or a parameter expression.
The input argument, $\mathit{interval}$, is a clocked component expression (\cref{def:component-expression}) or a parameter expression.
The $\mathit{interval}$ must be strictly positive ($\mathit{interval} > 0$) of type \lstinline!Real! with \lstinline!unit = "s"!.
The result is of base type \lstinline!Clock! that ticks when \lstinline!time! becomes $t_{\mathrm{start}}$, $t_{\mathrm{start}} + \mathit{interval}_{1}$, $t_{\mathit{start}} + \mathit{interval}_{1} + \mathit{interval}_{2}$, \@\ldots{}
The clock starts at the start of the simulation $t_{\mathrm{start}}$ or when the controller is switched on.
Expand Down Expand Up @@ -541,7 +544,11 @@ \section{Clocked State Variables}\label{clocked-state-variables}
previous($u$)
\end{lstlisting}\end{synopsis}
\begin{semantics}
The input argument $u$ is a \emph{component expression} (see \cref{argument-restrictions-component-expression}) or a parameter expression. The return argument has the same type as the input argument. Input and return arguments are on the same clock. At the first tick of the clock of $u$ or after a reset transition (see \cref{reset-handling}), the start value of $u$ is returned, see \cref{initialization-of-clocked-partitions}. At subsequent activations of the clock of $u$, the value of $u$ from the previous clock activation is returned.
The input argument $u$ is a component expression (\cref{def:component-expression}) or a parameter expression.
The return argument has the same type as the input argument.
Input and return arguments are on the same clock.
At the first tick of the clock of $u$ or after a reset transition (see \cref{reset-handling}), the start value of $u$ is returned, see \cref{initialization-of-clocked-partitions}.
At subsequent activations of the clock of $u$, the value of $u$ from the previous clock activation is returned.
\end{semantics}
\end{operatordefinition}

Expand Down Expand Up @@ -588,9 +595,12 @@ \subsection{Base-clock conversion operators}\label{base-clock-conversion-operato
hold($u$)
\end{lstlisting}\end{synopsis}
\begin{semantics}
Input argument $u$ is a clocked Component Expression (see \cref{argument-restrictions-component-expression}) or a parameter expression. The operator returns a piecewise constant signal of the same type of $u$. When the clock of $u$ ticks, the operator returns $u$ and otherwise returns the value of $u$ from the last clock activation. Before the first clock activation of $u$, the operator returns the start value of $u$, see \cref{initialization-of-clocked-partitions}.
Input argument $u$ is a clocked component expression (\cref{def:component-expression}) or a parameter expression.
The operator returns a piecewise constant signal of the same type of $u$.
When the clock of $u$ ticks, the operator returns $u$ and otherwise returns the value of $u$ from the last clock activation.
Before the first clock activation of $u$, the operator returns the start value of $u$, see \cref{initialization-of-clocked-partitions}.
\begin{nonnormative}
Since the input argument is not defined before the first tick of the clock of $u$, the restriction is present, that it must be a \emph{component expression} (or a parameter expression), in order that the initial value of $u$ can be used in such a case.
Since the input argument is not defined before the first tick of the clock of $u$, the restriction is present, that it must be a component expression (or a parameter expression), in order that the initial value of $u$ can be used in such a case.
\end{nonnormative}
\end{semantics}
\end{operatordefinition}
Expand Down Expand Up @@ -721,9 +731,12 @@ \subsection{Sub-clock conversion operators}\label{sub-clock-conversion-operators
backSample($u$, backCounter=$\mathit{cnt}$, resolution=$\mathit{res}$)
\end{lstlisting}\end{synopsis}
\begin{semantics}
The input argument $u$ is either a \emph{component expression} (see \cref{argument-restrictions-component-expression}) or an expression of type \lstinline!Clock!. This is an inverse of \lstinline!shiftSample! such that \lstinline!Clock y = backSample($u$, $\mathit{cnt}$, $\mathit{res}$)! implicitly defines a clock \lstinline!y! such that \lstinline!shiftSample(y, $\mathit{cnt}$, $\mathit{res}$)! activates at the same times as $u$. It is an error if the clock of \lstinline!y! starts before the base clock of $u$.
The input argument $u$ is either a component expression (\cref{def:component-expression}) or an expression of type \lstinline!Clock!.
This is an inverse of \lstinline!shiftSample! such that \lstinline!Clock y = backSample($u$, $\mathit{cnt}$, $\mathit{res}$)! implicitly defines a clock \lstinline!y! such that \lstinline!shiftSample(y, $\mathit{cnt}$, $\mathit{res}$)! activates at the same times as $u$.
It is an error if the clock of \lstinline!y! starts before the base clock of $u$.

At every tick of the clock of \lstinline!y!, the operator returns the value of $u$ from the last tick of the clock of $u$. If $u$ is a clocked Component Expression, the operator returns the start value of $u$, see \cref{initialization-of-clocked-partitions}, before the first tick of the clock of $u$.
At every tick of the clock of \lstinline!y!, the operator returns the value of $u$ from the last tick of the clock of $u$.
If $u$ is a clocked component expression, the operator returns the start value of $u$, see \cref{initialization-of-clocked-partitions}, before the first tick of the clock of $u$.

\begin{example}
\begin{lstlisting}[language=modelica]
Expand Down

0 comments on commit 460e221

Please sign in to comment.