|
FhSim
3.1.0
Marine systems simulation
|
Switch between the first and the third inputs output based on the value of the second input.
Collaboration diagram for Switch:The second input (In2) is compared to zero. In1 is sent to the output if the test is true, and In3 is sent to the output if the test is false. The test is made per element.
| SwitchType | Out is In1 if | Otherwise Out is In3 |
|---|---|---|
| "gt" or ">" | In2 > 0 | In2 <= 0 |
| "lt" or "<" | In2 <= 0 | In2 > 0 |
| "eq" or "==" | In2 == 0 | In2 != 0 |
| "ne" or "!=" | In2 != 0 | In2 == 0 |
Note that "lt" includes zero: it is the exact complement of "gt". At In2 == 0 both "lt" and "eq" pass In1.
| Name | Width | Description |
|---|---|---|
| In1 | <PortWidth> | The first input signal |
| In2 | <PortWidth> | The control signal |
| In3 | <PortWidth> | The second input signal |
| Name | Width | Description |
|---|---|---|
| Out | <PortWidth> | The selected input signal |
| Name | Width | Description |
|---|---|---|
| PortWidth | 1 | The number of elements in the input and output ports. |
| SwitchType | - | The logic type used in the comparison supported types*: "<" ">" "!=" or "==". Also accepts "gt", "lt", "eq", and "ne". |
There are no initial conditions for this function.
This SimObject is referred to as Signal/Switch