To implement Submarine Data Transmission in NS2 has needs to execute by mimic an Underwater Wireless Sensor Network (UWSN) or an Acoustic Network. In underwater communication, acoustic waves are usually used rather than radio waves owing to the high reduction and absorption of electromagnetic waves in water. Furthermore, underwater networks face difficulties such as limited bandwidth, high propagation delay, and node mobility due to water currents.

Get best  thesis ideas and topics, along with network comparison results. If you’re looking to implement submarine data transmission using the NS2 tool, feel free to reach out to the ns2project.com team for personalized support.

The below is brief procedure to implement Submarine Data Transmission in ns2:

Key Challenges in Submarine Communication:

  1. Low Bandwidth: The underwater acoustic channel has a very low bandwidth, usually in the range of a few kHz.
  2. High Propagation Delay: Acoustic waves travel at about 1500 meters per second in water that establish high latency.
  3. Energy Constraints: Nodes in UWSN usually have limited energy meanwhile recharging underwater is challenging.
  4. Mobility: Submarine nodes may drift because of ocean currents.

Steps to Implement Submarine Data Transmission in NS2

To mimic submarine data transmission in NS2, we will configure a network of underwater nodes using an acoustic channel. The basic steps contain to describing an acoustic propagation model, configuring underwater nodes, and setup a low-bandwidth, high-latency network.

  1. Set up the NS2 Environment

Make sure that NS2 is installed and properly configured. NS2 doesn’t natively support underwater acoustic models, however we can simulate it using custom settings, like reduced bandwidth, high delays, and using suitable propagation models.

  1. Create a TCL Script for Submarine Data Transmission

Below is a sample TCL script that mimics an underwater communication network with submarine nodes using a high-latency acoustic channel.

Example TCL Script for Submarine Communication:

# Create a new NS2 simulator

set ns [new Simulator]

# Open trace and NAM output files

set tracefile [open submarine_data.tr w]

$ns trace-all $tracefile

set namfile [open submarine_data.nam w]

$ns namtrace-all $namfile

# Define parameters for underwater network

set val(chan)   Channel/WirelessChannel  ;# Acoustic channel (wireless for now)

set val(prop)   Propagation/TwoRayGround ;# Approximate underwater propagation

set val(ant)    Antenna/OmniAntenna      ;# Omni-directional antenna

set val(netif)  Phy/WirelessPhy          ;# Physical layer for underwater transmission

set val(mac)    Mac/802_11               ;# Underwater MAC (simplified)

set val(ifq)    Queue/DropTail/PriQueue

set val(ifqlen) 50                       ;# Queue length

set val(ll)     LL

set val(rp)     DSR                      ;# Using DSR routing protocol (can also use AODV)

set val(x)      500                      ;# X dimension of the simulation area

set val(y)      500                      ;# Y dimension of the simulation area

# Topology definition

set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)

# Underwater acoustic channel parameters

set val(txPower) 0.5          ;# Transmission power (W)

set val(rxPower) 0.3          ;# Reception power (W)

set val(idlePower) 0.01       ;# Idle power (W)

set val(initialEnergy) 100.0  ;# Initial energy at each node

# Set up node configuration for underwater nodes

$ns node-config -adhocRouting $val(rp) \

-llType $val(ll) \

-macType $val(mac) \

-ifqType $val(ifq) \

-ifqLen $val(ifqlen) \

-antType $val(ant) \

-propType $val(prop) \

-phyType $val(netif) \

-channelType $val(chan) \

-topoInstance $topo \

-energyModel EnergyModel \

-initialEnergy $val(initialEnergy) \

-txPower $val(txPower) \

-rxPower $val(rxPower) \

-idlePower $val(idlePower) \

-agentTrace ON \

-routerTrace ON \

-macTrace ON

# Create submarine nodes (underwater)

set sub0 [$ns node]

set sub1 [$ns node]

set sub2 [$ns node]

set sub3 [$ns node]

# Set initial positions of the submarine nodes (X, Y, Z)

$sub0 set X_ 100

$sub0 set Y_ 100

$sub0 set Z_ 30  ;# Depth of 30 meters

$sub1 set X_ 200

$sub1 set Y_ 150

$sub1 set Z_ 40  ;# Depth of 40 meters

$sub2 set X_ 300

$sub2 set Y_ 250

$sub2 set Z_ 35  ;# Depth of 35 meters

$sub3 set X_ 400

$sub3 set Y_ 300

$sub3 set Z_ 50  ;# Depth of 50 meters

# Create a UDP agent for communication from sub0 to sub3

set udp0 [new Agent/UDP]

$ns attach-agent $sub0 $udp0

set null0 [new Agent/Null]

$ns attach-agent $sub3 $null0

$ns connect $udp0 $null0

# Create Constant Bit Rate (CBR) traffic for data transmission

set cbr0 [new Application/Traffic/CBR]

$cbr0 set packetSize_ 1000        ;# Packet size 1000 bytes

$cbr0 set rate_ 10Kb              ;# Low bandwidth for acoustic transmission

$cbr0 attach-agent $udp0

# Schedule the start and stop of the data transmission

$ns at 1.0 “$cbr0 start”

$ns at 9.0 “$cbr0 stop”

# End the simulation

$ns at 10.0 “finish”

# Finish procedure to close the simulation

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam submarine_data.nam &

exit 0

}

# Run the simulation

$ns run

  1. Explanation of Key Components
  • Submarine Nodes: The script describes four submarine nodes (sub0, sub1, sub2, and sub3) with different depths (Z-coordinate).
  • Acoustic Channel: We use a wireless channel to estimate an underwater acoustic channel. We can further customize the propagation model or use particular underwater extensions if available.
  • Traffic Generation: UDP/CBR traffic mimics data transmission from one submarine to another. We use low bandwidth (10 Kbps) to reflect the constraints of underwater acoustic channels.
  • Energy Model: Nodes have an energy model to mimic energy consumption during transmission and reception.
  • Mobility: Submarine nodes are stationary in this example. We can establish mobility to mimic underwater currents or drifting submarines.
  1. Run the Simulation

Save the script as submarine_data.tcl and executed it in NS2:

ns submarine_data.tcl

After the simulation completes, we can envision the communication among submarine nodes using NAM:

nam submarine_data.nam

  1. Analyse the Simulation

We can evaluate the trace file (submarine_data.tr) to observe the performance of the submarine communication network. Metrics to observe include:

  • Throughput: Assess the data successfully transmitted between nodes.
  • Delay: Acoustic waves travel slower than radio waves, so we will monitor higher delays.
  • Energy Consumption: Nodes have limited energy, and we can validate how much energy is utilized during the simulation.

Example: Calculate Throughput

To estimate throughput, we can use an AWK script to process the trace file and extract the number of bytes transmitted:

awk ‘/^r/ && /udp/ {sum+=$5} END {print “Throughput: “, sum/10, “bytes/sec”}’ submarine_data.tr

  1. Extend the Simulation

Here are some concepts to expand the simple submarine communication simulation:

  1. a) Mobility

To mimic the mobility of submarine nodes by adding setdest commands to move the nodes during the simulation. For example:

$ns at 2.0 “$sub0 setdest 400 500 10”  ;# Move sub0 to new position at 10 m/s

  1. b) Advanced Acoustic Propagation Model

Modify the propagation model to more accurately reflect underwater acoustic wave features such as multi-path fading, attenuation, and ambient noise.

  1. c) Error Model

Add error models to mimic packet loss because of underwater noise or interference. For example:

set loss_model [new ErrorModel]

$loss_model set rate_ 0.05   ;# 5% packet loss rate

$ns lossmodel $loss_model $sub0 $sub1

  1. d) Energy Harvesting

In underwater networks, energy replenishment through solar power or thermal gradients can be simulated. we can increase the energy of nodes during the simulation:

$ns at 5.0 “$sub0 energyModel energy_ [expr [$sub0 energyModel energy_] + 10]”

  1. e) QoS and Prioritization

To mimic Quality of Service (QoS) for priority data streams in underwater communication, like emergency messages or video streams.

As the above following instruction we shown on how to implement and extend the simulation for Submarine Data Transmission in ns2 tool and also we provide more significant information regarding the Submarine Data Transmission.