Hi all,

I've found, in the hard way, that "interval_" is a special pseudo-variable
of Application/Traffic/CBR and has unexpecded and undocumented behaviour. 

If the users sets the interval, followed by the packetsize, the specified
interval is changed to make the __rate__ constant, which is not probably the
user is trying to achieve.

This is exemplified by this test script; note that the difference is the
order of the lines setting interval and packetsize


##### 
set ns [new Simulator]
set opt(CBR_interval)  0.1              ;#  100 packets per second
set opt(packet_size)   1000             ;# 1000 bytes per packet


set generator1 [new Application/Traffic/CBR]
$generator1 set packetSize_ $opt(packet_size)
$generator1 set interval_   $opt(CBR_interval)
puts "Actual interval for generator 1: [$generator1 set interval_ ]
Desired interval:  $opt(CBR_interval)  "

set generator2 [new Application/Traffic/CBR]
$generator2 set interval_   $opt(CBR_interval)
$generator2 set packetSize_ $opt(packet_size)           
puts "Actual interval for generator 2: [$generator2 set interval_ ]
Desired interval:  $opt(CBR_interval)  "

exit
#####


Which results, in ns2.29:
Actual interval for generator 1: 0.1000000000001   Desired interval:  0.1  
Actual interval for generator 2: 0.4761904761616   Desired interval:  0.1  


The documentation is ambiguous:
http://www.isi.edu/nsnam/ns/doc/node498.html
"The setting of a CBR object's rate_ and interval_ are mutually exclusive"
... "In a simulation, either a rate or an interval (but not both) should be
specified for a CBR object."

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

To solve this, either:
  a) make sure you specify the interval AFTER the packetsize;
  b) use my patch that solves this problem

http://mailman.isi.edu/pipermail/ns-developers/2006-August/002375.html
http://mailman.isi.edu/pipermail/ns-developers/2006-August/002377.html

Pedro Vale Estrela



Reply via email to