ParetoChurn.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 //
00018 
00026 #ifndef __PARETOCHURN_H_
00027 #define __PARETOCHURN_H_
00028 
00029 #include <ChurnGenerator.h>
00030 
00031 class TransportAddress;
00032 class GlobalStatistics;
00033 
00046 class ParetoChurn : public ChurnGenerator
00047 {
00048 public:
00049     void handleMessage(cMessage* msg);
00050     void initializeChurn();
00051     ParetoChurn() { initFinishedTimer = NULL; };
00052     ~ParetoChurn();
00053 
00054 protected:
00055     struct node_stat {
00056         double l;
00057         double d;
00058         bool alive;
00059     };
00060     void updateDisplayString();
00061     void createNode(double lifetime, double meanLifetime, double meanDeadtime, bool initialize);
00062     void deleteNode(TransportAddress& addr, double meanLifetime, double meanDeadtime);
00063 
00066         double shiftedPareto(double a, double b, int rng=0);
00067 
00074         double betaByMean(double mean, double alpha=3);
00075 
00081         double individualMeanTime(double mean);
00082 
00088         double individualLifetime(double mean);
00089 
00095         double residualLifetime(double mean);
00096 
00097         void scheduleCreateNodeAt(double creationTime, double lifetime, double meanLifetime, double meanDeadtime);
00098 
00099 
00100 
00101 private:
00102         GlobalStatistics* globalStatistics;         //*< pointer to GlobalStatistics module in this node */
00103 
00104         double initialMean; 
00105         double initialDeviation; 
00106         double lifetimeMean; 
00107         double deadtimeMean; 
00108 
00109         simtime_t lastCreatetime;
00110         simtime_t lastDeletetime;
00111 
00112         cMessage* initFinishedTimer; 
00113 };
00114 
00115 #endif
Generated on Wed May 26 16:21:14 2010 for OverSim by  doxygen 1.6.3