Skip to Main Content Skip to Search
Product Documentation

Stateflow Chart - Classic, Mealy, and Moore finite state machines for implementing control logic

Library

Stateflow

Description

A finite state machine is a representation of an event-driven (reactive) system. In an event-driven system, the system responds by making a transition from one state (mode) to another. This action occurs in response to an event, as long as the condition defining the change is true.

A Stateflow chart is a graphical representation of a finite state machine, where states and transitions form the basic elements of the system. You can also represent stateless flow graphs. To add your control logic to a Simulink model, use a Stateflow block.

You can use Stateflow charts to control a physical plant in response to events such as a temperature or pressure sensor, or clock or user-driven events. For example, you can use a state machine to represent the automatic transmission of a car. The transmission has these operating states: park, reverse, neutral, drive, and low. As the driver shifts from one position to another, the system makes a transition from one state to another, for example, from park to reverse.

The following block diagram contains a Chart block named Hotel that responds to inputs from several Manual Switch blocks.

If you double-click the Chart block in the model, the chart appears.

By default, the Chart block uses Classic chart semantics. You can also specify Mealy or Moore semantics for your state chart. For more information, see Building Mealy and Moore Charts.

Data Type Support

The Chart block accepts inputs of any type including two-dimensional matrices, fixed-point data, and enumerated data. Floating-point inputs pass through the block unchanged. Boolean inputs are treated as uint8 signals.

You can declare local data of any type or size.

Parameters and Dialog Box

For a description of the block parameters, see the Subsystem block reference page in the Simulink documentation.

Characteristics

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

N/A

Dimensionalized

Yes

Zero-Crossing Detection

Yes, if enabled for continuous-time systems

For more information, see Modeling Continuous-Time Systems in Stateflow Charts in the Stateflow documentation.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS