Logical.LogicalSwitch
Logical Switch.
The LogicalSwitch switches, depending on the Boolean u2 connector (the middle connector), between the two possible Boolean input signals u1 (upper connector) and u3 (lower connector).
If u2 is true, connector y is set equal to u1, else it is set equal to u3.
This component extends from BlockComponents.Interfaces.PartialBooleanSI3SO
Usage
BlockComponents.Logical.LogicalSwitch()
Connectors
u1- This connector represents a boolean signal as an input to a component (BooleanInput)u2- This connector represents a boolean signal as an input to a component (BooleanInput)u3- This connector represents a boolean signal as an input to a component (BooleanInput)y- This connector represents a boolean signal as an output from a component (BooleanOutput)
Behavior
Source
"""
Logical Switch.
The LogicalSwitch switches, depending on the Boolean u2 connector (the middle connector),
between the two possible Boolean input signals u1 (upper connector) and u3 (lower connector).
If u2 is **true**, connector y is set equal to u1, else it is set equal to u3.
"""
component LogicalSwitch
extends BlockComponents.Interfaces.PartialBooleanSI3SO
relations
y = ifelse(u2, u1, u3)
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://BlockComponents/LogicalSwitch.svg"}
}
}
endFlattened Source
"""
Logical Switch.
The LogicalSwitch switches, depending on the Boolean u2 connector (the middle connector),
between the two possible Boolean input signals u1 (upper connector) and u3 (lower connector).
If u2 is **true**, connector y is set equal to u1, else it is set equal to u3.
"""
component LogicalSwitch
"Connector of first Boolean input signal"
u1 = BooleanInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 80, "x2": 0, "y2": 180, "rot": 0}
},
"tags": []
}
}
"Connector of second Boolean input signal"
u2 = BooleanInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
},
"tags": []
}
}
"Connector of third Boolean input signal"
u3 = BooleanInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -100, "y1": 820, "x2": 0, "y2": 920, "rot": 0}
},
"tags": []
}
}
"Connector of Boolean output signal"
y = BooleanOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
relations
y = ifelse(u2, u1, u3)
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://BlockComponents/LogicalSwitch.svg"}
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests