Define Exclusive and Parallel Modes by Using State Decomposition
Every state (or chart) has a decomposition that dictates what type of substates the state (or chart) can contain. All substates of a superstate must be of the same type as the superstate decomposition. State decomposition can be exclusive (OR) or parallel (AND).
Exclusive (OR) State Decomposition
Substates with solid borders indicate exclusive (OR) state decomposition. Use this decomposition to describe operating modes that are mutually exclusive. When a state has exclusive (OR) decomposition, only one substate can be active at a time.
For example, in this chart, either state A
or state
B
can be active. If state A
is active, either state
A1
or state A2
can be active at a given time.
Parallel (AND) State Decomposition
Substates with dashed borders indicate parallel (AND) decomposition. Use this decomposition to describe concurrent operating modes. When a state has parallel (AND) decomposition, all substates are active at the same time.
In the following example, when state A
is active,
A1
and A2
are both active at the same time.
The activity within parallel states is essentially independent, as demonstrated in the following example.
In the following example, when state A
becomes active, both states
B
and C
become active at the same time. When state
C
becomes active, either state C1
or state
C2
can be active.
Specify Substate Decomposition
You specify whether a superstate contains parallel (AND) states or exclusive (OR) states by setting its decomposition. A state whose substates are all active when it is active has parallel (AND) decomposition. A state in which only one substate is active when it is active has exclusive (OR) decomposition.
To alter the decomposition of a state, select the state, right-click the state to display the Decomposition context menu, and select OR (Exclusive) or AND (Parallel) from the menu.
You can also specify the state decomposition of a chart. In this case, the Stateflow® chart treats its top-level states as substates. The chart creates states with exclusive decomposition. To specify the decomposition of a chart, deselect any selected objects, right-click the chart to display the Decomposition context menu, and select OR (Exclusive) or AND (Parallel) from the menu.
The appearance of the substates indicates the decomposition of their superstate. Exclusive substates have solid borders, parallel substates, dashed borders. A parallel substate also contains a number in its upper right corner. The number indicates the activation order of the substate relative to its sibling substates.