Use Arrays of Buses in Models

Array of Buses Requirements and Limitations

Bus Requirements

All buses combined into an array of buses must:

  • Be nonvirtual

  • Have the same bus type (that is, same name, hierarchies, and attributes for the bus elements)

  • Have no variable-size signals or frame-based signals

Blocks That Support Arrays of Buses

These blocks support arrays of buses:

Note

You can use an array of buses as an input to an In Bus Element block, but you cannot use that block to select individual buses. The block passes through the whole array of buses.

Block Parameter Settings

Using an array of buses with some blocks requires specific block parameter settings.

This information is also in the reference pages for each of these blocks. For usage information for bus-related blocks, see Work with Arrays of Buses.

BlockBlock Parameters Settings
Memory

Initial condition — You can specify this parameter with:

  • The value 0. In this case, all the individual signals in the array of buses use the initial value 0.

  • An array of structures that specifies an initial condition for each of the individual signals in the array of buses.

  • A single scalar structure that specifies an initial condition for each of the elements that the bus type defines. Use this technique to specify the same initial conditions for each of the buses in the array.

Merge
  • Allow unequal port widths — Clear this parameter.

  • Number of inputs — Set to a value of 2 or greater.

  • Initial condition — You can specify this parameter with:

    • The value 0. In this case, all the individual signals in the array of buses use the initial value 0.

    • An array of structures that specifies an initial condition for each of the individual signals in the array of buses.

    • A single scalar structure that specifies an initial condition for each of the elements that the bus type defines. Use this technique to specify the same initial conditions for each of the buses in the array.

Multiport Switch

Number of data ports — Set to a value of 2 or greater.

Signal Conversion

Output — Set to Signal copy.

Switch

Threshold — Specify a scalar threshold.

Structure Parameter Requirements

To initialize an array of buses with structure parameters, you can use:

  • The number 0. In this case, all the individual signals in the array of buses use the initial value 0.

  • A scalar struct that represents the same hierarchy of fields and field names as the bus type. In this case, the scalar structure expands to initialize each of the individual signals in the array of buses.

  • An array of structures that specifies an initial value for each of the individual signals in the array of buses.

    If you use an array of structures, all the structures in the array must have the same hierarchy of fields. Each field in the hierarchy must have the same characteristics across the array:

    • Field name

    • Numeric data type, such as single or int32

    • Complexity

    • Dimensions

You cannot use partial structures.

For more information about specifying initial conditions for buses, see Initialize Arrays of Buses.

Signal Logging Limitation

Simulink® software does not log arrays of buses inside referenced models in rapid accelerator mode.

Stateflow Limitations

Stateflow® action language does not support arrays of buses.

Bus Creator Blocks

A Bus Creator block can accept an array of buses as input, but cannot have an array of buses as output.

Signal Line Style

After model simulation, the line style for the array of buses is a thicker version of the signal line style for a nonvirtual bus.

For example, in the sldemo_bus_arrays model, the Scalar Bus signal is a nonvirtual bus, and the Bus Array output signal of the Concatenate block is an array of buses.

Related Topics