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

[ns] BUGS in LAN ??



Hi

I have sent a question earlier.I am using 2.17.
The problems I am facing are

1= drops in lan.from source to lan node.
 I think there sould be no drops in Lan.

2= a lot of duplicate packets on destination of CBR
source.Is it a bug in nS or ????

I was using 2.16 it can not support more than 2 tcp
and 1 udp source in a lan.Any suggestions about that
or is it a BUG again???


Any help will be appreciated.

Adeel
UNSW
Australia

My script is as follows
#design of a simple LAN with five nodes and a node 
# outside the LAN
#                                 n5 
#                                 ||
#                                 ||
#                                 ||
#   n0            n2              n4
#   |             |               |
#   |             |               |    
#   |             |               |
#   +=============+===============+
#                 |               |
#                 |               |
#                 |               |
#                n1               n3
#
#

set ns [new Simulator]
puts "Starting Simulation
.................................. Done"
# open file for nam animation
set f [open outf.nam w]
$ns namtrace-all $f

# open files for tracing out put for the graph
set f0 [open out0.tr w]
set f1 [open out1.tr w]
set fc [open outc.tr w]
set g [open outfg.tr w]
$ns trace-all $g


# create node with given color

set n0 [$ns node]
$n0 color "blue" 

set n1 [$ns node]
$n1 color "red" 

set n2 [$ns node]
$n2 shape "square" 
$n2 color "yellow"

set n3 [$ns node]
$n3 color "blue"

set n4 [$ns node]
$n4 color "black"

set n5 [$ns node]
$n5 color "red"


# make node list for lan
set nodelist_ "$n0 $n1 $n2 $n3 $n4"

#link the node with option that is outside the lan  
$ns duplex-link $n5 $n4  10Mb 1ms DropTail
$ns duplex-link-op $n5 $n4 orient down

# make lan with the node list 
set lan_ [$ns make-lan $nodelist_ 10Mb 1ms LL
Queue/DropTail Mac/802_3 Channel]

# create TCP agent and attach it to the node
set tcp0 [new Agent/TCP]

$ns attach-agent $n0 $tcp0 


#create TCP sink 
set sink1 [new Agent/TCPSink]
$ns attach-agent $n3 $sink1

# connect TCP source to sink
$ns connect $tcp0 $sink1 

# craet UDP agent and attach to the node
set udp1 [new Agent/UDP]
$ns attach-agent $n1 $udp1

# attach CBR application to the UDP agent
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set packetSize_ 256
$cbr1 set interval_ .000975

# attach Loss Monitor agent to the node
set sink0 [new Agent/LossMonitor]
$ns attach-agent $n5 $sink0

# conenct UDP to sink
$ns connect $udp1 $sink0


# attach FTP application to the TCP agent
set ftp0 [$tcp0 attach-app FTP]


# define flow ID
$udp1 set fid_ 1
$tcp0 set fid_ 2

# color to flow ID
$ns color 1 Red
$ns color 2 Blue

# record procedure for the calculation of bandwidth
proc record {} {
        global sink0 sink1 tcp0 fc  f0 f1  
        #Get an instance of the simulator
        set ns [Simulator instance]
        #Set the time after which the procedure should
be
called again
        set time 0.5
        #How many bytes have been received by the
traffic
sinks?
        set bw0 [$sink0 set bytes_]
        #set bw1 [$sink1 set bytes_]
        #set cw [$tcp0 set cwnd_]
        #set bw2 [$sink2 set bytes_]
        #Get the current time
        set now [$ns now]
        #Calculate the bandwidth (in MBit/s) and write
it to
the files
        puts $f0 "$now [expr $bw0/$time*8/1048576]"
        puts $f1 "$now [expr $bw1/$time*8/1048576]"
        #puts $fc "$now $cw" 
        #puts $f2 "$now [expr $bw2/$time*8/1000000]"
        #Reset the bytes_ values on the traffic sinks
        $sink0 set bytes_ 0
        #$sink1 set bytes_ 0
        #$sink2 set bytes_ 0
        #Re-schedule the procedure
        $ns at [expr $now+$time] "record"
        }


# start simulation and record proc 
$ns at 0.0 "record"

# start CBR   
$ns at 0.0 "$cbr1 start"


# start FTP 
$ns at 5.0 "$ftp0 start"
 
$ns at 10.0 "$ftp0 stop" 



# stop simulation
$ns at 10.0 "$ns halt" 


$ns run

# close files and exec graph
$ns flush-trace
close $f0
close $f1
close $f
close $fc
close $g

exit 0

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/