Control Chart Execution Using Default Transitions

Default Transition in Exclusive (OR) Decomposition

This example shows a transition from an OR state to a superstate with exclusive (OR) decomposition, where a default transition to a substate is defined.

Initially, the chart is asleep. State A is active. Event E_one occurs and awakens the chart, which processes the event from the root down through the hierarchy:

  1. The chart root checks to see if there is a valid transition as a result of E_one. There is a valid transition from state A to superstate B.

  2. State A exit actions (exitA()) execute and complete.

  3. State A is marked inactive.

  4. The transition action, A, is executed and completed.

  5. State B is marked active.

  6. State B entry actions (entB()) execute and complete.

  7. State B detects a valid default transition to state B.B1.

  8. State B.B1 is marked active.

  9. State B.B1 entry actions (entB1()) execute and complete.

  10. The chart goes back to sleep.

This sequence completes the execution of this Stateflow® chart associated with event E_one when state A is initially active.

Default Transition to a Junction

The following example shows the behavior of a default transition to a connective junction. The default transition to the junction is valid only when state B is first entered, not every time the chart wakes up.

For this example, initially, the chart is asleep. State B.B1 is active. Condition [C_two] is true. An event occurs and awakens the chart, which processes the event from the root down through the hierarchy:

  1. State B checks to see if there is a valid transition as a result of any event. There is none.

  2. State B during actions (durB()) execute and complete.

  3. State B1 checks to see if there is a valid transition as a result of any event. There is none.

  4. State B1 during actions (durB1()) execute and complete.

This sequence completes the execution of this Stateflow chart associated with the occurrence of any event.

Default Transition and a History Junction

This example shows the behavior of a superstate with a default transition and a history junction. The chart uses implicit ordering of outgoing transitions (see Implicit Ordering of Outgoing Transitions).

Initially, the chart is asleep. State A is active. A history junction records the fact that state B4 is the previously active substate of superstate B. Event E_one occurs and awakens the chart, which processes the event from the root down through the hierarchy:

  1. The chart root checks to see if there is a valid transition as a result of E_one.

    There is a valid transition from state A to superstate B.

  2. State A exit actions (exitA()) execute and complete.

  3. State A is marked inactive.

  4. State B is marked active.

  5. State B entry actions (entB()) execute and complete.

  6. State B uses the history junction to determine the substate destination of the transition into the superstate.

    The history junction indicates that substate B.B4 was the last active substate, which becomes the destination of the transition.

  7. State B.B4 is marked active.

  8. State B.B4 entry actions (entB4()) execute and complete.

  9. The chart goes back to sleep.

This sequence completes the execution of this Stateflow chart associated with event E_one.

Labeled Default Transitions

This example shows the use of a default transition with a label. The chart uses implicit ordering of outgoing transitions (see Implicit Ordering of Outgoing Transitions).

Initially, the chart is asleep. State A is active. Event E_one occurs and awakens the chart, which processes the event from the root down through the hierarchy:

  1. The chart root checks to see if there is a valid transition as a result of E_one.

    There is a valid transition from state A to superstate B. The transition is valid if event E_one or E_two occurs.

  2. State A exit actions execute and complete (exitA()).

  3. State A is marked inactive.

  4. State B is marked active.

  5. State B entry actions execute and complete (entB()).

  6. State B detects a valid default transition to state B.B1. The default transition is valid as a result of E_one.

  7. State B.B1 is marked active.

  8. State B.B1 entry actions execute and complete (entB1()).

  9. The chart goes back to sleep.

This sequence completes the execution of this Stateflow chart associated with event E_one when state A is initially active.

Was this topic helpful?