Skip to content

Discrete time dynamics

Peter Corke edited this page Jun 7, 2021 · 1 revision

This concerns systems that have discrete time dynamics and includes blocks such as:

  • ZOH
  • DINTEGRATOR
  • DLTI_SS

The blocks inherit from ClockedBlock class. When instantiated in a block diagram, each such block has an associated clock, which is a parameter of the block. The clock is a reference to an instance of a Clock class. Each clock has a period and a phase.

Single clock

For the simple case of a system with just one clock the following occurs:

  • the output of all clocked blocks is a function of the state and is considered constant as far as the continuous time dynamics is concerned
  • the system is integrated until the time of the next clock tick
  • the input to the clocked blocks is sampled and their state is updated. The state of all blocks associated with this clock is saved in the clock object. The state of the clocked blocks is updated.
  • repeat...

Multiple clocks

For the case of multiple clocks the situation for each clock and its associated blocks is the same as for the single-clock case. Integration proceeds until whichever clock ticks next. There is no requirement for the clock frequencies to be in any way related, and neither is there any exclusion, ie. multiple clocks can tick at the same time.

This mechanism is shared with the event queue which is used to support discontinuous inputs.

Real-time application

In a real-time system each clock could be associated with a hardware timer or thread.

Important difference with respect to Simulink(™)

Consider two blocks on the same clock, A and B, and the output of A is input to B

U --> [A] --> [B] --> Y

On the first clock, a change in U is propagated to the output of A, and hence the input to B. However it is not propagated to Y until the next clock.

In contrast Simulink provides instantaneous propagation of signals through all blocks on the same clock.