Reduce the Compilation Time of a Chart

An atomic subchart is a graphical object that helps you to create standalone 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.

Goal of the Tutorial

Assume that you have the following model, and the chart has two states:

Suppose that you want to reduce the compilation time of the chart for simulation. You can convert state A to an atomic subchart. Then you can make changes, one by one, to state A and see how each change affects simulation results. Making one change requires recompilation of only the atomic subchart and not the entire chart.

Edit a Model to Use Atomic Subcharts

  1. Right-click state A and select Group & Subchart > Atomic Subchart.

  2. Double-click the atomic subchart.

    The contents of the subchart appear in a separate window.

  3. Start simulation.

    Side-by-side animation for the main chart and the atomic subchart occurs.

  4. In the atomic subchart, change the state action for Pos to y1 = 2.

  5. Restart simulation.

    Recompilation occurs only for the atomic subchart and not the entire chart.

Related Topics