Main Content

In Bus Element, Bus Element In

Select input from external port

  • Library:
  • Simulink / Ports & Subsystems

    Simulink / Sources

    HDL Coder / Ports & Subsystems

    HDL Coder / Sources

  • In Bus Element block

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 Block Parameters dialog box.

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.

Create Port and Related Blocks

When you insert an In Bus Element block, the block label populates with default values. The label consists of 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 in it.

To create related In Bus Element blocks, in the Block Parameters dialog box, you can select the Add blocks for selected signals button.

If 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.

You can create additional ports by holding Ctrl while you drag an existing In Bus Element block to a new location. Upon releasing the mouse, you have the option to create a port or use the existing port associated with the block being copied.

Examine Port Input

You can view the elements associated with a port in the Block Parameters dialog box for any of the related In Bus Element blocks.

Black element names are already associated with an In Bus Element block. Grey element names are available, but are not being used. Red element names are not available in the input bus, despite being specified by an In Bus Element block.

You can create In Bus Element blocks for each selected element by clicking the Add blocks for selected signals button .

To remove blocks associated with selected elements, such as elements which are unavailable in the input bus, click the Remove blocks of selected signals button .

Select Element

To change the bus element associated with the block, edit the second text field in the label by clicking in it.

If a bus is connected to the port, you can select an element of the bus from the list that appears. To see all elements of the bus along with the previously specified element name, clear the text. The list of elements is filtered to include only the elements that contain the existing text.

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 by selecting the block, pausing over the ellipsis, and selecting Compact Notation from the action bar. To show the bus hierarchy again, select Expanded Notation from the action bar.

You can pass through the entire input connected to the port, including nonbus signals, by deleting 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.

You can select an In Bus Element block that has duplicates to highlight the duplicate blocks. To show a related block in an open diagram or new tab, pause on the ellipsis that appears after selection. Then, select Related Blocks Related Blocks button 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

expand all

Selected input that is associated with an external subsystem or model port.

While you can select bus elements, you cannot select elements of arrays of buses.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | string | Boolean | fixed point | enumerated | bus

Parameters

expand all

Specify a port name that is not already in use by another block or port. The name appears on the parent Subsystem or Model block. The name also appears next to the block. Multiple blocks can access the same port.

Programmatic Use

Block Parameter: PortName
Type: character vector
Values: 'InBus' | '<port name>'
Default: 'InBus'

Specify the order in which the port that corresponds to the block appears on the parent Subsystem or Model block.

  • If you add a block that creates another port, the port number is the next available number.

  • Deleting all blocks associated with a port deletes the port. Other ports are renumbered so that they are sequential and do not skip any numbers.

  • Specifying a port number that exceeds the number of ports creates a port for that number and for any skipped sequential numbers.

Programmatic Use

Block Parameter: Port
Type: character vector
Values: real integer
Default: '1'

Specify the block background color. This specification sets the color of blocks associated with selected bus elements, or of all blocks associated with the port if you do not select any bus elements.

Programmatic Use

Block Parameter: BackgroundColor
Type: character vector
Values: 'black' | 'white | 'red' | 'green' | 'blue' | 'cyan' | 'magenta' | 'yellow' | 'gray' | 'lightBlue' | 'orange' | 'darkGreen' | '[r,g,b]' where r, g, and b, are the red, green, blue values of the color in the range 0.0 to 1.0
Default: 'black'

Specify a search term to use for filtering a long list of bus elements. Do not enclose the search term in quotation marks. The filter does a partial string search and supports regular expressions. To use a regular expression character as a literal, include an escape character (\). For example, to use a question mark, type sig\?1.

Attributes

To specify attributes, click the pencil button or nondefault attribute summary next to the name of a bus or bus element.

The data type can be inherited, specified directly, or expressed as a data type object such as a Simulink.NumericType object.

You can specify any of these options:

  • Inherited data type

  • Built-in Simulink® data type — For example, specify single or uint8. See Data Types Supported by Simulink.

  • Fixed-point data type — Use the fixdt function. For example, specify fixdt(1,16,0).

  • Enumerated data type — Use the name of the type preceded by Enum:. For example, specify Enum: myEnumType.

  • Bus data type — Use the name of the Simulink.Bus object preceded by Bus:. For example, specify Bus: myBusObject.

  • Value type — Use the name of the Simulink.ValueType object preceded by ValueType:. For example, specify ValueType: windVelocity.

  • Custom data type — Use a MATLAB® expression that specifies the type. For example, you can specify a Simulink.NumericType object whose DataTypeMode property is set to a value other than 'Fixed-point: unspecified scaling'.

When you specify a Simulink.ValueType or Simulink.Bus object, the object defines more than the data type. The object also defines properties such as Min, Max, and Unit. The property values specified by the ValueType object override the corresponding property values specified by a block. For example, suppose a block sets Unit to ft/s. When the Data type of the block specifies a ValueType object that has m/s as its unit, the block uses m/s instead of ft/s.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Inherit: auto' | 'double' | 'single' | 'half' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | 'string' | 'Enum: <class name>' | 'Bus: <object name>' | 'ValueType: <object name>' | '<data type expression>'
Default: 'Inherit: auto'

Specify the data mode of the elements of the bus.

  • inherit — Bus elements inherit their data modes.

  • signal — Bus elements must be signals.

  • message — Bus elements must be messages.

    For the In Bus Element block, if you choose message as the data mode, an envelope button appears next to the bus or bus element. Use the envelope button to specify custom queue properties for each message element. The Out Bus Element block does not support queue specifications.

Dependencies

To enable this parameter, the block must be at the top level of a model.

Programmatic Use

Block Parameter: DataMode
Type: character vector
Values: 'inherit' | 'signal' | 'message'
Default: 'inherit'

Specify whether to inherit the bus virtuality or define the bus as virtual or nonvirtual. For more information, see Types of Composite Signals.

This parameter determines whether the blocks inherit or define the bus virtuality. If the blocks define the bus virtuality and the virtuality of the input bus does not match, compiling the model produces an error.

Dependencies

To enable this parameter, set Data type to a Bus object.

Programmatic Use

Block Parameter: BusVirtuality
Type: character vector
Values: 'inherit' | 'virtual' | 'nonvirtual'
Default: 'inherit'

Specify the dimensions of a signal.

  • -1 — The signal can have any dimensions.

  • N — The signal must be a vector of size N.

  • [R C] — The signal must be a matrix having R rows and C columns.

Programmatic Use

Block Parameter: PortDimensions
Type: character vector
Values: '-1' | integer | [integer, integer]
Default: '-1'

Specify the type of signals allowed.

  • Inherit — Allow variable-size and fixed-size signals.

  • Variable — Allow only variable-size signals.

  • Fixed — Allow only fixed-size signals. Do not allow variable-size signals.

When the signal is variable-sized, the Dimensions parameter specifies the maximum dimensions of the signal.

Programmatic Use

Parameter: VarSizeSig
Type: character vector
Value: 'Inherit' | 'No' | 'Yes'
Default: 'Inherit'

Specify the physical unit of the signal. For a list of supported units, see Allowed Unit Systems.

Programmatic Use

Block Parameter: Unit
Type: character vector
Values: 'inherit' | '<Enter unit>'
Default: 'inherit'

Specify the discrete interval between sample time hits or specify another appropriate sample time such as continuous or inherited.

By default, the signal inherits its sample time. To set a different sample time, enter a valid sample time based on the table in Types of Sample Time.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '-1'

Specify the numeric type of the signal. To choose the numeric type of the signal, select auto. Otherwise, choose a real or complex signal type.

Programmatic Use

Block Parameter: SignalType
Type: character vector
Values: 'auto' | 'real' | 'complex'
Default: 'auto'

Lower value of the range that Simulink checks.

This number must be a finite real double scalar value.

Simulink software uses this value to perform:

  • Simulation range checking (see Specify Signal Ranges).

  • Automatic scaling of fixed-point data types.

  • Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).

Programmatic Use

Block Parameter: OutMin
Type: character vector
Values: '[]' | scalar
Default: '[]'

Upper value of the range that Simulink checks.

This number must be a finite real double scalar value.

Simulink software uses this value to perform:

  • Simulation range checking (see Specify Signal Ranges).

  • Automatic scaling of fixed-point data types.

  • Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).

Programmatic Use

Block Parameter: OutMax
Type: character vector
Values: '[]' | scalar
Default: '[]'

Use the description to document information about the bus or bus element, such as where it is used. This information does not affect Simulink processing.

Programmatic Use

Block Parameter: Description
Type: character vector
Values: '' | '<Enter text>'
Default: ''

Queue Attributes

Queue attributes are visible only when the block must be at the top level of a model and you set the Data mode parameter to message.

To specify attributes, click the envelope button next to the name of a bus or bus element.

Use this parameter to select between default or custom queue specifications.

To use the default queue properties, leave the parameter selected. In this case, for each message bus element, a LIFO overwriting queue of capacity 1 is automatically inserted.

To use custom specifications, clear the parameter and configure the queue properties. Queue attributes are applicable if there is no storage block placed outside a component.

For more information, see Specify Queue Properties for Message Interface.

Dependencies

To enable this parameter, set the Data mode parameter to message.

Programmatic Use

Block Parameter: MessageQueueUseDefaultAttributes
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Specify the number of messages elements the queue can store.

Dependencies

This parameter is visible when you set the Data mode parameter to message.

Programmatic Use

Block Parameter: MessageQueueCapacity
Type: character vector
Values: '1' | scalar
Default: '1'

Choose one of these queue types:

  • FIFO — First-in-first-out

  • LIFO — Last-in-first-out

Dependencies

This parameter is visible when you set the Data mode parameter to message.

Programmatic Use

Block Parameter: MessageQueueType
Type: character vector
Values: 'FIFO' | 'LIFO'
Default: 'LIFO'

Select this parameter to choose between two queue overwriting policies.

  • If you select the parameter, an incoming message element overwrites the oldest message if the queue is full.

  • If you clear the parameter, the block does not accept new messages if the queue is full.

Dependencies

To enable this parameter, set the Data mode parameter to message.

Programmatic Use

Block Parameter: MessageQueueOverwriting
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Block Characteristics

Data Types

Boolean | bus | double | enumerated | fixed point | half | integer | single | string

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Introduced in R2017a