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 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.
To build graphical objects, use the object palette in the Stateflow Editor (see Stateflow Editor Operations).
Graphical Objects | Types | References |
---|---|---|
Flow charts | Decision logic patterns | Flow Charts in Stateflow |
Loop logic patterns | ||
Functions | Graphical functions | Reuse Logic Patterns by Defining Graphical Functions |
MATLAB® functions | Reuse MATLAB Code by Defining MATLAB Functions | |
Truth table functions | Use Truth Tables to Model Combinatorial Logic | |
Simulink® functions | Reuse Simulink Components in Stateflow Charts | |
Junctions | Connective junctions | Combine Transitions and Junctions to Create Branching Paths |
History junctions | History Junctions | |
States | States with exclusive (OR) decomposition | Exclusive (OR) State Decomposition |
States with parallel (AND) decomposition | Parallel (AND) State Decomposition | |
Substates and superstates | Create Substates and Superstates | |
Transitions | Default transitions | Default Transitions |
Object-to-object transitions | Transition Connections | |
Inner transitions | ||
Self-loop transitions |
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 Object | Description | Reference |
---|---|---|
Condition | Boolean expression that specifies that a transition path is valid if the expression is true; part of a transition label | |
Condition action | Action that executes as soon as the condition evaluates to true; part of a transition label | |
State actions | Expressions that specify actions to take when a state is active, such as initializing or updating data; part of a state label | |
Function calls | Expression 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 statements | Operators that are used to control chart actions. | Control Chart Execution by Using Temporal Logic |