Stateflow    

Executing a Set of Flow Graphs

Each flow graph group is executed in the order of group priority until a valid transition is found. The default transitions group is executed first, followed by the inner transitions group and then the outer transitions group. Each flow graph group is executed with the following procedure.

  1. Order the group's transition segments for the active state.
  1. An active state can have several possible outgoing transitions. These are ordered before checking them for a valid transition. See Ordering Single Source Transitions.

  1. Select the next transition segment in the set of ordered transitions.
  2. Test the transition segment for validity.
  3. If the segment is invalid, go to step 2.
  4. If the destination of the transition segment is a state, do the following:
    1.     No more transition segments are tested and a transition path is formed by 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 are exited (see Executing an Active State).
    3.     The transition action for the final transition segment of the full transition path is executed.
    4. The destination state is entered (see Entering a State).
  5. If the destination is a junction with no outgoing transition segments, do the following:
    1. Testing stops without any states being exited or entered.
  6. If the destination is a junction with outgoing transition segments, repeat step 1 for the set of outgoing segments from the junction.
  7.     After testing all outgoing transition segments at a junction, back up the incoming transition segment that brought you to the junction and continue at step 2, starting with the next transition segment after the backup segment. The set of flow graphs is done executing when all starting transitions have been tested.

  Transition Flow Graph Types Ordering Single Source Transitions