To simulate DYMO (Dynamic MANET On-demand) routing protocol in NS2 (Network Simulator 2) that has requires to contain stepwise approach, which is an on-demand routing protocol created for mobile ad-hoc networks (MANETs). DYMO discovers routes on demand that is it introduces a route discovery only when a node needs to communicate with another node for which it does not have a route. DYMO is an enhancement over AODV, however it is not involved within NS2 by default. We want to implement a patch or execute it manually.
Below is a sequential method to simulate DYMO protocol projects in NS2.
Steps to Simulate DYMO Protocol Projects in NS2
- Install NS2
Make sure that NS2 is installed on the machine. We can download it from the NS2 official website. If we have a DYMO patch then we can implement it as follows:
Applying DYMO Patch (If Available)
- Download the DYMO patch for NS2.
- Implement the patch to the NS2 installation:
cd ns-allinone-2.35/ns-2.35/
patch -p1 < dymo-patch.diff
- Rebuild NS2:
./configure
make clean
make
- Set Up DYMO Network Topology
After installing the patch or manually executing DYMO then we need to configure a simple mobile ad-hoc network (MANET) in which nodes will find and establish routes utilizing DYMO on demand.
Example TCL Script for DYMO Network Topology:
# Create a new simulator instance
set ns [new Simulator]
# Define trace and nam files for logging and visualization
set tracefile [open dymo_simulation.tr w]
$ns trace-all $tracefile
set namfile [open dymo_simulation.nam w]
$ns namtrace-all $namfile
# Set up network parameters (wireless channel, propagation, MAC, etc.)
set val(chan) Channel/WirelessChannel ;# Channel type
set val(prop) Propagation/TwoRayGround ;# Propagation model
set val(netif) Phy/WirelessPhy ;# Network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type
set val(ll) LL ;# Link layer type
set val(ant) Antenna/OmniAntenna ;# Antenna type
set val(x) 1000 ;# X dimension
set val(y) 1000 ;# Y dimension
# Configure nodes to use DYMO protocol
$ns node-config -adhocRouting DYMO \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan)
# Create nodes for the MANET
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
# Set initial positions for nodes (optional if mobility is not needed)
$n0 set X_ 50; $n0 set Y_ 50; $n0 set Z_ 0.0
$n1 set X_ 200; $n1 set Y_ 100; $n1 set Z_ 0.0
$n2 set X_ 300; $n2 set Y_ 200; $n2 set Z_ 0.0
$n3 set X_ 400; $n3 set Y_ 300; $n3 set Z_ 0.0
$n4 set X_ 500; $n4 set Y_ 400; $n4 set Z_ 0.0
# Enable mobility for the nodes (optional)
$ns at 5.0 “$n0 setdest 150 250 10.0” ;# Move node n0 to a new destination at 10 m/s
$ns at 5.0 “$n1 setdest 250 300 12.0” ;# Move node n1
$ns at 5.0 “$n2 setdest 400 200 8.0” ;# Move node n2
$ns at 5.0 “$n3 setdest 600 350 15.0” ;# Move node n3
$ns at 5.0 “$n4 setdest 800 400 7.0” ;# Move node n4
- Set Up Traffic for DYMO Network
DYMO protocol functions on demand that means routes are only established once a communication session begins. We can be replicated TCP or UDP traffic among the nodes to validate the route discovery and packet forwarding mechanisms of DYMO.
Example for TCP Traffic:
# Set up TCP connection between node 0 and node 4
set tcp0 [new Agent/TCP]
set sink0 [new Agent/TCPSink]
$ns attach-agent $n0 $tcp0
$ns attach-agent $n4 $sink0
$ns connect $tcp0 $sink0
# Create FTP traffic over TCP
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$ns at 2.0 “$ftp0 start”
$ns at 10.0 “$ftp0 stop”
Example for UDP Traffic (CBR):
# Set up UDP communication between node 1 and node 3
set udp0 [new Agent/UDP]
set null0 [new Agent/Null]
$ns attach-agent $n1 $udp0
$ns attach-agent $n3 $null0
# Generate CBR traffic over UDP
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 512
$cbr0 set rate_ 100kb
$cbr0 attach-agent $udp0
$ns at 3.0 “$cbr0 start”
$ns at 12.0 “$cbr0 stop”
- Run the Simulation
When TCL script is equipped (e.g., dymo_simulation.tcl) then we execute the simulation in NS2:
ns dymo_simulation.tcl
It will make a trace file (.tr) and a NAM file (.nam) for investigation and visualization using Network Animator (NAM).
- Analyse the Simulation Results
We need to examine DYMO performance utilizing parameters like:
- Packet Delivery Ratio (PDR): The percentage of packets efficiently delivered.
- End-to-End Delay: The average time taken by data packets to travel from origin to destination.
- Routing Overhead: The amount of control packets are sent for route discovery and maintenance.
Example AWK Script to Calculate Packet Delivery Ratio:
BEGIN { sent = 0; received = 0; }
{
if ($1 == “s” && $4 == “AGT”) { sent++; }
if ($1 == “r” && $4 == “AGT”) { received++; }
}
END { print “Packet Delivery Ratio = “, received/sent*100, “%”; }
- Example Project Ideas for DYMO Protocol Simulation
- Performance Comparison Between DYMO and AODV:
- Replicate both DYMO and AODV in the similar network and relate their performance such as packet delivery ratio, routing overhead, and delay.
- Impact of Node Mobility on DYMO Performance:
- Mimic a mobile network including high node mobility then examine how DYMO manage frequent route breaks and the effect on end-to-end delay.
- Energy-Efficient DYMO:
- Alter DYMO to contain energy-aware routing metrics and estimate its performance such as energy consumption and network lifetime.
- Scalability of DYMO in Large Networks:
- Replicate a large-scale MANET utilizing DYMO and learn its scalability like control overhead and route discovery time as the network size maximizes.
We exhibited a series of steps, supported by sample snippets for DYMO protocol projects, which were simulated and analysed through NS2 simulator. Further details and in-depth approach will be included in another manual.
Find help on mobile ad-hoc networks (MANETs) at phdprime.com. We also offer detailed instructions to help you recreate DYMO Protocol Projects with NS2 based on your needs.