[ns] still unable to configure mobile nodes; prob with node-config statement

Hari Prassadh hari.mj23 at gmail.com
Fri Apr 1 02:16:27 PST 2005


this is my complete code. i ve basically taken it from the in-built
examples. even the examples in the directory ns-tutorial dont work
properly. could u please help me out by spotting the errors as i am
totally new to linux and ns-2 and am doin a project in ns-2. it keeps
returning error in the statement "$ns_ node-config -adhocRouting
$val(rp) \"


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) 10                           ;# number of mobilenodes
set val(rp) DSDV                         ;# routing protocol

set ns_ [new Simulator]
set tracefd [open simple.tr w]
$ns_ trace-all $tracefd

set topo [new Topography]
$topo load_flatgrid 500 500
create-god $val(nn)

$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) \
                 -channelType $val(chan) \
		 -topoInstance $topo \
		 -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace OFF \
                 -movementTrace OFF

for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]	
$node_($i) random-motion 1		
}
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 105.0
$node_(1) set Y_ 44.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 35.0
$node_(2) set Y_ 22.0
$node_(2) set Z_ 0.0

$node_(3) set X_ 475.0
$node_(3) set Y_ 442.0
$node_(3) set Z_ 0.0

$node_(4) set X_ 275.0
$node_(4) set Y_ 422.0
$node_(4) set Z_ 0.0

$node_(5) set X_ 110.0
$node_(5) set Y_ 26.0
$node_(5) set Z_ 0.0

$node_(6) set X_ 98.0
$node_(6) set Y_ 6.0
$node_(6) set Z_ 0.0

$node_(7) set X_ 299.0
$node_(7) set Y_ 123.0
$node_(7) set Z_ 0.0

$node_(8) set X_ 499.0
$node_(8) set Y_ 480.0
$node_(8) set Z_ 0.0

$node_(9) set X_ 393.0
$node_(9) set Y_ 189.0
$node_(9) set Z_ 0.0


for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 150.0 "$node_($i) reset";
}

$ns_ at 150.0 "stop"
$ns_ at 150.01 "puts \"NS EXITING...\" ; $ns_ halt"

proc stop {} {
 global ns_ tracefd
 $ns_ flush-trace
 close $tracefd
}


thanking you in advance and awaiting ur response

hari



More information about the Ns-users mailing list