Documentation Center

  • Trial Software
  • Product Updates

Contents

Composite Signals

What is a Composite Signal?

A composite signal is a signal that is composed of other signals. The constituent signals originate separately and join to form the composite signal. You can then extract individual signals from the composite signal downstream and use the signal as if it had never been part of a composite signal.

Composite signals can reduce visual complexity in models by grouping signals that run in parallel over some or all of their courses. Composite signals offer other benefits, as described in the documentation for each technique for combining signals.

Techniques for Combining Signals

Simulink® provides several techniques for combining signals into a composite signal, depending on your modeling requirements.

Composite Signal TechniqueWhen to Use

Virtual bus

Combine signals of any type and dimension, without affecting the memory layout. Use for graphical convenience.

See Choosing Between Virtual and Nonvirtual Buses.

Nonvirtual bus

Combine signals of different types and dimensions such that they are contiguous in memory. Produces a structure in the generated code.

See Choosing Between Virtual and Nonvirtual Buses.

Mux block

Graphically combine signals of same type. See Buses and Muxes.

Vector Concatenate and Matrix Concatenate block

Create a vector or matrix, for example to be used in mathematical operations. The resulting vector is stored in contiguous memory.

Array of buses

Combine multiple buses with identical properties. Array of buses is equivalent to an array of structures in MATLAB®.

See Combine Buses into an Array of Buses.

Buses and Muxes

If all signals in a bus are the same type, you may be able to use a contiguous vector or a virtual vector (mux) instead of a bus. For more information, see Mux Signals.

In the context of a model, do use 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. For more information, see Prevent Bus and Mux Mixtures.

Bus Code

The various techniques for defining buses are essentially equivalent for simulation, but the techniques used can make a significant difference in the efficiency, size, and readability of generated code. If you intend to generate production code for a model that uses buses, for information about the best techniques to use, in the Embedded Coder® documentation, see Buses.

Function-Call Signals

To combine function-call signals to call a single system, use a Mux block.

If you use a Bus Creator block to group function-call signals into one bus, then use a Bus Selector block to separate out specific function-call signals.

Was this topic helpful?