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

[ns] Pareto sources



Hi,

  I have been trying to understand the Pareto ON-OFF sources as coded in 
file pareto.cpp.

  Can some one please explain to me the meaning of "burstlen", "interval" 
and how the code works ?

  Here's a snapshot of the code...

********************************************************************
void POO_Traffic::init()
{
	interval_ = (double)(size_ << 3)/(double)rate_;
	burstlen_ = ontime_/interval_;
	rem_ = 0;
	on_ = 0;
	p1_ = burstlen_ * (shape_ - 1.0)/shape_;
	p2_ = offtime_ * (shape_ - 1.0)/shape_;
	if (agent_)
		agent_->set_pkttype(PT_PARETO);
}

double POO_Traffic::next_interval(int& size)
{
	double t = interval_;

	on_ = 1;
	if (rem_ == 0) {
		/* compute number of packets in next burst */
		rem_ = int(Random::pareto(p1_, shape_) + .5);
		/* make sure we got at least 1 */
		if (rem_ == 0)
			rem_ = 1;
		/* start of an idle period, compute idle time */
		t += Random::pareto(p2_, shape_);
		on_ = 0;
	}
	rem_--;

	size = size_;
	return(t);

}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com