Main Content

Bus Assignment

Replace specified bus elements

  • Library:
  • 金宝appSimulink /信号路由

    HDL Coder / Signal Routing

  • Bus Assignment block

Description

TheBus Assignmentblock assigns the values of an input element to bus elements. Use aBus Assignmentblock to change bus element values without addingBus SelectorandBus Creatorblocks that select bus elements and reassemble them into a bus.

Connect the bus to the first input port. To other input ports, connect one or more elements whose values you want to assign to a bus element. 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. For an example of a model that uses a Bus Assignment block, seeReplace Values of Bus Elements

By default, Simulink®repairs broken selections in theBus AssignmentBlock 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 theModel Configuration Parameters>Diagnostics>Connectivitypane, set theRepair bus selectionsdiagnostic to没有修理错误

Limitations

When using arrays of buses with aBus Assignmentblock, these limitations apply:

  • You can assign or replace a nested bus that is an array of buses. For a bus that is nested inside an array of buses, seeAssign into Arrays of Buses

  • To replace an element in an array of buses, use aSelectorblock to select the index for the bus element that you want to use with theBus Assignmentblock. Then, use that selected bus element with theBus Assignmentblock.

Ports

Input

expand all

输入总线可以具有Simulink支持的任何数据类型的真实或复杂值,包括总线对象,总线,传输阵列,固定点和枚举数据类型。金宝app金宝app有关数据类型的详细信息,请参阅Simulink,金宝appData Types Supported by Simulink

The element 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 aRate Transitionblock to change the sample time of an individual element or elements in a bus, to include the element or bus in a nonvirtual bus.

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

任务输入端口可以接受元素可以甲型肝炎e real or complex values of any data type supported by Simulink, including bus objects, arrays of buses, fixed-point, and enumerated data types. You cannot use theBus Assignmentblock to replace a bus that is nested within an array of buses. For details about data types, see Simulink,Data Types Supported by Simulink

TheBus Assignmentblock assigns elements connected to its assignment input ports to specified elements of the bus connected to its bus input port. The block replaces the elements previously assigned to those elements. The change does not affect the composition of the bus; it affects only the values of the elements themselves. Signals not replaced are unaffected by the replacement of other elements.

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

Output

expand all

Bus that includes the assigned bus element values and the values of the bus elements of the input bus that you did not assign values to.

Data Types:single|double|half|int8|int16|int32|int64|uint8|uint16|uint32|uint64|Boolean|固定点|enumerated|bus|string

Parameters

expand all

List of the bus elements of the input bus. An arrow next to an element name indicates that the input element is a bus. To display the elements in an input bus, click the arrow.

Click any item in the list to select it. To find the source of the selected element, click。Simulink opens and highlights the system containing the element source. To move the currently selected element into the adjacent list of elements to be assigned values (seeElements that are being assignedbelow), clickSelect。To refresh the display to reflect modifications to the bus connected to the block, clickRefresh

Specify a search term to use for filtering a long list of input elements. Do not enclose the search term in quotation marks. The filter does a partial string search. To access filtering options, including using a regular expression for specifying the search term, click thebutton on the right of theFilter by nameedit box.

Enable the use of MATLAB®regular expressions for filtering element names. For example, enteringt$in theFilter by nameedit box displays all elements whose names end with a lowercaset(and their immediate parents). For details, seeRegular Expressions

Dependencies

To access this parameter, click thebutton on the right of theFilter by nameedit box.

By default, the list displays as a tree list of filtered elements, based on the search text in theFilter by nameedit box. To use a flat list format that uses dot notation to reflect the hierarchy of buses, select this parameter.

Dependencies

To access this parameter, click thebutton on the right of theFilter by nameedit box

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 elements by using theUp,Down, orRemovebuttons. Port connectivity is maintained when you change the element order.

如果一个输入公共汽车时不再包含一个元素,three question marks (???) appear before the name of that bus element. The bus has changed since the last time you refreshed theBus Assignmentblock input and bus element assignment lists. To address this issue, either modify the bus to include an element of the specified name or remove the name from the list of bus elements designated to be assigned values.

Programmatic Use

Block Parameter:OutputSignals
Type:character vector
Values:'signal1'|'signal2'
Default:none

Block Characteristics

Data Types

Boolean|bus|double|enumerated|固定点|half|integer|single|string

Direct Feedthrough

yes

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

no

Extended Capabilities

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Introduced before R2006a