## 4 Implementation and Testing Activities on MDTP  
### Implementation Works  
Once the protocol was fully designed, implementation works were carried out in order to test the usefulness of the solution. A prototype that covers the main features previously described has been implemented. This prototype, which has been used as the platform where MDTP performance was tested, is composed of two parts:  
* A Java component that represents _the publish-subscription manager_ of the middleware, in charge of the DDS communication with the AUVs. The DDS functionalities of this component are implemented by means of _CoreDX DDS_, a proprietary DDS solution offered by Twin Oaks [43]. * A C++ component that represents _the DDS proxy_ of the AUV. This component is composed by two different layers: a communication layer in charge of DDS communication with the middleware, and a translation layer in charge of formatting the information to/from the language or commands supported by the AUV (e.g., ROS). This manuscript focuses on the communication layer, as the purpose of the authors is to validate the PDUs defined under MDTP. The DDS functionalities of the DDS proxy are implemented by means of _Vortex OpenSplice DDS Community Edition_ which is an open-source DDS solution offered by PrismTech [44]. The DDS communication between both components has been tested in an acoustic network emulated by means of an online modem emulator provided by Evologics [46], which consists of a simulation of their medium frequency modem S2 CR 18/34 whose effective bitrate is 1 kbps. This emulator provides real-time modem working procedures, and implements the same source code and commands that the real acoustic modem does. Besides, as it is accessible remotely via Internet, it allows the simplification of the integration tasks and the minimization of the development costs. Besides, the Evologics emulator is able to simulate specific propagation effects in underwater acoustic communication channels, like signal propagation delays, data packet collision detection, packet synchronization errors, time difference of arrivals on the Ultra-Short Base Line (USBL) grid elements and the movement of a real modem due to sea current. Besides, in order to enable the compatibility of this modem with the DDS protocol, a specific software module called _DDS-acoustic converter_ able to implement the translation DDS/Evologics-Acoustic-Framework has been developed in the SWARMs project. This is a C++ component with DDS functionalities implemented by means of Vortex OpenSplice DDS Community Edition. In order to create a scenario for testing purposes, the _publish-subscription manager_ of the middleware, the _DDS proxy_ of the vehicle and the _DDS-acoustic converter_ were installed on a Linux based Personal Computer. To run the modem emulator, it was also necessary to install the Evologics Dual Media Access Control (DMAC) advanced data-link layer protocol. A specific Interface Description Language (IDL) file has been defined to implement the messages in MDTP. IDL can be defined as a specification language used to describe the data model used in the interface between software components in a language-independent manner. All commercial and open source DDS implementations currently available use an IDL file, also known as Data Definition Language (DDL) file, as the cornerstone for the generation of the data types needed for a specific software implementation. The format of the IDL file that has been defined is the following:  
module swarmsIDL { struct SWARMsmsg {  octet vid_type; //8 bits (VID bits 7..4, Type bits 3..0)  octet _subtype; //8 bits  octet seoperation; //Sequence nr of the operation (8 bits)  unsigned long dataInt[15]; //15 x 32 bitsThe first byte represents the Vehicle ID (4 bits) and the Type (4 bits) of MDTP, while the second and the third byte represent the SubType and the Sequence Operation (all of them described in Section 3.3).