You can use Simulink buses to keep signals organized
and to reduce the visual clutter that builds up in your model.
Let's take a look at how you can get started
using buses in Simulink.
As your Simulink model grows in both size and complexity,
you may start to find that the number of signals connected
to different parts of your model starts to become
difficult to read when editing.
Or you may have groups of signals,
with common sources and destinations,
that create a lot of traffic between certain parts
of your model.
Keeping your diagram clean and organized
helps keep your model readable and understandable.
Buses can be useful tools in reducing clutter,
and organizing based on common sources and destinations.
To get started with Simulink buses,
first identify what signals you want to put onto your bus.
Ideally we want to trace our signals back to a common
starting or ending point, to identify what should
be grouped onto the same bus.
To make a new bus, add a Bus Creator block,
and set the number of inputs to the number of signals
you want to put on the bus.
If you need to add additional signals to the bus,
you can change the number of signals from the block dialog.
Or use the smart editing features
to add new signals directly from the Simulink canvas.
By default, the name of the signal that is input to the bus
is used to identify it elsewhere.
So it's a good idea to name your signals with descriptive names
to make identifying them easy later on.
If you need multiple levels of signals organized into buses,
you can nest buses inside of other buses,
to further organize the signals inside.
Now, you can cleanly route your bus to any part of your model
that was using your signals.
Once we update the diagram, we can tell our buses apart
from our regular signals, as they
are drawn in a different style.
To look inside the bus, you can use bus selector blocks.
When you open the Selectors dialogue,
you can choose what signals from the bus you
want the block to output.
For nested buses, you can directly
access any element in a nested bus
or output the entire nested bus.
Keep in mind that bus selectors do not remove signals
from the bus, so you can have multiple selectors output
the same signal in different locations.
If you're using buses at the boundary of subsystems or model
references, you can also convert your bus creators
to bus element ports, using the Action bar.
Bus element ports offer a little more cleanliness
and flexibility over bus creators and selectors.
These ports further reduce diagram clutter
by having multiple bus element ports connect to the same bus,
removing the need to have a single origin
point for all of your signals inside the subsystem.
From outside your subsystem, the interface
will still appear as a single bus port,
but you can now use elements of the bus
individually where they will be used in the subsystem.
Now that we've cleaned up our model using Simulink buses,
it is much easier to look at our model
and understand where our data is going.
Now you know the basics of creating and using
buses in Simulink.
To learn more about advanced Simulink bus
concepts, such as the use of virtual and non-virtual buses,
and the creation of bus objects, you
can check out the documentation.