Selector
Signal RoutingSelects one of multiple input signals based on an index value.
Mathematical Model
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | idx |
Idx | number | Required |
| → In | in |
In | number | Required |
| ← Out | out |
Out | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
numInputs |
Number of Inputs | number | 2 |
|
indexBase |
Index Base | select | 1 |
Usage Examples
- Zie de ingebouwde voorbeelden in de handleiding voor een demonstratie van dit blok.
Remarks & Best Practices
- Index clamping: The index input is rounded to the nearest integer and clamped to [1, numInputs] (or [0, numInputs-1] in 0-based mode); out-of-range indices always produce a valid output
- 0-based vs 1-based: Use
indexBase = 0when the index comes from another block that outputs zero-based indices (e.g., a counter starting at 0) - Dynamic selection: The index can be a time-varying signal, allowing the selector to dynamically switch between inputs during simulation
- Unconnected inputs: If a selected data input is not connected, the output is 0.0
- Performance: Minimal overhead — index clamping and selection happen in a single step
Related Components
- Constant: Eenvoudige signaalbron