Stateflow User's Guide Previous page   Next Page

Guarding Transitions with Event Triggers

The transitions for the Controller Stateflow diagram in the SFcontrol1 model that you build in Building an On-Off Control Model react to the event event. However, these transitions react the same to any event, whether it is named event, x, y, z, or whatever. This means that any event sent to the Controller Stateflow diagram results in taking a transition.

You can restrict transitions to react only to specific events with event triggers. In the following procedure topics, you add event triggers to the Controller Stateflow diagram and test them with trigger events that you add to the Simulink test interface:

  1. Adding Event Triggers to Transitions -- Use event triggers to restrict the transitions between the On and Off states to the events on_switch and off_switch.
  2. Adding Multiple Trigger Events to a Stateflow Chart -- Add the events on_switch and off_switch to the Stateflow diagram.
  3. Sending Multiple Trigger Events to a Stateflow Chart -- Send the on_switch and off_switch events to the Controller Stateflow diagram from the Simulink interface for testing.

Previous page  Using the Debug Tool During Simulation Adding Event Triggers to Transitions Next page

© 1994-2005 The MathWorks, Inc.