[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] bug in wireless implementation?
Hi,
i have noticed the following bug while running a "very simple
simulation" using mac-802.11 implementation of ns.
try running any simulation under a heavy CBR load case (eg just two nodes
in a single broadcast environment, CBR traffic, pkt size 512, interval say
.0025, )....
one would not expect the sequence numbers of the packets received (
note..sequence numbers not uid...) to be out of order (at the agt
level trace) since mac-802.11 takes packets from the ifq in FIFO order
right ? wrong!!!
i have attached a copy of my wireless1.tcl file below ....let me know
whether i am doing something wrong or is there a serious bug in mac-802.11
implementation....
when you run the simulation as defined in the attached file, the sequence
number of the first packet received by node 1 is 0 and the SECOND PACKET
SEQUENCE NUMBER IS 6----sequence number 1 comes much later.
-Vikram
####################### wireless1.tcl ###################
# A simple example for wireless simulation
# ======================================================================
# 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
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(x) 670 ;# X dimension of the topography
set val(y) 670 ;# Y dimension of the topography
set val(ifqlen) 50 ;# max packet in ifq
set val(seed) 0.0
set val(adhocRouting) DSR
set val(nn) 2 ;# how many nodes are simulated
set val(stop) 200.0 ;# simulation time
# =====================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
# create simulator instance
set ns_ [new Simulator]
# setup topography object
set topo [new Topography]
# create trace object for ns and nam
set tracefd [open wireless1-out.tr w]
$ns_ trace-all $tracefd
# define topology
$topo load_flatgrid $val(x) $val(y)
#
# Create God
#
set god_ [create-god $val(nn)]
#
# define how node should be created
#
# Create channel #1
set chan_1_ [new $val(chan)]
#global node setting
$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) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF \
-channel $chan_1_
#
# Create the specified number of nodes [$val(nn)] and "attach" them
# to the channel.
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
#setting initial positions of the nodes
#nodes are stationary for throughout the simulation
$node_(1) set Z_ 0.000000000000
$node_(1) set Y_ 0.0
$node_(1) set X_ 200.0
$node_(0) set Z_ 0.000000000000
$node_(0) set Y_ 0.00
$node_(0) set X_ 0.00
#creating a CBR flow from node 0 to node 1
set udp_(0) [new Agent/UDP]
$ns_ attach-agent $node_(0) $udp_(0)
set null_(0) [new Agent/Null]
$ns_ attach-agent $node_(1) $null_(0)
set cbr_(0) [new Application/Traffic/CBR]
$cbr_(0) set packetSize_ 512
$cbr_(0) set interval_ .0025
$cbr_(0) set random_ 2
$cbr_(0) set maxpkts_ 10000
$cbr_(0) attach-agent $udp_(0)
$ns_ connect $udp_(0) $null_(0)
$ns_ at 5.00 "$cbr_(0) start"
# Tell nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).0 "$node_($i) reset";
}
$ns_ at $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
puts "Starting Simulation..."
$ns_ run