Stateflow    

Defining Edge-Triggered Output Events

These are essential conditions that define the use of triggered output events:

Example: Edge-Triggered Semantics

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, 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 Inputting Events from Simulink