| Stateflow User's Guide |
 |
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.
- Start simulation.
When simulation starts, the first temp_event event updates the diagram and the state Off is entered.
|

|
- 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.
|

|
- 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.
|

|
- 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.
|

|
| Adding a History Junction to a Superstate | | Creating Subcharts to Add More Substates |  |
© 1994-2005 The MathWorks, Inc.