formula.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAXRATE   25000000.0
#define SAMLLFLOAT   0.0000001

Functions

static double p_to_b (double p, double rtt, double tzero, int psize, int bval)


Define Documentation

#define MAXRATE   25000000.0
 

Definition at line 1 of file formula.h.

Referenced by p_to_b().

#define SAMLLFLOAT   0.0000001
 

Definition at line 2 of file formula.h.

Referenced by p_to_b().


Function Documentation

static double p_to_b double  p,
double  rtt,
double  tzero,
int  psize,
int  bval
[static]
 

Definition at line 8 of file formula.h.

References MAXRATE, and SAMLLFLOAT.

Referenced by b_to_p(), and TfrcAgent::recv().

00009 {
00010     double tmp1, tmp2, res;
00011 
00012     if (p < 0 || rtt < 0) {
00013         return MAXRATE ; 
00014     }
00015     res=rtt*sqrt(2*bval*p/3);
00016     tmp1=3*sqrt(3*bval*p/8);
00017     if (tmp1>1.0) tmp1=1.0;
00018     tmp2=tzero*p*(1+32*p*p);
00019     res+=tmp1*tmp2;
00020 //  if (formula_ == 1 && p > 0.25) { 
00021 //      // Get closer to RFC 3714, Table 1.
00022 //      // This is for TCP-friendliness with a TCP flow without ECN
00023 //      //   and without timestamps.
00024 //      // Just for experimental purposes. 
00025 //      if p > 0.70) {
00026 //          res=res*18.0;
00027 //      } else if p > 0.60) {
00028 //          res=res*7.0;
00029 //      } else if p > 0.50) {
00030 //          res=res*5.0;
00031 //      } else if p > 0.45) {
00032 //          res=res*4.0;
00033 //      } else if p > 0.40) {
00034 //          res=res*3.0;
00035 //      } else if p > 0.25) {
00036 //          res=res*2.0;
00037 //      }
00038 //  }
00039     // At this point, 1/res gives the sending rate in pps:
00040     // 1/(rtt*sqrt(2*bval*p/3) + 3*sqrt(3*bval*p/8)*tzero*p*(1+32*p*p))
00041     if (res < SAMLLFLOAT) {
00042         res=MAXRATE;
00043     } else {
00044         // change from 1/pps to Bps.
00045         res=psize/res;
00046     }
00047     if (res > MAXRATE) {
00048         res = MAXRATE ; 
00049     }
00050     return res;
00051 }


Generated on Tue Mar 6 16:52:51 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6