#include <socMovGen.h>
Protected Member Functions | |
| virtual void | initialize (int) |
| generates the mobility tracefile according to the given parameters | |
Protected Attributes | |
| double | totalSimulationTime |
| Sets the total simulation time. | |
| double | reconfigurationInterval |
| Sets the reconfiguration interval. | |
| int | numberOfEpochs |
| Sets the number of the epochs. | |
| double | minHostSpeed |
| Sets lower bound of the speed of the hosts (in m/s). | |
| double | maxHostSpeed |
| Sets upper bound of the speed of the hosts (in m/s). | |
| double | connectionThreshold |
| Sets the connection threshold, for which a frienship is regarded. | |
| double | sideLength_X |
| Defines the x-axis length of the simulation ground (in meters). | |
| double | sideLength_Y |
| Defines the y-axis length of the simulation ground (in meters). | |
| int | numberOfRows |
| Sets the number of rows of the simulation ground. | |
| int | numberOfColumns |
| Sets the number of columns of the simulation ground. | |
| double | radius |
| Sets the transmission range (in m) -- not so important. | |
| double | rewiringProb |
| Sets the rewiring probability during the model initialization. | |
| int | numberOfGroups |
| Sets the initial number of groups for the Caveman model. | |
| int | numHosts |
| Used for the total number of hosts participating in the simulation. | |
| int | numberOfTravellers |
| Sets the number of travelers. | |
| int | pauseTime |
| Sets the maximum pause time duration. | |
| double | travellerSpeed |
| Sets the speed of the travelers. | |
| unsigned | inputSeed |
| Sets the seed of the Random Number Generator. | |
| bool | girvanNewmanOn |
| Sets the Girvan-Newman algorithm on/off. | |
| bool | colocationTracesOn |
| Sets the colocation traces on/off. | |
| bool | communitiesTracesOn |
| Sets the communities traces on/off. | |
| bool | deterministicOn |
| Sets the deterministic selection of the nodes on/off. If true the selection is deterministic, if false is probabilistic. | |
| bool | generateXML |
| Generates XML. | |
| bool | readAdjacency |
| Indicates whether an input adjacency file will be used. | |
| bool | outAdjacency |
| Sets the output adjacency file generation on/off. | |
| std::string | inputFile |
| Sets the the name of the input adjacency file. | |
| std::string | mobType |
| Three mobility models are supported, the CMM, the HCMM and the ECMM. | |
| void socMovGen::initialize | ( | int | stage | ) | [protected, virtual] |
generates the mobility tracefile according to the given parameters
Reimplemented from cComponent.
00038 { 00039 if(stage==0) 00040 { 00041 // Read ned parameters 00042 totalSimulationTime=par("totalSimulationTime"); 00043 reconfigurationInterval=par("reconfigurationInterval"); 00044 numberOfEpochs=par("numberOfEpochs"); 00045 minHostSpeed=par("minHostSpeed"); 00046 maxHostSpeed=par("maxHostSpeed"); 00047 connectionThreshold=par("connectionThreshold"); 00048 numberOfRows=par("numberOfRows"); 00049 numberOfColumns=par("numberOfColumns"); 00050 radius=par("radius"); 00051 rewiringProb=par("rewiringProb"); 00052 numberOfGroups=par("numberOfGroups"); 00053 numberOfTravellers=par("numberOfTravellers"); 00054 travellerSpeed=par("travellerSpeed"); 00055 girvanNewmanOn=par("girvanNewmanOn"); 00056 colocationTracesOn=par("colocationTracesOn"); 00057 communitiesTracesOn=par("communitiesTracesOn"); 00058 deterministicOn=par("deterministicOn"); 00059 generateXML=par("generateXML"); 00060 readAdjacency=par("readAdjacency"); 00061 inputFile=par("inputFile").stringValue(); 00062 mobType=par("mobType").stringValue(); 00063 pauseTime=par("pauseTime"); 00064 outAdjacency=par("outputAdjacency"); 00065 00066 // Read number of Hosts and ground size from network 00067 numHosts=getParentModule()->par("numHosts"); 00068 sideLength_X=getParentModule()->par("playgroundSizeX"); 00069 sideLength_Y=getParentModule()->par("playgroundSizeY"); 00070 00071 // String to capture parameters 00072 const char* buf; 00073 00074 std::string parmts; 00075 //Select mobility type 00076 if (mobType.compare("CMM")==0) 00077 parmts="../src/SocialMobility/movGen"; 00078 else if (mobType.compare("HCMM")==0) 00079 parmts="../src/SocialMobility/homeMovGen"; 00080 else 00081 parmts="../src/SocialMobility/enMovGen"; 00082 00083 std::stringstream out; 00084 00085 // Generate Input Seed for random generator 00086 srand ( time(NULL) ); 00087 inputSeed=par("randSeed"); 00088 // If input seed has default value set a random one 00089 if(inputSeed==0) 00090 inputSeed=intrand(100000); 00091 00092 ev << "Social Mobility model created with random seed: " << inputSeed << endl; 00093 00094 //Create the output file using the run number to allow multiple runs 00095 if(generateXML==true) { 00096 out << " -x" << " socMov-" << ev.getConfigEx()->getActiveRunNumber(); 00097 } 00098 00099 // Add boolean parameters to string 00100 if(deterministicOn==true) 00101 parmts+=" -d on"; 00102 else 00103 parmts+=" -d off"; 00104 if(communitiesTracesOn==true) 00105 parmts+=" -b on"; 00106 else 00107 parmts+=" -b off"; 00108 if(colocationTracesOn==true) 00109 parmts+=" -A on"; 00110 else 00111 parmts+=" -A off"; 00112 if(girvanNewmanOn==true) 00113 parmts+=" -a on"; 00114 else 00115 parmts+=" -a off"; 00116 if(outAdjacency==true) 00117 parmts+=" -o on"; 00118 else 00119 parmts+=" -o off"; 00120 if(readAdjacency==true) 00121 parmts+=" -i " + inputFile; 00122 00123 // Copying parameters to string 00124 out << " -n " << numHosts; 00125 out << " -t " << totalSimulationTime; 00126 out << " -r " << reconfigurationInterval; 00127 out << " -s " << minHostSpeed; 00128 out << " -S " << maxHostSpeed; 00129 out << " -p " << connectionThreshold; 00130 out << " -X " << sideLength_X; 00131 out << " -Y " << sideLength_Y; 00132 out << " -R " << numberOfRows; 00133 out << " -C " << numberOfColumns; 00134 out << " -T " << radius; 00135 out << " -w " << rewiringProb; 00136 out << " -G " << numberOfGroups; 00137 out << " -c " << numberOfTravellers; 00138 out << " -v " << travellerSpeed; 00139 out << " -g " << inputSeed; 00140 out << " -P " << pauseTime; 00141 out << " -e " << numberOfEpochs; 00142 parmts+=(out.str()); 00143 00144 buf = parmts.c_str(); 00145 buf = const_cast<char*>(buf); 00146 00147 // Check if system responds 00148 if (system(NULL)) puts ("Ok"); 00149 else exit(1); 00150 00151 // Create trace file 00152 if(totalSimulationTime!=-1) { 00153 if(system(buf)==0) 00154 { 00155 EV << "Community Model trace file created with the command:"<< endl; 00156 EV << buf << endl; 00157 } 00158 else { 00159 EV << buf << endl; 00160 error("Problem in creating Community Model trace file..."); 00161 } 00162 } 00163 00164 } 00165 }
bool socMovGen::colocationTracesOn [protected] |
Sets the colocation traces on/off.
bool socMovGen::communitiesTracesOn [protected] |
Sets the communities traces on/off.
double socMovGen::connectionThreshold [protected] |
Sets the connection threshold, for which a frienship is regarded.
bool socMovGen::deterministicOn [protected] |
Sets the deterministic selection of the nodes on/off. If true the selection is deterministic, if false is probabilistic.
bool socMovGen::generateXML [protected] |
Generates XML.
bool socMovGen::girvanNewmanOn [protected] |
Sets the Girvan-Newman algorithm on/off.
std::string socMovGen::inputFile [protected] |
Sets the the name of the input adjacency file.
unsigned socMovGen::inputSeed [protected] |
Sets the seed of the Random Number Generator.
double socMovGen::maxHostSpeed [protected] |
Sets upper bound of the speed of the hosts (in m/s).
double socMovGen::minHostSpeed [protected] |
Sets lower bound of the speed of the hosts (in m/s).
std::string socMovGen::mobType [protected] |
Three mobility models are supported, the CMM, the HCMM and the ECMM.
int socMovGen::numberOfColumns [protected] |
Sets the number of columns of the simulation ground.
int socMovGen::numberOfEpochs [protected] |
Sets the number of the epochs.
int socMovGen::numberOfGroups [protected] |
Sets the initial number of groups for the Caveman model.
int socMovGen::numberOfRows [protected] |
Sets the number of rows of the simulation ground.
int socMovGen::numberOfTravellers [protected] |
Sets the number of travelers.
int socMovGen::numHosts [protected] |
Used for the total number of hosts participating in the simulation.
bool socMovGen::outAdjacency [protected] |
Sets the output adjacency file generation on/off.
int socMovGen::pauseTime [protected] |
Sets the maximum pause time duration.
double socMovGen::radius [protected] |
Sets the transmission range (in m) -- not so important.
bool socMovGen::readAdjacency [protected] |
Indicates whether an input adjacency file will be used.
double socMovGen::reconfigurationInterval [protected] |
Sets the reconfiguration interval.
double socMovGen::rewiringProb [protected] |
Sets the rewiring probability during the model initialization.
double socMovGen::sideLength_X [protected] |
Defines the x-axis length of the simulation ground (in meters).
double socMovGen::sideLength_Y [protected] |
Defines the y-axis length of the simulation ground (in meters).
double socMovGen::totalSimulationTime [protected] |
Sets the total simulation time.
double socMovGen::travellerSpeed [protected] |
Sets the speed of the travelers.
1.6.3