| Using Stateflow | Search  Help Desk |
What Is an Inner Transition?
An inner transition is a transition that does not exit the source state. Inner transitions are most powerful when defined for superstates with exclusive (OR) decomposition. Use of inner transitions can greatly simplify a Stateflow diagram.Example One: Before Using an Inner Transition
This is an example of a Stateflow diagram that could be simplified by using an inner transition.
[C_one] and [C_two]. If [C_one] is true, the transition to A1 is true. If [C_two] is true, the transition to A2 is valid. If neither [C_one] nor [C_two] is true, the transition to A3 is valid. The transitions among A1, A2, and A3 are determined by E_one, [C_one], and [C_two].
Example One: Inner Transition to a Connective Junction
This example shows a solution to the same problem (Example One) using an inner transition to a connective junction.
[C_one] and [C_two].
The Stateflow diagram is simplified by using an inner transition in place of the many transitions amongst all the states in the original example. If state A is already active, the inner transition is used to re-evaluate which of the substates of state A is to be active. When event E_one occurs, the inner transition is potentially valid. If [C_one] is true, the transition to A1 is valid. If [C_two] is true, the transition to A2 is valid. If neither [C_one] nor [C_two] is true, the transition to A3 is valid. This solution is much simpler than the previous one.
See the section titled "Example: Processing One Event with an Inner Transition to a Connective Junction" for more information on the semantics of this notation.
Example Two: Before Using an Inner Transition
This is an example of a Stateflow diagram that could be simplified by using an inner transition.
[C_one] and [C_two]. If [C_one] is true, the transition to A1 is true. If [C_two] is true, the transition to A2 is valid. The transitions between A1 and A2 are also determined by [C_one] and [C_two].
Example Two: Inner Transition to a Connective Junction
This example shows a solution to the same problem (Example Two) using an inner transition to a connective junction.
[C_one] and [C_two]. (When the default transition path is followed, neither state A1 nor A2 is active; thus the truth of condition is based exclusively on [C_one] and [C_two].)
The Stateflow diagram is simplified by using an inner transition in place of the transitions between A.A1 and A.A2 in the original example. If state A is already active, the inner transition is used to re-evaluate which of the substates of state A is to be active. If state A1 is not active and [C_one] is true, the transition to A1 is valid. If state A2 is not active and [C_two] is true, the transition to A2 is valid. This solution is much simpler than the previous one.
See the section titled "Example: Processing One Event with an Inner Transition to a Connective Junction" for more information on the semantics of this notation.
Example: Inner Transition to a History Junction
This example shows an inner transition to a history junction.
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, will be exited. When the inner transition to the history junction is processed, the last active state, Power_on.High, becomes active (is re-entered). If Power_on.Low was active under the same circumstances, Power_on.Low would be exited and re-entered 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 the section titled "Example: Use of History Junctions" for another example using a history junction.
See the section titled "Example: Inner Transition to a History Junction" for more information on the semantics of this notation.