Signal Routing & Logicals Mux & Demux : Group signals of same type A mux block groups multiple signals of the same type. In Block Parameters you specify the
Number of Inputs to group. You can feed a mux output directly into a mathematical block so that
the block will operate on all signals at once.
A demux block separates out individual signals. Specify the Number of Outputs in block
parameters - this can be a single integer or a vector. Each number in the vector specifies the
number of signals in a particular output.
Example:
A mux groups 3 signals and
multiplies them all by a gain 5. The demux,
with Number of Outputs = [1 3 1], separates
the signals into 3 outputs: The first and last
outputs are single wires, and the middle
output is a mux group with 3 signals.
Buses : Grouping signals of different types A bus is like cable tidy: a convenient way keeping things organised and not having a lots of wires
running everywhere.
Buses contain signals of different types and sizes.
That means that it is not always possible to feed a bus
into a mathematical block.
Create bus signals using the BusCreator block
(analogous to Mux). Unpack bus signals using
BusSelector (analogous to demux).
To overcome possible dimension mismatch errors created by using buses
and mux blocks in the same model, it is helpful to visualise Mux and Bus
signals.
To give a different style to each signal type set:
Display > Signals & Ports > Wide Nonscalar Lines Switches The simplest is the Manual Switch.
A user double clicks the block to divert the signal between two paths.
The output of the Switch block is determined by the centre pin. A
comparison is carried out between the centre input and a threshold
value. You can select the threshold value and for the comparison to
be
≥, ≤, =
, etc. If the comparison is true, the output is switch to the
top input, else the output is connected to the bottom input.