Explore Types of Subsystems
R2026bSubsystems 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.

Use the
get_paramfunction to query the Boolean block parameterIsSubsystemVirtual. For more information, see Determine Whether Subsystem Is Virtual.Note
For a variant choice in a Variant Subsystem block, the
IsSubsystemVirtualparameter returns different values depending on these factors: the model compilation state, the Treat as atomic unit parameter setting of the variant choice, and the Variant activation time parameter setting of the Variant Subsystem block.When the model is in edit mode, the
IsSubsystemVirtualparameter reflects the Treat as atomic unit parameter setting. It returnsoffif the variant choice is atomic (nonvirtual) andonif the variant choice is virtual.Simulink® removes inactive choices from the compiled model when the model is in compilation mode and the Variant activation time parameter is set to
update diagram,update diagram analyze all choices, orcode compile. As a result, theIsSubsystemVirtualparameter returnsonfor an inactive choice, even if the choice is atomic. When the Variant activation time parameter is set tostartuporruntime, all choices remain in the compiled model. Therefore, theIsSubsystemVirtualparameter continues to reflect the Treat as atomic unit parameter setting.To compile a model named
myModel.slx, usefeval('myModel', [], [], [], 'compile'). To end model compilation, usefeval('myModel', [], [], [], 'term').
This table classifies some of the types of nonvirtual subsystems.
| Basis of Subsystem Execution | Subsystem Description | Subsystem Block Name | More Information |
|---|---|---|---|
| Control signal value | Subsystem whose execution is enabled by external input. | Enabled Subsystem | Using Enabled Subsystems |
| Subsystem whose execution is triggered by external input. | Triggered Subsystem | Using Triggered Subsystems | |
| Subsystem whose execution is enabled and triggered by external inputs. | Enabled and Triggered Subsystem | Using Enabled and Triggered Subsystems | |
| Subsystem whose block states reset with an external trigger. | Resettable Subsystem | Using Resettable Subsystems | |
| If-else logic | Subsystem whose execution is enabled by an If block. | If Action Subsystem | Select Subsystem Execution |
| Switch logic | Subsystem whose execution is controlled by a Switch Case block. | Switch Case Action Subsystem | Select Subsystem Execution |
| Function-call event | Subsystem whose execution is controlled by an external function-call input. | Function-Call Subsystem | Using Function-Call Subsystems |
| Number of iterations | Subsystem that repeats execution during a simulation time step for a specified number of iterations. | For Iterator Subsystem | Iterate 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 Subsystem | Iterate Subsystem Execution with While Iterator and For Iterator Subsystems | |
| Number of elements | Subsystem that repeats execution on each element or subarray of input signal and concatenates results. | For Each Subsystem | Repeat an Algorithm Using a For-Each Subsystem |
| Message | Subsystem that executes conditionally at each time step based on whether a message is available at the control port. | Message Polling Subsystem | Using Message Polling and Message Triggered Subsystems |
| Subsystem that executes whenever a message is available at the control port, independent of sample time. | Message Triggered Subsystem | Using Message Polling and Message Triggered Subsystems | |
| Execution order only | Subsystem that executes as a single block, or atomic unit, when the parent model executes. | Atomic Subsystem | Specify Whether Subsystem Is Atomic |