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

[ns] question on CBQ



Dear all:
  The following CBQ script works correctly,but it appears error message after i add a line " $cbqlink algorithm top-level" in this script .why? Who can tell me the reason? How to use the command" $cbqlink algorithm top-level"??
  The script  is as follows:

set ns [new Simulator]

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

$ns color 1 red
$ns color 2 green
$ns color 3 blue

##Define a 'finish' procedure
proc finish {} {
        global ns nf tf 
        $ns flush-trace
	close $nf
        close $tf
	exit 0
}

##Create five nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]

$ns duplex-link $n0 $n3 10Mb 5ms DropTail
$ns duplex-link $n1 $n3 10Mb 5ms DropTail
$ns duplex-link $n2 $n3 10Mb 5ms DropTail
$ns simplex-link $n3 $n4 2Mb 10ms CBQ/WRR
set cbqlink [$ns link $n3 $n4]

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

set topClass [new CBQClass]
set videoClass [new CBQClass]
set audioClass [new CBQClass]
set dataClass [new CBQClass]
$topClass setparams none 0 0.98 auto 8 2 0
$videoClass setparams $topClass true 0.32 auto 1 1 0
$audioClass setparams $topClass true 0.03 auto 1 1 0
$dataClass setparams $topClass true 0.65 auto 2 1 0

set q1 [new Queue/DropTail]
$q1 set limit_ 20
set q2 [new Queue/DropTail]
$q2 set limit_ 20
set q3 [new Queue/DropTail]
$q3 set limit_ 20

$videoClass install-queue $q1
$audioClass install-queue $q2
$dataClass install-queue $q3

$cbqlink insert $topClass
$cbqlink insert $videoClass
$cbqlink insert $audioClass
$cbqlink insert $dataClass

$cbqlink bind $videoClass 1  ;# fid 1
$cbqlink bind $audioClass 2  ;# fid 2
$cbqlink bind $dataClass 3   ;# fid 3

# Create three CBR connections.
set udp1 [$ns create-connection UDP $n0 LossMonitor $n4 1]
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 190
$cbr1 set rate_ 1.52Mb  ;# interval of 0.001
$cbr1 attach-agent $udp1

set udp2 [$ns create-connection UDP $n1 LossMonitor $n4 2]
set cbr2 [new Application/Traffic/CBR]
$cbr2 set packetSize_ 500
$cbr2 set rate_ 2Mb  ;# interval of 0.002
$cbr2 attach-agent $udp2
	
set udp3 [$ns create-connection UDP $n2 LossMonitor $n4 3]
set cbr3 [new Application/Traffic/CBR]
$cbr3 set packetSize_ 1000 
$cbr3 set rate_ 1.6Mb   ;# interval of 0.005
$cbr3 attach-agent $udp3
	
$ns at 0.5 "$cbr1 start; $cbr2 start; $cbr3 start"
$ns at 2.0 "$cbr1 stop; $cbr2 stop; $cbr3 stop"

$ns at 2.0 "finish"
$ns run

the error message is as follows:
_o82: unable to dispatch method algorithm
    while executing
"$cbqlink algorithm top-level"

  Thanks in adance!!
Dongmin





__________________________________________
IP����������ȫ����ˮ��  http://shopping.263.net/category08.htm
�Ű����������ﶩ��      http://shopping.263.net/category11.htm