Buses allow you to simplify subsystem and model interfaces with In Bus Element and Out Bus Element blocks. These blocks:
Reduce signal line complexity and clutter in a block diagram.
Make it easier to change the interface incrementally.
Allow access to elements closer to their point of usage.
You can use these blocks instead of Inport and Bus Selector blocks for inputs, and Outport and Bus Creator blocks for outputs. For example, this model uses Inport, Bus Selector, Bus Creator, and Outport blocks.
This equivalent model uses In Bus Element and Out Bus Element blocks.
To support In Bus Element and Out Bus Element blocks, parent subsystems and models must:
Convert nonvirtual buses to virtual buses before the related input ports.
Support virtual bus output from the related output ports.
Consider using In Bus Element and Out Bus Element blocks for models with buses that you anticipate changing frequently during the model development process.
Tip
Simulink® can help you update a subsystem interface to use In Bus Element and Out Bus Element blocks. From the action bar, you can:
These actions are not available for model interfaces or for signal lines and blocks that have extra specifications, including signal names and logging. Extra specifications create potential conflicts.
The following examples illustrate how to use the action bar to update subsystem interfaces. The example models are simple, however, buses are most useful when you have many signals to combine.
This example shows how to convert an interface that uses Inport, Bus Selector, Bus Creator, and Outport blocks to use In Bus Element and Out Bus Element blocks.
Open and simulate the example model, which contains a subsystem that modifies an input bus hierarchy using Bus Selector and Bus Creator blocks. The subsystem uses Inport and Outport blocks for input and output.
Open the subsystem.
To convert Inport and Bus Selector blocks to In Bus Element blocks:
Click a Bus Selector block that directly connects to an Inport block.
In the action bar that appears when you pause over the ellipsis, click Bus Ports.
You can similarly convert an In Bus Element and Bus Selector block.
To convert Outport and Bus Creator blocks to Out Bus Element blocks:
Click a Bus Creator block that directly connects to an Outport block without branching.
In the action bar that appears when you pause over the ellipsis, click Bus Ports.
You can similarly convert Out Bus Element and Bus Creator blocks.
The resulting model simplifies line routing, makes it easier to incrementally change the interface, and lets you access elements closer to their point of usage.
You can change the name of a bus and its elements by double-clicking the block labels and editing them.
To easily identify elements of the same nested bus or bus port, specify block colors.
Double-click an In Bus Element or Out Bus Element block to open the dialog box for the related port.
Select an element or the top bus.
Specify the background color with the Set color dropdown menu.
This example shows three ways to simplify a subsystem interface by converting multiple ports and their connected signals into one port and a bus.
Open the example model, which contains two subsystems with multiple input and output ports.
Drag a selection box around the signal lines between the two subsystems. From the action bar that appears, click Create Bus.
Simulink replaces the Inport and Outport blocks in the source and destination subsystems with In Bus Element and Out Bus Element blocks.
Drag a selection box around the signal lines between the source blocks and first subsystem. From the action bar that appears, click Create Bus.
Simulink adds a Bus Creator block before the first subsystem and replaces the Inport blocks in the first subsystem with In Bus Element blocks.
Drag a selection box around the signal lines between the second subsystem and Scope blocks. From the action bar that appears, click Create Bus.
Simulink replaces the Outport blocks in the second subsystem with Out Bus Element blocks and adds a Bus Selector block after the second subsystem.
The resulting model uses virtual buses at the subsystem interfaces.
In Bus Element | Out Bus Element