How to Simulate Zone Protocol Projects Using NS2

To simulate Zone Routing Protocol (ZRP) projects using NS2 that containing set of steps, which needs executing a hybrid routing protocol that integrates proactive and reactive routing techniques. ZRP splits the network into zones in which intra-zone routing is managed proactively and inter-zone routing is done reactively. The simulation platform NS2 does not have a built-in ZRP implementation thus we require to either execute ZRP from scratch or discover extensions to mimic it.

phdprime.com will be the number one company who provide you tailored simulation guidance in  Zone Routing Protocol (ZRP) projects using NS2 tool , get best project topics from us.

The following is a step-by-step method to simulate ZRP (Zone Routing Protocol) in NS2 that concentrating on defining zones, implementing intra-zone proactive routing, and inter-zone reactive routing.

Steps to Simulate ZRP in NS2

  1. Install NS2

Make certain we have NS2 installed on the machine. We can install it using the below command (for Linux systems):

sudo apt-get install ns2

For Windows, we can utilize Cygwin or download a precompiled version of NS2.

  1. Understanding ZRP

ZRP (Zone Routing Protocol) is a hybrid protocol with the following aspects:

  • Intra-zone Routing: Within a zone, nodes utilize proactive routing (e.g., DSDV).
  • Inter-zone Routing: For communication among zones, nodes use reactive routing (e.g., AODV).
  • Zone Radius: Each node has a zone radius, which describes the boundary in which proactive routing is utilized.
  1. Create the TCL Script for ZRP Simulation

In NS2, we can be replicated ZRP by splitting the network into zones and executing proactive routing within zones and reactive routing among the zones. Following is an instance of a simplified ZRP implementation in NS2.

Example TCL Script for ZRP Simulation

# Define the simulator object

set ns [new Simulator]

# Open trace and NAM file for visualization

set tracefile [open zrp.tr w]

$ns trace-all $tracefile

set namfile [open zrp.nam w]

$ns namtrace-all $namfile

# Define simulation parameters

set val(nn) 10                ;# Number of nodes (sensors)

set val(x) 500                ;# X dimension of topology

set val(y) 500                ;# Y dimension of topology

set val(stop) 50.0            ;# Simulation stop time

set zone_radius 2             ;# Define zone radius (distance within a zone)

# Create topology object

set topo [new Topography]

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

# Define the wireless channel and network interface parameters

set val(chan)   Channel/WirelessChannel

set val(prop)   Propagation/TwoRayGround

set val(netif)  Phy/WirelessPhy

set val(mac)    Mac/802_11

set val(ifq)    Queue/DropTail/PriQueue

set val(ll)     LL

set val(ant)    Antenna/OmniAntenna

set val(ifqlen) 50             ;# Max number of packets in the interface queue

set val(seed)   0.0            ;# Random seed

# Define routing protocols (Proactive and Reactive)

set proactive_routing DSDV     ;# Use DSDV for intra-zone routing (proactive)

set reactive_routing AODV      ;# Use AODV for inter-zone routing (reactive)

# Create nodes for the network

for {set i 0} {$i < $val(nn)} {incr i} {

set node_($i) [$ns node]

$node_($i) set X_ [expr rand()*$val(x)]

$node_($i) set Y_ [expr rand()*$val(y)]

$node_($i) set Z_ 0.0

}

# Proactive routing within a zone

proc proactive_zone_routing {node_id zone_radius} {

global ns node_

puts “Proactive routing for node $node_id within zone radius $zone_radius”

# Intra-zone routing using DSDV (within the zone radius)

$ns rtproto DSDV

for {set i 0} {$i < [llength $node_]} {incr i} {

if {abs([set $node_($node_id) get X_] – [set $node_($i) get X_]) <= $zone_radius} {

# Connect nodes within the zone proactively

$ns duplex-link $node_($node_id) $node_($i) 10Mb 10ms DropTail

}

}

}

# Reactive routing between zones

proc reactive_zone_routing {source dest} {

global ns node_

puts “Reactive routing between nodes $source and $dest”

# Inter-zone routing using AODV

$ns rtproto AODV

set udp [new Agent/UDP]

$ns attach-agent $node_($source) $udp

set null [new Agent/Null]

$ns attach-agent $node_($dest) $null

$ns connect $udp $null

# Setup CBR traffic

set cbr [new Application/Traffic/CBR]

$cbr set packetSize_ 512

$cbr set interval_ 0.05

$cbr attach-agent $udp

return $cbr

}

# Form zones and implement intra-zone and inter-zone routing

for {set i 0} {$i < $val(nn)} {incr i} {

# Intra-zone proactive routing

proactive_zone_routing $i $zone_radius

}

# Inter-zone reactive communication

set app [reactive_zone_routing 0 5]  ;# Communication between node 0 and node 5 (across zones)

$ns at 1.0 “$app start”

$ns at $val(stop) “$app stop”

# End the simulation after stop time

$ns at $val(stop) “finish”

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam zrp.nam &

exit 0

}

# Run the simulation

$ns run

  1. Explanation of the Script
  • Proactive Zone Routing: The function proactive_zone_routing executes proactive routing in a zone using DSDV. Nodes within the specified zone radius are associated using duplex links, replicating intra-zone proactive routing.
  • Reactive Inter-zone Routing: The function reactive_zone_routing executes reactive routing using AODV among the nodes in distinct zones. UDP traffic is transmitted among the nodes, which are in distinct zones using AODV.
  • Zone Radius: The zone radius describes the distance in which nodes are deliberated part of the similar zone. Proactive routing is applied to nodes in this radius, even though reactive routing is applied to nodes outside this zone.
  • Traffic: Constant Bit Rate (CBR) traffic is made among an origin and destination node. The source and destination are selected to illustrate both intra-zone (proactive) and inter-zone (reactive) routing.
  1. Running the Simulation

We can save the TCL script as zrp.tcl and then we run it using NS2:

ns zrp.tcl

  1. Visualizing the Simulation

After running the simulation, we can envision the network topology and communication using NAM (Network Animator):

nam zrp.nam

It will open the NAM window, in which we can observe the nodes, the zones, and the packet flows among them. The nodes inside the zone utilize proactive routing (DSDV), and nodes outside the zone use reactive routing (AODV).

  1. Analyzing the Trace File

The trace file (zrp.tr) encompasses detailed records of packet transmissions, drops, routing updates, and other network events. We can examine this file to calculate performance parameters like:

  • Throughput: The total data effectively delivered to the destination.
  • Packet Delivery Ratio: The ratio of packets efficiently delivered to the total packets transmitted.
  • Routing Overhead: The amount of routing control packets are made by the proactive and reactive routing protocols.
  • End-to-End Delay: The average time it takes for a packet to travel from the origin to the destination.

We can be used AWK, Python, or other tools to process the trace file and estimate these parameters.

  1. Modifying and Extending the Simulation

We can improve the simple ZRP simulation by:

  • Increasing Node Density: Replicate larger networks with more nodes to investigate the scalability of ZRP.
  • Adjusting Zone Radius: Test with distinct zone radii to monitor the impact on performance (e.g., routing overhead, latency).
  • Energy Consumption: Integrate energy models for the nodes to estimate the energy efficiency of ZRP.
  • Traffic Patterns: Insert TCP or FTP traffic to experiment the protocol under distinct kinds of network traffic.
  • Mobility Models: Execute node mobility to calculate ZRP in mobile ad hoc networks (MANETs).

These projects focused on describing the zones, executing intra-zone proactive routing, and inter-zone reactive routing for Zone Protocol, which was replicated using the above techniques within NS2 tool. If asked, we can ready to deliver addition insights on this projects.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2