Stateflow Semantics

In Stateflow®, semantics describe the execution behavior of your Stateflow chart. Various factors can affect how your chart executes, including:

  • Explicit or implicit ordering of states

  • Transition ordering between states

  • Events sent by parallel or superstates

As you build your chart, you expect it to behave in a certain way. By knowing how these factors affect your chart, you can create a chart that behaves with intentional interaction of the graphical and nongraphical objects. Graphical and nongraphical objects are the building blocks for all Stateflow charts.

Stateflow Objects

Stateflow objects are the building blocks of Stateflow charts. These objects can be categorized as either graphical or nongraphical. Graphical objects consist of objects that appear graphically in a chart. Nongraphical objects appear textually in a chart and often refer to data, events, and messages. This chart shows a variety of both graphical and nongraphical objects.

Graphical Objects

To build graphical objects, use the object palette in the Stateflow Editor (see Stateflow Editor Operations).

Graphical ObjectsTypesReferences

Flow charts

Decision logic patternsFlow Charts in Stateflow
Loop logic patterns

Functions

Graphical functionsReuse Logic Patterns by Defining Graphical Functions
MATLAB® functionsReuse MATLAB Code by Defining MATLAB Functions
Truth table functionsUse Truth Tables to Model Combinatorial Logic
Simulink® functionsReuse Simulink Components in Stateflow Charts

Junctions

Connective junctionsCombine Transitions and Junctions to Create Branching Paths
History junctionsHistory Junctions

States

States with exclusive (OR) decompositionExclusive (OR) State Decomposition
States with parallel (AND) decompositionParallel (AND) State Decomposition
Substates and superstatesCreate Substates and Superstates

Transitions

Default transitionsDefault Transitions
Object-to-object transitionsTransition Connections
Inner transitions
Self-loop transitions

Nongraphical Objects

You create nongraphical objects textually in your chart. See Add Stateflow Data, Define Events in a Chart, and Define Messages in a Chart for details. Examples of nongraphical objects include:

Nongraphical ObjectDescriptionReference
ConditionBoolean expression that specifies that a transition path is valid if the expression is true; part of a transition label

Transition Labels and Conditions

Condition actionAction that executes as soon as the condition evaluates to true; part of a transition label

Transition Labels and Condition Actions

State actionsExpressions that specify actions to take when a state is active, such as initializing or updating data; part of a state label

State Labels and State Action Types

Function callsExpression used to activate a specific function within a chart.Reuse MATLAB Code by Defining MATLAB Functions and Reuse Simulink Components in Stateflow Charts
Temporal logic statementsOperators that are used to control chart actions.Control Chart Execution by Using Temporal Logic

Related Topics