Specify Properties for Stateflow Charts
Chart properties enable you to specify how your Stateflow® chart interfaces with a Simulink® model. You can specify chart 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 in 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 in the chart.
In the properties dialog box, edit the chart properties.
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 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.
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 that defines the syntax for state and transition actions in the chart. Options include:
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 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.
Method by which a simulation updates or wakes up a chart in a Simulink model.
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.
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.
|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.|
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
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
~ perform bitwise operations in action
statements (default). If you clear this check box:
~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 Supported Operations for Chart 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
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.
|Chart execution continues to the next time step.|
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.
Saturate on integer overflow
Specifies that integer overflows saturate in the generated code. See Handle Integer Overflow for Chart Data.
Generate preprocessor conditionals
Generates a preprocessor conditional in the generated code. See Code Generation Using Variant Transitions.
States when enabling
Specifies how states behave when function-call input events reenable the chart. Options include:
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:
Leaf state activity
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
Specifies whether the chart treats inherited fixed-point and integer signals as
|The chart treats all fixed-point inputs as |
|The chart treats all fixed-point and integer inputs as
Specifies default properties for the chart.
|Use the same |
Use your own default
For more information, see fimath Properties Usage for Fixed-Point Arithmetic (Fixed-Point Designer).
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 of the chart.
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.
The Stateflow machine represents all of the Stateflow blocks in a model (including all charts, state transition tables, and truth tables). You can specify 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.
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.
Date on which this Stateflow machine was created. This property is read-only.
Name of the person who created this Stateflow machine.
Comment text for recording modifications to the Simulink model that defines this Stateflow machine.
Comment text for recording the version of the Simulink model that defines this Stateflow machine.
Description of the Stateflow machine.
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.
- Model Explorer (Simulink)