Specify Properties for Stateflow Charts
Chart properties specify how your Stateflow® chart interfaces with the Simulink® model. You can modify these properties in the Property Inspector, the Model Explorer, or the Chart properties dialog box.
To use the Property Inspector:
In the Modeling tab, under Design Data, select Property Inspector.
In the Stateflow Editor, click the chart.
In the Property Inspector, edit the chart properties.
To use the Model Explorer:
In the Modeling tab, under Design Data, select Model Explorer.
In the Model Hierarchy pane, select the chart.
In the Dialog pane, edit the chart properties.
To use the Chart properties dialog box:
In the Stateflow Editor, right-click the chart.
Select Properties.
In the properties dialog box, edit the chart properties.
You can also modify chart properties programmatically by using Stateflow.Chart
objects. For more information about the Stateflow programmatic interface, see Overview of the Stateflow API.
Stateflow Chart Properties
You can set the following chart properties in:
The Properties tab of the Property Inspector
The General tab of the Model Explorer or the Chart properties dialog box
Name
Name of the chart. This property is read-only. When you click the chart name hyperlink in the Model Explorer and the Chart properties dialog box, the chart opens in the Stateflow Editor.
Machine
Name of the Simulink subsystem. This property is read-only and is not available in the Property Inspector. When you click the machine name hyperlink, the Machine properties dialog box opens.
Action Language
Action language that defines the syntax for state and transition actions in the chart. Options include:
MATLAB
C
The default value is MATLAB
. For more
information, see Differences Between MATLAB and C as Action Language Syntax.
State Machine Type
Type of state machine semantics to implement. Options include:
Classic
Mealy
Moore
Classic charts provide the full set of Stateflow semantics. Mealy and Moore charts use a subset of these semantics. The
default value is Classic
. For more information, see Overview of Mealy and Moore Machines.
Update Method
Method by which a simulation updates or wakes up a chart in a Simulink model.
Setting | Description |
---|---|
Inherited | Input from the Simulink model determines when the chart wakes up during a simulation (default). If you define input events for the chart, the
Stateflow chart is explicitly triggered by a signal on its trigger port
originating from a connected Simulink block. You can set this trigger input event to occur in response
to a Simulink signal. The Simulink signal can be If you do not define input events, the Stateflow chart implicitly inherits triggers from the Stateflow model. These implicit events are the discrete or continuous sample times of the Stateflow signals providing inputs to the chart. If you define data inputs, the chart awakens at the rate of the fastest data input. If you do not define any data input for the chart, the chart wakes up as defined by the execution behavior of its parent subsystem. |
Discrete | The Simulink model generates an implicit event at regular time intervals to awaken the Stateflow chart at the rate that you specify in the Sample Time chart property. Other blocks in the Simulink model can have different sample times. |
Continuous | The Stateflow chart updates its state during major time steps only, although it computes outputs and local continuous variables during major and minor time steps. The chart can register zero crossings, which allows Simulink models to sample Stateflow charts whenever state changes occur. The Stateflow chart computes derivatives for local continuous variables. For more information, see Continuous-Time Modeling in Stateflow. |
Sample Time
The time interval at which the Stateflow chart wakes up during simulation. The sample time can be any nonzero number.
The sample time is in the same units as the Simulink simulation time. Other blocks in the Simulink model can have different sample times. This option is available only when
you set the chart property Update method to
Discrete
.
Enable zero-crossing detection
Specifies that zero-crossing detection is enabled (default). This option is available
only when you set the chart property Update method to
Continuous
. See Disable Zero-Crossing Detection.
Enable C-bit operations
Specifies that the operators &
, ^
,
|
, and ~
perform bitwise operations in action
statements (default). If you clear this check box:
&
,|
, and~
perform logical operations.^
performs the power operation.
This option is available only in charts that use C as the action language. For more information, see Operations for Stateflow Data.
User-specified state/transition execution order
Specifies that the chart uses explicit ordering of parallel states and transitions (default). You determine the order in which the chart executes parallel states and tests transitions originating from a source. This option is available only in charts that use C as the action language. For more information, see Execution Order for Parallel States and Evaluate Transitions.
Export chart level functions
Extends the scope of functions defined at the root level of the chart to other parts of the model. This option enables Simulink Caller blocks to call Stateflow functions in the local hierarchy by using qualified notation chartName.functionName. For more information, see Export Stateflow Functions for Reuse.
Treat exported functions as globally visible
Enables Stateflow and Simulink Caller blocks throughout the model to call functions exported from Stateflow without using qualified notation. This option is available only when you select the chart property Export chart level functions. For more information, see Export Stateflow Functions for Reuse.
Execute (enter) chart at initialization
Specifies that the chart initializes its state configuration at time 0 instead of at the first occurrence of an input event. For more information, see Execution of a Chart at Initialization.
Initialize outputs every time chart wakes up
Specifies that the chart resets its output values every time that the chart wakes up, not only at time 0. Output values are reset whenever a chart is triggered by function call, edge trigger, or clock tick. If you set an initial value for an output data object, the output resets to that value. Otherwise, the output resets to zero. Select this option to:
Ensure that all outputs are defined in every chart execution.
Prevent latching of outputs (carrying over values of outputs computed in previous executions).
Provide all chart outputs with a meaningful initial value.
For more information, see Initial value.
Enable super step semantics
Specifies that the chart can take multiple transitions in each time step until it
reaches a stable state. This option is not available when you set the chart property
Update method to Continuous
.
For more information, see Super Step Semantics.
Maximum iterations in each super step
Specifies the maximum number of transitions that the chart can take in each time step. The chart always takes one transition during a super step, so the value N that you specify represents the maximum number of additional transitions (for a total of N+1). This option is available only when you select the chart property Enable super step semantics. For more information, see Maximum Number of Iterations.
Behavior after too many iterations
Specifies how the chart behaves after it reaches the maximum number of transitions in a time step.
Behavior | Description |
---|---|
Proceed | Chart execution continues to the next time step. |
Throw Error | Simulation stops and an error message appears. This setting is valid only for simulation. In generated code, chart execution always proceeds to the next time step rather than generating an error. |
This option is available only when you select the chart property Enable super step semantics.
Support variable-size arrays
Specifies that chart supports data that vary in size during simulation. See Declare Variable-Size Data in Stateflow Charts.
Treat dimensions of length 1 as fixed size
Since R2023a
Specifies if output data with at least one dimension of length 1 are fixed size. When this property is enabled, the chart sets data that are variable size in the chart with a dimension of 1 to fixed size. When this property is disabled, data in the chart that has the Variable size property enabled are always variable size. Prior to R2023a, the chart treats data with at least one dimension of length 1 as fixed size.
This property only affects output data that have the Variable size property enabled. See Declare Variable-Size Data in Stateflow Charts.
Saturate on integer overflow
Specifies that integer overflows saturate in the generated code. See Handle Integer Overflow for Chart Data.
Variant activation time
Specifies active choice of the variant blocks or variant parameters at different stages of the simulation and code generation workflow. Based on the stage you specify using this property, Stateflow determines if the generated code must contain only the active choice or both active and inactive choices.
update diagram analyze all choices
– with this option enabled, Stateflow analyzes both active and inactive choices for incompatibilities in signal attributes, however it generates code only for the active choice.code compile
– with this option enabled, Stateflow analyzes both active and inactive choices of variant transitions and generates code for both active and inactive choices. The choices are enclosed in C preprocessor conditional statements #if and #endif that are conditionally compiled when you compile the generated code.
States when enabling
Specifies how states behave when function-call input events reenable the chart. Options include:
Held
Reset
See Control States in Charts Enabled by Function-Call Input Events.
Create output for monitoring
Specifies that the chart produces active state output. When you enable this option, you can select one of these activity types to output:
Child activity
Leaf state activity
Fixed-Point Properties
You can set fixed-point properties for the chart in:
The Properties tab of the Property Inspector
The Fixed Point Properties tab of the Model Explorer or the Chart properties dialog box
Fixed-point properties are available only in charts that use MATLAB® as the action language.
Treat These Inherited Simulink Signal Types as fi
Objects
Specifies whether the chart treats inherited fixed-point and integer signals as
Fixed-Point Designer™
fi
objects.
Setting | Description |
---|---|
Fixed-point | The chart treats all fixed-point inputs as fi objects
(default). |
Fixed-point & Integer | The chart treats all fixed-point and integer inputs as
fi objects. |
MATLAB Chart fimath
Specifies default properties for the chart.
Setting | Description |
---|---|
Same as MATLAB
| Use the same fimath properties as the current default
fimath object in MATLAB. |
Specify Other | Use your own default
|
For more information, see fimath Properties Usage for Fixed-Point Arithmetic (Fixed-Point Designer).
Additional Properties
You can set additional properties for the chart in:
The Info tab of the Property Inspector
The Documentation tab of the Model Explorer or the Chart properties dialog box
Description
Description of the chart.
Document Link
Link to online documentation for the chart. You can enter a web URL address or a MATLAB command that displays documentation as an HTML file or as text in the MATLAB Command Window. When you click the Document link hyperlink, Stateflow evaluates the link and displays the documentation.
Machine Properties
The Stateflow machine represents all of the Stateflow blocks in a model (including all charts, state transition tables, and truth tables). You can modify the properties listed below in the Machine properties dialog box.
Open the Model Explorer or the Chart properties dialog box for any chart in the model.
In the Machine chart property field, click the machine name link.
In the Machine properties dialog box, edit the properties for the Stateflow machine.
You can also modify machine properties programmatically by using Stateflow.Machine
objects. For more information about the Stateflow programmatic interface, see Overview of the Stateflow API.
Simulink Model
Name of the Simulink model that defines this Stateflow machine. This property is read-only. You change the model name when you save the model.
Creation Date
Date on which this Stateflow machine was created. This property is read-only.
Creator
Name of the person who created this Stateflow machine.
Modified
Comment text for recording modifications to the Simulink model that defines this Stateflow machine.
Version
Comment text for recording the version of the Simulink model that defines this Stateflow machine.
Description
Description of the Stateflow machine.
Document Link
Link to online documentation for the Stateflow machine. You can enter a web URL address or a MATLAB command that displays documentation as an HTML file or as text in the MATLAB Command Window. When you click the Document link hyperlink, Stateflow evaluates the link and displays the documentation.
See Also
Blocks
Objects
Tools
- Model Explorer (Simulink)