Transition Connections

Transitions to and from Exclusive (OR) States

This example shows simple transitions to and from exclusive (OR) states.

The following transition...Is valid when...
B to AState B is active and the event E1 occurs.
A1 to A2State A1 is active and event E2 occurs.

See Transition to and from Exclusive (OR) States for more information on the semantics of this notation.

Transitions to and from Junctions

The following chart shows transitions to and from connective junctions.

The chart uses temporal logic to determine when the input u equals 1.

If the input equals 1...A transition occurs from...
Before t = 2Start to Fast
Between t = 2 and t = 5Start to Good
After t = 5Start to Slow

For more information about temporal logic, see Control Chart Execution Using Temporal Logic. For more information on the semantics of this notation, see Transition from a Common Source to Multiple Destinations.

Transitions to and from Exclusive (OR) Superstates

This example shows transitions to and from an exclusive (OR) superstate and the use of a default transition.

The chart has two states at the highest level in the hierarchy, Power_off and Power_on. By default, Power_off is active. The event Switch toggles the system between the Power_off and Power_on states. Power_on has three substates: First, Second, and Third. By default, when Power_on becomes active, First also becomes active. When Shift equals 1, the system transitions from First to Second, Second to Third, Third to First, for each occurrence of the event Switch, and then the pattern repeats.

For more information on the semantics of this notation, see Control Chart Execution Using Default Transitions.

Transitions to and from Substates

The following example shows transitions to and from exclusive (OR) substates.

For details on how this chart works, see Key Behaviors of Debouncer Chart. For information on the semantics of this notation, see Transition from a Substate to a Substate with Events.

Self-Loop Transitions

A transition that originates from and terminates on the same state is a self-loop transition. The following chart contains four self-loop transitions:

See these sections for more information about the semantics of this notation:

Inner Transitions

An inner transition is a transition that does not exit the source state. Inner transitions are powerful when defined for superstates with exclusive (OR) decomposition. Use of inner transitions can greatly simplify a Stateflow® chart, as shown by the following examples:

Before Using an Inner Transition

This chart is an example of how you can simplify logic using an inner transition.

Any event occurs and awakens the Stateflow chart. The default transition to the connective junction is valid. The destination of the transition is determined by [c1 > 0] and [c2 > 0]. If [c1 > 0] is true, the transition to A1 is true. If [c2 > 0] is true, the transition to A2 is valid. If neither [c1 > 0] nor [c2 > 0] is true, the transition to A3 is valid. The transitions among A1, A2, and A3 are determined by E, [c1 > 0], and [c2 > 0].

After Using an Inner Transition to a Connective Junction

This example simplifies the preceding example using an inner transition to a connective junction.

An event occurs and awakens the chart. The default transition to the connective junction is valid. The destination of the transitions is determined by [c1 > 0] and [c2 > 0].

You can simplify the chart by using an inner transition in place of the transitions among all the states in the original example. If state A is already active, the inner transition is used to reevaluate which of the substates of state A is to be active. When event E occurs, the inner transition is potentially valid. If [c1 > 0] is true, the transition to A1 is valid. If [c2 > 0] is true, the transition to A2 is valid. If neither [c1 > 0] nor [c2 > 0] is true, the transition to A3 is valid. This chart design is simpler than the previous one.

    Note:   When you use an inner transition to a connective junction, an active substate can exit and reenter when the transition condition for that substate is valid. For example, if substate A1 is active and [c1 > 0] is true, the transition to A1 is valid. In this case:

    1. Exit actions for A1 execute and complete.

    2. A1 becomes inactive.

    3. A1 becomes active.

    4. Entry actions for A1 execute and complete.

See Process the First Event with an Inner Transition to a Connective Junction for more information on the semantics of this notation.

Using an Inner Transition to a History Junction

This example shows an inner transition to a history junction.

State Power_on.High is initially active. When event Reset occurs, the inner transition to the history junction is valid. Because the inner transition is valid, the currently active state, Power_on.High, is exited. When the inner transition to the history junction is processed, the last active state, Power_on.High, becomes active (is reentered). If Power_on.Low was active under the same circumstances, Power_on.Low would be exited and reentered as a result. The inner transition in this example is equivalent to drawing an outer self-loop transition on both Power_on.Low and Power_on.High.

See Use of History Junctions Example for another example using a history junction.

See Inner Transition to a History Junction for more information on the semantics of this notation.

Was this topic helpful?