[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Newbie Questions in running NS2
Hi,
Thanks for your reply. However, I can't undersatand what's wrong with
the finish process
# finish process proc finish {} {
global ns f nf
$ns flush-trace
close $f
puts "running nam .."
exec nam out.nam &
exit 0
}
Can you show me the syntax error and how to correct it?
> watch your syntax, Tcl must not like the close brace of finish, hence
> run is not executed and route not computed -> nice barf of an
> error msg
>
> -Tarik
>
>
>
>
>
>
>
>
> On Tue, 30 Jan 2001, Chien-Lung Wu wrote:
>
> > Hi,
> >
> > As a newbie in NS2, I try a simple file (copy from the NS2 manual) to feel
> > NS2. I get the example from NS2 manual
> >
> > #sample.tcl
> > set ns [new Simulator]
> > set f [open out.tr w]
> >
> > $ns trace-all $f
> >
> > set nf [open out.nam w]
> >
> > $ns namtrace-all $nf
> >
> > set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node]
> >
> > set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0
> >
> > set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0 $udp0 set
> > class_ 0
> >
> >
> > set null0 [new Agent/Null] $ns attach-agent $n3 $null0
> >
> > $ns connect $udp0 $null0 $ns at 1.0 "cbr0 start"
> >
> > puts [$cbr0 set packetSize_] puts [$cbr0 set interval_]
> >
> >
> > set tcp [new Agent/TCP] $tcp set class_ 1 $ns attach-agent $n1 $tcp
> >
> > set sink [new Agent/TCPSink] $ns attach-agent $n3 $sink
> >
> > set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 1.2 "$ftp
> > start"
> >
> > $ns connect $tcp $sink $ns at 1.35 "$ns detach-agent $n0 $tcp; $ns
> > detach-agent $n3 $sink"
> >
> >
> > $ns at 3.0 "finish"
> >
> > proc finish{ } {
> >
> > global ns f nf
> > $ns flush-trace
> > close $f
> > close $nf
> >
> > puts "running nam .."
> > exec nam out.nam &
> > exit 0 }
> >
> > $ns run
> > ####### end of sample.tcl
> >
> >
> >
> > When I run the simulator, I got the message:
> >
> > [root@bone Intention-Driven-iTrace]# ns sample.tcl
> > 210
> > 0.0037499999999999999 routes not yet computed
> > (_o31 cmd line 1)
> > invoked from within "$self cmd lookup $nodeid $destid"
> > (procedure "_o31" line 18)
> > (RouteLogic lookup line 18)
> > invoked from within "$r lookup $i $j"
> > (procedure "_o3" line 26)
> > (Simulator compute-flat-routes line 26)
> > invoked from within "$self compute-flat-routes"
> > (procedure "_o3" line 5)
> > (Simulator compute-routes line 5)
> > invoked from within "[Simulator instance] compute-routes"
> > (procedure "Agent/rtProto/Static" line 2)
> > (Agent/rtProto/Static init-all line 2)
> > invoked from within "Agent/rtProto/Static init-all"
> > (procedure "_o31" line 8)
> > (RouteLogic configure line 8)
> > invoked from within "[$self get-routelogic] configure"
> > (procedure "_o3" line 4)
> > (Simulator run line 4)
> > invoked from within "$ns run"
> > (file "sample.tcl" line 63)
> >
> > What's wrong with this?
> >
> > I download the ns-allinone-2.1b7a and ./install it successfully. Do
> > I miss something, since it seems that I miss something in the related lib?
> >
> >
> > Can anybody help me out?
> >
> > As my research, I need to create a new module (new componets) in
> > NS2? Could anyone give me the pointer how can I modify/add a new module?
> >
> > Thanks,
> >
> >
> > C.L
> >
>
>
****************************************************************************
Chien-Lung Wu [email protected]
Graduate Student of ECE (O) 919-513-1894
at North Carolina State University (H) 919-233-6724
****************************************************************************