Documentation

Bus Assignment

Replace specified bus elements

Library

Signal Routing

Description

To assign the values of a signal to bus element, you can use a Bus Assignment block. Use a Bus Assignment block to change bus element values without adding Bus Selector and Bus Creator blocks that select bus elements and reassemble them into a bus.

The Bus Assignment block assigns signals connected to its assignment input ports (:=) to specified elements of the bus connected to its bus input port. The block replaces the signals previously assigned to those elements. The change does not affect the composition of the bus; it affects only the values of the signals themselves. Signals not replaced are unaffected by the replacement of other signals. You cannot use the Bus Assignment block to replace a bus that is nested within an array of buses.

Use the Block Parameters dialog box to specify the bus elements to be replaced. The block displays an assignment input port for each such element. The signal connected to the assignment port must have the same structure, data type, and sample time as the bus element to which it corresponds. You can use a Rate Transition block to change the sample time of an individual signal or signals in a bus, to include the signal or bus in a nonvirtual bus. See Virtual and Nonvirtual Buses for more information.

By default, Simulink® repairs broken selections in the Bus Assignment Block Parameters dialog boxes that are due to upstream bus hierarchy changes. Simulink generates a warning to highlight that it modified the model. To prevent Simulink from making these repairs automatically, in the Model Configuration Parameters > Diagnostics > Connectivity pane, set the Repair bus selections diagnostic to Error without repair.

When using arrays of buses with a Bus Assignment block, these limitations apply:

  • You can assign or replace a subbus that is an array of buses. However, the nested bus cannot be nested inside an array of buses.

  • To replace a signal in an array of buses, use a Selector block to select the index for the bus element that you want to use with the Bus Assignment block. Then use that selected bus element with the Bus Assignment block.

Data Type Support

The bus input port of the Bus Assignment block accepts real or complex values of any data type that Simulink supports, including fixed-point and enumerated data types. The assignment input ports accept the same data types as the bus elements to which they correspond. The Bus Assignment block outputs real or complex values of any data type that Simulink supports, including fixed-point and enumerated data types.

For more information, see Data Types Supported by Simulink.

Parameters

Signals in the bus

Displays the names of the signals contained by the bus connected to the bus input port. Click any item in the list to select it. To find the source of the selected signal, click Find. Simulink opens and highlights the system containing the signal source. To move the currently selected signal into the adjacent list of signals to be assigned values (see Signals that are being assigned below), click Select>>. To refresh the display to reflect modifications to the bus connected to the block, click Refresh.

Signals that are being assigned

Lists the names of bus elements to be assigned values. This block displays an assignment input port for each bus element in this list. The label of the corresponding input port contains the name of the element. You can order the signals by using the Up, Down, or Remove. Port connectivity is maintained when you change the signal order.

Three question marks (???) before the name of a bus element indicate that the input bus no longer contains an element of that name. This situation can occur because the bus has changed since the last time you refreshed the Bus Assignment block input and bus element assignment lists. To address this issue, either modify the bus to include a signal of the specified name or remove the name from the list of bus elements to be assigned values.

Enable regular expression

To display this parameter, click the Options button on the right-hand side of the Filter by name edit box ( ).

Enables the use of MATLAB® regular expressions for filtering signal names. For example, entering t$ in the Filter by name edit box displays all signals whose names end with a lowercase t (and their immediate parents). For details, see Regular Expressions.

The default is On. If you disable use of MATLAB regular expressions for filtering signal names, filtering treats the text you enter in the Filter by name edit box as a literal character vector.

Show filtered results as a flat list

To display this parameter, click the Options button on the right-hand side of the Filter by name edit box ( ).

Uses a flat list format to display the list of filtered signals, based on the search text in the Filter by name edit box. The flat list format uses dot notation to reflect the hierarchy of bus signals. For example, here is the flat list format for a filtered set of nested bus signals.

The default is Off, which displays the filtered list using a tree format.

Characteristics

Data Types

Double | Single | Boolean | Base Integer | Fixed-Point | Enumerated | Bus

Multidimensional Signals

Yes

Variable-Size Signals

Yes

Code Generation

Yes

Introduced before R2006a

Was this topic helpful?