RedRouter Class Reference

#include <asim.h>

Collaboration diagram for RedRouter:

Collaboration graph
[legend]

Detailed Description

Definition at line 58 of file asim.h.

Public Member Functions

double ComputeProbability (double Lambda, double &Delay)
short Identical (int mTh, int MTh, double MP)
 RedRouter (int mTh, int MTh, double MP)

Private Member Functions

void Populate ()

Private Attributes

double Lambda_H
double Lambda_L
double MaxP
double MaxTh
double MinTh


Constructor & Destructor Documentation

RedRouter::RedRouter int  mTh,
int  MTh,
double  MP
[inline]
 

Definition at line 65 of file asim.h.

References MaxP, MaxTh, MinTh, and Populate().

00065                                          {
00066     MinTh = mTh;
00067     MaxTh = MTh;
00068     MaxP = MP; 
00069     Populate();
00070   }

Here is the call graph for this function:


Member Function Documentation

double RedRouter::ComputeProbability double  Lambda,
double &  Delay
 

Definition at line 89 of file asim.h.

References a, b, Lambda_H, Lambda_L, MaxP, MaxTh, and MinTh.

00089                                                                  {
00090   double p;
00091   
00092   if (Lambda <= Lambda_L) {
00093     delay = Lambda/(1-Lambda);
00094     return 0;
00095   }
00096 
00097   if (MaxP < 1 && Lambda > Lambda_H) {
00098     delay = MaxTh;
00099     p = (Lambda - Lambda_H*(1 - MaxP))/Lambda;
00100     return p;
00101   }
00102 
00103   // Solve the quadratic a.p^2 + b.p + c = 0
00104   double a, b, c;
00105   a = Lambda * (MaxTh - MinTh)/(MaxP);
00106   b = (MaxTh - MinTh)*(1-Lambda)/MaxP + MinTh * Lambda + Lambda;
00107   c = MinTh*(1-Lambda)-Lambda;
00108 
00109   p = (-b + sqrt(b*b - 4 * a * c))/(2 * a);
00110   delay = Lambda*(1-p)/(1-(Lambda*(1-p)));
00111   return p;
00112 }

short RedRouter::Identical int  mTh,
int  MTh,
double  MP
[inline]
 

Definition at line 72 of file asim.h.

References MaxP, MaxTh, and MinTh.

00072                                                {
00073     return (mTh == MinTh &&
00074         MTh == MaxTh &&
00075         MP  == MaxP);
00076   }

void RedRouter::Populate  )  [private]
 

Definition at line 79 of file asim.h.

References Lambda_H, Lambda_L, MaxP, MaxTh, and MinTh.

Referenced by RedRouter().

00079                          {
00080   // rho = Lambda_L: p = 0 => rho/(1-rho) = MinTh
00081   Lambda_L = ((double)MinTh)/((double)(1+MinTh));
00082 
00083   // rho = Lambda_H: p = Max_p => rho(1-Max_p)/(1-rho(1-Max_p)) = MaxTh;
00084   if (MaxP < 1)
00085     Lambda_H = ((double)MaxTh)/((double)(1+MaxTh))/(1-MaxP);
00086 }


Field Documentation

double RedRouter::Lambda_H [private]
 

Definition at line 61 of file asim.h.

Referenced by ComputeProbability(), and Populate().

double RedRouter::Lambda_L [private]
 

Definition at line 60 of file asim.h.

Referenced by ComputeProbability(), and Populate().

double RedRouter::MaxP [private]
 

Definition at line 59 of file asim.h.

Referenced by ComputeProbability(), Identical(), Populate(), and RedRouter().

double RedRouter::MaxTh [private]
 

Definition at line 59 of file asim.h.

Referenced by ComputeProbability(), Identical(), Populate(), and RedRouter().

double RedRouter::MinTh [private]
 

Definition at line 59 of file asim.h.

Referenced by ComputeProbability(), Identical(), Populate(), and RedRouter().


The documentation for this class was generated from the following file:
Generated on Tue Mar 6 17:27:19 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6