I have created a wireless network of 30 nodes and am using AODV as the
routing protocol. after running the simulation I find that the majority of
packets are dropped if the destination is outside of the sender's broadcast
radius. Effectively the routing protocol does not work because intermediate
nodes do not forward packets. Attached is my simulation script.
How can I ensure that the intermediate nodes forward packets using the
routing protocol?
All help is appreciated.
#=========================================================
#DEFINE OPTIONS
#=========================================================
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;#
radio-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 model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 30 ;# number of wireless nodes
set val(x) 1000
set val(y) 700
set val(rp) AODV ;# routing protocol
set val(scen) "scen-1000x700-30-901-1-3" ;# scenario file
set val(cp) "cbr-30-29-8-64" ;# connection pattern
file
set val(sim_duration) 900 ;# duration of the
simulation run
set val(addr_type) flat ;# addressing type
LL set mindelay_ 50us ;
LL set delay_ 25us ;
LL set bandwidth_ 0 ;# not used
Agent/Null set sport_ 0 ;
Agent/Null set dport_ 0 ;
Agent/CBR set sport_ 0 ;
Agent/CBR set dport_ 0 ;
Agent/UDP set sport_ 0 ;
Agent/UDP set dport_ 0 ;
Agent/UDP set packetSize 64 ;
Queue/DropTail/PriQueue set Prefer_Routing_Protocols 1 ;
#=========================================================
#ADDITIONAL OPTIONS based upon Linksys WRT54G specs
#=========================================================
# unity gain onmidirectional antennas, centered in the node and 1.5m above
it
Antenna/OmniAntenna set X_ 0 ;
Antenna/OmniAntenna set Y_ 0 ;
Antenna/OmniAntenna set Z_ 1.5 ;
Antenna/OmniAntenna set Gt_ 4.0 ;# transmit antenna
gain (to be finalised)
Antenna/OmniAntenna set Gr_ 4.0 ;# receive antenna
gain (to be finalised)
###############################################################################
#DSSS (IEEE 802.11b)
Mac/802_11 set SlotTime_ 0.000020 ;#20us
Mac/802_11 set SIFS_ 0.000010 ;#10us
Mac/802_11 set PreambleLength_ 72 ;#72 bits
Mac/802_11 set PLCPHeaderLength_ 48 ;#48 bits
Mac/802_11 set PLCPDataRate_ 1.0e6
Mac/802_11 set dataRate_ 11Mb ;# rate for
data frames
Mac/802_11 set basicRate_ 2Mb ;# rate for
control frames
Mac/802_11 set aarf_ 1 ;# adaptive
auto rate fallback
###############################################################################
Phy/WirelessPhy set L_ 1.0 ;# system
loss factor
Phy/WirelessPhy set freq_ 2.462e9 ;#
channel 11. 2.462GHz
Phy/WirelessPhy set bandwidth_ 11Mb ;# 11 Mbps channel
bandwidth
Phy/WirelessPhy set Pt_ 0.063095734 ;#
transmission power in watts
Phy/WirelessPhy set CPThresh_ 10.0 ;# collision
threshold (to be finalised)
Phy/WirelessPhy set CSThresh_ 3.70789e-09 ;# carrier
sense power
Phy/WirelessPhy set RXThresh_ 3.70789e-09 ;# receive
power threshold based on above frequency, transmit power and a distance of
160m; calculated under TwoRayGround model by tools from ns2
###############################################################################
ErrorModel80211 noise1_ -104
ErrorModel80211 noise2_ -101
ErrorModel80211 noise55_ -97
ErrorModel80211 noise11_ -92
ErrorModel80211 shortpreamble_ 1
ErrorModel80211 LoadBerSnrFile_ "ber_snr_choi.txt"
#=========================================================
#MAIN PROGRAM
#=========================================================
#
#Initialise golbal variables
#
set ns_ [new Simulator]
set tracefd [open sim_trace.tr w]
set namtrace [open sim_trace.nam w]
#$ns_ use-newtrace
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
# create a loss_module and set its packet error rate to 1 percent
#set loss_module [new ErrorModel]
#$loss_module set rate_ 0.01
#optional: set the unit and random variable
#$loss_module unit pkt ; #default value
#$loss_module ranvar [new RandomVariable/Uniform]
#set target for dropped packets
#$loss_module drop-target [new Agent/Null]
#setup topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
#create god
set god_ [create-god $val(nn)]
# create channel #1
set chan_1_ [new $val(chan)]
#configure node
$ns_ node-config -addressingType $val(addr_type) \
-adhocRouting $val(rp) \
-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 ON \
-movementTrace OFF
#=============================================================
#$mobilenode addif
#$mobilenode radius
#=============================================================
#Node set multiPath_ 1
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) shape "box"
$node_($i) random-motion 0 ;# disable random motion
#set aodv($i) [new Agent/rtProto/AODV]
#$aodv($i) node $node_($i)
$god_ new_node $node_($i)
}
#
#Provide X,Y,Z coordinates for wireless nodes by loading the scenario file
#
puts "Loading the scenario file"
source $val(scen)
#Define node initial position in nam
for {set i 0} {$i < $val(nn)} {incr i} {
# 20 defines the node size in nam, must adjust it according to your
scenario
# The function must be called after mobility model is defined
$ns_ initial_node_pos $node_($i) 20
}
#
#Setup traffic flow between nodes
#
puts "Loading connection pattern"
source $val(cp)
#
#Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(sim_duration).0 "$node_($i) reset";
}
#$ns_ at $val(sim_duration) "stop"
$ns_ at $val(sim_duration).01 "puts \"NS EXITING...\" ; $ns_ halt"
#for {set i 0} {$i < $val(nn)} {incr i} {
# for {set j 0} {$i < $val(nn)} {incr j} {
# "puts God::instance()->IsNeighbor(i , j);"
# }
#}
#proc stop{} {
# global ns_ tracefd
# $ns_ flush-trace
# close $tracefd
#}
puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(rp)"
puts $tracefd "M 0.0 sc $val(scen) cp $val(cp)"
puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"
puts "Starting Simulation..."
$ns_ run
--
Pragasen