Skip to content

Simulating And Visualizing 3D Mobile Underwater Sensor Network (UWSN) Under ns-3

Underwater acoustic communication [1] :

Underwater acoustic communication is a technique of sending and receiving messages below water. There are several ways of employing such communication but the most common is by using hydrophones.

Underwater communication is difficult due to factors such as multi-path propagation, time variations of the channel, small available bandwidth and strong signal attenuation, especially over long ranges. Compared to terrestrial communication, underwater communication has low data rates because it uses acoustic waves instead of electromagnetic waves.

Underwater Wireless Sensor Networks (UWSN)

UWSNs is usually made up of autonomous vehicles and individual sensor nodes that implement monitoring operations as well as storing and forwarding operations to route the data that has been collected to a  sink node.  

Acoustic communications are the typical physical layer technology in UWSNs as other mediums are not feasible to be used in the underwater environment, such as radio waves and optical waves. Each of these sensor nodes is equipped with an acoustic modem and being deployed manually or randomly in deep or shallow water based on their application requirement.  

However, there  are  several limitations and challenges in UWSNs because of the uniqueness of UWSNs compared to other networking environments like Terrestrial Wireless Sensor Networks (TWSNs)

UAN/UWSN Simulation and Visualization support in/for ns-3

In fact, with default installation itself, ns-3 does have the physical layer and mac layer for simulating acoustic underwater communications (UAN Framework).   The main goal of the UAN Framework is to enable researchers to model a variety of underwater network scenarios. The ns-3’s UAN model is broken into four main parts: The channel, PHY, MAC and Autonomous Underwater Vehicle (AUV) models. But the default UAN framework of ns-3 only contains some basic functionalities and does not contain any UWSN routing protocols. 

In addition to this ns-3 UAN model, another underwater protocol extension is also available for ns-3. It is called ‘Aqua-Sim Next Generation’ (AquaSim-NG).  It was originally developed for ns-2 and then ported to ns-3. The ns-2 version of aquasim has a separate 3D visualization tool called ‘Aqua3D’. But we can not use that  3D visualization tool Aqua3D to visualize ns-3 network scenarios.

The Network Visualization tool available under ns-3 (NetAnim) can not be used to visualize 3D underwater network scenarios. (It can able to render only 2D output of a 3D simulation. So that, it can not be used to visualize a 3D  UAN/UWSN simulation output.

NetSimulizer is a 3D Network Visualization tool written for visualizing outputs of ns-3 3D Network simulations.

Problems in simulating and visualizing 3D Mobile UAN/UWSN under ns-3 :

  • In the ns-3 (versions up to 3.33) ,  there are no rich, 3D mobility models available so that we can not simulate a practical 3D UAN/UWSN by using the available components and models.
  • Even though if we simulate a 3D scenario with a custom 3D mobility model, the standard visualization tool of ns-3 (NetAnim) can only show the 2D  view of a 3D simulation. It makes it impractical to visualize the simulated 3D scenario.

About this Mobile Underwater 3D Network Simulation

In this article, we will see the way of simulating and visualizing a UAN/UWSN  under ns-3 using NetSimulyzer.

NetSimulyzer 3D visualization tool able to ‘play’ the 3D network scenario from different camera perspectives using a special trace output file (.json format) which was created during the ns-3 simulation (the simulation which uses ns-3 NetSimulyzer module).

So, the NetSimulyzer  3D visualization tool can be used to play/animate/visualize ns-3 network scenarios for better understanding, presenting and debugging them.

We can simulate realistic UAN/UWSN using ns3 along with NetSimulyzer. In this article, we will see the way of simulating a  UWSN composed of some underwater mobile sensor nodes and a sink node (Boat) at the surface of the water.

In this simulation, I decided to use AquaSim-NG to simulate a realistic, Mobile Underwater Sensor Network.

The Components of the Simple 3D UWSN ns-3 Simulation Script

The following code segment presents the important components of the ns-3 simulation script which is used to simulate our 3D UWSN.

Include the header files Needed

The following lines include the necessary header files. The suitable 3D mobility model should be incorporated in mobility-module.h and the Netsimulyzer ns-3 module should be installed in the ns-3 directory tree. The header file for aqua-sim-ng and other header files for required components are included.

#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/aqua-sim-ng-module.h”
#include “ns3/applications-module.h”
#include “ns3/log.h”
#include “ns3/callback.h”
#include “ns3/mobility-module.h”
#include “ns3/netanim-module.h”
#include “ns3/netsimulyzer-module.h”

The following two articles explain the way to set up the Netsimulyzer 3D visualization support.

Installing NetSimulyzer 3D Visualization Support Add-on Module in ns-3 under Debian/Ubuntu

Installing NetSimulyzer 3D Visualization Tool under Debian/Ubuntu

The following lines show some of the parameters that we used for creating different nodes and setting their communication attributes for this underwater network simulation.

double simTimeSec=200.0;

double simStop = 20; //seconds
uint32_t numNodes = 10;
uint32_t sinks = 1;
uint32_t m_dataRate = 10000;
uint32_t m_packetSize = 40;
double range = 100;

NodeContainer nodesCon;
NodeContainer sinksCon;
NodeContainer senderCon;
nodesCon.Create(numNodes);
sinksCon.Create(sinks);
senderCon.Create(1);

PacketSocketHelper socketHelper;
socketHelper.Install(nodesCon);
socketHelper.Install(sinksCon);
socketHelper.Install(senderCon);

AquaSimChannelHelper channel = AquaSimChannelHelper::Default();
channel.SetPropagation(“ns3::AquaSimRangePropagation”);
AquaSimHelper asHelper = AquaSimHelper::Default();

asHelper.SetChannel(channel.Create());
asHelper.SetMac(“ns3::AquaSimBroadcastMac”);
asHelper.SetRouting(“ns3::AquaSimDBR”);

OnOffHelper app (“ns3::PacketSocketFactory”, Address (socket));
app.SetAttribute (“OnTime”, StringValue (“ns3::ConstantRandomVariable[Constant=0.0066]”));
app.SetAttribute (“OffTime”, StringValue (“ns3::ConstantRandomVariable[Constant=0.9934]”));
app.SetAttribute (“DataRate”, DataRateValue (m_dataRate));
app.SetAttribute (“PacketSize”, UintegerValue (m_packetSize));

ApplicationContainer apps = app.Install (senderCon);
apps.Start (Seconds (0.5));
apps.Stop (Seconds (simStop));

Ptr<Node> sinkNode = sinksCon.Get(0);
TypeId psfid = TypeId::LookupByName (“ns3::PacketSocketFactory”);

Ptr<Socket> sinkSocket = Socket::CreateSocket (sinkNode, psfid);
sinkSocket->Bind (socket);

Simulate some 3D Ocean Water Body top of the Ocean Ground

The following section of code will mimic some water body for our UWSN. (This will not affect the Physical Media Implementation of AquaSim NG – it is just for 3D visualization on NetSimulyzer only.

// create a some Water Body
double WaterSizeX = 500; // m
double WaterSizeY = 500; // m
double WaterHeight = 250; // m

std::vector<Ptr<Building> > WaterVector;

Ptr < Building > Water;
Water = CreateObject<Building> ();

Water->SetBoundaries (Box (0,
WaterSizeX,
0,
WaterSizeY,
0.0, WaterHeight));
Water->SetNRoomsX (1);
Water->SetNRoomsY (1);
Water->SetNFloors (1);
WaterVector.push_back (Water);

Create Some Mobile Underwater Sensor Nodes and install RandomWalk3dMobilityModel them

//set up mobility model for nodes and sinks 

MobilityHelper mobility;

mobility.SetMobilityModel (“ns3::RandomWalk3dMobilityModel”,
“Mode”, StringValue (“Time”),
“Time”, StringValue (“10s”),
“Speed”, StringValue (“ns3::ConstantRandomVariable[Constant=25.0]”),
“Bounds”, BoxValue (Box (0.0, 300.0, 0.0, 300.0, 0.0, 200.0)));

mobility.Install (nodesCon);

MobilityHelper otherMobility;

Create a Sink Node and install ConstantPositionMobilityModel in it

//Set sink at top-center of water surface and randomly place other sensor nodes under water.
otherMobility.SetPositionAllocator(position);
otherMobility.SetMobilityModel(“ns3::ConstantPositionMobilityModel”);
otherMobility.Install(sinksCon);
otherMobility.Install(senderCon);

Configure Things for 3D Netsimulyzer Visualization

The following are the three important things that will be done by this section of code:

  • The 3D simulation output will be stored in the file “SimpleNS3MobileUWSNRandomWalk3D.json”.
  • The underwater sensors nodes will be represented by a 3D Sphere models.
  • The Sink Node will be represented by a 3d Boat object on the Water Surface
  • The 3D water body will be created using the previosuly configured information

Sorry!!!. Some sections are hidden; because, you are only having restricted access to this article.

While getting paid support/assistance for your research from Charles, you may get an access key/password to some articles. If you are having the access key/password to this particular article, then please enter it below to unlock the restricted section of this article.

If your research is related to this area, and you want to get paid support/assistance from Charles, then you may start a 'free' research discussion with Charles.

A view of the network from the bottom. (see the bottom surface of the boat which is on the surface of the water). The long white objects are simulated clouds on the sky.


Configure standard NetAnim file and end the simulation

For comparison purposes, we create a NetAnim simulation file, which will only be capable of showing 2D of this 3D Mobile UWSN scenario.

 AnimationInterface anim (“SimpleNS3UWSNRandomWalk3D.xml”);

Simulator::Stop (Seconds (simTimeSec));
Simulator::Run ();
Simulator::Destroy ();

return 0;

The 2D output of the Simulation using NetAnim

The following output shows the output of Mobile UWSN simulation on NetAnim. A 3D scene that is rendered on a 2D canvas will be similar to the following output.

 

The following video shows the 2D animation of the 3D Mobile UWSN scenario.

 

The 3D Visualization using NetSimulyzer Tool

The following output shows the NetSimulyzer GUI on initialization(before loading our UWNS simulation).

 

The following output shows the NetSimulyzer GUI after loading our Mobile UWSN simulation.

The  3D Mobile UWSN Simulation output  with NetSimulyzer

The following video shows the 3D output of the Mobile UWSN simulation on NetSimulyzer.

Note: The visualization of Packet Transmission and wave Propagation on Medium are not yet implemented in NetSimulyzer. So we can only see the movement of nodes. But we can add “log events” to understand the events of transmission and reception through some text messages that will be displayed in a separate text window of NetSimulyzer. 

Some Attractive UWSN simulation can be found at the following link:

References:

  1. https://en.wikipedia.org/wiki/Underwater_acoustic_communication
  2. https://www.nsnam.org/research/wns3/wns3-2021/tutorials/

For Assistance in Protocol Implementation, Simulations & Analysis of Industrial as well as Scholarly Research Works, you may Contact Us.

WhatsApp chatDiscuss Through WhatsApp

Call 91 9843779735

Send an e-Mail Message.




This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.

WhatsApp Discuss Through WhatsApp