PositionSwitch_Mux Icon
Switches.PositionSwitch_Mux
PositionSwitch_Mux(; name, threshold)A conditional switch that selects between two multiplexed (3-component) signal sets based on a threshold comparison.
Parameters
threshold: Threshold value for comparison against u2
Variables
u2: Control signal input for threshold comparisonu1: First multiplexed input connector (3 components)u3: Second multiplexed input connector (3 components)y: Output multiplexed connector (3 components)
Description
Switches between two sets of multiplexed signals based on whether the control signal u2 is greater than the threshold. When u2 > threshold, outputs u1 components (y.u1 = u1.u1, y.u2 = u1.u2, y.u3 = u1.u3). Otherwise, outputs u3 components (y.u1 = u3.u1, y.u2 = u3.u2, y.u3 = u3.u3).
Usage
PrimitiveComponents.Switches.PositionSwitch_Mux(threshold)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
threshold | – |
Connectors
u2- This connector represents a real signal as an input to a component (RealInput)u1- connector3input
A connector type with three real-valued input signals.
Variables
u1: First real input signalu2: Second real input signalu3: Third real input signal
Description
This connector bundles three real-valued input signals together, allowing them to be connected as a single unit in block diagrams. (connector_3_input)
u3- connector3input
A connector type with three real-valued input signals.
Variables
u1: First real input signalu2: Second real input signalu3: Third real input signal
Description
This connector bundles three real-valued input signals together, allowing them to be connected as a single unit in block diagrams. (connector_3_input)
y- connector3output
A connector type with three real-valued output signals.
Variables
u1: First real output signalu2: Second real output signalu3: Third real output signal
Description
This connector bundles three real-valued output signals together, allowing them to be connected as a single unit in block diagrams. (connector_3_output)
Behavior
\[ \begin{align} \mathtt{y.u1}\left( t \right) &= ifelse\left( \mathtt{u2}\left( t \right) > \mathtt{threshold}, \mathtt{u1.u1}\left( t \right), \mathtt{u3.u1}\left( t \right) \right) \\ \mathtt{y.u2}\left( t \right) &= ifelse\left( \mathtt{u2}\left( t \right) > \mathtt{threshold}, \mathtt{u1.u2}\left( t \right), \mathtt{u3.u2}\left( t \right) \right) \\ \mathtt{y.u3}\left( t \right) &= ifelse\left( \mathtt{u2}\left( t \right) > \mathtt{threshold}, \mathtt{u1.u3}\left( t \right), \mathtt{u3.u3}\left( t \right) \right) \end{align} \]
Source
"""
PositionSwitch_Mux(; name, threshold)
A conditional switch that selects between two multiplexed (3-component) signal sets based on a threshold comparison.
# Parameters
- `threshold`: Threshold value for comparison against u2
# Variables
- `u2`: Control signal input for threshold comparison
- `u1`: First multiplexed input connector (3 components)
- `u3`: Second multiplexed input connector (3 components)
- `y`: Output multiplexed connector (3 components)
# Description
Switches between two sets of multiplexed signals based on whether the control signal u2 is greater than the threshold.
When u2 > threshold, outputs u1 components (y.u1 = u1.u1, y.u2 = u1.u2, y.u3 = u1.u3).
Otherwise, outputs u3 components (y.u1 = u3.u1, y.u2 = u3.u2, y.u3 = u3.u3).
"""
component PositionSwitch_Mux
u2 = Dyad.RealInput() {
"Dyad": {
"placement": {
"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0},
"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0}
}
}
}
u1 = PrimitiveComponents.Connectors.connector_3_input() {
"Dyad": {
"placement": {
"diagram": {"x1": -70, "x2": 10, "y1": 80, "y2": 160, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -70, "x2": 10, "y1": 80, "y2": 160, "sh": 1, "sw": 1, "rot": 0}
}
}
}
u3 = PrimitiveComponents.Connectors.connector_3_input() {
"Dyad": {
"placement": {
"diagram": {"x1": -70, "x2": 10, "y1": 820, "y2": 900, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -70, "x2": 10, "y1": 820, "y2": 900, "sh": 1, "sw": 1, "rot": 0}
}
}
}
y = PrimitiveComponents.Connectors.connector_3_output() {
"Dyad": {
"placement": {
"diagram": {"x1": 980, "x2": 1060, "y1": 460, "y2": 540, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": 980, "x2": 1060, "y1": 460, "y2": 540, "sh": 1, "sw": 1, "rot": 0}
}
}
}
parameter threshold::Real()
relations
y.u1 = ifelse(u2 > threshold, u1.u1, u3.u1)
y.u2 = ifelse(u2 > threshold, u1.u2, u3.u2)
y.u3 = ifelse(u2 > threshold, u1.u3, u3.u3)
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "> $(threshold)", "x": 500, "y": -150, "rot": 0}
],
"icons": {"default": "dyad://PrimitiveComponents/Switch3.svg"}
}
}
end
Flattened Source
"""
PositionSwitch_Mux(; name, threshold)
A conditional switch that selects between two multiplexed (3-component) signal sets based on a threshold comparison.
# Parameters
- `threshold`: Threshold value for comparison against u2
# Variables
- `u2`: Control signal input for threshold comparison
- `u1`: First multiplexed input connector (3 components)
- `u3`: Second multiplexed input connector (3 components)
- `y`: Output multiplexed connector (3 components)
# Description
Switches between two sets of multiplexed signals based on whether the control signal u2 is greater than the threshold.
When u2 > threshold, outputs u1 components (y.u1 = u1.u1, y.u2 = u1.u2, y.u3 = u1.u3).
Otherwise, outputs u3 components (y.u1 = u3.u1, y.u2 = u3.u2, y.u3 = u3.u3).
"""
component PositionSwitch_Mux
u2 = Dyad.RealInput() {
"Dyad": {
"placement": {
"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0},
"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0}
}
}
}
u1 = PrimitiveComponents.Connectors.connector_3_input() {
"Dyad": {
"placement": {
"diagram": {"x1": -70, "x2": 10, "y1": 80, "y2": 160, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -70, "x2": 10, "y1": 80, "y2": 160, "sh": 1, "sw": 1, "rot": 0}
}
}
}
u3 = PrimitiveComponents.Connectors.connector_3_input() {
"Dyad": {
"placement": {
"diagram": {"x1": -70, "x2": 10, "y1": 820, "y2": 900, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -70, "x2": 10, "y1": 820, "y2": 900, "sh": 1, "sw": 1, "rot": 0}
}
}
}
y = PrimitiveComponents.Connectors.connector_3_output() {
"Dyad": {
"placement": {
"diagram": {"x1": 980, "x2": 1060, "y1": 460, "y2": 540, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": 980, "x2": 1060, "y1": 460, "y2": 540, "sh": 1, "sw": 1, "rot": 0}
}
}
}
parameter threshold::Real()
relations
y.u1 = ifelse(u2 > threshold, u1.u1, u3.u1)
y.u2 = ifelse(u2 > threshold, u1.u2, u3.u2)
y.u3 = ifelse(u2 > threshold, u1.u3, u3.u3)
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "> $(threshold)", "x": 500, "y": -150, "rot": 0}
],
"icons": {"default": "dyad://PrimitiveComponents/Switch3.svg"}
}
}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses