How to Simulate TORA Protocol Projects Using NS2

To simulate Temporally Ordered Routing Algorithm (TORA) in NS2 can support you learn its performance that is especially appropriate for highly dynamic mobile ad hoc networks (MANETs). TORA is not involved by default in NS2; however NS2 supports its replication with extension lead or patches.For best simulation help stay in touch with us for best results.

Below are the steps to simulate TORA in NS2.

Steps to Simulate TORA in NS2

  1. Install NS2
  • Ensure NS2 is installed on the system.
  1. Enable TORA in NS2

TORA is not available by default in NS2; however certain versions of NS2 such as NS-2.35 support TORA. If it’s already permit in NS2, we can directly support TORA in simulation script. If not, we want to install or patch NS2 to contain the TORA implementation.

To validate if TORA is available in version of NS2, validate in the NS2 installation folder:

grep -r “TORA” ns-allinone-2.35/ns-2.35/

  1. Configure TCL Script for TORA

In TCL script, we will need to require TORA as the routing protocol.

Below is a step-by-step guide for configuring a simple TORA simulation.

3.1 Setup Nodes and Simulation Parameters

# Create a new simulator instance

set ns [new Simulator]

# Setup trace file for logging and NAM visualization file

set tracefile [open tora.tr w]

$ns trace-all $tracefile

set namfile [open tora.nam w]

$ns namtrace-all $namfile

# Create topology object

set topo [new Topography]

$topo load_flatgrid 500 500

3.2 Configure Wireless Channel and Protocols

Configure wireless channels, radio propagation models, and antennas.

# Wireless Channel Setup

set val(chan) Channel/WirelessChannel;# Channel Type

set val(prop) Propagation/TwoRayGround;# Propagation Model

set val(ant) Antenna/OmniAntenna;# Antenna Model

set val(ll) LL;# Link Layer

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

set val(ifq) Queue/DropTail/PriQueue;# Interface Queue

set val(netif) Phy/WirelessPhy;# Network Interface

set val(rp) TORA;# Routing Protocol (TORA)

set val(x) 500  ;# Topology X dimension

set val(y) 500;# Topology Y dimension

3.3 Configure Node Creation

Generate nodes and configure them to utilize TORA as the routing protocol:

for {set i 0} {$i < 10} {incr i} {

set node_($i) [$ns node]

$node_($i) random-motion 0 ;# Disable random motion

}

3.4 Node Mobility (Optional)

If we require the nodes to be mobile, we can set up their movement:

$ns at 10.0 “$node_(0) setdest 100 200 5.0”  ;# Move node 0 to location (100,200) at 5 m/s

3.5 Configure Traffic (TCP/CBR over UDP)

Describe traffic patterns among nodes, for example, TCP or UDP traffic using CBR (constant bit rate):

  • UDP/CBR Traffic:

set udp0 [new Agent/UDP]

set cbr0 [new Application/Traffic/CBR]

$cbr0 attach-agent $udp0

$udp0 set packetSize_ 512

$udp0 set interval_ 0.05

# Attach agents to nodes

$ns attach-agent $node_(0) $udp0

$ns attach-agent $node_(1) [new Agent/Null]

# Connect agents

$ns connect $udp0 [new Agent/Null]

  • TCP/FTP Traffic:

set tcp0 [new Agent/TCP]

set sink [new Agent/TCPSink]

$ns attach-agent $node_(0) $tcp0

$ns attach-agent $node_(1) $sink

3.6 Start the Simulation

Describe when to initiate traffic and terminate the simulation:

$ns at 1.0 “$cbr0 start”

$ns at 100.0 “$ns halt”

Run the simulation:

$ns run

  1. Run the Simulation

Save the TCL script as tora_simulation.tcl. Then process it from the command line:

ns tora_simulation.tcl

  1. Analyse the Output

NS2 generates two main files:

  • Trace file (.tr): Utilized for performance evaluation of parameters like packet delivery ratio, throughput, delay, etc.
  • NAM file (.nam): Utilized for envision the simulation using NS2’s NAM tool.
  1. Performance Metrics

To measure the performance of the TORA protocol, we can estimate parameters:

  • Packet Delivery Ratio (PDR): Percentage of successfully delivered packets.
  • End-to-End Delay: Average latency among packet transmission and reception.
  • Routing Overhead: The amount of control packets (like route requests) created by TORA.

Utilize AWK scripts or Python to run the trace file. Here’s an instance AWK script for estimating packet delivery ratio:

BEGIN { sent = 0; received = 0; }

{

if ($1 == “s” && $4 == “AGT”) { sent++ }

if ($1 == “r” && $4 == “AGT”) { received++ }

}

END { print “PDR = “, received/sent*100 “%” }

Example Project Ideas Using TORA in NS2

  1. Performance Comparison of TORA and AODV/DSR: implement TORA and relate it with AODV and DSR for packet delivery ratio, end-to-end delay, and overhead.
  2. Energy-Efficient Routing Using TORA: Adapt the TORA protocol to deliberate energy efficiency in wireless sensor networks and replicate it in NS2.
  3. Impact of Mobility on TORA’s Performance: measure the effects of node speed and mobility on the performance of TORA in a mobile ad hoc network.
  4. TORA in Vehicular Ad-Hoc Networks (VANET): replicate TORA in a VANET environment and evaluate its suitability for dynamic vehicular networks.
  5. Performance Evaluation of TORA under High Node Density: validate how TORA manage high node density in a MANET environment.

In this page, we clearly showed the simulation process on how the Temporally Ordered Routing Algorithm perform in the ns2 tool and also we offered the complete elaborated explanation to understand the concept of the simulation. We plan to deliver the more information regarding the Temporally Ordered Routing Algorithm in further manual.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2