98 #include <mesosim/MELoop.h>
106 #ifdef CHECK_MEMORY_LEAKS
108 #endif // CHECK_MEMORY_LEAKS
157 throw ProcessError(
"A network was not yet constructed.");
165 myRouterTTInitialized(false),
166 myRouterTTDijkstra(0),
170 throw ProcessError(
"A network was already constructed.");
207 std::vector<SUMOTime> stateDumpTimes,
208 std::vector<std::string> stateDumpFiles) {
246 myMsgEmitter.clear();
255 delete MSGlobals::gMesoNet;
311 std::ostringstream msg;
312 msg <<
"Performance: " <<
"\n" <<
" Duration: " << duration <<
" ms" <<
"\n";
315 msg.setf(std::ios::fixed , std::ios::floatfield);
316 msg.setf(std::ios::showpoint);
322 const std::string collisionNotice = (
325 const std::string teleportNotice = (
329 msg <<
"Vehicles: " <<
"\n"
360 std::ofstream strm(
myStateDumpFiles[dist].c_str(), std::fstream::out | std::fstream::binary);
375 MSGlobals::gMesoNet->simulate(
myStep);
457 if (stopTime >= 0 &&
myStep >= stopTime) {
470 return "The final simulation step has been reached.";
472 return "All vehicles have left the simulation.";
474 return "TraCI requested termination.";
476 return "An error occured (see log).";
478 return "Too many vehicles.";
480 return "Unknown reason.";
538 timestep = timestep.substr(0, timestep.length() - 3);
540 std::string filename = output +
"_" + timestep +
".vtp";
560 <<
"meanWaitingTime=\"";
562 od <<
"\" meanTravelTime=\"";
583 MSNet::saveState(std::ostream& os) {
589 MSRoute::dict_saveState(os);
592 MSGlobals::gMesoNet->saveState(os);
600 unsigned int sizeT, fpSize, numEdges;
610 if (sizeT !=
sizeof(
size_t)) {
611 WRITE_WARNING(
"State was written on a different platform (32bit vs. 64bit)!");
614 WRITE_WARNING(
"State was written with a different precision for SUMOReal!");
620 MSRoute::dict_loadState(bis);
657 std::ostringstream oss;
658 oss.setf(std::ios::fixed , std::ios::floatfield);
659 oss.setf(std::ios::showpoint);
666 oss <<
" (0ms ?*RT. ?";
668 oss <<
"UPS, vehicles"
673 std::cout << oss.str().substr(0, 78 - prev.length());
699 (*i)->vehicleStateChanged(vehicle, to);
721 for (std::map<std::string, MSBusStop*>::const_iterator it = vals.begin(); it != vals.end(); ++it) {
724 return stop->
getID();
736 if (routingAlgorithm ==
"dijkstra") {
740 if (routingAlgorithm !=
"astar") {
741 WRITE_WARNING(
"TraCI and Triggers cannot use routing algorithm '" + routingAlgorithm +
"'. using 'astar' instead.");
772 MSNet::getMsgEmitter(
const std::string& whatemit) {
774 msgEmitVec = myMsgEmitter.buildAndGetStaticVector();
775 for (std::vector<MSMessageEmitter*>::iterator it = msgEmitVec.begin(); it != msgEmitVec.end(); ++it) {
776 if ((*it)->getEventsEnabled(whatemit)) {
785 MSNet::createMsgEmitter(std::string&
id,
787 const std::string& base,
788 std::string& whatemit,
793 MSMessageEmitter* msgEmitter =
new MSMessageEmitter(file, base, whatemit, reverse, table, xy, step);
794 myMsgEmitter.add(
id, msgEmitter);