Marine systems simulation
Connection/DdsWriter

Send data from an FhSim simulation to external applications using the OMG DDS standard.

+ Collaboration diagram for Connection/DdsWriter:
Author
Joakim Haugen

This SimObject enables communication via DDS. This includes communication between different FhSim instances on the same network, or input from external processes such as physical processes. The DDS abstraction lets the user specify Partitions and Topics that one can publish or subscribe to. Within a Partition one can specify Topics, which are 'buffers' that holds information.

DdsWriter is a SimObject that publishes information to the user-specified Partition:Topic. The SimObject writes to the 'buffer' (doubles vector(s)) with a user-specified sampling frequencies.

Example file input:

<Lib LibName = "fhsim_extras"
SimObject = "Connection/DdsWriter"
Name = "DdsOutput"
Partition = "FhSimExternal"
Topic = "PhysicalEntity"
DdsRoot = "../lib"
DdsConfigFile = "../resources/ospl.xml"
ForceDdsEnv = "0"
PortWidth = "3"
ArrayIDs = "0, 2, 4"
PortSizes = "1, 4, 3"
SamplingPeriods = "0.3"
/>

Input Ports

Name Width Description
In1 .. In<PortWidth> <PortSizes> Value to be written to the corresponding DDS partition and topic with <ArrayIDs>.

Output Ports

No output ports available

Configuration parameters

Name Width Description
Partition 1 String name of DDS partition to read from.
Topic 1 String name of DDS topic to read from.
DdsRoot 1 The relative path to the DDS Library from the current working directory, which might be the directory of the FhSim executable. Also sets OSPL_HOME
DdsConfigFile 1 Path to OpenSplice DDS config file. Effectively sets OSPL_URI
ForceDdsEnv 1 Force setting OpenSplice DDS environment variables OSPL_HOME and OSPL_URI, even if they are set (default: 0).
PortWidth 1 Number of vectors to read.
ArrayIDs <PortWidth> or 0 The array IDs to read from on the prescribed partition and topic. A zero-indexed sequence is assumed if parameter is missing.
PortSizes <PortWidth> The length of each vector to be read.
SamplingPeriods <PortWidth> or 1 Sampling period for each input port. Can be uniform or distinct for each port.

Initial conditions

This SimObject contains no initial conditions.

Full example file

<Contents>
<OBJECTS>
<Lib LibName = "fhsim_extras"
SimObject = "Connection/DdsWriter"
Name = "DdsOutput"
Partition = "FhSimExternal"
Topic = "PhysicalEntity"
DdsRoot = "../lib"
DdsConfigFile = "../resources/ospl.xml"
ForceDdsEnv = "0"
PortWidth = "2"
ArrayIDs = "1, 2"
PortSizes = "1, 2"
SamplingPeriods = "0.3"
/>
<Lib LibName = "fhsim_extras"
SimObject = "Connection/DdsReader"
Name = "DdsInput"
Partition = "FhSimExternal"
Topic = "PhysicalEntity"
DdsRoot = "../lib"
DdsConfigFile = "../resources/ospl.xml"
ForceDdsEnv = "1"
InitializationTimeout = "0"
PortWidth = "2"
Tags = "InputAlpha, Input2"
DefaultInputAlpha = "0"
DefaultInput2 = "1, 2"
ArrayIDs = "1, 2"
PortSizes = "1, 2"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
DdsOutput.In1="1"
DdsOutput.In2="2, 3"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialConditions/>
</INITIALIZATION>
<INTEGRATION>
<Engine
IntegratorMethod="2"
NumCores="1"
TOutput="0, 5, 5"
LogStates ="1"
stepsize ="0.001"
HMax="0.2"
HMin="0.00001"
AbsTol="1e-3" RelTol="1e-3"
UseRSSNormInsteadOfInfNorm="0"
FileOutput="object.DdsInput:ports"
/>
</INTEGRATION>
</Contents>