Skip to content

Commit

Permalink
Rename continuous-time partition to unclocked partition.
Browse files Browse the repository at this point in the history
At first non-clocked was considered, but it is used in logical circuits for something different.

Rebased to remove previous one.
(Well, could have cherrypicked instead)
  • Loading branch information
HansOlsson committed Feb 15, 2024
1 parent 4f9fced commit c0527d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions chapters/statemachines.tex
Expand Up @@ -341,7 +341,11 @@ \subsection{Reset Handling}\label{reset-handling}

\subsection{Activation Handling}\label{activation-handling}

<<<<<<< HEAD
When a state is suspended, its equations should not be executed, and its variables keep their values -- including state-variables in discretized equations.
=======
When a state is suspended its equations should not be executed, and its variables keep their values -- including state-variables in discretized equations.
>>>>>>> fdc0ebe6 (Rename continuous-time partition to unclocked partition.)

The execution of a sub-state machine has to be suspended when its
enclosing state is not active. This activation flag is given as a
Expand Down
38 changes: 19 additions & 19 deletions chapters/synchronous.tex
Expand Up @@ -223,7 +223,7 @@ \subsection{Base- and Sub-Partitions}\label{base-clock-and-sub-clock-partitions}
\item \willintroduce{Discretized sub-partitions}.
\end{itemize}
\item
\willintroduce{Continuous-time base-partition}.
\willintroduce{Unclocked base-partition}.
\end{itemize}
\begin{nonnormative}
Note that the term \emph{clock partition} refers to these partitions in general, whereas \emph{clocked base-partition} is a specific kind of partition.
Expand Down Expand Up @@ -414,7 +414,7 @@ \section{Clock Constructors}\label{clock-constructors}
The optional $\mathit{startInterval}$ argument (defaults to 0) is the value returned by \lstinline!interval()! at the first tick of the clock, see \cref{initialization-of-clocked-partitions}.
The result is of base type \lstinline!Clock! that ticks when \lstinline!edge($\mathit{condition}$)! becomes \lstinline!true!.
\begin{nonnormative}
This clock is used to trigger a clocked base-partition due to a state event (that is a zero-crossing of a \lstinline!Real! variable) in a continuous-time base-partition, or due to a hardware interrupt that is modeled as \lstinline!Boolean! in the simulation model.
This clock is used to trigger a clocked base-partition due to a state event (that is a zero-crossing of a \lstinline!Real! variable) in a unclocked base-partition, or due to a hardware interrupt that is modeled as \lstinline!Boolean! in the simulation model.
\end{nonnormative}

\begin{example}
Expand Down Expand Up @@ -567,14 +567,14 @@ \section{Partitioning Operators}\label{partitioning-operators}

\subsection{Base-Clock Conversion Operators}\label{base-clock-conversion-operators}\index{base-clock!conversion-operators}\index{conversion-operators!base-clock}

The operators listed below convert between a continuous-time and a clocked-time representation and vice versa.
The operators listed below convert between a clocked and an unclocked representation and vice versa.
\begin{center}
\begin{tabular}{l|l l}
\hline
\tablehead{Expression} & \tablehead{Description} & \tablehead{Details}\\
\hline
\hline
{\lstinline!sample($u$, $\mathit{clock}$)!} & Sample continuous-time expression & \Cref{modelica:clocked-sample} \\
{\lstinline!sample($u$, $\mathit{clock}$)!} & Sample unclocked expression & \Cref{modelica:clocked-sample} \\
{\lstinline!hold($u$)!} & Zeroth order hold of clocked-time variable & \Cref{modelica:hold} \\
\hline
\end{tabular}
Expand All @@ -585,16 +585,16 @@ \subsection{Base-Clock Conversion Operators}\label{base-clock-conversion-operato
sample($u$, $\mathit{clock}$)
\end{lstlisting}\end{synopsis}
\begin{semantics}
Input argument $u$ is a continuous-time expression according to \cref{continuous-time-expressions}.
Input argument $u$ is in an unclocked partition, and there are no variability restrictions, i.e., it is continuous-time according to \cref{continuous-time-expressions}.
The optional input argument $\mathit{clock}$ is of type \lstinline!Clock!, and can in a call be given as a named argument (with the name $\mathit{clock}$), or as positional argument.
The operator returns a clocked variable that has $\mathit{clock}$ as associated clock and has the value of the left limit of $u$ when $\mathit{clock}$ is active (that is the value of $u$ just before the event of $\mathit{clock}$ is triggered).
If $\mathit{clock}$ is not provided, it is inferred, see \cref{sub-clock-inferencing}.
\begin{nonnormative}
Since the operator returns the left limit of $u$, it introduces an infinitesimal small delay between the continuous-time and the clocked base-partition.
Since the operator returns the left limit of $u$, it introduces an infinitesimal small delay between the unclocked and the clocked partition.
This corresponds to the reality, where a sampled data system cannot act infinitely fast and even for a very idealized simulation, an infinitesimal small delay is present.
The consequences for the sorting are discussed below.

Input argument $u$ can be a general expression, because the argument is continuous-time and therefore has always a value.
Input argument $u$ can be a general expression, because the argument is unclocked and therefore has always a value.
It can also be a constant, a parameter or a piecewise constant expression.

Note that \lstinline!sample! is an overloaded function:
Expand Down Expand Up @@ -641,9 +641,9 @@ \subsubsection{Sorting of a Simulation Model}
Since \lstinline!sample(u)! returns the left limit of \lstinline!u!, and the left limit of \lstinline!u! is a known value, all inputs to a base-partition are treated as known during sorting.
Since a periodic and interval clock can tick at most once at a time instant, and since the left limit of a variable does not change during event iteration (i.e., re-evaluating a base-partition associated with a condition clock always gives the same result because the \lstinline!sample(u)! inputs do not change and therefore need not to be re-evaluated), all base-partitions, see \cref{base-clock-partitioning}, need not to be sorted with respect to each other.
Instead, at an event instant, active base-partitions can be evaluated first (and once) in any order.
Afterwards, the continuous-time base-partition is evaluated.
Afterwards, the unclocked base-partition is evaluated.

Event iteration takes place only over the continuous-time base-partition.
Event iteration takes place only over the unclocked base-partition.
In such a scenario, accessing the left limit of \lstinline!u! in \lstinline!sample(u)! just means to pick the latest available value of \lstinline!u! when the base-partition is entered, storing it in a local variable of the base-partition and only using this local copy during evaluation of the equations in this base-partition.
\end{nonnormative}

Expand Down Expand Up @@ -887,7 +887,7 @@ \section{Clock Partitioning}\label{clock-partitioning}

Every clocked variable is uniquely associated with exactly one clock.

After model flattening, every equation in an equation section, every expression and every algorithm section is either continuous-time, or it is uniquely associated with exactly one clock.
After model flattening, every equation in an equation section, every expression and every algorithm section is either unclocked, or it is uniquely associated with exactly one clock.
% Warning: The uses of \firstuse below aren't the first time these terms are used.
In the latter case it is called a \firstuse[clocked!equation]{clocked equation}\index{equation!clocked}, a \willintroduce{clocked expression} or \firstuse[clocked!algorithm]{clocked algorithm}\index{algorithm!clocked} section respectively.
The associated clock is either explicitly defined by a \lstinline!when!-clause, see \cref{sub-clock-conversion-operators}, or it is implicitly defined by the requirement that a clocked equation, a clocked expression and a clocked algorithm section must have the same clock as the variables used in them with exception of the expressions used as first arguments in the conversion operators of \cref{partitioning-operators}.
Expand Down Expand Up @@ -939,7 +939,7 @@ \subsection{Connected Components of the Equations and Variables Graph}\label{con

\subsection{Base-Partitioning}\label{base-clock-partitioning}

The goal is to identify all clocked equations and variables that should be executed together in the same task, as well as to identify the continuous-time base-partition.
The goal is to identify all clocked equations and variables that should be executed together in the same task, as well as to identify the unclocked base-partition.

The base-partitioning is performed with base-clock inference which uses the following incidence definition:
$\operatorname{incidence}(e)$ =
Expand All @@ -952,11 +952,11 @@ \subsection{Base-Partitioning}\label{base-clock-partitioning}
\end{list}
\end{list}\vspace{\parskip}% Compensate for removal of \parskip from \topset.

The resulting set of connected components, is the partitioning of the equations and variables, $B_{i} = \left\langle E_{i},\, V_{i} \right\rangle$, according to base-clocks and continuous-time partitions.
The resulting set of connected components, is the partitioning of the equations and variables, $B_{i} = \left\langle E_{i},\, V_{i} \right\rangle$, according to base-clocks and unclocked partitions.

The base-partitions are identified as \firstuse[clocked!base-partition]{clocked}\index{base-partition!clocked} or as \firstuse[continuous-time!base-partition]{continuous-time partitions}\index{base-partition!continuous-time}\index{partition!continuous-time} according to the following properties:
The base partitions are identified as \firstuse[clocked!base-clock partition]{clocked}\index{base-clock partition!clocked} or as \firstuse[base-clock partition!unclocked]{unclocked partitions}\index{partition!unclocked} according to the following properties:

A variable \lstinline!u! in \lstinline!sample(u)!, a variable \lstinline!y! in \lstinline!y = hold(ud)!, and a variable \lstinline!b! in \lstinline!Clock(b, startInterval=$\ldots$)! where the \lstinline!Boolean! \lstinline!b! is in a continuous-time partition.
A variable \lstinline!u! in \lstinline!sample(u)!, a variable \lstinline!y! in \lstinline!y = hold(ud)!, and a variable \lstinline!b! in \lstinline!Clock(b, startInterval=$\ldots$)! where the \lstinline!Boolean! \lstinline!b! is in an unclocked partition.

Correspondingly, variables \lstinline!u! and \lstinline!y! in
\lstinline!y = sample(uc)!,
Expand All @@ -969,7 +969,7 @@ \subsection{Base-Partitioning}\label{base-clock-partitioning}
Equations in a clocked \lstinline!when!-clause are also in a clocked base-partition.
Other base-partitions where none of the variables in the partition are associated with any of the operators above have an unspecified partition kind and are considered continuous-time base-partitions.

All continuous-time base-partitions are collected together and form \firstuse[continuous-time!base-partition@base-partition, \emph{the}]{the continuous-time base-partition}.
All unclocked partitions are collected together and \emph{the} unclocked partition.

\begin{example}
\begin{lstlisting}[language=modelica]
Expand All @@ -981,7 +981,7 @@ \subsection{Base-Partitioning}\label{base-clock-partitioning}
ud2 = superSample(yd1,2);
0 = f2(yd2, ud2);

// Continuous-time system
// Unclocked system
u = hold(yd2);
0 = f3(der(x1), x1, u);
0 = f4(der(x2), x2, x1);
Expand All @@ -997,7 +997,7 @@ \subsection{Base-Partitioning}\label{base-clock-partitioning}
ud2 = superSample(yd1, 2); // incidence(e) = {ud2, yd1}
0 = f2(yd2, ud2); // incidence(e) = {yd2, ud2}

// Base partition 2 -- continuous-time partition
// Base partition 2 -- unclocked partition
u = hold(yd2); // incidence(e) = {u}
0 = f3(der(x1), x1, u); // incidence(e) = {x1, u}
0 = f4(der(x2), x2, x1); // incidence(e) = {x2, x1}
Expand Down Expand Up @@ -1049,7 +1049,7 @@ \subsection{Sub-Partitioning}\label{sub-clock-partitioning}
ud2 = superSample(yd1, 2); // incidence(e) = {ud2}
0 = f2(yd2, ud2); // incidence(e) = {yd2,ud2}

// Base partition 2 (no sub-partitioning, since continuous-time)
// Base partition 2 (no sub-partitioning, since unclocked)
u = hold(yd2);
0 = f3(der(x1), x1, u);
0 = f4(der(x2), x2, x1);
Expand Down Expand Up @@ -1424,7 +1424,7 @@ \section{Other Operators}\label{other-operators}
\end{tabular}
\end{center}

It is an error if these operators are called in the continuous-time base-partition.
It is an error if these operators are called in the unclocked base-partition.

\begin{operatordefinition}[firstTick]
\begin{synopsis}\begin{lstlisting}
Expand Down

0 comments on commit c0527d7

Please sign in to comment.