Stateflow    

Executing a Chart

A Stateflow chart executes when it is triggered by an event from Simulink. Like all events, this event is processed top down in the updated chart. See Executing an Event.

A chart is inactive when it is first triggered by an event from the Simulink model and has no active states within it. After the chart executes and completely processes its initial trigger event from the Simulink model, it exits to the model and goes to sleep, but still remains active. A sleeping chart has active states within it, but no events to process. When Simulink triggers the chart the next time, it is an active but sleeping chart.

Executing an Inactive Chart

When a chart is inactive and first triggered by an event from Simulink, it first executes its set of default flow graphs (see Executing a Set of Flow Graphs). If this does not cause an entry into a state and the chart has parallel decomposition, then each parallel state is entered (see Entering a State).

If executing the default flow paths does not cause state entry, a state inconsistency error occurs.

Executing an Active Chart

After a chart has been triggered the first time by the Simulink model, it is an active chart. When it receives another event from Simulink, it executes again as an active chart. If the chart has no states, each execution is equivalent to initializing a chart. Otherwise, the active children are executed. Parallel states are executed in the same order that they are entered.


  Processing Events Executing a Transition