Stateflow User's Guide Previous page   Next Page

Stateflow Changes Active States with Transitions

States alone are not sufficient to model the behavior of an object that changes active states. Also needed are paths for changing active states. This service is provided by transitions. The following example adds three transitions to the example in Stateflow Represents Control Modes with States:

Notice that transitions are directional. They originate with a source state and terminate with a destination state. If the source state is active and the transition is taken, the source state becomes inactive and the destination state becomes active.

For example, if the Off state is active, the On state can become active through the Off to On transition. However, the model cannot use the same transition to activate the Off state if the On state is active. To make this change, an On to Off transition is required.

Also present is another type of transition, a default transition. This transition points to the state Off but has no apparent source state. The default transition is used to indicate which of the two states, On and Off, becomes active when the Stateflow diagram becomes active. In this case, the Off state becomes active when the diagram becomes active.


Previous page  Stateflow Represents Control Modes with States Stateflow Reacts to Events Next page

© 1994-2005 The MathWorks, Inc.