Documentation

Composite Signals

Use composite signals, such as buses, to group signals and reduce model complexity

To simplify model layout, use these techniques to combine individual signals into composite signals:

  • A virtual or nonvirtual bus — Combine signals using a Bus Creator block and access individual signals based on name with a Bus Selector block.

  • An array of buses — Combine similar nonvirtual bus signals into a Vector Concatenate or Vector Concatenate block and select buses using Selector and Bus Selector blocks.

  • A mux — Connect signals of the same type using a Mux block and access individual signals using a Demux block.

  • A concatenated vector or matrix of signals — Combine signals using a Vector Concatenate or Vector Concatenate block.

Using virtual buses meets most modeling requirements for combining signals into a composite signal. Virtual buses give you flexibility for combining different types of signals. Compared to nonvirtual buses, virtual buses are simpler to use, require less memory, and usually simulate faster. For an example of using virtual buses, see Getting Started with BusesCreate and Use Virtual Buses. For a comparison of approaches to creating composite signals, see Select a Composite Signal Technique.

Blocks

Bus Assignment Replace specified bus elements
Bus Creator Create signal bus
Bus Selector Select signals from incoming bus
Bus to Vector Convert virtual bus to vector
Demux Extract and output elements of vector signal
Mux Combine several input signals into vector

Functions

Simulink.BlockDiagram.addBusToVector Add Bus to Vector blocks to convert virtual bus signals into vector signals
Simulink.Bus.cellToObject Convert cell array containing bus information to bus objects
Simulink.Bus.createMATLABStruct Create MATLAB structures using same hierarchy and attributes as bus signals
Simulink.Bus.createObject Create bus objects from blocks or MATLAB structures
Simulink.Bus.objectToCell Convert bus objects to cell array containing bus information
Simulink.Bus.save Save bus objects in MATLAB file
slreplace_mux Replace Mux blocks used to create buses with Bus Creator blocks

Classes

Simulink.Bus Specify properties of signal bus
Simulink.BusElement Describe element of signal bus

Topics

Composite Signal Basics

Overview of Composite Signal Techniques

Get an overview of the techniques you can use to combine signals into a composite signal.

Select a Composite Signal Technique

Choose the composite signal technique that meets your modeling requirements.

Getting Started with Buses

Use Bus Creator and Bus Selector blocks to combine signals into virtual and nonvirtual buses and select signals from those buses.

Display Information About Buses

Display information about bus signals, such as paths and the kind of bus.

Bus Signal Routing

Bus-Capable Blocks

Identify the blocks that support bus signals as inputs.

Nested Buses

Include a bus signal in another bus signal, creating a hierarchy of nested bus signals.

Assign Signal Values to a Bus

Use a Bus Assignment block to assign the values of a signal to elements of a bus. Change bus element values without adding Bus Selector and Bus Creator blocks to select bus elements and reassemble them into a bus.

Specify Bus Signal Sample Times

All signals in a nonvirtual bus must have the same sample time, even if the elements of the associated bus object specify inherited sample times. You can use a Rate Transition block to apply the same sample time to each bus element.

Specify Initial Conditions for Bus Signals

Specify bus element values as initial conditions for bus signals.

Prevent Bus and Mux Mixtures

A bus and mux mixture occurs when some blocks treat a signal as a mux, while other blocks treat that same signal as a bus. Mixing bus and mux signals in a model causes your model to be less robust.

Correct Mux Blocks That Create Bus Signals

Use the Model Advisor to modify models that contain Mux blocks that create bus signals.

Correct Buses Used as Muxes

Modify models that use bus signals as muxes by using the Model Advisor or manually changing your model.

Arrays of Buses

Combine Buses into an Array of Buses

Streamline a model by combining nonvirtual bus signals that have the same bus type (use the same bus object) into an array of buses.

Use Arrays of Buses in Models

Use array of bus signals in a model, load array of bus data, and log array of bus signals.

Work with Array of Buses Signals

Set up your model to that uses an array of buses to select signals, assign values to a signal, perform iterative processing, log and load signals, and initialize signals.

Convert Models to Use Arrays of Buses

Convert an existing model that does not use arrays of buses to use arrays of buses.

Bus Signals at Model Interfaces

Use Buses for Inports and Outports

Use bus signals with root-level Inport and Outport blocks, atomic subsystem nonvirtual Inports, and referenced models.

Bus Data Crossing Model Reference Boundaries

Use bus signals that cross the boundary between a model that contains a Model block and the referenced model.

Buses and Libraries

Use bus signals in a library block.

Buses in the Generated Code

Code generation for virtual and nonvirtual buses produces different results. Nonvirtual bus code generation creates a structure to represent the bus. You can control data types of initial condition structure fields.

Trace Connections Using Interface Display

Display interfaces to trace signals through the nested levels, annotate signal characteristics, and view units associated with signals.

Bus Objects

When to Use Bus Objects

Understand what bus objects are and when and how you can use them.

Create Bus Objects with the Bus Editor

Create and manage bus objects using the Bus Editor.

Create Bus Objects Programmatically

Use functions and classes to define bus objects and bus elements, create bus objects from blocks, or create bus objects from MATLAB® data.

Modify Bus Objects

Change bus object and bus element properties or add and delete bus elements.

Save and Import Bus Objects

Store bus objects in a data dictionary, MATLAB file, MAT-file, or an external source file, such as a database file. Load bus objects from these files into the base workspace.

Customize Bus Object Import and Export

Customize the Bus Editor import and export commands by writing MATLAB functions that provide the desired capabilities. Register these functions using the Simulink® Customization Manager.

Map Bus Objects to Models

Associate bus objects with models and keep track of those associations.

Was this topic helpful?