Multiplexer (mux)
Passes one of up to eight inputs to its output, picked by the
selsignal.
Group: Control · Kind: {"block":"mux","kind":"control"}
When to use it
Use it to switch a controller between references, gains or modes (soft start then regulation, a fault value, a test signal) without rewiring. Use limiter or max/min when you want a smooth combination rather than a choice.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in1 |
signal | Data input picked by sel = 0. |
in2 |
signal | Data input picked by sel = 1. |
in3 |
signal | Data input picked by sel = 2 (read when n is 3 or more). |
in4 |
signal | Data input picked by sel = 3 (read when n is 4 or more). |
in5 |
signal | Data input picked by sel = 4 (read when n is 5 or more). |
in6 |
signal | Data input picked by sel = 5 (read when n is 6 or more). |
in7 |
signal | Data input picked by sel = 6 (read when n is 7 or more). |
in8 |
signal | Data input picked by sel = 7 (read when n is 8). |
sel |
signal | Selector, counted from 0; rounded to the nearest whole number and limited to 0 ... n - 1. |
out |
signal | The selected input. |
Common parameters
n: Number of data inputs read, 2 to 8 (in1 … in8); sel = 0 picks in1, 1 picks in2, …, rounded and limited to n − 1 (Default: 2)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
n |
— | 2 | Number of data inputs read, 2 to 8 (in1 … in8); sel = 0 picks in1, 1 picks in2, …, rounded and limited to n − 1 |
Parameter descriptions are in English in both languages.
Model
The output is input number round(sel) counted from 0, with the index limited to 0 ... n - 1, so sel = 0 gives in1 and a logic level (0 or 1) switches between in1 and in2. A sel that is not a number picks in1. The block has direct feedthrough and no state; the switch happens at the step where sel crosses a half.
Common mistakes
- The selector counts from 0, not from 1:
sel= 1 picksin2. A selector that comes from a comparator or a logic gate is 0 or 1 and therefore picksin1orin2. - Switching between two controller outputs jumps the output. When the inputs are the outputs of integrating controllers, the one that is not selected keeps integrating and winds up; reset it or limit it so the switch-over does not kick the plant.
Datasheet and sources
There is no datasheet. Set n to the number of inputs you wire; inputs past n are not read.
Example
Open the example with the command file.openExample and the name demo:mux.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.