Iteratively Process Nonvirtual Buses with Arrays of Buses - MATLAB & Simulink (original) (raw)

Main Content

Update a model to use an array of buses when:

For example, compare the following modeling patterns.

The original modeling pattern uses three subsystems and three nonvirtual buses. The new modeling pattern uses one for-each subsystem and an array of the three nonvirtual buses.

In the original modeling pattern:

The original modeling pattern is inefficient. To process each nonvirtual bus, the model has copies of the subsystem that encapsulates the algorithm. To process another nonvirtual bus with the same BusObject data type, the model requires another copy of the subsystem.

To convert the original modeling pattern to use an array of buses:

  1. Identify the buses and associated algorithm that you want to convert.
    • The buses that you concatenate in an array of buses must be nonvirtual. If the buses are virtual and all their elements have the same sample time or inherit their sample time, convert the virtual buses to nonvirtual buses.
    • The nonvirtual buses cannot have variable-dimensioned and frame-based elements.
  2. Use a Vector Concatenate block to group the nonvirtual buses into an array of buses.
  3. Replace all identical copies of the subsystem with a for-each subsystem that encapsulates the algorithm.
  4. Connect the array of buses to the for-each subsystem.
  5. Configure the For Each Subsystem block to iterate over the input array of buses and concatenate the output.
    The scalar algorithm within the for-each subsystem cannot have continuous states.

The array of buses lets you replace multiple identical subsystems with one subsystem that supports iterative processing.

For more information on creating arrays of buses, see Group Nonvirtual Buses in Arrays of Buses.

See Also

Topics