Nested array hierarchy for signals

10 visualizzazioni (ultimi 30 giorni)
Ratna
Ratna il 5 Giu 2025
Risposto: TED MOSBY il 5 Giu 2025
I would like to create bus object with 4 level of nested bus hierechy. Is it possible to do?

Risposte (1)

TED MOSBY
TED MOSBY il 5 Giu 2025
Hi @Ratna,
Yes you can certainly nest buses to any depth. So you can build a 4-level hierarchy by defining each “leaf” bus first and then using it as an element in the next‐higher‐level bus, and so on.
You can follow the following :
  1. Define the innermost (Level 4) bus with normal signal elements.
  2. Define Level 3, including one BusElement whose DataType is 'Bus: Bus_L4'.
  3. Define Level 2, including one element 'Bus: Bus_L3'.
  4. Define Level 1, including one element 'Bus: Bus_L2'.
As a result you are gonna see a top-level bus (Bus_L1) containing nested subbuses down four levels. Once you’ve assigned all four bus definitions (Bus_L1 through Bus_L4) into the workspace, you can simply set your Inport, Outport, or Data Store’s type to Bus: Bus_L1 in Simulink and get the full nested hierarchy in your model.
Some things to keep in mind:
  • Each bus object must have a unique Name property.
  • You must create Level 4 first, then Level 3 (which references Level 4), then Level 2, then Level 1. Otherwise Simulink won’t know about the referenced bus.
  • If you pull this bus into a block (e.g., Inport), be sure to set that Inport’s “Port data type” to Bus: Bus_L1.
  • If you build a bus directly by connecting a Bus Creator with multiple inputs, Simulink can create a “virtual bus.” But for nested (hierarchical) buses, you can choose explicit Simulink.Bus definitions so you can control names and data types.
Please refer these pages to know more:
  1. https://www.mathworks.com/help/simulink/slref/buscreator.html?searchHighlight=nested+bus+heirarchy&s_tid=srchtitle_support_results_2_nested+bus+heirarchy
  2. https://www.mathworks.com/help/simulink/slref/simulink.bus.html
  3. https://www.mathworks.com/help/simulink/ug/create-bus-objects-programmatically.html
Hope this helps!

Categorie

Scopri di più su Composite Interfaces in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by