You can nest buses to any depth. To create a nested bus, use a Bus Creator block. If one of the inputs to the Bus Creator block is a bus, then the output is a nested bus. To select a signal within a nested bus, use a Bus Selector block.
For example, in the next model, the
signal combines two signals,
Bus2 signal combines the
signal and the
Bus1 signal combines the
signal and the
All the signals retain their separate identities, as if no bus creation and selection occurred. You can use Bus Selector blocks to select individual signals from a nested bus.
The Simulink® software automatically handles most of the
complexities involved. For example, you can have Simulink repair
broken selections in the Bus Selector and Bus
Assignment block parameter dialog boxes due to upstream bus
hierarchy changes. To enable these automatic repairs, in theConfiguration Parameters > Diagnostics > Connectivity pane, set the Repair
bus selections diagnostic to
Warn and repair.
The repairs occur when you update a model. To save the repairs, save
Nesting buses can produce a loop of Bus Creator, Bus Selector, and bus-capable blocks that inadvertently includes a bus as an element of itself. The resulting circular definition cannot be resolved and therefore causes an error.
The error message that appears specifies the location at which the Simulink software determined that the circular structure exists. The error is not really at any one location: the structure as a whole is in error. Nonetheless, the location cited in the error message can be useful for beginning to trace the definition cycle. However, the circular structure is not always obvious on visual inspection.
Begin by selecting a signal line associated with the location cited in the error message.
Right-click a signal and choose Highlight to Signal to Source or Highlight Signal to Destination. See Display Signal Sources and Destinations for more information.
Continue choosing signals and highlighting their sources and destinations until the cycle becomes clear.
Restructure the model to eliminate the circular bus definition.
Because the problem is a circular definition rather than a circular computation, the cycle cannot be broken by inserting additional blocks. You cannot fix the circular definition the way that you can break an algebraic loop by inserting a Unit Delay block. Restructure the model to eliminate the circular bus definition.