FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
INTERCONNECTIONS section

The <INTERCONNECTIONS> section defines how SimObjects are connected. Connections link input ports to output ports or to constant values.

Syntax

Connections are specified as attributes of <Connection> tags:

<INTERCONNECTIONS>
<Connection
someObject.SomeInport="anotherObject.SomeOutport"
anotherObject.AnotherInport="yetAnotherObject.SomeOutport"
/>
</INTERCONNECTIONS>

Each attribute has the form:

<inputObject>.<inputPort> = "<outputObject>.<outputPort>"

or, to connect to a constant value:

<inputObject>.<inputPort> = "<constant value>"

Rules

  • All input ports must be connected. Every input port of every SimObject must appear on the left-hand side of a connection. Unconnected input ports cause a runtime error.
  • Output ports may be left unconnected. Not all outputs need to be consumed.
  • Multiple <Connection> tags are allowed. You can group connections into separate tags for readability:
<INTERCONNECTIONS>
<!-- Environment connections -->
<Connection
vessel.CurrentVelocity="environment.CurrentVelocity"
vessel.WaveElevation="environment.WaveElevation"
/>
<!-- Mechanical connections -->
<Connection
cable.PosA="mass1.Pos"
cable.PosB="0,0,0"
/>
</INTERCONNECTIONS>

Connecting to constants

When an input port is set to a literal value rather than an output port, the value is parsed as a comma-separated list of numbers. The list must contain exactly as many numbers as the input port declares, or the run stops with *"Constant value for input port &lt;object,port&gt; is incorrectly defined"*:

<!-- mass.Force is a downward force, in whatever force unit this library uses. -->
<Connection
cable.PosB="0,0,0"
mass.Force="0,0,9810"
/>
Warning
The magnitude 9810 cannot be interpreted without knowing the unit system of the library that provides mass: FhSim defines no units and converts nothing. A positive third component means "downward" only by the NED convention (Z down), which the integrator itself does not know about. See Units and coordinate conventions.

Variable substitution and arithmetic

Connection values can use $Variable references defined in the VARIABLES section, and are then passed through the arithmetic evaluator, so cable.PosB="0,0,-$Depth/2" is valid. See Arithmetic in attribute values for exactly when a value is treated as an expression:

<VARIABLES>
<Var Name="AnchorPos" Value="10,0,-50"/>
</VARIABLES>
<INTERCONNECTIONS>
<Connection cable.PosB="$AnchorPos"/>
</INTERCONNECTIONS>

Example

<INTERCONNECTIONS>
<Connection
cable.PosA="mass1.Pos"
cable.PosB="mass2.Pos"
/>
<Connection
mass1.Force="cable.ForceA"
mass2.Force="cable.ForceB"
/>
</INTERCONNECTIONS>

The first connection links the cable endpoints to the positions of two mass objects. The second connects the cable reaction forces back to the masses.

See also