Contenido principal

Simulink Based State

R2026b

Simulink subsystem in Stateflow chart

Description

A Simulink® based state embeds a Simulink subsystem within a Stateflow® state. Use a Simulink based state to model hybrid dynamic systems or systems that switch between periodic and continuous time dynamics.

To add a Simulink based state to a chart:

  1. In the Stateflow Editor, in the object palette, click the Simulink Based State icon The Simulink based state object palette icon..

  2. Click a location in the chart canvas to place the Simulink based state.

  3. Type a name for the Simulink based state.

Properties

expand all

To edit graphical object properties interactively, right-click the object and select Properties.

To modify Simulink based state properties programmatically, use Stateflow.SimulinkBasedState objects.

Properties

Description of the Simulink based state, specified as a character vector.

Link to a document associated with the Simulink based state, specified as a character vector. Enter a web URL or a MATLAB® expression that opens the document.

Mappings

The Mappings tab displays the symbol mappings between the Simulink based state subsystem and the main chart. Each mapping table lists the subsystem symbol on the left and the corresponding main chart symbol on the right. The tab contains these mapping tables:

  • Input Mapping — Maps input data symbols from the subsystem to symbols in the main chart.

  • Output Mapping — Maps output data symbols from the subsystem to symbols in the main chart.

Info

Option to create an output data port on the Chart block that reports whether the Simulink based state is active. Select this check box to add a self-activity output port to the Chart block.

Option to log the self activity of the Simulink based state during simulation. Select this check box to save the active state data to the MATLAB workspace.

Option to set the Simulink based state as a test point. Select this check box to enable monitoring the state activity during simulation. For example, enable this property to monitor the state with a Floating Scope block or log its values to the MATLAB workspace.

Source of the signal name for logging, specified as one of these values:

  • Use state name — Use the Simulink based state name as the logging signal name.

  • Custom — Use a custom name as the logging signal name. Enter the custom name in the text field.

Option to limit the number of data points logged during simulation. To specify the maximum number of data points, select this check box and enter a value in the text field. The default limit is 5000 data points.

Option to log every Nth data point during simulation. Select this check box and specify the decimation interval in the adjacent field. The default decimation interval is 2.

Packaging of generated code for the Simulink based state, specified as one of these values:

  • Auto — Stateflow determines the packaging based on the Simulink based state contents.

  • Nonreusable function — Generate the Simulink based state as a nonreusable function.

  • Reusable function — Generate the Simulink based state as a reusable function with a separate data structure for its data.

Version History

Introduced in R2017b