33 "red",
"green",
"yellow",
"brown",
"grey",
"violet",
"pink",
"orange"};
70 new cMessage(
"endSimulationNotificationTimer");
93 std::vector<std::string> churnGeneratorTypes =
94 cStringTokenizer(par(
"churnGeneratorTypes"),
" ").asVector();
95 std::vector<std::string> terminalTypes =
96 cStringTokenizer(par(
"terminalTypes"),
" ").asVector();
98 if (terminalTypes.size() != 1
99 && churnGeneratorTypes.size() != terminalTypes.size())
101 opp_error(
"UnderlayConfigurator.initialize(): "
102 "terminalTypes size does not match churnGenerator size");
105 for (std::vector<std::string>::iterator it =
106 churnGeneratorTypes.begin(); it != churnGeneratorTypes.end(); ++it) {
108 cModuleType* genType = cModuleType::get(it->c_str());
110 if (genType == NULL) {
111 throw cRuntimeError((std::string(
"UnderlayConfigurator::"
112 "initialize(): invalid churn generator: ") + *it).c_str());
116 (genType->create(
"churnGenerator",
121 gen->finalizeParameters();
123 if ((*it ==
"oversim.common.LifetimeChurn" ||
124 *it ==
"oversim.common.ParetoChurn") &&
125 ((
double)gen->par(
"noChurnThreshold") > 0) &&
126 ((
double)gen->par(
"lifetimeMean") >=
127 (double)gen->par(
"noChurnThreshold"))) {
130 cModuleType* genType =
131 cModuleType::get(
"oversim.common.NoChurn");
133 (genType->create(
"churnGenerator", getParentModule(),
135 gen->finalizeParameters();
136 EV <<
"[UnderlayConfigurator::initialize()]\n"
137 <<
" churnGenerator[" << t.
typeID
138 <<
"]: \"oversim.common.NoChurn\" is used instead of \""
139 << *it <<
"\"!\n (lifetimeMean exceeds noChurnThreshold)"
147 terminalTypes[it - churnGeneratorTypes.begin()];
158 Enter_Method_Silent();
172 throw cRuntimeError(
"UnderlayConfigurator::initFinished():"
173 " gracefulLeaveDelay must be bigger "
174 "than transitionTime + measurementTime!");
218 struct timeval now, diff;
219 gettimeofday(&now, NULL);
222 std::stringstream ss;
223 std::string line1(71,
'*');
224 std::string line2(71,
'*');
226 ss <<
" " << text <<
" ";
227 line1.replace(35 - ss.str().size() / 2,
232 ss <<
" (sim time: " << simTime()
233 <<
", real time: " << diff.tv_sec
234 <<
"." << diff.tv_usec <<
") ";
235 line2.replace(35 - ss.str().size() / 2,
239 std::cout <<
"\n" << line1 <<
"\n"
240 << line2 <<
"\n" << std::endl;
242 EV <<
"[UnderlayConfigurator::consoleOut()] " << text;
248 Enter_Method_Silent();
255 Enter_Method_Silent();