ns2 - Segmentation fault for the DSR protocol -
i have been trying find out why segmentation fault occurs couldn't following code can help
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) 60 ; set val(nn) 20 ; set val(rp) dsr ; set val(x) 900 ; set val(y) 900 ; set val(stop) 800 ; set ns [new simulator] set tracefd [open testdsr.tr w] set namtrace [open testdsr.nam w] set windowvstime2 [open win.tr w] $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) set topo [new topography] $topo load_flatgrid $val(x) $val(y) 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 on \ -mactrace off \ -movementtrace on {set 0} {$i < $val(nn) } { incr } { set node_($i) [$ns node] $node_($i) set x_ [ expr 10+round(rand()*480) ] $node_($i) set y_ [ expr 10+round(rand()*380) ] $node_($i) set z_ 0.0 } $ns @ 10.0 "$node_(0) setdest 300.0 300.0 10.0" $ns @ 15.0 "$node_(1) setdest 45.0 285.0 10.0" $ns @ 110.0 "$node_(0) setdest 480.0 300.0 10.0" $ns @ 70.0 "$node_(3) setdest 180.0 30.0 10.0" $ns @ 180.0 "$node_(8) setdest 410.0 770.0 15.0" $ns @ 200.0 "$node_(10) setdest 363.0 335.0 15.0" $ns @ 230.0 "$node_(7) setdest 304.0 720.0 10.0" $ns @ 270.0 "$node_(0) setdest 580.0 790.0 25.0" $ns @ 330.0 "$node_(0) setdest 810.0 790.0 20.0" $ns @ 80.0 "$node_(4) setdest 480.0 790.0 25.0" $ns @ 150.0 "$node_(7) setdest 610.0 790.0 10.0" $node_(4) color red $ns @ 8.0 "$node_(4) color darkgreen" $ns @ 8.0 "$node_(4) label source" $node_(7) color red $ns @ 8.0 "$node_(7) label destination" $ns @ 8.0 "$node_(7) color darkgreen" set tcp [new agent/tcp/newreno] $tcp set class_ 2 $tcp set packetsize_ 1000 set sink [new agent/tcpsink] $ns attach-agent $node_(4) $tcp $ns attach-agent $node_(7) $sink $ns connect $tcp $sink set ftp [new application/ftp] $ftp attach-agent $tcp $ftp set packetsize_ 1000 $ns @ 10.0 "$ftp start" proc plotwindow {tcpsource file} { global ns set time 0.01 set [$ns now] set cwnd [$tcpsource set cwnd_] puts $file "$now $cwnd" $ns @ [expr $now+$time] "plotwindow $tcpsource $file" } $ns @ 10.1 "plotwindow $tcp $windowvstime2" # define node initial position in nam {set 0} {$i < $val(nn)} { incr } { $ns initial_node_pos $node_($i) 30 } # telling nodes when simulation ends {set 0} {$i < $val(nn) } { incr } { $ns @ $val(stop) "$node_($i) reset"; } $ns @ $val(stop) "$ns nam-end-wireless $val(stop)" $ns @ $val(stop) "stop" $ns @ 350.01 "puts \"end simulation\" ; $ns halt" proc stop {} { global ns tracefd namtrace $ns flush-trace close $tracefd close $namtrace exit 0 } $ns run
i know modifications needed avoid segmentation fault error.
thanks.
plots : xgraph-12.x included in ns-allinone-2.35. available debian, mint, ubuntu.
dsr : example delay plots (2) : clustering-moc_v1.tcl (one xgraph window opens.)
dsr : example loss plots (3) : dsr-project-code_input.tcl (six xgraph windows opens : move top windows watch "lost*, 1 - 2 - 3".)
dsr : change protocol dsr in wireless-udp-1.tcl (three xgraph windows opens, second 4 times loss plots. 4 delay plots included in top window.)
all xgraph_ns2-files-tcl_05.2016 https://drive.google.com/file/d/0b7s255p3kfxnajq5s1nuohntcue/view?usp=sharing
Comments
Post a Comment