Contenuto principale

Atomic Subchart

R2026b

Reusable, independent subcomponents in Stateflow chart

Description

An atomic subchart creates a reusable, independent subcomponent inside a Stateflow® chart. Use an atomic subchart to reuse the same state or subchart across multiple charts and models and to isolate generated code for a specific state or subchart. Because atomic subcharts are independent subcomponents, they also speed up simulation after small changes in charts with many states or levels of hierarchy.

To add an atomic subchart to a chart:

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

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

  3. Type a name for the state.

  4. Click the state. In the toolstrip, in the State tab, click Atomic Subchart.

Properties

expand all

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

To modify atomic subchart properties programmatically, use Stateflow.AtomicSubchart objects.

General

Name of the atomic subchart in the chart hierarchy. This property is read-only. Click the hyperlink to navigate to the atomic subchart in the Stateflow Editor. To change the name, edit the label on the chart canvas.

Option to create an output data port that reports whether the atomic subchart is active. Select this check box to add a self-activity output port to the atomic subchart.

Packaging of generated code for the atomic subchart, specified as one of these values:

  • Auto — Stateflow determines the packaging based on the atomic subchart contents.

  • Nonreusable function — Generate the atomic subchart as a nonreusable function.

  • Reusable function — Generate the atomic subchart as a reusable function with a separate data structure for its data.

Subchart Properties

Action language for the atomic subchart, specified as one of these values:

  • MATLAB — Use MATLAB syntax in state and transition actions.

  • C — Use C syntax in state and transition actions.

Option to make chart-level functions accessible to other blocks in the model. Select this check box to export graphical functions defined at the chart level so that other Stateflow charts and Simulink® blocks in the same model reference them.

Option to saturate integer data on overflow. When you select this check box, integer data in the atomic subchart saturates at the maximum or minimum value of the data type on overflow instead of wrapping around.

Option to treat dimensions of length 1 as fixed size rather than variable size. When you select this check box, the atomic subchart treats any dimension of length 1 as fixed size, regardless of the variable-size setting of the data.

Time at which variant conditions are evaluated, specified as one of these values:

  • update diagram analyze all choices — Evaluate all variant choices when you update the diagram.

  • update diagram — Evaluate variant conditions when you update the diagram and activate the valid variant choices.

  • code compile — Evaluate variant conditions at code compilation time.

  • startup — Evaluate variant conditions at model startup.

Option to create an output port for monitoring the active child state of the atomic subchart, specified as one of these values:

  • Child activity — Create an output port that indicates which child state is active.

  • Leaf state activity — Create an output port that indicates which leaf-level child state is active.

Fixed-Point Properties

Signal types to treat as fixed-point objects when inherited from Simulink, specified as one of these values:

  • Fixed-point — Treat only inherited fixed-point signals as fi objects.

  • Fixed-point and integer — Treat inherited fixed-point and integer signals as fi objects.

MATLAB Chart fimath

Fixed-point math settings for the atomic subchart, specified as one of these options:

  • Same as MATLAB — Use the default MATLAB fimath settings for fixed-point operations in the atomic subchart.

  • Specify other — Enter a custom fimath expression in the text field.

Mappings

The Mappings tab displays the symbol mappings between the atomic subchart and the main chart. Each mapping table lists the atomic subchart 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 atomic subchart to symbols in the main chart.

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

  • Data Store Memory Mapping — Maps data store memory symbols from the atomic subchart to symbols in the main chart.

  • Parameter Mapping — Maps parameter symbols from the atomic subchart to symbols in the main chart.

  • Input Event Mapping — Maps input event symbols from the atomic subchart to symbols in the main chart.

Logging

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

Option to set the atomic subchart as a test point. Select this check box to monitor the atomic subchart with a floating scope or log its values to the MATLAB workspace during simulation.

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

  • Use state name — Use the atomic subchart 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.

Version History

Introduced in R2010b