Stateflow User's Guide Previous page   Next Page

Simulating with a History Junction

Observe the behavior of the substates of the superstate On during simulation of the Stateflow diagram in the SFcontrol6 model.

  1. Start simulation.

    When simulation starts, the first temp_event event updates the diagram and the state Off is entered.

  2. Use the Manual Switch to send an on_switch event to the Controller block.

    The on_switch event triggers the transition to On. Both On and its default state, Lo, become active.

    The periodic event temp_event updates the diagram every second. Because the data temp is set to 130, the function hot returns a true and the transition from Lo to Hi is taken. State Hi becomes active.

  3. Use the Manual Switch to send an off_switch event to the Controller block.

    The off_switch event triggers a transition from On to Off. Off becomes active.

  4. Use the Manual Switch to send an on_switch event to the Controller block.

    The on_switch event triggers a transition from Off to On. This time, Hi is the active substate, and not Lo, the default substate.


Previous page  Adding a History Junction to a Superstate Creating Subcharts to Add More Substates Next page

© 1994-2005 The MathWorks, Inc.