[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on debugging tcl scripts



Sorry, the script in the previous mail was slightly more buggy than it was
supposed to be. Here is another one(which still isn't working)

Tor Hval

On Thu, 10 Jun 1999, Shuqian YAN wrote:

> why don't you send the script to the mailing list, I can help to take a
> look.
> 
> shuqian
> 
> On Thu, 10 Jun 1999, T.Hval wrote:
> 
> > Hello!
> > Just wondering if anybody has any usefull advice for debugging the tcl
> > scripts. I am a bit stuck with a test script Im writing to get to know the
> > multicast functionality, the problem is that no traffic is generated even
> > though I have set events to happend. I  let a node join a multicast
> > group, which has a sender that sends CBR traffic, but no traffic appears
> > when I look at the result in nam.
> > I am using mcast.tcl in the "ns-2.1b5/tcl/ex" directory as a pattern
> > (that script do work).
> > 
> > Any hints for a beginner?
> > 
> > Thanks
> >  
> > Tor Hval
> > 
> > 
> 
> 
#Creat a simulator object
set ns [new Simulator -multicast on]
$ns multicast

#Simulator set EnableMcast_ 1


set group [Node allocaddr]

$ns color 2 Blue
$ns color 3 Red

#Open the nam trace file
set nf [open testmulti.nam w]
$ns namtrace-all $nf


#Defining 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 testmulti.nam &
    exit 0
}    

#Create nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
set n8 [$ns node]


#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n3 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n2 $n4 500Kb 10ms DropTail
$ns duplex-link $n2 $n5 1Mb 10ms DropTail
$ns duplex-link $n4 $n6 1Mb 10ms DropTail
$ns duplex-link $n2 $n7 1Mb 10ms DropTail
$ns duplex-link $n4 $n8 1Mb 10ms DropTail



$ns duplex-link-op $n0 $n1 orient up-down
$ns duplex-link-op $n1 $n3 orient right
$ns duplex-link-op $n1 $n2 orient left-down
$ns duplex-link-op $n2 $n4 orient right-down
$ns duplex-link-op $n2 $n5 orient up-down
$ns duplex-link-op $n4 $n6 orient right-down
$ns duplex-link-op $n2 $n7 orient left
$ns duplex-link-op $n4 $n8 orient left-down

set mproto DM
set mrthandle [$ns mrtproto $mproto {}]


#queue monitor
#$ns duplex-link-op $n2 $n4 queuePos 0.5


set udp [new Agent/UDP]
$ns attach-agent $n3 $udp
$udp set dst_ $group
set src [new Application/Traffic/CBR]
$src attach-agent $udp


#creating receiver
set rcvr [new Agent/LossMonitor]
$ns attach-agent $n0 $rcvr


# TCP sender agent
#set tcp [new Agent/TCP]
#$tcp set fid_ 2

#set tcp2 [new Agent/TCP]
#$tcp2 set fid_ 3
# Tcp sink agent
#set sink [new Agent/TCPSink]
#$ns attach-agent $n1 $tcp
#$ns attach-agent $n6 $sink
#$ns connect $tcp $sink

#set sink2 [new Agent/TCPSink]
#$ns attach-agent $n7 $tcp2
#$ns attach-agent $n4 $sink2
#$ns connect $tcp2 $sink2

#Create an "application"
#set ftp [new Application/FTP]
#set ftp2 [new Application/FTP]
#$ftp attach-agent $tcp
#$ftp2 attach-agent $tcp2

$ns at 0.1 "$n0 join-group $rcvr $group"
$ns at 1.1 "$n0 leave-group $rcvr $group"
#$ns at 2.1 "$ftp start"
#$ns at 2.1 "$ftp2 start"
#$ns at 4.9 "$ftp stop"
#$ns at 4.9 "$ftp2 stop"

#Call the finish procedure 
$ns at 5.0 "finish"

#Run the simulaton
$ns run