FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
External link

External .dll communication interface.

+ Collaboration diagram for External link:

Special class of SimObject that can have it's ports read and set from outside the simulation. This implements the interface in ExternalLink

Author
Jorgen Haavind Jensen
Date
16.02.2011 JHJ: Initial version.

Configuration parameters

See example file at the bottom of this page, for clarification.

Name Width Description
outputPortNames n Comma separated list of output port names.
Initial_<outputPortName1>...Initial_<outputPortName<n>> m One for each output port name. Initial values for each output port.
inputPortNames k Comma separated list of input port names.
Size_<inputPortName1>...Size_<inputPortName<k>> 1 One for each input port name. Size of each input port.
Initial_<inputPortName1>...Size_<inputPortName<k>> size_<inputPortName<..> One for each input port name. Initial values for each input port.
Note
In/Out-put ports can be referenced both as their name and number. The number corresponds to the index in the respective vectors from GetAllInputPorts()/GetAllOutputPorts().

There are two different ways of setting the output port values of an ExternalLink. With and without copy. Without-Copy only stores the given memory reference. Other processes that have access to the same memory reference can change values of the port at any time. With-Copy transfers the data from the given memory reference to a local buffer.

The internal state and time must be updated with "UpdateStatesAndTime" before correct values can be retrieved from the "GetMyInputPort" functions.

Full example file

<Contents>
<OBJECTS>
<Lib
LibName="base"
SimObject="System/ExternalLinkStandard"
Name="ExtLink"
outputPortNames="out1"
Initial_out1="0,0,1"
inputPortNames="in1"
Size_in1="3"
Initial_in1="2,2,2"
/>
<Lib
LibName="base"
SimObject="Body/Mass"
Name="M"
Scale="1"
Mass="1"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
ExtLink.in1="M.Pos"
M.Force="ExtLink.out1"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
M.Pos="1,1,1"
M.Vel="0,0,0"
/>
</INITIALIZATION>
<SIMULATION>
<Timing TStart="0" TEnd="11.0"/>
<Integrator Method="RK45_i" NumCores="1" LogStates="1" UseRSSNorm="0">
<StepControl StepMax="0.002" StepMin="0.00000001" AbsTol="1e-3" RelTol="1e-3"/>
</Integrator>
</SIMULATION>
<OBSERVERS>
<FileOutput TOutput="0, 0,1,2, 30" Select="objects:all"/>
</OBSERVERS>
</Contents>

This SimObject is referred to as ExternalLinkStandard

This SimObject is referred to as System/ExternalLinkStandard