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:
Open the Property Inspector. In the Modeling tab, select Property Inspector.
Click in the chart.
In the Property Inspector, edit the chart properties.
To use the Model Explorer:
Open the Model Explorer. In the Modeling tab, select Model Explorer.
In the Model Hierarchy pane, select the chart.
In the Chart pane, edit the chart properties.
To use the Chart properties dialog box:
Right-click in the chart.
Edit the chart properties.
Stateflow Chart Properties
You can set the following chart properties in:
The main and Advanced sections of the Property Inspector.
The General tab of the Model Explorer or the Chart properties dialog box.
Name of the chart (read-only). When you click the chart name hyperlink, the chart opens in the Stateflow Editor.
Name of the Simulink subsystem (read-only). When you click the machine name hyperlink, the Machine properties dialog box opens. This property is not available in the Property Inspector.
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
Enable zero-crossing detection
Specifies that zero-crossing detection is enabled (default). This option is
available only when you set the chart property Update
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.
Use strong data typing with Simulink I/O
Enables charts to interface directly with signals from Simulink models (default). The chart accepts only input signals whose data type matches the type of the corresponding Stateflow data object. Otherwise, a type mismatch error occurs. This option is available only in charts that use C as the action language. For more information, see Strong Data Typing with Simulink Inputs and Outputs.
The Use strong data typing with Simulink I/O chart property is provided for backward compatibility. Clearing this check box can produce unpredictable results and is not recommended.
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.
|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 input and output data that varies in dimension during simulation. See Declare Variable-Size Data.
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 Fixed Point Properties section 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 Fixed-Point Designer™
|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. You can enter a brief description and comments.
Link to online documentation for the chart. You can enter a web URL address or a MATLAB command that displays documentation in a suitable online format, such as an HTML file or 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 machine properties 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 (read-only). You change the model name when you save the model.
Date on which this Stateflow machine was created (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. You can enter a brief description and comments.
Link to online documentation for the Stateflow machine. You can enter a web URL address or a MATLAB command that displays documentation in a suitable online format, such as an HTML file or text in the MATLAB Command Window. When you click the Document link hyperlink, Stateflow evaluates the link and displays the documentation.