[ns] Problem in setting parameters in red.cc

Khushboo Shah khushboo@usc.edu
Tue Apr 16 10:30:04 2002


Hi,

You are right. That's the way I do it. If you look at the q_weight_incr
proc, its pretty much the same. The problem is back in red.cc somehow the
parameter values are getting reset to the default value of q_weight. And I
get the output shown below. And that's the case with all the red
parameters which we can set it from tcl. Can you help me on that?

Thanks,
Khushboo

On Tue, 16 Apr 2002, Debojyoti Dutta wrote:

> An easier way to change parameters at runtime is
>
> proc chparam {time} {
> 	$ns at "[expr [$ns now] + $time]" tclcode
> }
>
>
> in your case the tcl code would be some proc to change all the red params.
>
> debo
>
> On Tue, 16 Apr 2002, Khushboo Shah wrote:
>
> >
> > Hi,
> >
> > I have a problem setting up any parameter dynamically in red.cc. For
> > instance, q_weight_. I want to change value of q_weight say every 0.05
> > sec.
> > I modify add following in red.cc to output q_weight at simulator time.
> > Here is the simple script to modify q_weight dynamically. I want to change
> > q_weight at 0.05 sec to 0.6 and then at 0.1 to 0.6. The problem is ns sets
> > q_weight at 0.05 sec to 0.6 and at 0.1 to 0.5 but in the middle somewhere
> > it resets the value to a default value (0.002) here. I have also attached
> > the output time and q_weight_ from ns. It becomes clear from that output
> > that ns sets up the q_weight_ to a specified value but it resets it back.
> > And I am facing this problem with every parameter which we can specify for
> > RED. Any idea how I can fix this problem? Or does it mean that we cannot
> > change RED parameters dynamically?
> >
> >
> > RED.CC:::::
> >
> > void REDQueue::enque(Packet* pkt)
> > {
> >
> > 	double now = Scheduler::instance().clock();
> > 	printf("IN red.cc:: time = %f    q_weight_ =  %f
> > \n",now,edp_.q_w);
> >         ............
> >
> > }
> >
> > TCL Script:::::
> >
> > global ns
> > set ns [new Simulator]
> > $ns color 0 blue
> > $ns color 1 red
> > $ns color 2 white
> >
> > set n0 [$ns node]
> > set n1 [$ns node]
> > set n2 [$ns node]
> > set n3 [$ns node]
> >
> >
> > proc build_topology {} {
> >
> >     global ns n0 n1 n2 n3 index time_incr
> >     Agent/TCP set packetsize_ 1000
> >     Queue/RED set bytes_ true
> >
> >     $ns duplex-link $n0 $n1 5Mb 2ms RED
> >     $ns duplex-link $n1 $n2 1.5Mb 3ms RED
> >     $ns duplex-link $n2 $n3 5Mb 4ms RED
> >     set tcp_(1) [$ns create-connection TCP $n0 TCPSink $n2 0]
> >     set ftp_(1) [$tcp_(1) attach-app FTP]
> >     $ns at 0.0 "$ftp_(1) start"
> >
> >     set index 1
> >     set time_incr 0.05
> >     $ns at  $time_incr  "q_weight_incr  $time_incr "
> >     $ns at 1.0 "finish"
> >     $ns run
> > }
> >
> > proc finish {} {
> >     global ns f nf
> >     $ns flush-trace
> >     exit 0
> > }
> >
> >
> >
> > proc q_weight_incr { time } {
> >     global n  index time_incr ns n0 n1 n2 n3
> >     set ns [Simulator instance]
> >     set now [$ns now]
> >     if {$index == 1.0} {
> >        [[$ns link $n1 $n2] queue] set q_weight_ 0.6
> > 	incr index
> >     } else {
> > 	[[$ns link $n1 $n2] queue] set q_weight_ 0.5
> > 	incr index
> >     }
> >
> >     $ns at [expr $now +$time_incr] "q_weight_incr $time "
> > }
> >
> > build_topology
> >
> > OUTPUT:::
> >
> > IN red.cc:: time = 0.000000    q_weight_ =  0.002000
> > IN red.cc:: time = 0.002064    q_weight_ =  0.002000
> > IN red.cc:: time = 0.005277    q_weight_ =  0.002000
> > IN red.cc:: time = 0.008491    q_weight_ =  0.002000
> > IN red.cc:: time = 0.010555    q_weight_ =  0.002000
> > IN red.cc:: time = 0.010555    q_weight_ =  0.002000
> > IN red.cc:: time = 0.014155    q_weight_ =  0.002000
> > IN red.cc:: time = 0.015755    q_weight_ =  0.002000
> > IN red.cc:: time = 0.022488    q_weight_ =  0.002000
> > IN red.cc:: time = 0.025701    q_weight_ =  0.002000
> > IN red.cc:: time = 0.027765    q_weight_ =  0.002000
> > IN red.cc:: time = 0.027765    q_weight_ =  0.002000
> > IN red.cc:: time = 0.027821    q_weight_ =  0.002000
> > IN red.cc:: time = 0.031035    q_weight_ =  0.002000
> > IN red.cc:: time = 0.031365    q_weight_ =  0.002000
> > IN red.cc:: time = 0.032965    q_weight_ =  0.002000
> > IN red.cc:: time = 0.033099    q_weight_ =  0.002000
> > IN red.cc:: time = 0.033099    q_weight_ =  0.002000
> > IN red.cc:: time = 0.036699    q_weight_ =  0.002000
> > IN red.cc:: time = 0.038299    q_weight_ =  0.002000
> > IN red.cc:: time = 0.039699    q_weight_ =  0.002000
> > IN red.cc:: time = 0.042912    q_weight_ =  0.002000
> > IN red.cc:: time = 0.044976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.044976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.045032    q_weight_ =  0.002000
> > IN red.cc:: time = 0.048245    q_weight_ =  0.002000
> > IN red.cc:: time = 0.048576    q_weight_ =  0.002000
> > IN red.cc:: time = 0.050176    q_weight_ =  0.600000
> > IN red.cc:: time = 0.050309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.050309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.050365    q_weight_ =  0.002000
> > IN red.cc:: time = 0.053579    q_weight_ =  0.002000
> > IN red.cc:: time = 0.053909    q_weight_ =  0.600000
> > IN red.cc:: time = 0.055509    q_weight_ =  0.600000
> > IN red.cc:: time = 0.055643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.055643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.055699    q_weight_ =  0.002000
> > IN red.cc:: time = 0.058912    q_weight_ =  0.002000
> > IN red.cc:: time = 0.059243    q_weight_ =  0.600000
> > IN red.cc:: time = 0.060843    q_weight_ =  0.600000
> > IN red.cc:: time = 0.060976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.060976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.061032    q_weight_ =  0.002000
> > IN red.cc:: time = 0.064245    q_weight_ =  0.002000
> > IN red.cc:: time = 0.064576    q_weight_ =  0.600000
> > IN red.cc:: time = 0.066176    q_weight_ =  0.600000
> > IN red.cc:: time = 0.066309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.066309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.066365    q_weight_ =  0.002000
> > IN red.cc:: time = 0.069579    q_weight_ =  0.002000
> > IN red.cc:: time = 0.069909    q_weight_ =  0.600000
> > IN red.cc:: time = 0.071509    q_weight_ =  0.600000
> > IN red.cc:: time = 0.071643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.071643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.071699    q_weight_ =  0.002000
> > IN red.cc:: time = 0.074912    q_weight_ =  0.002000
> > IN red.cc:: time = 0.075243    q_weight_ =  0.600000
> > IN red.cc:: time = 0.076843    q_weight_ =  0.600000
> > IN red.cc:: time = 0.076976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.076976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.077032    q_weight_ =  0.002000
> > IN red.cc:: time = 0.080245    q_weight_ =  0.002000
> > IN red.cc:: time = 0.080576    q_weight_ =  0.600000
> > IN red.cc:: time = 0.082176    q_weight_ =  0.600000
> > IN red.cc:: time = 0.082309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.082309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.082365    q_weight_ =  0.002000
> > IN red.cc:: time = 0.085579    q_weight_ =  0.002000
> > IN red.cc:: time = 0.085909    q_weight_ =  0.600000
> > IN red.cc:: time = 0.087509    q_weight_ =  0.600000
> > IN red.cc:: time = 0.087643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.087643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.087699    q_weight_ =  0.002000
> > IN red.cc:: time = 0.090912    q_weight_ =  0.002000
> > IN red.cc:: time = 0.091243    q_weight_ =  0.600000
> > IN red.cc:: time = 0.092843    q_weight_ =  0.600000
> > IN red.cc:: time = 0.092976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.092976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.093032    q_weight_ =  0.002000
> > IN red.cc:: time = 0.096245    q_weight_ =  0.002000
> > IN red.cc:: time = 0.096576    q_weight_ =  0.600000
> > IN red.cc:: time = 0.098176    q_weight_ =  0.600000
> > IN red.cc:: time = 0.098309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.098309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.098365    q_weight_ =  0.002000
> > IN red.cc:: time = 0.101579    q_weight_ =  0.002000
> > IN red.cc:: time = 0.101909    q_weight_ =  0.500000
> > IN red.cc:: time = 0.103509    q_weight_ =  0.500000
> > IN red.cc:: time = 0.103643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.103643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.103699    q_weight_ =  0.002000
> > IN red.cc:: time = 0.106912    q_weight_ =  0.002000
> > IN red.cc:: time = 0.107243    q_weight_ =  0.500000
> > IN red.cc:: time = 0.108843    q_weight_ =  0.500000
> > IN red.cc:: time = 0.108976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.108976    q_weight_ =  0.002000
> > IN red.cc:: time = 0.109032    q_weight_ =  0.002000
> > IN red.cc:: time = 0.112245    q_weight_ =  0.002000
> > IN red.cc:: time = 0.112576    q_weight_ =  0.500000
> > IN red.cc:: time = 0.114176    q_weight_ =  0.500000
> > IN red.cc:: time = 0.114309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.114309    q_weight_ =  0.002000
> > IN red.cc:: time = 0.114365    q_weight_ =  0.002000
> > IN red.cc:: time = 0.117579    q_weight_ =  0.002000
> > IN red.cc:: time = 0.117909    q_weight_ =  0.500000
> > IN red.cc:: time = 0.119509    q_weight_ =  0.500000
> > IN red.cc:: time = 0.119643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.119643    q_weight_ =  0.002000
> > IN red.cc:: time = 0.119699    q_weight_ =  0.002000
> >
> >
> > Any idea?
> > Thanks,
> > Khushboo
> >
> >
> >
>