Main Content

Out Bus Element, Bus Element Out

Specify output that connects to external port

  • Library:
  • Simulink / Ports & Subsystems

    Simulink / Sinks

    HDL Coder / Ports & Subsystems

    HDL Coder / Sinks

  • Out Bus Element block

Description

The Out Bus Element block, also known as the Bus Element Out block, combines the functionality of an Outport block and a Bus Creator block. This block is of the Outport block type, and all Out Bus Element blocks that use the same port share a dialog box.

For interfaces that include buses composed of many bus elements, Out 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 Creator and From block configuration.

The Out Bus Element block does not support mixing message and signal elements as inputs.

Create Output Bus Element Port

To create an output bus element port for a model component, add an Out 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 out 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.

A cursor is at the end of the first text field.

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 output bus element port, hold Ctrl while you drag an existing Out Bus Element block to a new location. Upon releasing the pointer, click Create New Port.

Add Elements to Output Bus

To output multiple elements, add an Out Bus Element block for each element that you want to include in the bus. This table provides ways to add Out Bus Element blocks for an existing port.

GoalAction

Add an Out Bus Element block for a new element.

Double-click the Out Bus Element block. In the dialog box that opens, select Add a new signal . Optionally, drag the new element into a nested bus.

Add an Out Bus Element block for a new nested bus.

Double-click the Out Bus Element block. In the dialog box that opens, select Add a new sub-bus . Optionally, drag the bus into another bus.

Add an Out Bus Element block for a new element at the same level as an existing element.

Hold Ctrl while you drag an existing Out Bus Element block for the port to a new location. Upon releasing the pointer, click Use Existing Port.

All element names associated with the port must be unique. You cannot specify the same element name more than once for an output bus element port. Simulink® does not support overlapping writes to the same port.

To change the name or hierarchy of an element at an Out Bus Element block, edit the second text field in the label by clicking it.

A cursor is in the second text field in the label.

To create hierarchy in the output bus, use dots in the part of the label that describes the bus element. Each dot 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.

The compact notation for OutBus.NestedBus.chirp is chirp.

Pass Block Input to Output Port Without Bus

To pass the block input to the external output port without nesting it in a bus, delete the text from the second text field.

One Out Bus Element block passes a virtual bus to an output port named Bus. Another Out Bus Element block passes a scalar signal to an output port named Signal.

When an Out Bus Element block defines an entire port, the output of the bus element port is the Out Bus Element block input, which may be a nonbus signal.

Subsystem block with an output port named Bus that outputs a virtual bus and an output port named Signal that outputs a scalar signal

Modify Port Output

In the dialog box, you can:

  • Change port and element names.

  • Reorder bus elements by dragging elements to new locations in the list of elements.

  • Remove blocks associated with selected elements by clicking the Remove blocks of selected signals button .

Log Output Data

When you save output data to the workspace or a file, bus data defined by groups of root-level Out Bus Element blocks are logged along with root-level Outport block data.

Ports

Input

expand all

Connect a bus, signal, or message to pass to the corresponding external output port of the parent subsystem or model.

When multiple Out Bus Element blocks are associated with the same external port, the input to this block is an element of the bus at the output port. The second text field in the label specifies the element name.

When one Out Bus Element block is associated with the external port, the input to this block is passed directly to the output port or nested in a bus at the output port. To pass the input of the block to the output port without nesting it in a bus, delete the text from the second text field in the label.

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

Parameters

expand all

To interactively edit the parameters of the block and the corresponding port, double-click the block.

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: 'OutBus' | '<port name>'
Default: 'OutBus'

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, such as data type, pause on the name of a bus, signal, or message. Then, click the pencil button that appears.

Pencil button next to bus name

When you specify attributes, they appear next to the name of the bus, signal, or message. Click an attribute summary to edit the attributes of the bus, signal, or message.

Attribute summaries next to bus and bus element names

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 Composite Interface Guidelines.

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 type of sample time, such as continuous (0) or inherited (-1). For more options, see Types of Sample Time.

By default, the signal inherits its 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: ''

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

Version History

Introduced in R2017a