Stateflow    

Defining Edge-Triggered Output Events

Simulink controls the execution of edge-triggered subsystems with output events. These are essential conditions that define this use of triggered output events:

Edge-Triggered Semantics Example

In this example the transition from state A to state B (in the Stateflow diagram) has a transition action that specifies the broadcast of event1. event1 is defined in Stateflow to be an Output to Simulink with an Either edge trigger type. The Stateflow block output port for event1 is connected to the trigger port of the band pass filter1 Simulink block. The band pass filter1 block has its Trigger type field set to Either edge.

This sequence is followed when state A is active and the transition from state A to state B is valid and is taken:

  1. State A exit actions execute and complete.
  2. State A is marked inactive.
  3. The transition action, an edge-triggered Output to Simulink event broadcast, is registered (but not executed). Simulink is controlling the execution and execution control does not shift until the Stateflow block completes.
  4. State B is marked active.
  5. State B entry actions execute and complete (x = x++).
  6. The Stateflow diagram goes back to sleep, waiting to be awakened by another event.
  7. The band pass filter1 block is triggered, executes, and completes.

  Defining Function Call Output Events MATLAB Workspace Interfaces