Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions chapters/synchronous.tex
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,9 @@ \section{Clock Constructors}\label{clock-constructors}
If $\mathit{intervalCounter}$ is a clocked component expression it must be greater than zero.
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{}
The clock starts at the start of the simulation $t_{\mathrm{start}}$ or when the controller is switched on.
At the start of the simulation, \lstinline!previous($\mathit{intervalCounter}$)! = \lstinline!$\mathit{intervalCounter}$.start! and the clocks ticks the first time.
At the first clock tick $\mathit{intervalCounter}$ must be computed and the second clock tick is then triggered at $\mathit{interval}_{1} = \mathit{intervalCounter}/\mathit{resolution}$.
At the second clock tick at time $t_{\mathrm{start}} + \mathit{interval}_{1}$, a new value for $\mathit{intervalCounter}$ must be computed and the next clock tick is scheduled at $\mathit{interval}_{2} = \mathit{intervalCounter}/\mathit{resolution}$, and so on.


\begin{nonnormative}
The given interval and time shift % What given "interval" and "time shift"?
can be modified by using the \lstinline!subSample!, \lstinline!superSample!, \lstinline!shiftSample! and \lstinline!backSample! operators on the returned clock, see \cref{sub-clock-conversion-operators}.
Expand All @@ -371,10 +369,10 @@ \section{Clock Constructors}\label{clock-constructors}
y2 = previous(y2) + 1;
end when;
\end{lstlisting}
\end{example}

Note that operator \lstinline!interval(c)! of \lstinline!Clock c = Clock(nextInterval, $\mathit{resolution}$)! returns:\newline
\lstinline!previous($\mathit{intervalCounter}$) / $\mathit{resolution}$! (in seconds)
\end{example}
\end{semantics}
\end{operatordefinition*}

Expand Down Expand Up @@ -434,7 +432,6 @@ \section{Clock Constructors}\label{clock-constructors}
This is because both the event clock and sample introduce a delay of one event iteration, keeping them synchronized.
\end{example}


\begin{nonnormative}
The implicitly given interval and time shift can be modified by using the \lstinline!subSample!, \lstinline!superSample!, \lstinline!shiftSample! and \lstinline!backSample! operators on the returned clock, see \cref{sub-clock-conversion-operators}, provided the base interval is not smaller than the implicitly given interval.
\end{nonnormative}
Expand Down Expand Up @@ -1451,11 +1448,11 @@ \section{Other Operators}\label{other-operators}
This operator returns the interval between the previous and present tick of the clock of the expression, in which this operator is called.
The optional argument $u$ is only used for clock inference, see \cref{clock-partitioning}.
At the first tick of the clock the following is returned:
\begin{enumerate}
\item If the specified clock interval is a parameter expression, this value is returned.
\item Otherwise the start value of the variable specifying the interval is returned.
\item For an event clock the additional \lstinline!startInterval! argument to the event clock constructor is returned.
\end{enumerate}
\begin{itemize}
\item For a rational interval clock (\cref{modelica:clock-rational}): \lstinline!previous($\mathit{intervalCounter}$)!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\item For a rational interval clock (\cref{modelica:clock-rational}): \lstinline!previous($\mathit{intervalCounter}$)!
\item For a rational interval clock (\cref{modelica:clock-rational}): \lstinline!previous($\mathit{intervalCounter}$)/resolution!

It was missing before, but when we add it, then it must be correct.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but with proper formatting. OK?

\item For a real interval clock (\cref{modelica:clock-interval}): \lstinline!previous($\mathit{interval}$)!
\item For an event clock (\cref{modelica:clock-event}): $\mathit{startInterval}$
\end{itemize}
The return value of \lstinline!interval! is a scalar \lstinline!Real! number.
\end{semantics}
\end{operatordefinition}
Expand Down