# Underwater Wireless Communications for Cooperative Robotics with UWSim-NET
## 2 UWSim-NET  
On the one hand, the tools used in robotics allow modeling the kinematics of the robots, but hardly ever account for the communications. On the other hand, there are excellent tools, such as NS3, that permit the modeling of communication networks [13]. However, NS3 simulations require the position of communication nodes to be defined in advance, which hampers the realization of HIL experiments. UWSim [17] has been upgraded to model the behavior of underwater wireless communications for a network of robots. The new extension has been named UWSim-NET (github: [[https://github.com/uji-ros-pkg/underwater_simulation/tree/uwsimnet-devel](https://github.com/uji-ros-pkg/underwater_simulation/tree/uwsimnet-devel)]([https://github.com/uji-ros-pkg/underwater_simulation/tree/uwsimnet-devel](https://github.com/uji-ros-pkg/underwater_simulation/tree/uwsimnet-devel))) [18].  
The main advantage of UWSim-NET is that it is a system integrated in Robotic Operating System (ROS) [19], thus it can not only to simulate the network, but also perform a complete simulation of both the robots and the network in real-time. The movements of the robots and packet flows can be predefined before the start of the simulation as in UAN and AquaSim. UWSim-NET also allows the user to move the devices during the simulation by calling the ROS API as well as permits real traffic sent by the user applications. These two characteristics are essential to conduct HIL experiments in order to test the modems or the user application as well as to model the modems and their impact on the user application without needing to assemble real devices.  
The simulation of the communications network in UWSim-NET is based on the real-time event scheduler and other utilities of the NS3 library. It allows simulating both acoustic and custom modems. The modeling of acoustic devices is based on the NS3 module AquaSim NG [13], while RF and VLC devices are simulated as custom modems, based on a high-level statistical model that allows adjusting its bit-rate, intrinsic jitter and delay. Thus, it can reproduce the performance of a real modem. The custom device introduced in UWSim-NET allows modeling half and full duplex links. It also accounts for transmission errors caused by either signal attenuation or packet collisions. The user is able to define the behavior of a generic device by indicating the bitrate, the intrinsic delay, the jitter and the relationship of the bit error rate (BER) with the distance, which can be obtained from experimental measurements.  
The architecture of UWSim-NET, shown in Figure 2a, is based on a modular structure. The user application module can be either a real ROV or a simulated ROV. The Generic Link Interface (GLI) is an abstraction layer between the user application and the communication layer. It is aimed at easing the realization of HIL experiments by replacing the modem (Figure 2b) by its model (Figure 2c) when the physical devices are not available. This modular architecture also permits testing the user application even when the modems are not present. AquaSim and UAN allow modeling predefined transmission fluxes between the nodes of the network. This modular architecture of UWSim-NET also allows modeling the impact of the transmission fluxes generated by user applications.