## 5 Underwater Data Muling Simulator (UDMSim)
### ns-3 Based Simulator  
By using the traces provided by the AML simulator, UDMSim considers a trace-based network simulation in ns-3 [53], an open-source, discrete-event network simulator mainly used for research and educational purposes. The trace-based simulation approach was presented in [54]. It consists of a technique that feeds ns-3 with traces, including node positions and Signal-to-Noise Ratio (SNR) at the receiver. It provides more accurate results and allows reproducing real-world experiments. Despite offering several models for devices and protocols for wired and wireless networks, ns-3 lacks native underwater optical and RF propagation models. Therefore, the RF underwater model presented in [28] was used in UDMSim. The SNR value was computed in Matlab and added to each entry of the trace provided by AML. This step was necessary to meet the requirements of the ns-3 _TraceBasedPropagationLossModel_. Through the trace-based simulation approach, the native mobility and propagation models of ns-3 \begin{table}
\begin{tabular}{l c c c} \hline \hline
**Sensor** & **Update Rate (HZ)** & **Measurement Bias** & **Measurement Variance** \\ \hline Pressure & 10 & 0 Pa & \(9.80\times 10^{2}\) Pa\({}^{2}\) \\ Accelerometer & 100 & \(1.47\times 10^{-4}\) m s\({}^{-2}\) & \(3.46\times 10^{-4}\) m\({}^{2}\) s\({}^{-4}\) \\ Gyroscope & 100 & \(3.49\times 10^{-2}\) rad s\({}^{-1}\) & \(1.55\times 10^{-5}\) rad\({}^{2}\) s\({}^{-2}\) \\ Magnetometer & 100 & 0 T & \(1\times 10^{-6}\) T\({}^{2}\) \\ USBL & 1 & 0 s & \(3.6\times 10^{-11}\) s\({}^{2}\) \\ Artificial Vision & 10 & 0 m & \(6.25\times 10^{-4}\) m\({}^{2}\) \\ DVL & 5 & 0 m s\({}^{-1}\) & \(2.5\times 10^{-3}\) m\({}^{2}\) s\({}^{-2}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Sensor model parameters. Figure 8: Block diagram of sensors in the AUV simulator. The real state and known external quantities (left-hand side) are used to simulate the sensors. The sensors feed the state estimator at different rates. were replaced by the position of the AUV and SNR provided by the trace file imported into ns-3. Higher layers were simulated using native ns-3 modules. This enhanced version of the UDMSim includes the antenna radiation patterns (E-Plane and H-Plane) imported as a single.ant file with a one degree resolution. This allows evaluating antenna performance across the mission for different antenna location and design, especially during the docking and undocking procedures, where misalignments are prone to occur. The ns-3 simulator implements the state machine of the GROW UDMP protocol, including an out-of-band acoustic signalling channel to enable the control of the DMUs and a broadband short-range RF for data transfer. Figure 9 shows the message sequence diagram for two DMUs [9]. The UDMP starts by requesting the data size using the control link, and it splits the data file into different chunks according to the number of DMUs available (two in this case). The DMUs depart from the CSU according to the positions defined in the traces. When the DMU reaches a distance of 2 m from the SU, a docking request is sent. If successful, the DMU continues its approach. When the short-range link is available, the ns-3 _BulkSendApplication_ transfers the respective chunk of data. Due to the sharp SNR decay with the distance, the Minstrel auto rate mechanism is used and the data exchange application is monitored and restarted if the association between the DMU and SU is lost or in the case where the TCP retransmission timeout is exceeded. When the transfer is complete, the DMU performs the same process in reverse order. Upon the completion of the data upload to the CSU, ns-3 computes the equivalent throughput \(R_{b,q}\), taking into consideration the overhead of the DTN stack. Figure 9: Message sequence diagram for two Data Mule Units. Considering the modular architecture of UDMSim, new sensors and navigation modes can be added to the AML Simulator, allowing simulating different types of AUVs.