Anatomy of a Stateflow Chart

Here is an example of a Stateflow® chart, which models as a finite-state machine the logic required to shift gears in an automatic transmission system of a car:

Notice the following details in this chart:

  • Each gear and shift position is represented by a state.

  • States having a dashed boundary, such as gear_state and selection_state, are parallel (can be active concurrently).

  • States with a solid boundary, such as first, second, third and fourth, are exclusive (only one can be active at a time).

  • Transitions can be triggered by events and conditions.

  • Directed-event broadcasts, such as UP and DOWN, trigger selective execution of chart logic.

This chart is part of an example model called sf_car that ships with the Stateflow product. To explore the model further, open it by typing sf_car at the command prompt in the MATLAB® Command Window.

Was this topic helpful?