/*------------------------------------------------------------------------------
void calcAvg(int
prec, int m)
This method
calculates avg queue length, given the prec number, m (a value
used to adjust the
queue size appropriately during idle times).
If mredMode is
rio_c, each virtual queue size is calculated
independently. If
it is true, the calculated size of queue n includes the sizes
of all virtual
queues up to and including n.
------------------------------------------------------------------------------*/
void
redQueue::calcAvg(int prec, int m) {
float
f;
int i;
f =
qParam_[prec].edv_.v_ave;
while (--m >= 1)
{
f *= 1.0 -
qParam_[prec].edp_.q_w;
}
f *= 1.0 -
qParam_[prec].edp_.q_w;
if (mredMode ==
rio_c)
for (i = 0; i <=
prec; i ++)
f +=
qParam_[i].edp_.q_w * qParam_[i].qlen;
else if (mredMode
== rio_d)
f +=
qParam_[prec].edp_.q_w * qParam_[prec].qlen;
else
//wred
f +=
qParam_[prec].edp_.q_w * q_->length();
if (mredMode ==
wred)
for (i = 0; i <
numPrec; i ++)
qParam_[prec].edv_.v_ave = f;
else //rio_c,
rio_d
qParam_[prec].edv_.v_ave = f;
}