Connect Subsystems
To connect subsystems, use ports on a Subsystem block. The ports on a Subsystem block correspond with blocks inside the subsystem.
For example, this Subsystem block has two input ports and one output port.
The subsystem contains Inport blocks named In1
and
In2
and an Outport block named Out1
.
These blocks correspond to input ports 1 and 2 and output port
1, respectively.
When you add a blank subsystem to a model, the subsystem contains an input port and an output port by default.
Add Ports to Subsystems
To add ports to a Subsystem block directly, perform one of these actions:
Click the edge of a Subsystem block. Then, select whether to create an input or output signal port, an input or output bus element port, or a connection port.
Drag a line to the edge of a Subsystem block. This action creates an input signal port.
Drag a line from the edge of a Subsystem block. This action creates an output signal port.
These actions add corresponding port blocks inside the subsystem.
Tip
After port creation, the port label on the Subsystem block is enabled for quick editing. See Edit Port Labels on Subsystem Blocks.
Alternatively, open the subsystem by double-clicking the Subsystem block. Then, add the corresponding blocks to the subsystem.
Type of Port | Corresponding Block |
---|---|
Signal port, input | Inport block |
Signal port, output | Outport block |
Bus element port, input | In Bus Element block |
Bus element port, output | Out Bus Element block |
Control port, enabled | Enable block |
Control port, triggered | Trigger block |
Control port, function-call | Trigger block with Trigger
type set to function-call |
Control port, reset | Reset block |
Control port, action | Action Port block |
Connection port | Connection Port (Simscape) block |
These blocks add corresponding ports to the Subsystem block.
Change Port Locations on Subsystem Blocks
To change the location of a port on a Subsystem block, drag the port to a new location on any side of the block.
Edit Port Labels on Subsystem Blocks
By default, the software labels the ports on a Subsystem block. To specify how the software labels the ports:
Select the Subsystem block.
On the Format tab of the Simulink® Toolstrip, select one of the labeling options from the Port Labels menu. For more information, see Show port labels.
You can directly edit the port labels on these types of Subsystem blocks:
Regular subsystem
Subsystem with mask
Variant subsystem
Chart subsystem
To edit the port label on a Subsystem block in the current model:
Point to the port label. An interactive port label cue (blue box surrounding the port label) appears. Click the cue.
Alternatively, select the port and press F2. The cue enters edit mode.
Creating a new port on a Subsystem block using automatic port creation also enables the port label cue for quick editing.
A port selector cue appears above the port label cue to indicate the port label information that is being edited: the port block name, signal name, bus port, or connection port. For signal ports, you can edit both the port block name and the port signal name from the port label. To switch between the values, click the respective icon in the selector cue or use the keyboard shortcuts Ctrl+1,2.
Enter a value in the port label cue and press Enter or Esc, or click away.
After the port label is edited, the software automatically updates the name of the related port or signal within the subsystem.
Tip
To make successive port label edits on a Subsystem block:
Select a port on the block.
Edit the port label and press Enter. This action enables keyboard selection of ports.
Select adjacent ports using the up arrow or down arrow key and pressing F2 for quick editing.
This table lists the update action depending on the type of port label defined on the Subsystem block.
Type of Port Label | Action |
---|---|
None | Editing not supported. |
Port icon | Updates the names of elements in the subsystem depending on the Icon display parameter of the port. For
example, if the value of the Icon display parameter of the
port is For this type of port label, the information shown on the port label after an edit depends on the final edit performed on the label using the selector cue:
|
Port block name | Updates the block name of the port in the subsystem. For this type of port label, you can edit only the port block name using the port selector cue. |
Signal name | Updates the name of the signal linked to the port. Subsystem port labels show the name of propagated signals when all these conditions are true:
|
Port Editing Limitations
The software does not show the port selector cue for Chart blocks.
Editing port labels on Subsystem blocks with a mask icon is not supported.
Editing port numbers from the port label is not supported. You can still edit the port block name and signal name using the port label cue.
Editing name of propagated signals from the port label is not supported. You can still edit the port block name and internal signal name using the port label cue. When you click the cue, the port signal name field is empty because the internal signal does not have a name.