Stateflow® Hierarchy of Objects

Stateflow® machines arrange Stateflow objects in a hierarchy based on containment. That is, one Stateflow object can contain other Stateflow objects.

The highest object in Stateflow hierarchy is the Stateflow machine. It is defined as an object that contains all other Stateflow objects in a Simulink® model. This means that the Stateflow machine contains all the Stateflow charts in a Simulink model. In addition, the Stateflow machine for a model can also contain its own data, event, and target objects. Only a simulation target (named sfun) is added to the Stateflow machine by default when the model is created. All other data, event, and target objects must be added to the machine.

Similarly, charts can contain state, box, function, data, event, transition, junction, and note events. You use all of these objects to create a Stateflow chart. Continuing with the Stateflow hierarchy, states can contain all of these objects as well, including other states. You can represent state hierarchy with superstates and substates. For example, this chart has a superstate that contains two substates.

In the preceding chart, 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 superstate implies transitions out of any of its active substates. Transitions can cross superstate boundaries to specify a substate destination. If a substate is made active, its parent superstate is also made active.

You can organize complex charts by defining a containment structure. A hierarchical design usually reduces the number of transitions and produces neat, manageable charts. To manage graphical objects, use the Stateflow Editor. To manage nongraphical objects, use the Model Explorer or the Stateflow Editor.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS