Mux

Joins signals into one vector wire, in order. Set the number of inputs in its properties; an input may itself be a vector.

  • signal
  • Gradara equations
  • 4 ports
BlockMuxKindmuxLibraryRouting

Description

Joins several signals into one vector, in order, and carries it on one wire. The wire is drawn heavy so a bundle stands out from a single signal.

Set the number of inputs (2 to 32) under Signals in the block’s properties; the bar grows to fit. An input may itself be a vector, which is added in place, so Muxes can be chained. Split the vector again with a Demux, or pass it through subsystem ports unchanged.

A Mux carries one kind of signal, Real or Boolean. Choose the type under Signals while the block has no wires, or wire it: it takes the kind of the first wire you connect. A Boolean Mux joins Boolean signals (gate commands, flags) into one Boolean vector, drawn in the Boolean color.

Example

Mux and Demux Three signals carried across the sheet on one vector wire, then split apart again.

RampSineLevelMuxDemuxSum
In Gradara, select a Mux block and press F1, then choose Open example. It opens as a new model in My models, ready to run.

Also in this example:DemuxConstantRampSine waveSum

Ports

Inputs 3

  • 1u1

    First signal (or vector).

  • 2u2

    Second signal (or vector).

  • 3u3

    Third signal (or vector).

Outputs 1

  • y

    The inputs joined in order: as wide as all of them together.

Equations

Modelica
y = {u1, u2, u3}  (a vector input contributes all its signals)

Implementation

The block’s Modelica model
y = {u1, u2, u3};

Assumptions and limitations

  • A vector wire can go only to a Demux, a Bus Selector, a Bus Creator, another Mux, or a subsystem port. Other blocks take one signal each and report an error; element-wise math on vectors is not available yet.
  • A vector is all Real or all Boolean; a Mux cannot mix the two. Physical connections travel on a Physical bus instead.
  • Its signals have no names: in results they are numbered, as Mux.y[1], Mux.y[2]. Use a Bus Creator to name them.

Tips

  • Log the vector wire to record every signal on it: Results shows one trace per signal.

See also

Select a block in Gradara and press F1 to open its page offline.