Stateflow | ![]() |
action
Actions take place as part of Stateflow diagram execution. The action can be executed as part of a transition from one state to another, or depending on the activity status of a state. Transitions can have condition actions and transition actions. For example,
States can have entry
, during
, exit
, and, on
event_name
actions. For example,
If you enter the name and backslash followed directly by an action or actions (without the entry
keyword), the action(s) are interpreted as entry
action(s). This shorthand is useful if you are only specifying entry
actions.
actions
Actions take place as a part of Stateflow diagram execution. The action can be executed as part of a transition from one state to another, or depending on the activity status of a state. Transitions can have condition actions and transition actions. For example,
Action language defines the categories of actions you can specify and their associated notations. For example, states can have entry
, during
, exit
, and on
event_name
actions as shown by the following:
An action can be a function call, a broadcast event, a variable assignment, and so on. For more information on actions and action language, see Action Language.
API (application programming interface)
Format provided to access and communicate with an application program from a programming or script environment.
chart instance
Link from a Stateflow model to a chart stored in a Simulink library. A chart in a library can have many chart instances. Updating the chart in the library automatically updates all the instances of that chart.
condition
Boolean expression to specify that a transition occurs if the specified expression is true. For example,
The action language defines the notation to define conditions associated with transitions. See Action Language for more information.
connective junction
Decision points in the system. A connective junction is a graphical object that simplifies Stateflow diagram representations and facilitates generation of efficient code. Connective junctions provide alternative ways to represent desired system behavior.
This example shows how connective junctions (displayed as small circles) are used to represent the decision flow of an if
code structure.
See Connective Junctions for more information.
data
Data objects store numerical values for reference in the Stateflow diagram.
See Defining Data for more information on representing data objects.
data dictionary
Database where Stateflow diagram information is stored. When you create Stateflow diagram objects, the information about those objects is stored in the data dictionary once you save the Stateflow diagram.
Debugger
See Stateflow Debugger.
decomposition
A state has a decomposition when it consists of one or more substates. A Stateflow diagram that contains at least one state also has decomposition. Representing hierarchy necessitates some rules around how states can be grouped in the hierarchy. A superstate has either parallel (AND) or exclusive (OR) decomposition. All substates at a particular level in the hierarchy must be of the same decomposition.
Parallel (AND) State Decomposition. Parallel (AND) state decomposition is indicated when states have dashed borders. This representation is appropriate if all states at that same level in the hierarchy are active at the same time. The activity within parallel states is essentially independent.
Exclusive (OR) State Decomposition. Exclusive (OR) state decomposition is represented by states with solid borders. Exclusive (OR) decomposition is used to describe system modes that are mutually exclusive. Only one state at the same level in the hierarchy can be active at a time.
default transition
Primarily used to specify which exclusive (OR) state is to be entered when there is ambiguity among two or more neighboring exclusive (OR) states. For example, default transitions specify which substate of a superstate with exclusive (OR) decomposition the system enters by default in the absence of any other information. Default transitions are also used to specify that a junction should be entered by default. A default transition is represented by selecting the default transition object from the toolbar and then dropping it to attach to a destination object. The default transition object is a transition with a destination but no source object.
Name |
Button Icon |
Description |
Default transition |
Use a default transition to indicate, when entering this level in the hierarchy, which state becomes active by default. |
See Default Transitions for more information.
events
Events drive the Stateflow diagram execution. All events that affect the Stateflow diagram must be defined. The occurrence of an event causes the status of the states in the Stateflow diagram to be evaluated. The broadcast of an event can trigger a transition to occur and/or can trigger an action to be executed. Events are broadcast in a top-down manner starting from the event's parent in the hierarchy.
Events are added, removed, and edited through the Stateflow Explorer. See Defining Events for more information.
Explorer
A tool for displaying, modifying, and creating data and event objects for any parent object in Stateflow. The Explorer also displays, modifies, and creates targets for the Stateflow machine. See Stateflow Explorer.
Finder
A tool to search for objects in Stateflow diagrams on platforms that do not support the Simulink Find tool. See Stateflow Finder.
finite state machine (FSM)
Representation of an event-driven system. FSMs are also used to describe reactive systems. In an event-driven or reactive system, the system transitions from one mode or state to another prescribed mode or state, provided that the condition defining the change is true.
flow graph
Set of decision flow paths that start from a transition segment that, in turn, starts from a state or a default transition segment.
flow path
Ordered sequence of transition segments and junctions where each succeeding segment starts on the junction that terminated the previous segment.
flow subgraph
Set of decision flow paths that start on the same transition segment.
graphical function
Function whose logic is defined by a flow graph. See Using Graphical Functions in Stateflow Charts.
hierarchy
Hierarchy enables you to organize complex systems by placing states within other higher-level states. A hierarchical design usually reduces the number of transitions and produces neat, more manageable diagrams. See Stateflow Hierarchy of Objects for more information.
history junction
Provides the means to specify the destination substate of a transition based on historical information. If a superstate has a history junction, the transition to the destination substate is defined to be the substate that was most recently visited. The history junction applies to the level of the hierarchy in which it appears.
Name |
Button Icon |
Description |
History junction |
Use a history junction to indicate, when entering this level in the hierarchy, that the last state that was active becomes the next state to be active. |
See these sections for more information:
inner transitions
Transition that does not exit the source state. Inner transitions are most powerful when defined for superstates with XOR decomposition. Use of inner transitions can greatly simplify a Stateflow diagram.
See Inner Transitions and Inner Transition to a History Junction Example for more information.
library link
Link to a chart that is stored in a library model in a Simulink block library.
library model
Stateflow model that is stored in a Simulink library. You can include charts from a library in your model by copying them. When you copy a chart from a library into your model, Stateflow does not physically include the chart in your model. Instead, it creates a link to the library chart. You can create multiple links to a single chart. Each link is called a chart instance. When you include a chart from a library in your model, you also include its Stateflow machine. Thus, a Stateflow model that includes links to library charts has multiple Stateflow machines. When Stateflow simulates a model that includes charts from a library model, it includes all charts from the library model even if there are links to only some of its models. However, when Stateflow generates a stand-alone or RTW target, it includes only those charts for which there are links. A model that includes links to a library model can be simulated only if all charts in the library model are free of parse and compile errors.
machine
Collection of all Stateflow blocks defined by a Simulink model. This excludes chart instances from library links. If a model includes any library links, it also includes the Stateflow machines defined by the models from which the links originate.
notation
Defines a set of objects and the rules that govern the relationships between those objects. Stateflow notation provides a common language to communicate the design information conveyed by a Stateflow diagram.
Stateflow notation consists of
parallelism
A system with parallelism can have two or more states that can be active at the same time. The activity of parallel states is essentially independent. Parallelism is represented with a parallel (AND) state decomposition.
See State Decomposition for more information.
Real-Time Workshop
Automatic C language code generator for Simulink. It produces C code directly from Simulink block diagram models and automatically builds programs that can be run in real time in a variety of environments. See the Real-Time Workshop documentation for more information.
rtw target
Executable built from code generated by the Real-Time Workshop. See Building Targets, for more information.
S-function
When using Simulink together with Stateflow for simulation, Stateflow generates an S-function (MEX-file) for each Stateflow machine to support model simulation. This generated code is a simulation target and is called the sfun
target within Stateflow.
For more information, see Using Simulink documentation.
semantics
Semantics describe how the notation is interpreted and implemented behind the scenes. A completed Stateflow diagram communicates how the system will behave. A Stateflow diagram contains actions associated with transitions and states. The semantics describe in what sequence these actions take place during Stateflow diagram execution.
Simulink
Software package for modeling, simulating, and analyzing dynamic systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two. Systems can also be multirate, i.e., have different parts that are sampled or updated at different rates.
It allows you to represent systems as block diagrams that you build using your mouse to connect blocks and your keyboard to edit block parameters. Stateflow is part of this environment. The Stateflow block is a masked Simulink model. Stateflow builds an S-function that corresponds to each Stateflow machine. This S-function is the agent Simulink interacts with for simulation and analysis.
The control behavior that Stateflow models complements the algorithmic behavior modeled in Simulink block diagrams. By incorporating Stateflow diagrams into Simulink models, you can add event-driven behavior to Simulink simulations. You create models that represent both data and decision flow by combining Stateflow blocks with the standard Simulink blocksets. These combined models are simulated using Simulink.
The Using Simulink documentation describes how to work with Simulink. It explains how to manipulate Simulink blocks, access block parameters, and connect blocks to build models. It also provides reference descriptions of each block in the standard Simulink libraries.
state
A state describes a mode of a reactive system. A reactive system has many possible states. States in a Stateflow diagram represent these modes. The activity or inactivity of the states dynamically changes based on transitions among events and conditions.
Every state has hierarchy. In a Stateflow diagram consisting of a single state, that state's parent is the Stateflow diagram itself. A state also has history that applies to its level of hierarchy in the Stateflow diagram. States can have actions that are executed in a sequence based upon action type. The action types are entry
, during
, exit
, or on
event_name
actions.
Name |
Button Icon |
Description |
State |
Use a state to depict a mode of the system. |
Stateflow block
Masked Simulink model that is equivalent to an empty, untitled Stateflow diagram. Use the Stateflow block to include a Stateflow diagram in a Simulink model.
The control behavior that Stateflow models complements the algorithmic behavior modeled in Simulink block diagrams. By incorporating Stateflow blocks into Simulink models, you can add complex event-driven behavior to Simulink simulations. You create models that represent both data and decision flow by combining Stateflow blocks with the standard Simulink and toolbox block libraries. These combined models are simulated using Simulink.
Stateflow Debugger
Use to debug and animate your Stateflow diagrams. Each state in the Stateflow diagram simulation is evaluated for overall code coverage. This coverage analysis is done automatically when the target is compiled and built with the debug options. The Debugger can also be used to perform dynamic checking. The Debugger operates on the Stateflow machine.
Stateflow diagram
Using Stateflow, you create Stateflow diagrams. A Stateflow diagram is also a graphical representation of a finite state machine where states and transitions form the basic building blocks of the system. See Stateflow and Simulink for more information on Stateflow diagrams.
Stateflow Explorer
Use to add, remove, and modify data, event, and target objects. See The Stateflow Explorer Tool for more information.
Stateflow Finder
Use to display a list of objects based on search criteria you specify. You can directly access the properties dialog box of any object in the search output display by clicking that object. See The Stateflow Finder Tool for more information.
subchart
Chart contained by another chart. See Using Graphical Functions in Stateflow Charts.
substate
A state is a substate if it is contained by a superstate.
superstate
A state is a superstate if it contains other states, called substates.
supertransition
Transition between objects residing in different subcharts. See Using Supertransitions in Stateflow Charts for more information.
Target
An executable program built from code generated by Stateflow or the Real-Time Workshop. See Building Targets, for more information.
topdown processing
The way in which Stateflow processes states and events. In particular, Stateflow processes superstates before states. Stateflow processes a state only if its superstate is activated first.
transition
The circumstances under which the system moves from one state to another. Either end of a transition can be attached to a source and a destination object. The source is where the transition begins and the destination is where the transition ends. It is often the occurrence of some event that causes a transition to take place.
transition path
Flow path that starts and ends on a state.
transition segment
A state-to-junction, junction-to-junction, or junction-to-state part of a complete state-to-state transition. Transition segments are sometimes loosely referred to as transitions.
virtual scrollbar
Enables you to set a value by scrolling through a list of choices. When you move the mouse over a menu item with a virtual scrollbar, the cursor changes to a line with a double arrowhead. Virtual scrollbars are either vertical or horizontal. The direction is indicated by the positioning of the arrowheads. Drag the mouse either horizontally or vertically to change the value.
See Viewing Data and Events from the Editor for more information.
![]() | Glossary |