Documentation

Create Bus Ports in a Subsystem

This example shows adding In Bus Element and Out Bus Element blocks to create bus element ports in a subsystem for selecting signals from an input bus and creating an output bus signal.

Model Structure

Open the model. The top model has three constant signals combined into a bus that feeds a subsystem input port outputs a bus signal to a Scope block.

The subsystem includes two In Bus Element and Out Bus Element blocks.

Set the Port Name and Color for an In Bus Element Block

Open the Block Parameters dialog box for the ConstIn.a block. The Port name parameter is set to ConstIn, which changes the subsystem input input port name from the default InBus. This block selects the a signal. The block color is set to green instead of the default black.

The In Bus Element block feeds a Gain block, and the Gain block connects to an Out Bus Element block that includes an a*3 signal in the output bus signal.

Create an In Bus Element Block and an Out Bus Element Block

Create a third In Bus Element block for the c signal. In the Simulink Editor, right-click and drag the ConstIn.b block to make a copy of the block. Specify to use the existing port. Edit the block icon text to say ConstIn.c. Select the block and override the green block color by specifying black. Feed the output of the In Bus Element block to a third Gain block and set the gain to 10.

Copy the OutBus.b*5 block to create another Out Bus Element block, specifying to use the same port. Connect the Gain block to the Out Bus Element block that uses the same port. Connect the Gain block output signal to the Out Bus Element block and edit the icon text to say OutBus.c*10.

Add a Chirp Block and Include Its Output Signal in the Bus Output Signal

Add a Chirp Signal block and connect it to a new Out Bus Element block that uses the same port as the other Out Bus Element blocks (OutBus). Open the Out Bus Element dialog box, double-click the selected signal, and change the signal name to chirp.

The virtual bus signal that the subsystem outputs contains the output signals of the three Gain blocks and the Chirp block.

Was this topic helpful?