models.h File Reference

#include <math.h>
#include <stdlib.h>

Include dependency graph for models.h:

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

Go to the source code of this file.

Functions

double Binomial_aggregations (double mu, double p)
int Inet_default_no_hops (int diameter)
int Power_law_no_hops (double delta, double H)

Variables

static double table12 [12] = {0.000668, 0.068453, 0.367716, 0.359951, 0.147371, 0.042277, 0.010313, 0.002502, 0.000501, 0.000072, 0.000009, 0.000000}
static double table15 [15] = {0.000413, 0.057850, 0.363636, 0.380317, 0.148284, 0.037265, 0.008711, 0.002397, 0.000726, 0.000241, 0.000051, 0.000008, 0.000001, 0.000000, 0.000000}
static double table16 [16] = {0.000212, 0.044467, 0.327070, 0.390380, 0.170797, 0.049427, 0.013169, 0.003272, 0.000855, 0.000246, 0.000046, 0.000008, 0.000001, 0.000000, 0.000000, 0.000000}
static double table20 [20] = {0.000310, 0.001993, 0.006046, 0.019854, 0.045055, 0.072606, 0.079511, 0.061733, 0.037823, 0.019340, 0.009756, 0.005144, 0.002635, 0.001085, 0.000363, 0.000108, 0.000036, 0.000013, 0.000004, 0.000001}


Function Documentation

double Binomial_aggregations double  mu,
double  p
 

Definition at line 38 of file models.c.

00038                                                  {
00039 return(mu*ceil(log10(1-drand48())/log10(p)));
00040 }

int Inet_default_no_hops int  diameter  ) 
 

Definition at line 12 of file models.c.

References table12, table15, table16, and table20.

Referenced by CBRTrafficInet(), and set_Topology().

00012                                       {
00013   int i;
00014   double *table;
00015   double sum,ran;
00016   int hops=-1;
00017   switch(diameter){
00018   case 20 : { table = table20;break;}
00019   case 16 : { table = table16;break;} 
00020   case 15 : { table = table15;break;}
00021   case 12 : { table = table12;break;}
00022   default : { table = table20; diameter=20; break;}
00023   }
00024   ran = drand48();
00025   sum=0;
00026   for(i=1;i<=diameter;i++){
00027     sum+=table[i-1];
00028     if(ran<sum){
00029       hops=i;
00030       break;
00031     }
00032   }
00033   if(hops==-1)
00034     hops=diameter;
00035   return(hops);
00036 }

int Power_law_no_hops double  delta,
double  H
 

Definition at line 3 of file models.c.

References pow().

Referenced by CBRTrafficGen().

00003                                              {
00004   int hop;
00005   double ran;
00006   ran = drand48();
00007   hop = (int) ceil(delta*pow(ran,1/H) );
00008   return(hop);
00009 }

Here is the call graph for this function:


Variable Documentation

double table12[12] = {0.000668, 0.068453, 0.367716, 0.359951, 0.147371, 0.042277, 0.010313, 0.002502, 0.000501, 0.000072, 0.000009, 0.000000} [static]
 

Definition at line 8 of file models.h.

Referenced by Inet_default_no_hops().

double table15[15] = {0.000413, 0.057850, 0.363636, 0.380317, 0.148284, 0.037265, 0.008711, 0.002397, 0.000726, 0.000241, 0.000051, 0.000008, 0.000001, 0.000000, 0.000000} [static]
 

Definition at line 6 of file models.h.

Referenced by Inet_default_no_hops().

double table16[16] = {0.000212, 0.044467, 0.327070, 0.390380, 0.170797, 0.049427, 0.013169, 0.003272, 0.000855, 0.000246, 0.000046, 0.000008, 0.000001, 0.000000, 0.000000, 0.000000} [static]
 

Definition at line 4 of file models.h.

Referenced by Inet_default_no_hops().

double table20[20] = {0.000310, 0.001993, 0.006046, 0.019854, 0.045055, 0.072606, 0.079511, 0.061733, 0.037823, 0.019340, 0.009756, 0.005144, 0.002635, 0.001085, 0.000363, 0.000108, 0.000036, 0.000013, 0.000004, 0.000001} [static]
 

Definition at line 11 of file models.h.

Referenced by Inet_default_no_hops().


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