Main Content

Explore Types of Subsystems

Subsystems can be virtual or nonvirtual.

  • Virtual subsystems help visually organize a block diagram. When you group blocks in a virtual subsystem or expand a virtual subsystem, you can affect the execution order of blocks because of the changes to the block paths.

  • Nonvirtual subsystems, also known as atomic subsystems, help functionally organize a block diagram. When you group blocks in a nonvirtual subsystem or expand a nonvirtual subsystem, you change the model behavior. Each nonvirtual subsystem executes as a single block, or atomic unit, when the parent model executes. The blocks in a nonvirtual subsystem execute consecutively.

Tip

For controllers and other standalone components, define a hard boundary around the related blocks by using a nonvirtual subsystem or referenced model. Defining a hard boundary upfront avoids costly refactoring when you want to generate code for the component.

To determine whether a subsystem is virtual or nonvirtual, use either of these strategies:

  • Check the border of the block. A virtual subsystem has a thin border. A nonvirtual subsystem has a thick border.

    Virtual and nonvirtual subsystem blocks

  • Use the get_param function to query the Boolean block parameter IsSubsystemVirtual. For an example, see Determine Whether Subsystem Is Virtual.

This table classifies some of the types of nonvirtual subsystems.

Basis of Subsystem ExecutionSubsystem Description

Subsystem Block Name

More Information
Control signal valueSubsystem whose execution is enabled by external input.Enabled SubsystemUsing Enabled Subsystems
Subsystem whose execution is triggered by external input.Triggered SubsystemUsing Triggered Subsystems
Subsystem whose execution is enabled and triggered by external inputs.Enabled and Triggered SubsystemUsing Enabled and Triggered Subsystems
Subsystem whose block states reset with an external trigger.Resettable SubsystemUsing Resettable Subsystems
If-else logicSubsystem whose execution is enabled by an If block.If Action SubsystemSelect Subsystem Execution
Switch logicSubsystem whose execution is controlled by a Switch Case block. Switch Case Action SubsystemSelect Subsystem Execution
Function-call eventSubsystem whose execution is controlled by an external function-call input.Function-Call SubsystemUsing Function-Call Subsystems
Number of iterationsSubsystem that repeats execution during a simulation time step for a specified number of iterations.For Iterator SubsystemIterate Subsystem Execution with While Iterator and For Iterator Subsystems
Subsystem that repeats execution during a simulation time step while a logical condition is true.While Iterator SubsystemIterate Subsystem Execution with While Iterator and For Iterator Subsystems
Number of elementsSubsystem that repeats execution on each element or subarray of input signal and concatenates results.For Each SubsystemRepeat an Algorithm Using a For-Each Subsystem
MessageSubsystem that executes conditionally at each time step based on whether a message is available at the control port.Message Polling SubsystemUsing Message Polling and Message Triggered Subsystems
Subsystem that executes whenever a message is available at the control port, independent of sample time.Message Triggered SubsystemUsing Message Polling and Message Triggered Subsystems
Execution order onlySubsystem that executes as a single block, or atomic unit, when the parent model executes. Atomic SubsystemSpecify Whether Subsystem Is Atomic

See Also

Related Topics