Skip to Main Content Skip to Search
Product Documentation

Process for Grouping and Executing Transitions

Transition Flow Graph Types

Before executing transitions for an active state or chart, Stateflow software groups transitions by the following types:

Each set of flow graphs includes other transition segments connected to a qualifying transition segment through junctions and transitions. Consider the following example:

In this example, state A has both an inner and a default transition that connect to a junction with outgoing transitions to states A.A1 and A.A2. If state A is active, its set of inner flow graphs includes:

In addition, the set of default flow graphs for state A includes:

In this case, the two outgoing transition segments from the junction are members of more than one flow graph type.

Order of Execution for a Set of Flow Graphs

Each flow graph group executes in the order of group priority until a valid transition appears. The default transition group executes first, followed by the outer transitions group and then the inner transitions group. Each flow graph group executes as follows:

  1. Order the group's transition segments for the active state.

    An active state can have several possible outgoing transitions. The chart orders these transitions before checking them for validity. See Evaluation Order for Outgoing Transitions.

  2. Select the next transition segment in the set of ordered transitions.

  3. Test the transition segment for validity.

  4. If the segment is invalid, go to step 2.

  5. If the destination of the transition segment is a state, do the following:

    1. Testing of transition segments stops and a transition path forms by backing up and including the transition segment from each preceding junction back to the starting transition.

    2. The states that are the immediate children of the parent of the transition path exit (see Steps for Exiting an Active State).

    3. The transition action from the final transition segment of the full transition path executes.

    4. The destination state becomes active (see Steps for Entering a State).

  6. If the destination is a junction with no outgoing transition segments, do the following:

    1. Testing stops without any state exits or entries.

  7. If the destination is a junction with outgoing transition segments, repeat step 1 for the set of outgoing segments.

  8. After testing all outgoing transition segments at a junction, take the following actions:

    1. Backtrack the incoming transition segment that brought you to the junction.

    2. Continue at step 2, starting with the next transition segment after the backup segment.

    The set of flow graphs completes execution when all starting transitions have been tested.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS