| Simulink Reference |
 |
Subsystem, Atomic Subsystem, CodeReuse Subsystem
Represent a system within another system
Library
Ports & Subsystems
Description

A Subsystem block represents a subsystem of the system that contains it. The Subsystem block can represent a virtual subsystem or a true (atomic) subsystem, depending on the value of its Treat as Atomic Unit parameter. An Atomic Subsystem block is a Subsystem block that has its Treat as Atomic Unit parameter selected by default.
You create a subsystem in these ways:
- Copy the Subsystem (or Atomic Subsystem) block from the Ports & Subsystems library into your model. You can then add blocks to the subsystem by opening the Subsystem block and copying blocks into its window.
- Select the blocks and lines that are to make up the subsystem using a bounding box, then choose Create Subsystem from the Edit menu. Simulink replaces the blocks with a Subsystem block. When you open the block, the window displays the blocks you selected, adding Inport and Outport blocks to reflect signals entering and leaving the subsystem.
The number of input ports drawn on the Subsystem block's icon corresponds to the number of Inport blocks in the subsystem. Similarly, the number of output ports drawn on the block corresponds to the number of Outport blocks in the subsystem.
See Creating Subsystems for more information about subsystems.
Data Type Support
A subsystem's enable and trigger ports accept any data type supported by Simulink, including fixed-point data types. For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.
See Inport for information on the data types accepted by a subsystem's input ports. See Outport for information on the data types output by a subsystem's output ports.
Parameters and Dialog Box

- Show port labels
- Causes Simulink to display the labels of the subsystem's ports in the subsystem's icon.
- Read/Write permissions
- Controls user access to the contents of the subsystem. You can select any of the following values
Permissions
|
Description
|
ReadWrite
|
User can open and modify the contents of the subsystem.
|
ReadOnly
|
User can open but not modify the subsystem. If the subsystem resides in a block library, a user can create and open links to the subsystem and can make and modify local copies of the subsystem but cannot change the permissions or modify the contents of the original library instance.
|
NoReadOrWrite
|
User cannot open or modify the subsystem. If the subsystem resides in a library, a user can create links to the subsystem in a model but cannot open, modify, change permissions, or create local copies of the subsystem.
|
.
- Name of error callback function
- Name of a function to be called if an error occurs while Simulink is executing the subsystem. Simulink passes two arguments to the function: the handle of the subsystem and a string that specifies the error type. If no function is specified, Simulink displays a generic error message if executing the subsystem causes an error.
- Permit hierarchical resolution
- Specifies whether to resolve names of workspace variables referenced by this subsystem. The options are
- Treat as atomic unit
- Causes Simulink to treat the subsystem as a unit when determining the execution order of block methods. For example, when it needs to compute the output of the subsystem, Simulink invokes the output methods of all the blocks in the subsystem before invoking the output methods of other block at the same level as the subsystem block. If this option is not selected, Simulink treats all blocks in the subsystem as being at the same level in the model hierarchy as the subsystem when determining block method execution order. This can cause execution of methods of blocks in the subsystem to be interleaved with execution of methods of blocks outside the subsystem. See Atomic Subsystems for more information.
- Minimize algebraic loop occurrences
- Try to eliminate any algebraic loops that include this subsystem (see Eliminating Algebraic Loops in the online Simulink documentation for more information).
- Propagate execution context across subsystem boundary
- This option appears only if the subsystem is conditionally executed. If selected (the default), this option enables execution context propagation across this subsystem's boundary (see Propagating Execution Contexts in the online Simulink documentation).
- Warn if function-call inputs arise inside called context
- This option appears only if the subsystem is a function-call subsystem and is effective only if the Warn if function-call inputs arise inside called context diagnostic on the Configuration Parameters dialog box is set to
Use local settings. In this case, if this option is checked, Simulink displays a warning if it has to compute any of this function-call subsystem's inputs directly or indirectly during execution of a function-call (see the "Function-call systems" examples in the Simulink Subsystem Semantics library for examples of such function-call subsystems.
- Sample time
- Specifies the sample time of this subsystem.
| Note
Parameters whose names begin with RTW are used by Real-Time Workshop for code generation. See "Building Subsystems and Working with Referenced Models" in the Real-Time Workshop documentation for more information.
|
Characteristics
Sample Time
|
Depends on the blocks in the subsystem
|
Dimensionalized
|
Depends on the blocks in the subsystem
|
Zero Crossing
|
Yes, for enable and trigger ports if present
|
| Stop Simulation | | Subtract |  |
© 1994-2005 The MathWorks, Inc.