Composite Signals

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

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

  • Virtual buses

  • Nonvirtual buses

  • Mux signals

  • Concatenated signals

For a detailed comparison of composite signals, see Types of Composite Signals.

Virtual buses meet most modeling requirements for combining signals into a composite signal. Virtual buses give you flexibility for combining different types of signals.

Blocks

expand all

Bus to VectorConvert virtual bus to vector
Signal ConversionConvert signal to new type without altering signal values
Bus AssignmentReplace specified bus elements
Bus CreatorCreate bus from input signals
Bus SelectorSelect signals from incoming bus
In Bus Element Select signal that connects to input port
Out Bus ElementSpecify signal that connects to output port
Vector Concatenate, Matrix ConcatenateConcatenate input signals of same data type to create contiguous output signal
SelectorSelect input elements from vector, matrix, or multidimensional signal
MuxCombine input signals of same data type and numeric type into virtual vector
DemuxExtract and output elements of virtual vector signal

Functions

expand all

Simulink.BlockDiagram.addBusToVectorConvert virtual bus signals into vector signals by adding Bus to Vector blocks
Simulink.Bus.cellToObjectConvert cell array containing bus information to bus objects
Simulink.Bus.createMATLABStructCreate MATLAB structures using same hierarchy and attributes as bus signals
Simulink.Bus.createObjectCreate bus objects from blocks or MATLAB structures
Simulink.Bus.objectToCellUse bus objects to create cell array containing bus information
Simulink.Bus.saveSave bus objects in MATLAB file

Objects

Simulink.Bus Specify properties of buses
Simulink.BusElement Specify properties of elements of buses

Tools

Bus EditorCreate, modify, and manage Simulink.Bus objects

Topics

Composite Signal Basics

Types of Composite Signals

To reduce visual complexity in a model, combine signals into a composite signal.

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.

Simplify Bus Interfaces

Use In Bus Element and Out Bus Element blocks for bus inputs and outputs.

Display Information About Buses

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

Create Nonvirtual Buses

Nonvirtual buses affect simulation and code generation.

Bus Signal Routing

Bus-Capable Blocks

Identify the blocks that support bus signals as inputs.

Nest 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.

Correct Buses Used as Vectors

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 Arrays of Buses

Set up your model to use 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

Buses at Model Reference Interfaces

Use bus signals with root-level input and output blocks, atomic subsystem nonvirtual input blocks, and referenced models.

Bus Conversion

As part of simulation and code generation for S-Function blocks and Stateflow® charts, Simulink® automatically converts a virtual bus to a nonvirtual bus and nonvirtual buses to virtual buses, as necessary.

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.

Generate Code for Bus Signals

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.

Display Signal Attributes at Model Load Time

Display signal attributes at load time without compiling.

Find Attribute Mismatches Between Components

Find mismatching signal attributes at load time without compiling.

Bus Objects

Specify Bus Properties with Bus Objects

Understand bus object uses and implementation workflow.

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.

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.

Featured Examples