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

[ns] class based queuing problem



Hello,

I tried to make a CBQ sımulatıon, the code whıch I wrote below did not work.
I suspect that I may ignor some points in ns.

What is wrong ın my code?

Thanks,

Bilgin Metin

Research Assistant

Dept of Electrical&Electronics Engineering

Bogazici University

Istanbul/TURKEY

################cbq################^

# node0 X--------------------------X node1

set ns [new Simulator]

set n0 [$ns node]

set n1 [$ns node]

##########################################################

set nf [open cbqdene1.nam w]

$ns namtrace-all $nf

######################

##link definition####

######################

$ns duplex-link $n0 $n1 1Mb 2ms CBQ

#####################

## layout in nam

#####################

$ns duplex-link-op $n0 $n1 orient left

######################

##cbr source

#####################

set cbr0 [new Agent/CBR]

$ns attach-agent $n0 $cbr0

$cbr0 set interval_ 0.001

$cbr0 set packetSize_ 1200

#set null0 [new Agent/Null]

#$ns attach-agent $n1 $cbr0

#$ns connect $cbr0 $null0

$cbr0 set fid_ 1

##########################

set cbrsink1 [new Agent/LossMonitor]

$ns attach-agent $n1 $cbrsink1

##########################

## tcp source

##########################

set tcp [new Agent/TCP]

$tcp set window_ 50

$tcp set packetSize_ 1024

$tcp set interval_ 0.001

$tcp set class_ 2

set sink [new Agent/TCPSink]

$ns attach-agent $n0 $tcp

$ns attach-agent $n1 $sink

$ns connect $tcp $sink

set ftp0 [new Application/FTP]

$ftp0 attach-agent $tcp

$tcp set fid_ 2

###########################

$ns color 1 blue

$ns color 2 red

#queue class

###########################

set qlim 20

set cbq_qtype_ DropTail

###top class#################

set topclass_ [new CBQClass]

$topclass_ setparams none 0 0.98 auto 8 2 0

### audio class##############

set audioclass_ [new CBQClass]

set q1 [new Queue/$cbq_qtype_]

$q1 set limit_ $qlim

$audioclass_ install-queue $q1

$audioclass_ setparams $topclass_ true 0.1 auto 1 1 0

### Data class################

set dataclass_ [new CBQClass]

set q2 [new Queue/$cbq_qtype_]

$q2 set limit_ $qlim

$dataclass_ install-queue $q2

$dataclass_ setparams $topclass_ true 0.9 auto 2 1 0

##############################

set cbqlink [$ns link $n1 $n0]

$cbqlink insert $topclass_

$cbqlink insert $audioclass_

$cbqlink insert $dataclass_

$cbqlink bind $audioclass_ 1

$cbqlink bind $dataclass_ 2

$cbqlink bind $topclass_ 1 2

#$cbqlink algorithm $formal

##########################

set fmon [$ns makeflowmon Fid]

$ns attach-fmon $cbqlink $fmon

############################

## event definition

############################

$ns duplex-link-op $n0 $n1 queuePos 0.5

$ns at 0.1 "$ftp0 start"

#$cbr0 set dst_ [$cbrsink1 set addr_]

$ns at 0.3 "$cbr0 start"

$ns at 9.0 "$cbr0 stop"

$ns at 10.0 "$ftp0 stop"

$ns run