#include <UnderlayConfigurator.h>
Inheritance diagram for UnderlayConfigurator:
Public Member Functions | |
bool | isInit () |
still in initialization phase? | |
Public Attributes | |
timeval | initFinishedTime |
timestamp at end of init phase | |
Protected Member Functions | |
int | numInitStages () const |
OMNeT number of init stages. | |
virtual void | initialize (int stage) |
OMNeT init methods. | |
virtual void | initializeUnderlay (int stage)=0 |
Init method for derived underlay configurators. | |
virtual int | createRandomNode (bool initialize)=0 |
Creates an overlay node. | |
virtual void | killRandomNode ()=0 |
Removes randomly chosen overlay nodes from a randomly chosen access net. | |
virtual void | migrateRandomNode ()=0 |
Migrates randomly chosen overlay nodes from on access net to another. | |
virtual void | finish ()=0 |
Cleans up configurator. | |
virtual void | setDisplayString ()=0 |
Sets display string. | |
void | handleMessage (cMessage *msg) |
Node mobility simulation. | |
Protected Attributes | |
std::vector< std::string > | channelTypes |
possible access types | |
bool | init |
still in initialization phase? | |
int | initialOverlayTerminalNum |
number of overlay terminals at beginning of simulation | |
int | targetOverlayTerminalNum |
final number of overlay terminals | |
int | overlayTerminalCount |
current number of overlay terminals | |
bool | keepFirstNode |
int | firstNodeId |
BootstrapOracle * | bootstrapOracle |
pointer to BootstrapOracle | |
Private Attributes | |
double | creationProbability |
probability of creating a new overlay terminal | |
double | migrationProbability |
probability of migrating an overlay terminal | |
double | removalProbability |
probability of removing an overlay terminal | |
double | initialMean |
mean of update interval during initalization phase | |
double | initialDeviation |
deviation of update interval during initalization phase | |
double | targetMean |
mean of update interval after initalization phase | |
cMessage * | churnMsg |
bool | churnIntervalChanged |
virtual int UnderlayConfigurator::createRandomNode | ( | bool | initialize | ) | [protected, pure virtual] |
Creates an overlay node.
initialize |
Implemented in IPv4UnderlayConfigurator, SimpleNetConfigurator, and SingleHostConfigurator.
virtual void UnderlayConfigurator::finish | ( | ) | [protected, pure virtual] |
Cleans up configurator.
Implemented in IPv4UnderlayConfigurator, SimpleNetConfigurator, and SingleHostConfigurator.
void UnderlayConfigurator::handleMessage | ( | cMessage * | msg | ) | [protected] |
Node mobility simulation.
msg | timer-message |
00065 { 00066 //schedule churnMsg 00067 if((double)(par("churnChangeInterval")) == 0) { 00068 targetMean = par("targetMobilityDelay"); 00069 churnIntervalChanged = false; 00070 } else if(!churnMsg->isScheduled()) { 00071 scheduleAt(simulation.simTime() + (double)(par("churnChangeInterval")), churnMsg); 00072 } 00073 00074 if(msg == churnMsg) { 00075 if(churnIntervalChanged) { 00076 targetMean = par("targetMobilityDelay"); 00077 churnIntervalChanged = false; 00078 } else { 00079 targetMean = par("targetMobilityDelay2"); 00080 churnIntervalChanged = true; 00081 } 00082 std::stringstream temp; 00083 temp << "Churn-rate changed to " << targetMean; 00084 bubble(temp.str().c_str()); 00085 } 00086 else if ( init ) { 00087 // increase the number of nodes steadily during setup 00088 00089 init = (overlayTerminalCount < (int)par("targetOverlayTerminalNum")); 00090 00091 if (!init) 00092 gettimeofday(&initFinishedTime, NULL); 00093 else 00094 createRandomNode(false); 00095 00096 scheduleAt(simulation.simTime() 00097 + truncnormal(initialMean, initialDeviation), msg); 00098 } else { 00099 double random = uniform(0, 1); 00100 00101 // modify the number of nodes according to user parameters 00102 if (overlayTerminalCount != 0) { 00103 if(random < creationProbability) { 00104 createRandomNode(false); 00105 } else if(creationProbability <= random && 00106 random < creationProbability + removalProbability && 00107 overlayTerminalCount > 1) { 00108 killRandomNode(); 00109 } else if ( creationProbability + removalProbability <= random && 00110 random < creationProbability + removalProbability 00111 + migrationProbability) { 00112 migrateRandomNode(); 00113 } 00114 } 00115 scheduleAt(simulation.simTime() + truncnormal(targetMean, targetMean / 3), msg); 00116 } 00117 setDisplayString(); 00118 }
void UnderlayConfigurator::initialize | ( | int | stage | ) | [protected, virtual] |
OMNeT init methods.
00036 { 00037 if(stage == MIN_STAGE_UNDERLAY) { 00038 initialOverlayTerminalNum = par("initialOverlayTerminalNum"); 00039 targetOverlayTerminalNum = par("targetOverlayTerminalNum"); 00040 creationProbability = par("creationProbability"); 00041 migrationProbability = par("migrationProbability"); 00042 removalProbability = par("removalProbability"); 00043 initialMean = par("initialMobilityDelay"); 00044 initialDeviation = initialMean / 3; 00045 targetMean = par("targetMobilityDelay"); 00046 WATCH(targetMean); 00047 //targetDeviation = targetMean / 3; 00048 channelTypes = cStringTokenizer(par("channelTypes"), " ").asVector(); 00049 init = true; 00050 gettimeofday(&initFinishedTime, NULL); 00051 bootstrapOracle = BootstrapOracleAccess().get(); 00052 keepFirstNode = par("keepFirstNode"); 00053 firstNodeId = -1; 00054 WATCH(firstNodeId); 00055 00056 churnMsg = new cMessage; 00057 churnIntervalChanged = false; 00058 } 00059 00060 if(stage >= MIN_STAGE_UNDERLAY && stage <= MAX_STAGE_UNDERLAY) 00061 initializeUnderlay(stage); 00062 }
virtual void UnderlayConfigurator::initializeUnderlay | ( | int | stage | ) | [protected, pure virtual] |
Init method for derived underlay configurators.
Implemented in IPv4UnderlayConfigurator, SimpleNetConfigurator, and SingleHostConfigurator.
bool UnderlayConfigurator::isInit | ( | ) | [inline] |
virtual void UnderlayConfigurator::killRandomNode | ( | ) | [protected, pure virtual] |
Removes randomly chosen overlay nodes from a randomly chosen access net.
Implemented in IPv4UnderlayConfigurator, SimpleNetConfigurator, and SingleHostConfigurator.
virtual void UnderlayConfigurator::migrateRandomNode | ( | ) | [protected, pure virtual] |
Migrates randomly chosen overlay nodes from on access net to another.
Implemented in IPv4UnderlayConfigurator, SimpleNetConfigurator, and SingleHostConfigurator.
int UnderlayConfigurator::numInitStages | ( | ) | const [protected] |
virtual void UnderlayConfigurator::setDisplayString | ( | ) | [protected, pure virtual] |
Sets display string.
Implemented in IPv4UnderlayConfigurator, SimpleNetConfigurator, and SingleHostConfigurator.
BootstrapOracle* UnderlayConfigurator::bootstrapOracle [protected] |
pointer to BootstrapOracle
std::vector<std::string> UnderlayConfigurator::channelTypes [protected] |
possible access types
bool UnderlayConfigurator::churnIntervalChanged [private] |
cMessage* UnderlayConfigurator::churnMsg [private] |
double UnderlayConfigurator::creationProbability [private] |
probability of creating a new overlay terminal
int UnderlayConfigurator::firstNodeId [protected] |
bool UnderlayConfigurator::init [protected] |
still in initialization phase?
struct timeval UnderlayConfigurator::initFinishedTime |
timestamp at end of init phase
double UnderlayConfigurator::initialDeviation [private] |
deviation of update interval during initalization phase
double UnderlayConfigurator::initialMean [private] |
mean of update interval during initalization phase
int UnderlayConfigurator::initialOverlayTerminalNum [protected] |
number of overlay terminals at beginning of simulation
bool UnderlayConfigurator::keepFirstNode [protected] |
double UnderlayConfigurator::migrationProbability [private] |
probability of migrating an overlay terminal
int UnderlayConfigurator::overlayTerminalCount [protected] |
current number of overlay terminals
double UnderlayConfigurator::removalProbability [private] |
probability of removing an overlay terminal
double UnderlayConfigurator::targetMean [private] |
mean of update interval after initalization phase
int UnderlayConfigurator::targetOverlayTerminalNum [protected] |
final number of overlay terminals