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 is compared to zero by the different logical operators available. The first input signal is sent to the output if the logical test evaluates to true, and the third signal is sent to the output if the test is false.

Author
Benjamin Scholz
Date
06.09.2007 BSC: Initial version.
20.07.2011 KGA: Ported to FhSim 2.0.
25.07.2011 KGA: Added documentation.

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Signal/Switch"
Name = "Gt"
SwitchType = "gt"
/>
<Connection
Gt.In1="1"
Gt.In2="Pulse.Out" <!-- from somewhere -->
Gt.In3="3"
/>

Input Ports

Name Width Description
In1 <PortWidth> The first input signal
In2 <PortWidth> The control signal
In3 <PortWidth> The second input signal

Output Ports

Name Width Description
Out <PortWidth> The selected input signal

Configuration parameters

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".

Initial conditions

There are no initial conditions for this function.

Full example file

<Contents>
<OBJECTS>
<Lib
LibName="base"
SimObject="Signal/Switch"
Name="Gt"
SwitchType="gt"
/>
<Lib
LibName="base"
SimObject="Signal/Switch"
Name="Lt"
SwitchType="lt"
/>
<Lib
LibName="base"
SimObject="Signal/Switch"
Name="Eq"
SwitchType="eq"
/>
<Lib
LibName="base"
SimObject="Signal/Switch"
Name="Ne"
SwitchType="ne"
/>
<Lib
LibName="base"
SimObject="Src/Pulse"
Name="Pulse"
Amplitude="1"
Period="1"
Width="0.5"
RiseRime="0"
Delay="0"
Bias="0"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
Gt.In1="1"
Gt.In2="Pulse.Out"
Gt.In3="3"
Lt.In1="1"
Lt.In2="Pulse.Out"
Lt.In3="3"
Eq.In1="1"
Eq.In2="Pulse.Out"
Eq.In3="3"
Ne.In1="1"
Ne.In2="Pulse.Out"
Ne.In3="3"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
/>
</INITIALIZATION>
<INTEGRATION>
<Engine
IntegratorMethod="2"
NumCores="1"
TOutput="0, 0:0.5:2, 30"
LogStates ="1"
stepsize ="0"
HMax="0.002"
HMin="0.00000001"
AbsTol="1e-3" RelTol="1e-3"
UseRSSNormInsteadOfInfNorm="0"
FileOutput="objects:all"
/>
</INTEGRATION>
</Contents>

This SimObject is referred to as Signal/Switch