MATLAB Examples

Example of Defining Time Delays

This continuous-time chart defines two absolute time delays in transitions.

Chart execution consists of these steps:

  • When the chart awakens, the state Input activates first.
  • After 5.33 milliseconds of simulation time, the transition from Input to Output occurs.
  • The state Input deactivates, and then the state Output activates.
  • After 10.5 seconds of simulation time, the transition from Output to Input occurs.
  • The state Output deactivates, and then the state Input activates.
  • Steps 2 through 5 are repeated, until the simulation ends.

If a chart has a discrete sample time, any action in the chart occurs at integer multiples of this sample time. For example, suppose that you change the configuration parameters so that the Simulink® solver uses a fixed step of size 0.1 seconds. Then, the first transition from state Input to state Output occurs at t = 0.1 seconds. This behavior applies because the solver does not wake the chart at exactly t = 5.33 milliseconds. Instead, the solver wakes the chart at integer multiples of 0.1 seconds, such as t = 0.0 and 0.1 seconds.