Stateflow | ![]() ![]() |
Stateflow Hierarchy of Objects
The Stateflow hierarchy of objects enables you to organize complex Stateflow diagrams by defining a parent and child object containment structure. A hierarchical design usually reduces the number of transitions and produces neat, manageable diagrams. Stateflow supports a hierarchical organization of both charts and states. Charts can exist within charts. A chart that exists in another chart is known as a subchart.
Similarly, states can exist within other states. Stateflow represents state hierarchy with superstates and substates. For example, this Stateflow diagram has a superstate that contains two substates.
The engaged
superstate contains the first
and second
substates. The engaged
superstate is the parent in the hierarchy to the states first
and second
. When the event clutch_engaged
occurs, the system transitions out of the neutral
state to the engaged
superstate. Transitions within the engaged
superstate are intentionally omitted from this example for simplicity.
A transition out of a higher level, or superstate, also implies transitions out of any active substates of the superstate. Transitions can cross superstate boundaries to specify a substate destination. If a substate is made active its parent superstate is also made active.
![]() | Connective Junctions | Exploring a Real-World Stateflow Application | ![]() |