[ns] CBR traffic generator

Sampath N. Ranasinghe sampath.ranasinghe at kcl.ac.uk
Thu Sep 29 07:22:21 PDT 2005


Hi Ns2 user,
I have a question regarding the CBR traffic generator.  In calculating
the interval for the next packet transmission, the size_ variable value
is bitwise shifted by 3, multiplying its value by 8.  Can some one tell
me why this is done?

I have included a copy of the function.  I am using ns-2.26.

Regards,
Sampath


double CBR_Traffic::next_interval(int& size)
{
        // Recompute interval in case rate_ or size_ has changes
        interval_ = (double)(size_ << 3)/(double)rate_;
        double t = interval_;
        if (random_)
                t += interval_ * Random::uniform(-0.5, 0.5);    
        size = size_;
        if (++seqno_ < maxpkts_)
                return(t);
        else
                return(-1); 
}






More information about the Ns-users mailing list