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.

  • Property Inspector

    1. Open the Property Inspector by selecting View > Property Inspector.

    2. Click in the chart.

    3. In the Property Inspector, edit the chart properties.

  • Model Explorer

    1. Open the Model Explorer by selecting View > Model Explorer.

    2. In the Model Hierarchy pane, select the chart.

    3. In the Chart pane, edit the chart properties.

  • Chart properties dialog box

    1. Right-click in the chart.

    2. Select Properties.

    3. 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

Name of the chart (read-only). When you click the chart name hyperlink, the chart opens in the Stateflow editor.

Machine

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

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.

SettingDescription
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 Rising, Falling, or Either (rising and falling), or in response to a Function Call. For more information, see Activate a Stateflow Chart by Sending Input Events.

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.

ContinuousThe 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 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.

Note

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.

SettingDescription
ProceedChart execution continues to the next time step.
Throw ErrorSimulation stops and an error message appears. This setting is valid only for simulation. In generated code, chart execution always proceeds.

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 Inputs and Outputs.

Saturate on Integer Overflow

Specifies that integer overflows saturate in the generated code. See Handle Integer Overflow for Chart Data.

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

See Monitor State Activity Through Active State Data.

Fixed-Point Properties

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 fi Objects

Specifies whether the chart treats inherited fixed-point and integer signals as Fixed-Point Designer™ fi objects.

SettingDescription
Fixed-pointThe chart treats all fixed-point inputs as fi objects (default).
Fixed-point & IntegerThe chart treats all fixed-point and integer inputs as fi objects.

MATLAB Chart fimath

Specifies default properties for the chart.

SettingDescription
Same as MATLAB Use the same fimath properties as the current default fimath object in MATLAB.
Specify Other

Use your own default fimath object. You can:

  • Construct a fimath object inside the edit box.

  • Create a fimath object in the MATLAB or model workspace and enter its variable name in the edit box.

For more information, see Fixed-Point Basics in MATLAB (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. You can enter a brief description and comments.

Document Link

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.

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 specify machine properties in the Machine properties dialog box.

  1. Open the Model Explorer or the Chart properties dialog box for any chart in the model.

  2. In the Machine chart property field, click the machine name link.

  3. In the Machine properties dialog box, edit the properties for the Stateflow machine.

Simulink Model

Name of the Simulink model that defines this Stateflow machine (read-only). You change the model name when you save the model.

Creation Date

Date on which this Stateflow machine was created (read-only).

Creator

Name of the person who created this Stateflow machine.

Modified

Time of the most recent modification of this Stateflow machine.

Version

Version number of this Stateflow machine.

Description

Description of the Stateflow machine. You can enter a brief description and comments.

Document Link

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.

Related Topics