An atomic subchart is a graphical object that helps you to create independent subcomponents in a Stateflow® chart. Atomic subcharts are supported only in Stateflow charts in Simulink® models. For more information, see Create Reusable Subcomponents by Using Atomic Subcharts.
Moore charts do not have the same simulation behavior as Classic Stateflow charts with the same constructs.
Continuous-time charts do not support atomic subcharts.
You get a warning when the following conditions are true:
The chart property Execute (enter) Chart At Initialization is enabled.
The default transition path of the chart reaches an atomic subchart.
If an entry
action inside the atomic subchart requires
access to a chart input or data store memory, you can get inaccurate results. To
avoid this warning, you can disable Execute (enter) Chart At
Initialization or redirect the default transition path away from
the atomic subchart.
For more information about execute-at-initialization behavior, see Execution of a Chart at Initialization.
When you use linked atomic subcharts, verify that your settings for super step semantics match the settings in the main chart. For more information, see Super Step Semantics.
Be sure to define data that appears in an atomic subchart explicitly in the main chart. Atomic subcharts can only access main chart data whose size, type, and complexity are fully specified. For more information, see Set Data Properties.
When you use linked atomic subcharts, map the variables so that data in the subchart corresponds to the correct data in the main chart. Map subchart variables manually if, when you add the subchart, the variables do not have the same names as the corresponding symbols in the main chart. For more information, see Map Variables for Atomic Subcharts and Boxes.
Verify that the size, type, and complexity of variables in a subchart match the settings of the corresponding variables in the main chart. For more information, see Map Variables for Atomic Subcharts and Boxes.
Atomic subcharts do not support variable-sized arrays. If you select the Variable Size property of a subchart data object, an error occurs when you try to update the diagram or simulate the model.
When a data store memory in an atomic subchart maps to chart-level local data, the First index property of the local data must remain zero. If you change First index to a nonzero value, an error occurs when you try to update the diagram or simulate the model.
If an atomic subchart maps variables to variables at the main chart level with a different scope, you cannot log signals for the chart.
If your chart contains atomic subcharts, do not use machine-parented data with the following properties:
Imported or exported
Is 2-D or higher, or uses fixed-point type
Machine-parented data with these properties prevent reuse of generated code and other code optimizations.
If a parameter in an atomic subchart matches the name of a Simulink built-in subsystem parameter, the only mapping allowed for that
parameter is Inherited
. Specifying any other parameter
mapping in the Mappings tab of the properties dialog box
causes an error. You can, however, change the parameter value at the MATLAB® prompt so that all instances of that parameter have the same
value.
To get a list of Simulink subsystem parameters, enter:
param_list = sort(fieldnames(get_param('built-in/subsystem', 'ObjectParameters')));
Input events in an atomic subchart must all use edge-triggered type, or they must all use function-call type. This restriction is consistent with the behavior for the container chart. For more information, see Best Practices for Using Events in Stateflow Charts.
You cannot use outgoing transitions from an atomic subchart that uses local events at the top level of the subchart. Using this configuration causes a simulation error.
Each input event in an atomic subchart must map to an input event of the same trigger type in the container chart.
Each input event in an atomic subchart must map to a unique input event in the container chart. You can verify unique mappings of input events by opening the properties dialog box for the atomic subchart and checking the Input Event Mapping section of the Mappings tab.
If your atomic subchart contains a function call to a chart-level function, export that function by selecting Export Chart Level Functions. Do not export graphical functions from an atomic subchart that maps variables to variables at the main chart level with a different scope. For more information, see Export Stateflow Functions for Reuse.
The state or subchart that you want to convert to an atomic subchart cannot have any supertransitions crossing the boundary.
To convert a state or subchart to an atomic subchart, access to objects not parented by the state or subchart must be one of the following:
Chart-level data
Chart-level graphical functions
Input events
If the state or subchart accesses a chart-level graphical function, the chart must export that function. For more information, see Export Stateflow Functions for Reuse.
Do not export graphical functions from an atomic subchart that maps variables to variables at the main chart level with a different scope.
The state or subchart that you want to convert to an atomic subchart cannot access local data where the First index property is nonzero. For the conversion process to work, the First index property of the local data must be zero, which is the default value.
The state or subchart that you want to convert to an atomic subchart cannot reside in a chart that uses machine-parented data with the following properties:
Imported or exported
Is 2-D or higher, or uses a fixed-point type
Machine-parented data with these properties prevent reuse of generated code and other code optimizations.
To convert a state or subchart to an atomic subchart, your chart must use strong data typing with Simulink inputs and outputs. For more information, see Use strong data typing with Simulink I/O.
The state or subchart that you want to convert to an atomic subchart cannot refer to:
Local events that are outside the scope of that state or subchart
Output events
The state or subchart you want to convert can refer to input events.
You cannot use a masked library chart containing mask parameters as an atomic subchart.