Stateflow | ![]() ![]() |
How Hierarchy Is Represented
The notation supports the representation of object hierarchy in Stateflow diagrams. Some of the objects are graphical while others are nongraphical.
An example of a graphical hierarchy is the ability to draw one state within the boundaries of another state. Such a representation indicates that the inner state is a substate or child of the outer state or superstate. The outer state is the parent of the inner state. In the simple case of a Stateflow diagram with a single state, the Stateflow diagram is that state's parent. Transitions are another example of graphical hierarchy. A transition's hierarchy is represented by determining its parent, source, and destination. In a Stateflow diagram you can see a transition's parent, source, and destination.
Data and event object are nongraphical and their hierarchy is represented differently (using the Explorer) from the graphical object hierarchy (using the graphics editor).
All of the objects in the notation support the representation of hierarchy.
See Chapter 4, Defining Events and Data, and Chapter 5, Defining Stateflow Interfaces, for information and examples of representing data and event objects.
For more information on how the hierarchy representations are interpreted, see Chapter 8, Semantics.
Example: Representing State Hierarchy
This is an example of how state hierarchy is represented.
The Stateflow diagram is the parent of Car_done
. Car_done
is the parent state of the Car_made
and Car_shipped
states. Car_made
is also a parent to the Parts_assembled
and Car_painted
states. Parts_assembled
and Car_painted
are children of the Car_made
state.
The machine is the root of the Stateflow hierarchy. The Stateflow diagram is represented by the / character. Each level in the hierarchy of states is separated by the . character. The full hierarchy representation of the state names in this example is:
/Car_done
/Car_done
.Car_made
/Car_done
.Car_shipped
/Car_done
.Car_made
.Parts_assembled
/Car_done
.Car_made
.Painted
Example: Representing Transition Hierarchy
This is an example of how transition hierarchy is represented.
A transition's hierarchy is described in terms of the transition's parent, source, and destination. The parent is the lowest level that the transition (source and destination) is contained within. The machine is the root of the hierarchy. The Stateflow diagram is represented by the / character. Each level in the hierarchy of states is separated by the . (period) character. The three transitions in the example are represented in the following table.
Example: Representing Event Hierarchy
Event hierarchy is defined by specifying the parent of an event when you create it. Events are nongraphical and are created using either the graphics editor Add menu or the Explorer. Using hierarchy you can optimize event processing through directed event broadcasting. Directed event broadcasting is the ability to qualify who can send and receive event broadcasts.
See Defining Events for more information.
See Action Language for more information on the notation for directed event broadcasting.
![]() | The Data Dictionary | States | ![]() |