๐Ÿ”€

Demux

Signal Routing
Run the live example Free ยท no sign-up ยท runs in your browser

The Demux block splits an incoming vector or bus signal into separate scalar output lines, or distributes a single input signal simultaneously across multiple downstream blocks without drawing overlapping connection lines.

It is widely used in complex control architectures to unpack state vectors from multi-variable state-space models, distribute shared reference clocks, and route multi-channel sensor arrays cleanly across the canvas.

Mathematical Model

When receiving an incoming vector signal u(t)=[u0(t),u1(t),โ€ฆ,uMโˆ’1(t)]T\mathbf{u}(t) = [u_0(t), u_1(t), \dots, u_{M-1}(t)]^T matching M=numOutputsM = \text{numOutputs}, each output port emits the corresponding vector element:

yi(t)=ui(t),iโˆˆ{0,1,โ€ฆ,Mโˆ’1}y_i(t) = u_i(t), \quad i \in \{0, 1, \dots, M-1\}

When receiving a scalar signal u(t)u(t), the block acts as an active signal fan-out distributor, broadcasting the identical scalar value across all configured output terminals:

yi(t)=u(t),โˆ€iโˆˆ{0,1,โ€ฆ,Mโˆ’1}y_i(t) = u(t), \quad \forall i \in \{0, 1, \dots, M-1\}

Signal routing occurs with zero phase lag and zero sample-time transport delay:

ฮ”trouting=0\Delta t_{\text{routing}} = 0

Inputs & Outputs

Direction ID Label Type Status
→ In in Vector vector Required
← Out out Element number Output

Parameters

Parameters Label Type Default Description
numOutputs Number of Outputs number 2

Usage Examples

Example 1: Multi-State Vector Element Unpacking

Unpacking a 3-element state vector x(t)=[p(t),v(t),a(t)]T\mathbf{x}(t) = [p(t), v(t), a(t)]^T from a StateSpace mechanical plant model. Connecting the vector wire to Demux configured with numOutputs = 3 produces three dedicated scalar wires for position, velocity, and acceleration, allowing individual scope monitoring and state-feedback gain tuning.

Example 2: Clean Signal Fan-Out Without Wire Crossings

Distributing a central speed setpoint command simultaneously to a velocity controller, a feedforward compensator, and a data-logging display. Setting numOutputs = 3 allows each downstream subsystem to receive the command along straight, collinear connection paths without cluttering the diagram with intersecting wires.

Remarks & Best Practices

  • Zero-Latency Pass-Through: Signal extraction and distribution execute instantaneously within the same simulation timestep with zero numerical error.
  • Dynamic Port Resizing: Adjusting numOutputs dynamically updates the block dimensions and port handles on the diagram canvas.
  • Unconnected Output Handling: Unconnected output ports are safely ignored by the execution engine, consuming no simulation cycles or memory buffers.
  • Vector and Scalar Flexibility: Transparently decomposes typed vector arrays or broadcasts scalar signals depending on the input wire type.

Related Components

  • Mux: Combines multiple scalar signals into a bundled vector.
  • Selector: Extracts specific indexed elements or subarrays from an input vector.
  • Goto: Transmits signals wirelessly across canvas boundaries without visible wires.
  • uPlotDisplay: Multi-channel waveform scope for monitoring multiple signals.