- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- How to measure the path optimality for ad-hoc network ?
Hi
I am a phd student
I perform code for ad-hoc network using tcl (NS2), with number of nodes=50.
I want to evaluate the performance of DSDV, AODV, DSR routing protocols.
I made different mobility file by using different pause time , and I used different traffic files.
I chosed end to end delay and packet delivery ratio as a metrics.
I want to measure the path optimality which is the difference between the number of hops a packet took to reach its destination and the length of the shortest path that physically existed through the network when the packet was originated.
I don’t know how to measured the path optimality, I read that in some papers that it can be measured by using java parser code i really have no idea a bout how to compile java in NS2
I need your help to guide me to know how I can measure the path optimalty
I really appreciate your help.
Ad-hoc network code
[#compare between the routing protocols DSR & AODV
#1:DSR 2:AODV
#Speed = 1m/s
# ====================================================================
# Define options
# =====================================================================
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 opt(ifq) CMUPriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(x) 1000 ;# X dimension of the topography
set val(y) 1000 ;# Y dimension of the topography
set val(ifqlen) 50 ;# max packet in ifq
set val(seed) 0.0
set val(tr) dsdv-50-0-10.tr ;# trace file
set val(adhocRouting) DSR
#set opt(rpr) 1 ;#1 for DSR and anything else for AODV
set val(nn) 50 ;# how many nodes are simulated
set val(scen) “home/mona/Desktop/report/my-simulation/movement1/scen-50-0-1”
set opt(tfc) “home/mona/Desktop/report/my-simulation/traffic/cbr-50-10”
set val(stop) 300.0 ;# simulation time
# ======================================================================
# Main Program
# ======================================================================
if { $argc != 8 } {
puts “Wrong no. of cmdline args.”
puts “Usage: ns compare.tcl -scen
exit 0
}
# proc getopt {argc argv} {
for {set i 0} {$i < $argc} {incr i} {
set arg [lindex $argv $i]
if {[string range $arg 0 0] != “-“} continue
set name [string range $arg 1 end]
# puts $name
set val($name) [lindex $argv [expr $i+1]]
}
set val(scen) [lindex $argv 1]
set val(tfc) [lindex $argv 3]
if {$val(rpr) == 1} {
set val(adhocRouting) DSR
set opt(ifq) CMUPriQueue
#set val(ifq) Queue/DropTail/PriQueue
} else {
set val(adhocRouting) AODV
set val(ifq) Queue/DropTail/PriQueue
}
# set val(mov) $opt(scen)
# set val(traf) $opt(tfc)
# set opt(trace) $opt(tr)
puts $val(scen)
puts $val(tfc)
puts $val(tr)
# }
###########################
#solution to the segmentation fault (core dump”
if { $val(rpr) == 1} {
set val(ifq) CMUPriQueue
} else {
set val(ifq) Queue/DropTail/PriQueue
}
##########################
# getopt $argc $argv
puts $val(adhocRouting)
# puts $val(mov)
# puts $val(traf)
# puts $opt(trace)
set ns_ [new Simulator]
set tracefd [open $val(tr) w]
$ns_ trace-all $tracefd
#$ns_ use-newtrace
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
set chan_1_ [new $val(chan)]
$ns_ node-config -adhocRouting $val(adhocRouting)
-llType $val(ll)
-macType $val(mac)
-ifqType $val(ifq)
-ifqLen $val(ifqlen)
-antType $val(ant)
-propType $val(prop)
-phyType $val(netif)
-channel $chan_1_
-topoInstance $topo
-agentTrace ON
-routerTrace ON
-macTrace OFF
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;
# disable random motion
}
puts “Loading connection pattern…”
source $val(scen)
puts “Loading traffic file…”
source $val(tfc)
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ initial_node_pos $node_($i) 20
}
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).000000001 “$node_($i) reset”;
}
$ns_ at $val(stop).000000001 “puts “NS EXITING…”; $ns_ halt”
puts “Start Simulation…”
$ns_ run
][/code]
You must be logged in to reply to this topic.