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

[ns] X-Mailer: Infom@il (correo con interfaz WEB)



Hi all,

Sorry for bothering you again but I've found quite a weird problem when trying to simulate a simple 4-node scenario with two generator nodes, an aggregation node and a destination node. The traffic genrators I use are TCP and congestion is suffered on the aggregation node. I've set a queue "limit_" of 1 on que aggregation node and I expected to see packets being dropped with nam as soon as there were two elements on the queue, but the problem is I see the queue grow and grow and packets are not dropped until the queue is rally large (about 50 packest?). What's wrong with my code?:
-
-
-
#Create a simulator object
set ns [new Simulator]

$ns color 1 Red
$ns color 2 Blue

#Open the nam trace file
set nf [open tcp1.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 tcp1.nam &
        exit 0
}

#Create two nodes
set n0 [$ns node]
set n1 [$ns node]
set nagr [$ns node]
set nfin [$ns node]


#Create a duplex link between the nodes
$ns duplex-link $n0 $nagr 200kb 100ms DropTail
$ns duplex-link $n1 $nagr 200kb 100ms DropTail
$ns duplex-link $nagr $nfin 250kb 100ms DropTail limit_ 1
$ns duplex-link-op $nagr $nfin queuePos 0.3

#Create a TCP agent and attach it to node n0
set tcp0 [new Agent/TCP]
$tcp0 set window_ 50
$tcp0 set class_ 1
$tcp0 set packetSize_ 500
$ns attach-agent $n0 $tcp0
set tcp1 [new Agent/TCP]
$tcp1 set window_ 50
$tcp1 set class_ 2
$tcp1 set packetSize_ 500
$ns attach-agent $n1 $tcp1

# Create a FTP traffic source and attach it to udp0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1

#Create a Null agent (a traffic sink) and attach it to node n1
set sink0 [new Agent/TCPSink]
$ns attach-agent $nfin $sink0
set sink1 [new Agent/TCPSink]
$ns attach-agent $nfin $sink1


#Connect the traffic source with the traffic sink
$ns connect $tcp0 $sink0  
$ns connect $tcp1 $sink1  

#Schedule events for the CBR agent
$ns at 0.5 "$ftp0 start"
$ns at 0.6 "$ftp1 start"
$ns at 4.5 "$ftp0 stop"
$ns at 4.6 "$ftp1 stop"
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"

#Run the simulation
$ns run

Thanks a lot. Any help will be great, since I really can't figure out what the problem is.

Best regards,

Jorge Manrique