Stateflow    

How Hierarchy Is Represented

Stateflow notation supports the representation of graphical object hierarchy in Stateflow diagrams. See the following examples of representing hierarchy in Stateflow diagrams:

Data and event objects are nongraphical objects whose hierarchy is represented in the Explorer tool. Data and event hierarchy is defined by specifying the parent object when you create it. See Chapter 6, "Defining Events and Data" and Chapter 8, "Defining Stateflow Interfaces" for information and examples on representing data and event objects in the Explorer tool.

Representing State Hierarchy Example

In the following example, drawing one state within the boundaries of another state indicates that the inner state is a substate or child of the outer state or superstate and the outer state is the parent of the inner state:

In this example, the Stateflow diagram is the parent of the state Car_done. The state Car_done is the parent state of the Car_made and Car_shipped states. The state Car_made is also the parent of the Parts_assembled and Painted states. You can also say that the states Parts_assembled and Painted are children of the Car_made state.

Stateflow hierarchy can also be represented textually, in which the Stateflow diagram is represented by the slash (/) character and each level in the hierarchy of states is separated by the period (.) character. The following is a textual representation of the hierarchy of objects in the preceding example:

Representing Transition Hierarchy Example

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 contains the source and destination of the transition. 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.

Transition Label
Transition
Parent
Transition
Source
Transition
Destination
switch_off
/
/Power_on.Low.Heat
/Power_off
switch_high
/Power_on
/Power_on.Low.Heat
/Power_on.High
switch_cold
/Power_on.Low
/Power_on.Low.Heat
/Power_on.Low.Cold


  The Data Dictionary States