Contents

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 of 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, as described below.

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 if it is 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 not only makes your model more robust, it 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 Configure a Model 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, you may want to update it anyway. Doing so facilitates making future modifications to 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 new 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, Simulink reports an error if you introduce a bus and mux mixture.

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 not only configures your model to identify when you introduce a bus and mux mixture, it also automatically changes your model to correct many of the instances of such mixtures.

Was this topic helpful?