[ns] No Packet is exchanging usinng routing protocol Protoname.

2011-04-11 Thread moy . tan


Hello,

I have been able to implement the Manet routing protocol (protoname) 
reading implementing a new manet routing protocol in NS2 .


 
http://issuu.com/adioshun/docs/implementing_a_new_manet_unicast_routing_protocol_


 I have got it to compile successfully but when i run a test simulation 
using it , i do not get any packets to be successfully transmitted. I 
printed out the routing table onto the trace file and noticed that the 
routing table is empty throughout the simulation. The same simulation 
file works fine when i use AODV or DSR for that matter.


I am not sure why its not sending any packets.
i did not get any errors when compiling protoname.
I've sent an attachment of that tcl file with this mail.

Please help me.I m a new user.please help.

[ns] Need TCL code for xgraph for wpan_demo2.tcl

2011-04-11 Thread moy . tan

Hi,
please reply me with the code for drawing xgraph for the following 
program. i have tried writing the function record{} but failed to make 
out0.tr file for calculating bandwidth.



# wpan_demo2.tcl
#
#
# ==
# Define options
# ==
set val(chan)   Channel/WirelessChannel;# Channel Type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation 
model
set val(netif)  Phy/WirelessPhy/802_15_4
set val(mac)Mac/802_15_4
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) 150;# max packet in ifq
set val(nn) 7  ;# number of 
mobilenodes
set val(rp) AODV   ;# routing protocol
set val(x)  50
set val(y)  50

set val(nam)wpan_demo2.nam
set val(traffic)ftp;# cbr/poisson/ftp
#read command line arguments
proc getCmdArgu {argc argv} {
global val
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]
set val($name) [lindex $argv [expr $i+1]]
}
}
getCmdArgu $argc $argv

set appTime17.0 ;# in seconds
set appTime27.1 ;# in seconds
set appTime37.2 ;# in seconds
set appTime47.3 ;# in seconds
set appTime57.4 ;# in seconds
set appTime67.5 ;# in seconds
set stopTime100 ;# in seconds

# Initialize Global Variables
set ns_ [new Simulator]
set tracefd [open ./wpan_demo2.tr w]
$ns_ trace-all $tracefd
if { $val(nam) == wpan_demo2.nam } {
set namtrace [open ./$val(nam) w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
}

#open xgraph file...
set f0 [open out0.tr w]

proc record {} {
global sink0 f0
#Get an instance of the simulator
set ns [Simulator instance]
#Set the time after which the procedure should be called again
set time 0.5
#How many bytes have been received by the traffic sinks?
set bw0 [$sink0 set bytes_]
#Get the current time
set now [$ns now]
#Calculate the bandwidth (in MBit/s) and write it to the files
puts $f0 $now [expr $bw0/$time*8/100]
#Reset the bytes_ values on the traffic sinks
$sink0 set bytes_ 0
#Re-schedule the procedure
$ns at [expr $now+$time] record
}


$ns_ puts-nam-traceall {# nam4wpan #}   ;# inform nam that this is a 
trace file for wpan (special handling needed)

Mac/802_15_4 wpanCmd verbose on
Mac/802_15_4 wpanNam namStatus on   ;# default = off (should be 
turned 
on before other 'wpanNam' commands can work)
#Mac/802_15_4 wpanNam ColFlashClr gold  ;# default = gold

# For model 'TwoRayGround'
set dist(5m)  7.69113e-06
set dist(9m)  2.37381e-06
set dist(10m) 1.92278e-06
set dist(11m) 1.58908e-06
set dist(12m) 1.33527e-06
set dist(13m) 1.13774e-06
set dist(14m) 9.81011e-07
set dist(15m) 8.54570e-07
set dist(16m) 7.51087e-07
set dist(20m) 4.80696e-07
set dist(25m) 3.07645e-07
set dist(30m) 2.13643e-07
set dist(35m) 1.56962e-07
set dist(40m) 1.20174e-07
Phy/WirelessPhy set CSThresh_ $dist(15m)
Phy/WirelessPhy set RXThresh_ $dist(15m)

# set up topography object
set topo   [new Topography]
$topo load_flatgrid $val(x) $val(y)

# Create God
set god_ [create-god $val(nn)]

set chan_1_ [new $val(chan)]

# configure node

$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-topoInstance $topo \
-agentTrace OFF \
-routerTrace OFF \
-macTrace ON \
-movementTrace OFF \
#-energyModel EnergyModel \
#-initialEnergy 1 \
#-rxPower 0.3 \
#-txPower 0.3 \
-channel $chan_1_

for {set i 0} {$i  $val(nn) } {incr i} {
set node_($i) [$ns_ node]   
$node_($i) random-motion 0  ;# disable random motion
}

source ./wpan_demo2.scn

$ns_ at 0.0 $node_(0) NodeLabel PAN Coor
$ns_ at 0.0 $node_(0) sscs startPANCoord  ;# startPANCoord 
txBeacon=1 BO=3 SO=3
$ns_ at 0.5 $node_(1) sscs startDevice 1 0;# startDevice 
isFFD=1 
assoPermit=1 txBeacon=0 BO=3 SO=3
$ns_ at 1.5