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

[ns] [Q]multiPath and CBR?






I'm trying to use 'multiPath' to route a packet alternatively.
Here's topology.

   0  --  1  --  2  --  4
             |       |
             |-  3  -|

(What I want is to transmit every each other packets
to 0-1-2-4, 0-1-3-4.)

But when I use 'CBR' traffic and get a trace (out.tr),
I found out that 'out.tr' file has only a few lines!
It looks like CBR is not working,
or 'out.tr' can't log all the packets.
To check this, I removed 'multiPath' and 'DV',
then CBR source is working fine,
so I had to conclude that there's something wrong.

Is there anyone who can answer this question?
Any reply would be appreciated.


Greg.

--------- I'm attaching my script ------------
#Create a simulator object
set ns [new Simulator]

#Define different colors for data flows
$ns color 1 Blue
$ns color 2 Red

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

#Define a 'finish' procedure
proc finish {} {
        global ns nf f
        $ns flush-trace
        #Close the trace file
        close $nf
        close $f
        #Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

Node set multiPath_ 1
#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]

#Create links between the nodes
$ns simplex-link $n0 $n1 1Mb 10ms DropTail
$ns simplex-link $n1 $n2 1Mb 10ms DropTail
$ns simplex-link $n1 $n3 1Mb 10ms DropTail
$ns simplex-link $n2 $n4 1Mb 10ms DropTail
$ns simplex-link $n3 $n4 1Mb 10ms DropTail

$ns simplex-link-op $n0 $n1 orient right
$ns simplex-link-op $n1 $n2 orient right-up
$ns simplex-link-op $n1 $n3 orient right-down
$ns simplex-link-op $n2 $n4 orient right-down
$ns simplex-link-op $n3 $n4 orient right-up

#Monitor the queue for the link between node 2 and node 3
#$ns simplex-link-op $n2 $n3 queuePos 0.5

#Create a CBR agent and attach it to node n0
#set cbr0 [new Application/Traffic/CBR]
set cbr0 [new Agent/CBR]
$ns attach-agent $n0 $cbr0
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 set fid_ 1

#Create a CBR agent and attach it to node n1
#set cbr1 [new Application/Traffic/CBR]
set cbr1 [new Agent/CBR]
$ns attach-agent $n0 $cbr1
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
$cbr1 set fid_ 2

#Create a Null agent (a traffic sink) and attach it to node n3
set null0 [new Agent/Null]
$ns attach-agent $n4 $null0

#Connect the traffic sources with the traffic sink
$ns connect $cbr0 $null0
$ns connect $cbr1 $null0

$ns rtproto DV


#Schedule events for the CBR agents
$ns at 0.1 "$cbr0 start"
$ns at 0.15 "$cbr1 start"
$ns at 1.0 "$cbr1 stop"
$ns at 1.2 "$cbr0 stop"
#Call the finish procedure after 5 seconds of simulation time
$ns at 1.5 "finish"

#Run the simulation
$ns run




_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.