OverSim
ParetoChurn.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
26 #ifndef __PARETOCHURN_H_
27 #define __PARETOCHURN_H_
28 
29 #include <ChurnGenerator.h>
30 
31 class TransportAddress;
32 class GlobalStatistics;
33 
47 {
48 public:
49  void handleMessage(cMessage* msg);
50  void initializeChurn();
52  ~ParetoChurn();
53 
54 protected:
55  struct node_stat {
56  double l;
57  double d;
58  bool alive;
59  };
60  void updateDisplayString();
61  void createNode(double lifetime, double meanLifetime, double meanDeadtime, bool initialize);
62  void deleteNode(TransportAddress& addr, double meanLifetime, double meanDeadtime);
63 
66  double shiftedPareto(double a, double b, int rng=0);
67 
74  double betaByMean(double mean, double alpha=3);
75 
81  double individualMeanTime(double mean);
82 
88  double individualLifetime(double mean);
89 
95  double residualLifetime(double mean);
96 
97  void scheduleCreateNodeAt(double creationTime, double lifetime, double meanLifetime, double meanDeadtime);
98 
99 
100 
101 private:
102  GlobalStatistics* globalStatistics; //*< pointer to GlobalStatistics module in this node */
103 
104  double initialMean;
106  double lifetimeMean;
107  double deadtimeMean;
108 
109  simtime_t lastCreatetime;
110  simtime_t lastDeletetime;
111 
112  cMessage* initFinishedTimer;
113 };
114 
115 #endif