Hello, everyone!

I am new in the ns world.Currently i am learning wireless routing.

I run a sample in chapter 9 (mobile networks) in "NS simulator for beginners". 
The sample code is listed in pp. 117-118. When I set the routing protocol as 
"DSDV", it finished simulation successfully. But when I modified the routing 
protocol from "DSDV" to "DSR", it ran for a while and then quit with the 
message "Segmentaion fault (core dump)".

Can anybody give me an advice or a clue?

Thanks in advance!!

My ns2 version is 2.29 all in one. I installed the ns on the cygwin platform.
The tcl code source is as follows.



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 val(ll)         LL
set val(ant)        Antenna/OmniAntenna
set val(ifqlen)         50            ;# max packet in ifq
set val(nn)             3             ;# how many nodes are simulated
set val(adhocRouting)   DSR
set val(x)              500   ;# X dimension of the topography
set val(y)              400   ;# Y dimension of the topography
set val(stop)           150.0           ;# simulation time


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]
set namtrace    [open wireless1-out.nam w]

$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

# define topology
$topo load_flatgrid $val(x) $val(y)

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

#
# define how node should be created
#

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

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

$node_(0) set X_ 5.0
$node_(0) set Y_ 5.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 490.0
$node_(1) set Y_ 285.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 150.0
$node_(2) set Y_ 240.0
$node_(2) set Z_ 0.0

$ns_ at 10.0 "$node_(0) setdest 250.0 250.0 3.0"
$ns_ at 15.0 "$node_(1) setdest 45.0 285.0 5.0"
$ns_ at 110.0 "$node_(0) setdest 480.0 300.0 5.0"

set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $tcp
$ns_ attach-agent $node_(1) $sink
$ns_ connect $tcp $sink

set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ at 10.0 "$ftp start"

for {set i 0} {$i<$val(nn)} {incr i} {
    $ns_ initial_node_pos $node_($i) 30
}

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

$ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)"
$ns_ at $val(stop) "stop"

$ns_ at 150.1 "puts \"end simulation \"; $ns_ halt"

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

$ns_ run






xiongqing
2006-11-07

Reply via email to