In Bus Element, Bus Element In
Select input from external port
- Library:
Simulink / Ports & Subsystems
Simulink / Sources
HDL Coder / Ports & Subsystems
HDL Coder / Sources
Description
The In Bus Element block, also known as the Bus Element In block, combines the functionality of an Inport block and a Bus Selector block. This block is of the Inport block type, and all In Bus Element blocks that use the same port share a dialog box.
For interfaces that include buses composed of many bus elements, In Bus Element blocks:
Reduce signal line complexity and clutter in a block diagram.
Allow you to more easily make incremental changes to the interface.
Allow access to a bus element closer to the point of usage, avoiding the use of a Bus Selector and Goto block configuration.
You can use an In Bus Element block to select a bus element, bus, nonbus signal, or message associated with the port. To select multiple elements from a bus, use multiple In Bus Element blocks.
The In Bus Element block does not support mixing message and signal elements as outputs.
Create Input Bus Element Port
To create an input bus element port for a model component, add an In Bus Element block in the block diagram of the model component. Alternatively, for a subsystem, click the edge of the Subsystem block and select Create in bus port.
In the model component, the block label uses default values for its two interactive text fields: the port name and the bus element. To change the name of the port associated with the block, edit the first text field in the label by clicking it.
When multiple blocks are associated with the same port and you change the name of the port, all blocks that share the port update to reflect the new port name.
To create another input bus element port, hold Ctrl while you drag an existing In Bus Element block to a new location. Upon releasing the pointer, click Create New Port.
Select Elements from Port
To select elements from an input bus element port, use In Bus Element blocks. This table provides ways to add In Bus Element blocks for an existing port.
Goal | Action |
---|---|
Add an In Bus Element block for an existing element. | Double-click the In Bus Element block. In the dialog box,
select the elements to represent with new blocks. Then, click Add
blocks for selected signals
|
Add an In Bus Element block for a new element. | Double-click the In Bus Element block. In the dialog box,
select the parent for a new element. Then, click Add
element
|
Duplicate an In Bus Element block. | Hold Ctrl while you drag the In Bus Element block to a new location. Upon releasing the pointer, click Use Existing Port. |
To change the element that an In Bus Element block selects, edit the second text field in the label by clicking it.
You can select elements from the list that appears. To see all elements of the port along with the previously specified element, clear the text. The list of elements is filtered to include only the elements that contain the text in the text field.
Each dot in the part of the label that describes the bus element indicates a new level
of bus hierarchy. To reduce the size of the label, you can display only the element name.
Select the block, pause on the ellipsis, and select Compact Notation
from the action bar. To show the bus hierarchy again,
select Expanded Notation
from the action bar.
Select Entire Port Input
To pass through the entire input connected to the port, including nonbus signals, delete the text from the second text field.
Referenced models support passing through an entire bus with an In Bus Element block in either of these scenarios:
The bus is defined by a
Simulink.Bus
object.Additional In Bus Element blocks pass each leaf element of the bus into the referenced model.
Specify Elements of Model Interface
To specify the elements of an input bus element port at a model interface, you can:
Add elements with or without adding blocks to the block diagram.
Define the bus hierarchy with a
Simulink.Bus
object.
To add elements to an input bus element port at a model interface without adding blocks:
Double-click an In Bus Element block at the top level of the model.
In the dialog box that opens, select the element that you want to contain a new element.
Click the Add element button arrow
, then select Add element without block.
The new element is nested under the selected element. The block diagram is unchanged.
Note
Only elements that are selected by blocks support Simulink.Bus
object
data types.
Optionally, perform these actions:
Change port and element names.
Reorder bus elements by dragging elements to new locations in the list of elements.
Examine Element Usage
You can view the elements associated with an input bus element port in the dialog box for any of the related In Bus Element blocks.
The color of the element name indicates its status.
Black — The element is used by the interface. The element is selected by an In Bus Element block or specified by a
Simulink.Bus
object or model interface.Grey — The element is not used by the interface. An input bus element port at a subsystem interface lets you use a subset of the elements of an input virtual bus that is not defined by a
Simulink.Bus
object.Red — The element is invalid. An input bus element port at a subsystem interface supports only the elements of the input bus. An In Bus Element block cannot select an element that is not in the input bus.
To remove all In Bus Element blocks associated with an element of a
subsystem interface, in the dialog box, select the element. Then, click Remove
blocks of selected signals
. For example, remove blocks for elements that are unavailable in the
input bus.
To remove elements specified by a model interface, in the dialog box, select the
elements. Then, click Remove selected elements
. The blocks associated with the removed elements are also
removed.
Find Duplicate In Bus Element Blocks
To highlight duplicate In Bus Element blocks, select an In Bus
Element block that has duplicates. To show a related block in an open diagram or
new tab, pause on the ellipsis that appears after selection. Then, select Related
Blocks
from the action bar. When multiple blocks correspond to the
selected block, a list of related blocks opens. You can filter the list of related blocks by
entering a search term in the text box. After you select a related block from the list,
window focus goes to the open diagram or new tab that shows the related block.
Load Input Data
You can use an In Bus Element block to load external input data for
a bus. An In Bus Element block can load data for an element of a bus
or for an entire bus. When you use an In Bus Element block to load
data for an entire bus, you must specify the data type for the block using a Simulink.Bus
object. For more
information about loading input data for bus elements, see Load Input Data for a Bus Using In Bus Element Blocks.
You can load simulation input data for a group of root-level In Bus
Element blocks by using a structure of timeseries
,
timetable
, or SimulationDatastore
objects.
In Bus Element blocks interpolate loaded data for all data types
except string
, enumerated
, and fixed
point
.
Ports
Output
Parameters
Model Examples
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
Version History
Introduced in R2017a