Documentation

Prevent Bus and Mux Mixtures

What Are Bus and Mux Signal Mixtures?

A Simulink® mux signal is a virtual signal that graphically combines two or more scalar or vector signals into one signal line. All the signals in a mux signal must have the same data type and complexity. For more information, see Mux Signals.

Bus signals can contain signals of different data types and complexities.

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.

Mux Block That Creates a Virtual Bus

One way that a model can mix bus and mux signals is when a Mux block creates a virtual bus. For example:

  • A signal from a Mux block connects to a Bus Selector block.

  • Mux and Demux blocks combine a signal with different attributes (for example, data type or complexity).

Bus Signal Treated as a Mux Signal

A second way that a model can mix bus and mux signals is when the model treats a bus signal as a mux signal. For example:

  • Bus Creator block that creates a signal to be used as a vector.

  • Bus Creator block that creates a signal to be used as a vector.

Why Avoid Mixing Bus and Mux Signals?

Mixing bus and mux signals in a model causes your model to be less robust. Configuring your model to prevent bus and mux mixtures:

  • Improves loop handling

  • Produces clear error messages

  • Contributes to consistent edit and compile-time behavior

Configuring your model to prevent bus and mux mixtures also allows you to update your model to take advantage of several features that you could not otherwise use, including:

  • Nonzero initialization of bus signals

  • Bus support for blocks such as Constant, Data Store Memory, From File, From Workspace, To File, and To Workspace

  • Signal Hierarchy Viewer

  • Signal label propagation enhancements

  • Arrays of buses

When to Prevent Bus and Mux Mixtures?

Configure a model to prevent bus and mux mixtures if all of the following conditions apply — the model:

  • Was created before R2013b

  • Contains one of the following: Bus Creator, Bus Selector, or Bus Assignment block, or a bus object

  • Has Configuration Parameters > Diagnostics > Connectivity > Mux blocks used to create bus signals set to none or warning

Even if a model created before R2013b does not require that you configure it to prevent bus and mux mixtures, consider updating it anyway. Doing so facilitates modifying the model to use buses or features that require that the model is configured to prevent bus and mux mixtures.

Starting in R2013b, when you create a model, Simulink automatically configures the model to avoid bus and mux mixtures. Simulink sets the Mux blocks used to create bus signals parameter to error. Then, when you do a model update or simulate the model, if you introduce a bus and mux mixture Simulink reports an error.

Two Upgrade Procedures

Configuring a model to prevent bus and mux mixtures involves performing these procedures:

The procedure to correct muxes that create bus signals:

  • Configures your model to identify when you introduce a bus and mux mixture

  • Automatically changes your model to correct many of the instances of such mixtures

Related Examples

More About

Was this topic helpful?