Skip to content

Commit

Permalink
Improve formulation of rational clock. (modelica#2763)
Browse files Browse the repository at this point in the history
* Improve formulation of rational clock.
It might be that we should have a clearer separator for the =0 case.
Closes modelica#2386
  • Loading branch information
HansOlsson committed Dec 16, 2020
1 parent 7713d12 commit 914dc1b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chapters/synchronous.tex
Expand Up @@ -349,14 +349,15 @@ \section{Clock Constructors}\label{clock-constructors}
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}.

If $\mathit{intervalCounter}$ is a parameter expression greater than zero, the clock defines a periodic clock.
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.
If
interval % This should be "intervalCounter", right?
is a parameter expression, the clock defines a periodic clock.


\begin{nonnormative}
The given interval and time shift % What given "interval" and "time shift"?
Expand Down

0 comments on commit 914dc1b

Please sign in to comment.