in your script you have to change ifq value Queue/DropTail/PriQueue by
CMUPriQueue 
#Define wirleess scenario parameters
 
set val(chan) Channel/WirelessChannel;
set val(prop) Propagation/TwoRayGround1;
set val(netif) Phy/WirelessPhy;
set val(mac) Mac/802_11;
set val(ifq) CMUPriQueue ;
set val(ll) LL;
set val(ant) Antenna/OmniAntenna;
set val(ifqlen) 50;
set val(nn) 5;
set val(rp) DSR;
set val(x) 500;
set val(y) 400;
set val(stop) 150;
set ns [new Simulator]
set tracefd [open problem1Trace.tr w]
set windowVsTime2 [open problem1Win.tr w]
set namfd [open problem1Namtrace.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namfd $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
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns node]
}
$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
$node_(3) set X_ 495.0
$node_(3) set Y_ 100
$node_(3) set Z_ 0.0
$node_(4) set X_ 495
$node_(4) set Y_ 395
$node_(4) 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 20.0 "$node_(2) setdest 480.0 300.0 5.0"
$ns at 25.0 "$node_(3) setdest 50.0 150.0 5.0"
$ns at 15.0 "$node_(4) setdest 50.0 50.0 3.0"
#set TCP Connection between node_(0) and node_(1)
set tcp0 [new Agent/TCP/Newreno]
$tcp0 set class_ 2
set sink0 [new Agent/TCPSink]
$ns attach-agent $node_(0) $tcp0
$ns attach-agent $node_(1) $sink0
$ns connect $tcp0 $sink0
set ftp [new Application/FTP]
$ftp attach-agent $tcp0
$ns at 10.0 "$ftp start"
#set TCP Connection between node_(0) and node_(4)
set tcp1 [new Agent/TCP/Newreno]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns attach-agent $node_(0) $tcp1
$ns attach-agent $node_(4) $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ns at 12.0 "$ftp1 start"
#set TCP Connection between node_(3) and node_(2)
set tcp2 [new Agent/TCP/Newreno]
$tcp2 set class_ 2
set sink2 [new Agent/TCPSink]
$ns attach-agent $node_(3) $tcp2
$ns attach-agent $node_(2) $sink2
$ns connect $tcp2 $sink2
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
$ns at 15.0 "$ftp2 start"
proc plotWindow {tcpSource file} {
global ns
set time 0.01
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
puts $file "$now $cwnd"
$ns at [expr $now+$time] "plotWindow $tcpSource $file" }
$ns at 10.1 "plotWindow $tcp0 $windowVsTime2"
#define node position in NAM
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.01 "puts \"end simulation\" ; $ns halt"
proc stop {} {
global ns tracefd namfd
$ns flush-trace
close $tracefd
close $namfd
}
$ns run
  #Good Luck

-- 
View this message in context: 
http://www.nabble.com/Segmentation-fault-with-wireless-simulation-tp14679409p25017741.html
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to