[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] SEGMENTATION FAULT
Hi
We have installed the ns-2 pakage today and when i tried to simulate a
topology file it gave the following script error:
gum:8 ns-allinone-2.1b6> nam template.tcl
Failed to start animator:
class Animator: constructor failed: unmatched open brace in list
unmatched open brace in list
while executing
"foreach item $traceevent {
if { $next == 1 } {
return $item
}
if { $item == $tag } {
set next 1
}
}"
(procedure "get_trace_item" line 3)
invoked from within
"get_trace_item "-t" $line"
(procedure "_o3" line 9)
(Animator infer-network-model line 9)
invoked from within
"$self infer-network-model $tracefile"
(procedure "_o3" line 80)
(Animator init line 80)
invoked from within
"_o3 init template.tcl {}"
(Class create line 1)
invoked from within
"Animator create _o3 template.tcl {}"
invoked from within
"catch "$className create $o $args" msg"
(procedure "new" line 3)
invoked from within
"new $ANIMATOR_CLASS_ $tracefile [join $args]"
The topology file is:
#Create a simulator object
set ns [new Simulator]
$ns color 1 Blue
$ns color 2 Red
#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
exec nam out.nam &
exit 0
}
# Insert your own code for topology creation
# and agent definitions, etc. here
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n2 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n3 $n2 1Mb 10ms SFQ
#SQF = Stochastic Fair Queing mechanism
#for more control over the layout
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Create two CBR agents
#--------------------------------------------------------
set cbr0 [new Agent/CBR]
$ns attach-agent $n0 $cbr0
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
set cbr1 [new Agent/CBR]
$ns attach-agent $n1 $cbr1
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
$cbr0 set fid_ 1
$cbr1 set fid_ 2
#--------------------------------------------------------
$ns connect $cbr0 $null0
$ns connect $cbr1 $null0
$ns at 0.5 "$cbr0 start"
$ns at 1.0 "$cbr1 start"
$ns at 4.0 "$cbr0 stop"
$ns at 4.5 "$cbr1 stop"
#Call the finish procedure after 5 seconds simulation time
$ns at 5.0 "finish"
#Run the simulation
$ns run
I will appreciate if any one could figure out what exacltly is the error
and how to resolve it.
thanks
nitin
------------------------------------------------------------------------------
Nitin Nagar
Graduate Teaching Assistant
------------------------------------------------------------------------------