Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSNet.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
25// The simulated network and simulation performer
26/****************************************************************************/
27#include <config.h>
28
29#ifdef HAVE_VERSION_H
30#include <version.h>
31#endif
32
33#include <string>
34#include <iostream>
35#include <sstream>
36#include <typeinfo>
37#include <algorithm>
38#include <cassert>
39#include <vector>
40#include <ctime>
41
42#ifdef HAVE_FOX
44#endif
66#include <utils/xml/XMLSubSys.h>
68#include <libsumo/Helper.h>
69#include <libsumo/Simulation.h>
70#include <mesosim/MELoop.h>
71#include <mesosim/MESegment.h>
108#include <netload/NLBuilder.h>
109
110#include "MSEdgeControl.h"
111#include "MSJunctionControl.h"
112#include "MSInsertionControl.h"
114#include "MSEventControl.h"
115#include "MSEdge.h"
116#include "MSJunction.h"
117#include "MSJunctionLogic.h"
118#include "MSLane.h"
119#include "MSVehicleControl.h"
120#include "MSVehicleTransfer.h"
121#include "MSRoute.h"
122#include "MSGlobals.h"
123#include "MSEdgeWeightsStorage.h"
124#include "MSStateHandler.h"
125#include "MSFrame.h"
126#include "MSParkingArea.h"
127#include "MSStoppingPlace.h"
128#include "MSNet.h"
129
130
131// ===========================================================================
132// debug constants
133// ===========================================================================
134//#define DEBUG_SIMSTEP
135
136
137// ===========================================================================
138// static member definitions
139// ===========================================================================
140MSNet* MSNet::myInstance = nullptr;
141
142const std::string MSNet::STAGE_EVENTS("events");
143const std::string MSNet::STAGE_MOVEMENTS("move");
144const std::string MSNet::STAGE_LANECHANGE("laneChange");
145const std::string MSNet::STAGE_INSERTIONS("insertion");
146const std::string MSNet::STAGE_REMOTECONTROL("remoteControl");
147
149const std::vector<MSStoppingPlace*> MSNet::myEmptyStoppingPlaceVector;
150
151// ===========================================================================
152// static member method definitions
153// ===========================================================================
154double
155MSNet::getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t) {
156 double value;
157 const MSVehicle* const veh = dynamic_cast<const MSVehicle* const>(v);
158 if (veh != nullptr && veh->getWeightsStorage().retrieveExistingEffort(e, t, value)) {
159 return value;
160 }
162 return value;
163 }
164 return 0;
165}
166
167
168double
169MSNet::getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t) {
170 double value;
171 const MSVehicle* const veh = dynamic_cast<const MSVehicle* const>(v);
172 if (veh != nullptr && veh->getWeightsStorage().retrieveExistingTravelTime(e, t, value)) {
173 return value;
174 }
176 return value;
177 }
178 if (veh != nullptr) {
180 return MSRoutingEngine::getEffortExtra(e, v, t);
181 } else if ((veh->getRoutingMode() & libsumo::ROUTING_MODE_AGGREGATED) != 0) {
183 return MSRoutingEngine::getEffortBike(e, v, t);
184 } else {
185 return MSRoutingEngine::getEffort(e, v, t);
186 }
187 } else if (MSRoutingEngine::haveExtras()) {
188 double tt = e->getMinimumTravelTime(v);
190 return tt;
191 }
192 }
193 return e->getMinimumTravelTime(v);
194}
195
196
197// ---------------------------------------------------------------------------
198// MSNet - methods
199// ---------------------------------------------------------------------------
200MSNet*
202 if (myInstance != nullptr) {
203 return myInstance;
204 }
205 throw ProcessError(TL("A network was not yet constructed."));
206}
207
208void
213
214void
220
221
222MSNet::MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
223 MSEventControl* endOfTimestepEvents,
224 MSEventControl* insertionEvents,
225 ShapeContainer* shapeCont):
226 myAmInterrupted(false),
227 myVehiclesMoved(0),
228 myPersonsMoved(0),
229 myHavePermissions(false),
230 myHasInternalLinks(false),
231 myJunctionHigherSpeeds(false),
232 myHasElevation(false),
233 myHasPedestrianNetwork(false),
234 myHasBidiEdges(false),
235 myEdgeDataEndTime(-1),
236 myDynamicShapeUpdater(nullptr) {
237 if (myInstance != nullptr) {
238 throw ProcessError(TL("A network was already constructed."));
239 }
241 myStep = string2time(oc.getString("begin"));
243 myMaxTeleports = oc.getInt("max-num-teleports");
244 myLogExecutionTime = !oc.getBool("no-duration-log");
245 myLogStepNumber = !oc.getBool("no-step-log");
246 myLogStepPeriod = oc.getInt("step-log.period");
247 myInserter = new MSInsertionControl(*vc, string2time(oc.getString("max-depart-delay")), oc.getBool("eager-insert"), oc.getInt("max-num-vehicles"),
248 string2time(oc.getString("random-depart-offset")));
249 myVehicleControl = vc;
251 myEdges = nullptr;
252 myJunctions = nullptr;
253 myRouteLoaders = nullptr;
254 myLogics = nullptr;
255 myPersonControl = nullptr;
256 myContainerControl = nullptr;
257 myEdgeWeights = nullptr;
258 myShapeContainer = shapeCont == nullptr ? new ShapeContainer() : shapeCont;
259
260 myBeginOfTimestepEvents = beginOfTimestepEvents;
261 myEndOfTimestepEvents = endOfTimestepEvents;
262 myInsertionEvents = insertionEvents;
263 myLanesRTree.first = false;
264
266 MSGlobals::gMesoNet = new MELoop(string2time(oc.getString("meso-recheck")));
267 }
268 myInstance = this;
269 initStatic();
270}
271
272
273void
275 SUMORouteLoaderControl* routeLoaders,
276 MSTLLogicControl* tlc,
277 std::vector<SUMOTime> stateDumpTimes,
278 std::vector<std::string> stateDumpFiles,
279 bool hasInternalLinks,
280 bool junctionHigherSpeeds,
281 const MMVersion& version) {
282 myEdges = edges;
283 myJunctions = junctions;
284 myRouteLoaders = routeLoaders;
285 myLogics = tlc;
286 // save the time the network state shall be saved at
287 myStateDumpTimes = stateDumpTimes;
288 myStateDumpFiles = stateDumpFiles;
289 myStateDumpPeriod = string2time(oc.getString("save-state.period"));
290 myStateDumpPrefix = oc.getString("save-state.prefix");
291 myStateDumpSuffix = oc.getString("save-state.suffix");
292
293 // initialise performance computation
295 myTraCIMillis = 0;
297 myJunctionHigherSpeeds = junctionHigherSpeeds;
301 myVersion = version;
304 throw ProcessError(TL("Option weights.separate-turns is only supported when simulating with internal lanes"));
305 }
306}
307
308
311 // delete controls
312 delete myJunctions;
313 delete myDetectorControl;
314 // delete mean data
315 delete myEdges;
316 delete myInserter;
317 myInserter = nullptr;
318 delete myLogics;
319 delete myRouteLoaders;
320 if (myPersonControl != nullptr) {
321 delete myPersonControl;
322 myPersonControl = nullptr; // just to have that clear for later cleanups
323 }
324 if (myContainerControl != nullptr) {
325 delete myContainerControl;
326 myContainerControl = nullptr; // just to have that clear for later cleanups
327 }
328 // the CCH metric families (myCCHLive/myCCHFreeflow) own ref vehicles
329 // that hold a raw MSVehicleType*; tear them down before the vehicle
330 // types go away below (MSDevice::cleanupAll() -> MSRoutingEngine::
331 // cleanup() runs this again later via clearAll(), harmlessly, since
332 // cleanupCCH() nulls out what it deletes)
334 delete myVehicleControl; // must happen after deleting transportables
335 // ShapeContainer registers polygon-update commands with the event controls.
336 // It must be torn down before the event controls so that ~ShapeContainer
337 // can still deschedule() its (live) commands; the event controls then
338 // delete the commands themselves.
339 delete myShapeContainer;
340 myShapeContainer = nullptr;
341 // delete events late so that vehicles can get rid of references first
343 myBeginOfTimestepEvents = nullptr;
345 myEndOfTimestepEvents = nullptr;
346 delete myInsertionEvents;
347 myInsertionEvents = nullptr;
348 delete myEdgeWeights;
349 for (auto& router : myRouterTT) {
350 delete router.second;
351 }
352 myRouterTT.clear();
353 for (auto& router : myRouterEffort) {
354 delete router.second;
355 }
356 myRouterEffort.clear();
357 for (auto& router : myPedestrianRouter) {
358 delete router.second;
359 }
360 myPedestrianRouter.clear();
362 myLanesRTree.second.RemoveAll();
364 delete sub;
365 }
366 myTractionSubstations.clear();
367 clearAll();
369 delete MSGlobals::gMesoNet;
370 }
371 myInstance = nullptr;
372}
373
374
375void
376MSNet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
377 myRestrictions[id][svc] = speed;
378}
379
380
381const std::map<SUMOVehicleClass, double>*
382MSNet::getRestrictions(const std::string& id) const {
383 std::map<std::string, std::map<SUMOVehicleClass, double> >::const_iterator i = myRestrictions.find(id);
384 if (i == myRestrictions.end()) {
385 return nullptr;
386 }
387 return &i->second;
388}
389
390
391double
392MSNet::getPreference(const std::string& routingType, const SUMOVTypeParameter& pars) const {
394 auto it = myVTypePreferences.find(pars.id);
395 if (it != myVTypePreferences.end()) {
396 auto it2 = it->second.find(routingType);
397 if (it2 != it->second.end()) {
398 return it2->second;
399 }
400 }
401 auto it3 = myVClassPreferences.find(pars.vehicleClass);
402 if (it3 != myVClassPreferences.end()) {
403 auto it4 = it3->second.find(routingType);
404 if (it4 != it3->second.end()) {
405 return it4->second;
406 }
407 }
408 // fallback to generel preferences
409 it = myVTypePreferences.find("");
410 if (it != myVTypePreferences.end()) {
411 auto it2 = it->second.find(routingType);
412 if (it2 != it->second.end()) {
413 return it2->second;
414 }
415 }
416 }
417 return 1;
418}
419
420
421void
422MSNet::addPreference(const std::string& routingType, SUMOVehicleClass svc, double prio) {
423 myVClassPreferences[svc][routingType] = prio;
424 gRoutingPreferences = true;
425}
426
427
428void
429MSNet::addPreference(const std::string& routingType, std::string vType, double prio) {
430 myVTypePreferences[vType][routingType] = prio;
431 gRoutingPreferences = true;
432}
433
434void
435MSNet::addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType) {
436 myMesoEdgeTypes[typeID] = edgeType;
437}
438
440MSNet::getMesoType(const std::string& typeID) {
441 if (myMesoEdgeTypes.count(typeID) == 0) {
442 // init defaults
445 edgeType.tauff = string2time(oc.getString("meso-tauff"));
446 edgeType.taufj = string2time(oc.getString("meso-taufj"));
447 edgeType.taujf = string2time(oc.getString("meso-taujf"));
448 edgeType.taujj = string2time(oc.getString("meso-taujj"));
449 edgeType.jamThreshold = oc.getFloat("meso-jam-threshold");
450 edgeType.junctionControl = oc.getBool("meso-junction-control");
451 edgeType.tlsPenalty = oc.getFloat("meso-tls-penalty");
452 edgeType.tlsFlowPenalty = oc.getFloat("meso-tls-flow-penalty");
453 edgeType.minorPenalty = string2time(oc.getString("meso-minor-penalty"));
454 edgeType.overtaking = oc.getBool("meso-overtaking");
455 edgeType.edgeLength = oc.getFloat("meso-edgelength");
456 myMesoEdgeTypes[typeID] = edgeType;
457 }
458 return myMesoEdgeTypes[typeID];
459}
460
461
462bool
463MSNet::hasFlow(const std::string& id) const {
464 // inserter is deleted at the end of the simulation
465 return myInserter != nullptr && myInserter->hasFlow(id);
466}
467
468
471 // report the begin when wished
472 WRITE_MESSAGEF(TL("Simulation version % started with time: %."), VERSION_STRING, time2string(start));
473 // the simulation loop
475 // state loading may have changed the start time so we need to reinit it
476 myStep = start;
477 int numSteps = 0;
478 bool doStepLog = false;
479 while (state == SIMSTATE_RUNNING) {
480 doStepLog = myLogStepNumber && (numSteps % myLogStepPeriod == 0);
481 if (doStepLog) {
483 }
485 if (doStepLog) {
487 }
488 state = adaptToState(simulationState(stop));
489#ifdef DEBUG_SIMSTEP
490 std::cout << SIMTIME << " MSNet::simulate(" << start << ", " << stop << ")"
491 << "\n simulation state: " << getStateMessage(state)
492 << std::endl;
493#endif
494 numSteps++;
495 }
496 if (myLogStepNumber && !doStepLog) {
497 // ensure some output on the last step
500 }
501 // exit simulation loop
502 if (myLogStepNumber) {
503 // start new line for final verbose output
504 std::cout << "\n";
505 }
506 closeSimulation(start, getStateMessage(state));
507 return state;
508}
509
510
511void
515
516
517const std::string
518MSNet::generateStatistics(const SUMOTime start, const long now) {
519 std::ostringstream msg;
520 if (myLogExecutionTime) {
521 const long duration = now - mySimBeginMillis;
522 // print performance notice
523 msg << "Performance:\n" << " Duration: " << elapsedMs2string(duration) << "\n";
524 if (duration != 0) {
525 if (TraCIServer::getInstance() != nullptr) {
526 msg << " TraCI-Duration: " << elapsedMs2string(myTraCIMillis) << "\n";
527 }
528 msg << " Real time factor: " << (STEPS2TIME(myStep - start) * 1000. / (double)duration) << "\n";
529 msg.setf(std::ios::fixed, std::ios::floatfield); // use decimal format
530 msg.setf(std::ios::showpoint); // print decimal point
531 msg << " UPS: " << ((double)myVehiclesMoved / ((double)duration / 1000)) << "\n";
532 if (myPersonsMoved > 0) {
533 msg << " UPS-Persons: " << ((double)myPersonsMoved / ((double)duration / 1000)) << "\n";
534 }
535 }
536 // print vehicle statistics
537 const std::string vehDiscardNotice = ((myVehicleControl->getLoadedVehicleNo() != myVehicleControl->getDepartedVehicleNo()) ?
538 " (Loaded: " + toString(myVehicleControl->getLoadedVehicleNo()) + ")" : "");
539 msg << "Vehicles:\n"
540 << " Inserted: " << myVehicleControl->getDepartedVehicleNo() << vehDiscardNotice << "\n"
541 << " Running: " << myVehicleControl->getRunningVehicleNo() << "\n"
542 << " Waiting: " << myInserter->getWaitingVehicleNo() << "\n";
543
545 // print optional teleport statistics
546 std::vector<std::string> reasons;
548 reasons.push_back("Collisions: " + toString(myVehicleControl->getCollisionCount()));
549 }
551 reasons.push_back("Jam: " + toString(myVehicleControl->getTeleportsJam()));
552 }
554 reasons.push_back("Yield: " + toString(myVehicleControl->getTeleportsYield()));
555 }
557 reasons.push_back("Wrong Lane: " + toString(myVehicleControl->getTeleportsWrongLane()));
558 }
559 msg << " Teleports: " << myVehicleControl->getTeleportCount() << " (" << joinToString(reasons, ", ") << ")\n";
560 }
562 msg << " Emergency Stops: " << myVehicleControl->getEmergencyStops() << "\n";
563 }
565 msg << " Emergency Braking: " << myVehicleControl->getEmergencyBrakingCount() << "\n";
566 }
567 if (myPersonControl != nullptr && myPersonControl->getLoadedNumber() > 0) {
568 const std::string discardNotice = ((myPersonControl->getLoadedNumber() != myPersonControl->getDepartedNumber()) ?
569 " (Loaded: " + toString(myPersonControl->getLoadedNumber()) + ")" : "");
570 msg << "Persons:\n"
571 << " Inserted: " << myPersonControl->getDepartedNumber() << discardNotice << "\n"
572 << " Running: " << myPersonControl->getRunningNumber() << "\n";
573 if (myPersonControl->getJammedNumber() > 0) {
574 msg << " Jammed: " << myPersonControl->getJammedNumber() << "\n";
575 }
577 std::vector<std::string> reasons;
579 reasons.push_back("Abort Wait: " + toString(myPersonControl->getTeleportsAbortWait()));
580 }
582 reasons.push_back("Wrong Dest: " + toString(myPersonControl->getTeleportsWrongDest()));
583 }
584 msg << " Teleports: " << myPersonControl->getTeleportCount() << " (" << joinToString(reasons, ", ") << ")\n";
585 }
586 }
587 if (myContainerControl != nullptr && myContainerControl->getLoadedNumber() > 0) {
588 const std::string discardNotice = ((myContainerControl->getLoadedNumber() != myContainerControl->getDepartedNumber()) ?
589 " (Loaded: " + toString(myContainerControl->getLoadedNumber()) + ")" : "");
590 msg << "Containers:\n"
591 << " Inserted: " << myContainerControl->getDepartedNumber() << "\n"
592 << " Running: " << myContainerControl->getRunningNumber() << "\n";
594 msg << " Jammed: " << myContainerControl->getJammedNumber() << "\n";
595 }
597 std::vector<std::string> reasons;
599 reasons.push_back("Abort Wait: " + toString(myContainerControl->getTeleportsAbortWait()));
600 }
602 reasons.push_back("Wrong Dest: " + toString(myContainerControl->getTeleportsWrongDest()));
603 }
604 msg << " Teleports: " << myContainerControl->getTeleportCount() << " (" << joinToString(reasons, ", ") << ")\n";
605 }
606 }
607 }
608 if (OptionsCont::getOptions().getBool("duration-log.statistics")) {
610 }
611 std::string result = msg.str();
612 result.erase(result.end() - 1);
613 return result;
614}
615
616
617void
619 OutputDevice& od = OutputDevice::getDeviceByOption("collision-output");
620 for (const auto& item : myCollisions) {
621 for (const auto& c : item.second) {
622 if (c.time != SIMSTEP) {
623 continue;
624 }
625 od.openTag("collision");
627 od.writeAttr("type", c.type);
628 od.writeAttr("lane", c.lane->getID());
629 od.writeAttr("pos", c.pos);
630 od.writeAttr("collider", item.first);
631 od.writeAttr("victim", c.victim);
632 od.writeAttr("colliderType", c.colliderType);
633 od.writeAttr("victimType", c.victimType);
634 od.writeAttr("colliderSpeed", c.colliderSpeed);
635 od.writeAttr("victimSpeed", c.victimSpeed);
636 od.writeAttr("colliderFront", c.colliderFront);
637 od.writeAttr("colliderBack", c.colliderBack);
638 od.writeAttr("victimFront", c.victimFront);
639 od.writeAttr("victimBack", c.victimBack);
640 od.closeTag();
641 }
642 }
643}
644
645
646void
647MSNet::writeStatistics(const SUMOTime start, const long now) const {
648 const long duration = now - mySimBeginMillis;
649 OutputDevice& od = OutputDevice::getDeviceByOption("statistic-output");
650 od.openTag("performance");
651 od.writeAttr("clockBegin", time2string(mySimBeginMillis));
652 od.writeAttr("clockEnd", time2string(now));
653 od.writeAttr("clockDuration", time2string(duration));
654 od.writeAttr("traciDuration", time2string(myTraCIMillis));
655 od.writeAttr("realTimeFactor", duration != 0 ? (double)(myStep - start) / (double)duration : -1);
656 od.writeAttr("vehicleUpdatesPerSecond", duration != 0 ? (double)myVehiclesMoved / ((double)duration / 1000) : -1);
657 od.writeAttr("personUpdatesPerSecond", duration != 0 ? (double)myPersonsMoved / ((double)duration / 1000) : -1);
658 od.writeAttr("begin", time2string(start));
659 od.writeAttr("end", time2string(myStep));
660 od.writeAttr("duration", time2string(myStep - start));
661 od.closeTag();
662 od.openTag("vehicles");
666 od.writeAttr("waiting", myInserter->getWaitingVehicleNo());
667 od.closeTag();
668 od.openTag("teleports");
673 od.closeTag();
674 od.openTag("safety");
675 od.writeAttr("collisions", myVehicleControl->getCollisionCount());
676 od.writeAttr("emergencyStops", myVehicleControl->getEmergencyStops());
677 od.writeAttr("emergencyBraking", myVehicleControl->getEmergencyBrakingCount());
678 od.closeTag();
679 od.openTag("persons");
680 od.writeAttr("loaded", myPersonControl != nullptr ? myPersonControl->getLoadedNumber() : 0);
681 od.writeAttr("running", myPersonControl != nullptr ? myPersonControl->getRunningNumber() : 0);
682 od.writeAttr("jammed", myPersonControl != nullptr ? myPersonControl->getJammedNumber() : 0);
683 od.closeTag();
684 od.openTag("personTeleports");
685 od.writeAttr("total", myPersonControl != nullptr ? myPersonControl->getTeleportCount() : 0);
686 od.writeAttr("abortWait", myPersonControl != nullptr ? myPersonControl->getTeleportsAbortWait() : 0);
687 od.writeAttr("wrongDest", myPersonControl != nullptr ? myPersonControl->getTeleportsWrongDest() : 0);
688 od.closeTag();
689 if (OptionsCont::getOptions().isSet("tripinfo-output") || OptionsCont::getOptions().getBool("duration-log.statistics")) {
691 }
692}
693
694
695void
697 // summary output
699 const bool hasOutput = oc.isSet("summary-output");
700 const bool hasPersonOutput = oc.isSet("person-summary-output");
701 if (hasOutput || hasPersonOutput) {
702 const SUMOTime period = string2time(oc.getString("summary-output.period"));
703 const SUMOTime begin = string2time(oc.getString("begin"));
704 if ((period > 0 && (myStep - begin) % period != 0 && !finalStep)
705 // it's the final step but we already wrote output
706 || (finalStep && (period <= 0 || (myStep - begin) % period == 0))) {
707 return;
708 }
709 }
710 if (hasOutput) {
711 OutputDevice& od = OutputDevice::getDeviceByOption("summary-output");
712 int departedVehiclesNumber = myVehicleControl->getDepartedVehicleNo();
713 const double meanWaitingTime = departedVehiclesNumber != 0 ? myVehicleControl->getTotalDepartureDelay() / (double) departedVehiclesNumber : -1.;
714 int endedVehicleNumber = myVehicleControl->getEndedVehicleNo();
715 const double meanTravelTime = endedVehicleNumber != 0 ? myVehicleControl->getTotalTravelTime() / (double) endedVehicleNumber : -1.;
716 od.openTag("step");
717 od.writeAttr("time", time2string(myStep));
721 od.writeAttr("waiting", myInserter->getWaitingVehicleNo());
724 od.writeAttr("collisions", myVehicleControl->getCollisionCount());
725 od.writeAttr("teleports", myVehicleControl->getTeleportCount());
728 od.writeAttr("meanWaitingTime", meanWaitingTime);
729 od.writeAttr("meanTravelTime", meanTravelTime);
730 std::pair<double, double> meanSpeed = myVehicleControl->getVehicleMeanSpeeds();
731 od.writeAttr("meanSpeed", meanSpeed.first);
732 od.writeAttr("meanSpeedRelative", meanSpeed.second);
734 if (myLogExecutionTime) {
735 od.writeAttr("duration", mySimStepDuration);
736 }
737 od.closeTag();
738 }
739 if (hasPersonOutput) {
740 OutputDevice& od = OutputDevice::getDeviceByOption("person-summary-output");
742 od.openTag("step");
743 od.writeAttr("time", time2string(myStep));
744 od.writeAttr("loaded", pc.getLoadedNumber());
745 od.writeAttr("inserted", pc.getDepartedNumber());
746 od.writeAttr("walking", pc.getMovingNumber());
747 od.writeAttr("waitingForRide", pc.getWaitingForVehicleNumber());
748 od.writeAttr("riding", pc.getRidingNumber());
749 od.writeAttr("stopping", pc.getWaitingUntilNumber());
750 od.writeAttr("jammed", pc.getJammedNumber());
751 od.writeAttr("ended", pc.getEndedNumber());
752 od.writeAttr("arrived", pc.getArrivedNumber());
753 od.writeAttr("teleports", pc.getTeleportCount());
754 od.writeAttr("discarded", pc.getDiscardedNumber());
755 if (myLogExecutionTime) {
756 od.writeAttr("duration", mySimStepDuration);
757 }
758 od.closeTag();
759 }
760}
761
762
763void
764MSNet::closeSimulation(SUMOTime start, const std::string& reason) {
765 // report the end when wished
766 WRITE_MESSAGE(TLF("Simulation ended at time: %.", time2string(getCurrentTimeStep())));
767 if (reason != "") {
768 WRITE_MESSAGE(TL("Reason: ") + reason);
769 }
771 if (OptionsCont::getOptions().isSet("queue-output")) {
773 }
774 if (MSStopOut::active() && OptionsCont::getOptions().getBool("stop-output.write-unfinished")) {
776 }
777 MSDevice_Vehroutes::writePendingOutput(OptionsCont::getOptions().getBool("vehroute-output.write-unfinished"));
778 if (OptionsCont::getOptions().getBool("tripinfo-output.write-unfinished")) {
780 }
781 if (OptionsCont::getOptions().isSet("chargingstations-output")) {
782 if (!OptionsCont::getOptions().getBool("chargingstations-output.aggregated")) {
784 } else if (OptionsCont::getOptions().getBool("chargingstations-output.aggregated.write-unfinished")) {
785 MSChargingStationExport::write(OutputDevice::getDeviceByOption("chargingstations-output"), true);
786 }
787 }
788 if (OptionsCont::getOptions().isSet("overheadwiresegments-output")) {
790 }
791 if (OptionsCont::getOptions().isSet("substations-output")) {
793 }
795 const long now = SysUtils::getCurrentMillis();
796 if (myLogExecutionTime || OptionsCont::getOptions().getBool("duration-log.statistics")) {
798 }
799 if (OptionsCont::getOptions().isSet("statistic-output")) {
800 writeStatistics(start, now);
801 }
802 // maybe write a final line of output if reporting is periodic
803 writeSummaryOutput(true);
804}
805
806
807void
808MSNet::simulationStep(const bool onlyMove) {
810 postMoveStep();
812 return;
813 }
814#ifdef DEBUG_SIMSTEP
815 std::cout << SIMTIME << ": MSNet::simulationStep() called"
816 << ", myStep = " << myStep
817 << std::endl;
818#endif
820 int lastTraCICmd = 0;
821 if (t != nullptr) {
822 if (myLogExecutionTime) {
824 }
825 lastTraCICmd = t->processCommands(myStep);
826#ifdef DEBUG_SIMSTEP
827 bool loadRequested = !TraCI::getLoadArgs().empty();
828 assert(t->getTargetTime() >= myStep || loadRequested || TraCIServer::wasClosed());
829#endif
830 if (myLogExecutionTime) {
832 }
833 if (TraCIServer::wasClosed() || !t->getLoadArgs().empty()) {
834 return;
835 }
836 }
837#ifdef DEBUG_SIMSTEP
838 std::cout << SIMTIME << ": TraCI target time: " << t->getTargetTime() << std::endl;
839#endif
840 // execute beginOfTimestepEvents
841 if (myLogExecutionTime) {
843 }
844 // simulation state output
845 std::vector<SUMOTime>::iterator timeIt = std::find(myStateDumpTimes.begin(), myStateDumpTimes.end(), myStep);
846 if (timeIt != myStateDumpTimes.end()) {
847 const int dist = (int)distance(myStateDumpTimes.begin(), timeIt);
849 }
850 if (myStateDumpPeriod > 0 && myStep % myStateDumpPeriod == 0) {
851 std::string timeStamp = time2string(myStep);
852 std::replace(timeStamp.begin(), timeStamp.end(), ':', '-');
853 const std::string filename = myStateDumpPrefix + "_" + timeStamp + myStateDumpSuffix;
855 myPeriodicStateFiles.push_back(filename);
856 int keep = OptionsCont::getOptions().getInt("save-state.period.keep");
857 if (keep > 0 && (int)myPeriodicStateFiles.size() > keep) {
858 std::remove(myPeriodicStateFiles.front().c_str());
860 }
861 }
865 }
866#ifdef HAVE_FOX
867 MSRoutingEngine::waitForAll();
868#endif
871 }
872 // check whether the tls programs need to be switched
874
877 } else {
878 // assure all lanes with vehicles are 'active'
880
881 // compute safe velocities for all vehicles for the next few lanes
882 // also register ApproachingVehicleInformation for all links
884
885 // register junction approaches based on planned velocities as basis for right-of-way decision
887
888 // decide right-of-way and execute movements
892 }
893
894 // vehicles may change lanes
896
899 }
900 }
901 // flush arrived meso vehicles and micro vehicles that were removed due to collision
903 loadRoutes();
904
905 // persons
908 }
909 // containers
912 }
913#ifdef HAVE_FOX
914 MSRoutingEngine::waitForAll();
915 if (myPersonControl != nullptr) {
916 myPersonControl->processPendingRouting(this, myStep);
917 }
918 if (myContainerControl != nullptr) {
919 myContainerControl->processPendingRouting(this, myStep);
920 }
921#endif
924 // preserve waitRelation from insertion for the next step
925 }
926 // insert vehicles
929#ifdef HAVE_FOX
930 MSRoutingEngine::waitForAll();
931#endif
934 //myEdges->patchActiveLanes(); // @note required to detect collisions on lanes that were empty before insertion. wasteful?
936 }
938
939 // execute endOfTimestepEvents
941
942 if (myLogExecutionTime) {
944 }
945 if (onlyMove) {
947 return;
948 }
949 if (t != nullptr && lastTraCICmd == libsumo::CMD_EXECUTEMOVE) {
950 t->processCommands(myStep, true);
951 }
952 postMoveStep();
953}
954
955
956void
958 const int numControlled = libsumo::Helper::postProcessRemoteControl();
959 if (numControlled > 0 && MSGlobals::gCheck4Accidents) {
961 }
962 if (myLogExecutionTime) {
965 }
967 // collisions from the previous step were kept to avoid duplicate
968 // warnings. we must remove them now to ensure correct output.
970 }
971 // update and write (if needed) detector values
973 writeOutput();
974
975 if (myLogExecutionTime) {
977 if (myPersonControl != nullptr) {
979 }
980 }
981 myStep += DELTA_T;
982}
983
984
989 }
990 if (TraCIServer::getInstance() != nullptr && !TraCIServer::getInstance()->getLoadArgs().empty()) {
991 return SIMSTATE_LOADING;
992 }
993 if ((stopTime < 0 || myStep > stopTime) && TraCIServer::getInstance() == nullptr && (stopTime > 0 || myStep > myEdgeDataEndTime)) {
996 && (myPersonControl == nullptr || !myPersonControl->hasNonWaiting())
1000 }
1001 }
1002 if (stopTime >= 0 && myStep >= stopTime) {
1004 }
1007 }
1008 if (myAmInterrupted) {
1009 return SIMSTATE_INTERRUPTED;
1010 }
1011 return SIMSTATE_RUNNING;
1012}
1013
1014
1016MSNet::adaptToState(MSNet::SimulationState state, const bool isLibsumo) const {
1017 if (state == SIMSTATE_LOADING) {
1020 } else if (state != SIMSTATE_RUNNING && ((TraCIServer::getInstance() != nullptr && !TraCIServer::wasClosed()) || isLibsumo)) {
1021 // overrides SIMSTATE_END_STEP_REACHED, e.g. (TraCI / Libsumo ignore SUMO's --end option)
1022 return SIMSTATE_RUNNING;
1023 } else if (state == SIMSTATE_NO_FURTHER_VEHICLES) {
1024 if (myPersonControl != nullptr) {
1026 }
1027 if (myContainerControl != nullptr) {
1029 }
1031 }
1032 return state;
1033}
1034
1035
1036std::string
1038 switch (state) {
1040 return "";
1042 return TL("The final simulation step has been reached.");
1044 return TL("All vehicles have left the simulation.");
1046 return TL("TraCI requested termination.");
1048 return TL("An error occurred (see log).");
1050 return TL("Interrupted.");
1052 return TL("Too many teleports.");
1054 return TL("TraCI issued load command.");
1055 default:
1056 return TL("Unknown reason.");
1057 }
1058}
1059
1060
1061void
1063 // clear container
1064 MSEdge::clear();
1065 MSLane::clear();
1070 while (!MSLaneSpeedTrigger::getInstances().empty()) {
1071 delete MSLaneSpeedTrigger::getInstances().begin()->second;
1072 }
1073 while (!MSTriggeredRerouter::getInstances().empty()) {
1074 delete MSTriggeredRerouter::getInstances().begin()->second;
1075 }
1084 if (t != nullptr) {
1085 t->cleanup();
1086 }
1089}
1090
1091
1092void
1093MSNet::clearState(const SUMOTime step, bool quickReload) {
1097 for (MSEdge* const edge : MSEdge::getAllEdges()) {
1098 for (MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(*edge); s != nullptr; s = s->getNextSegment()) {
1099 s->clearState();
1100 }
1101 }
1102 } else {
1103 for (MSEdge* const edge : MSEdge::getAllEdges()) {
1104 for (MSLane* const lane : edge->getLanes()) {
1105 lane->getVehiclesSecure();
1106 lane->clearState();
1107 lane->releaseVehicles();
1108 }
1109 edge->clearState();
1110 }
1111 }
1113 // detectors may still reference persons/vehicles
1117
1118 if (myPersonControl != nullptr) {
1120 }
1121 if (myContainerControl != nullptr) {
1123 }
1124 // delete vtypes after transportables have removed their types
1128 // delete all routes after vehicles and detector output is done
1130 for (auto& item : myStoppingPlaces) {
1131 for (auto& item2 : item.second) {
1132 item2.second->clearState();
1133 }
1134 }
1141 myStep = step;
1142 MSGlobals::gClearState = false;
1143}
1144
1145
1150
1151void
1156
1157void
1159 // update detector values
1162
1163 // check state dumps
1164 if (oc.isSet("netstate-dump")) {
1166 oc.getInt("netstate-dump.precision"));
1167 }
1168
1169 // check fcd dumps
1170 if (OptionsCont::getOptions().isSet("fcd-output")) {
1171 if (OptionsCont::getOptions().isSet("person-fcd-output")) {
1174 } else {
1176 }
1177 }
1178
1179 // check emission dumps
1180 if (OptionsCont::getOptions().isSet("emission-output")) {
1182 }
1183
1184 // battery dumps
1185 if (OptionsCont::getOptions().isSet("battery-output")) {
1187 oc.getInt("battery-output.precision"));
1188 }
1189
1190 // charging station aggregated dumps
1191 if (OptionsCont::getOptions().isSet("chargingstations-output") && OptionsCont::getOptions().getBool("chargingstations-output.aggregated")) {
1193 }
1194
1195 // elecHybrid dumps
1196 if (OptionsCont::getOptions().isSet("elechybrid-output")) {
1197 std::string output = OptionsCont::getOptions().getString("elechybrid-output");
1198
1199 if (oc.getBool("elechybrid-output.aggregated")) {
1200 // build a xml file with aggregated device.elechybrid output
1202 oc.getInt("elechybrid-output.precision"));
1203 } else {
1204 // build a separate xml file for each vehicle equipped with device.elechybrid
1205 // RICE_TODO: Does this have to be placed here in MSNet.cpp ?
1207 for (MSVehicleControl::constVehIt it = vc.loadedVehBegin(); it != vc.loadedVehEnd(); ++it) {
1208 const SUMOVehicle* veh = it->second;
1209 if (!veh->isOnRoad()) {
1210 continue;
1211 }
1212 if (static_cast<MSDevice_ElecHybrid*>(veh->getDevice(typeid(MSDevice_ElecHybrid))) != nullptr) {
1213 std::string vehID = veh->getID();
1214 std::string filename2 = output + "_" + vehID + ".xml";
1215 OutputDevice& dev = OutputDevice::getDevice(filename2);
1216 std::map<SumoXMLAttr, std::string> attrs;
1217 attrs[SUMO_ATTR_VEHICLE] = vehID;
1220 dev.writeXMLHeader("elecHybrid-export", "", attrs);
1221 MSElecHybridExport::write(OutputDevice::getDevice(filename2), veh, myStep, oc.getInt("elechybrid-output.precision"));
1222 }
1223 }
1224 }
1225 }
1226
1227
1228 // check full dumps
1229 if (OptionsCont::getOptions().isSet("full-output")) {
1232 }
1233
1234 // check queue dumps
1235 if (OptionsCont::getOptions().isSet("queue-output")) {
1237 }
1238
1239 // check amitran dumps
1240 if (OptionsCont::getOptions().isSet("amitran-output")) {
1242 }
1243
1244 // check vtk dumps
1245 if (OptionsCont::getOptions().isSet("vtk-output")) {
1246
1247 if (MSNet::getInstance()->getVehicleControl().getRunningVehicleNo() > 0) {
1248 std::string timestep = time2string(myStep);
1249 if (TS >= 1.0) {
1250 timestep = timestep.substr(0, timestep.length() - 3);
1251 } else if (DELTA_T % 100 == 0) {
1252 timestep = timestep.substr(0, timestep.length() - 1);
1253 }
1254 std::string output = OptionsCont::getOptions().getString("vtk-output");
1255 std::string filename = output + "_" + timestep + ".vtp";
1256
1257 OutputDevice_File dev(filename);
1258
1259 //build a huge mass of xml files
1261
1262 }
1263
1264 }
1265
1267
1268 // write detector values
1270
1271 // write link states
1272 if (OptionsCont::getOptions().isSet("link-output")) {
1273 OutputDevice& od = OutputDevice::getDeviceByOption("link-output");
1274 od.openTag("timestep");
1276 for (const MSEdge* const edge : myEdges->getEdges()) {
1277 for (const MSLane* const lane : edge->getLanes()) {
1278 for (const MSLink* const link : lane->getLinkCont()) {
1279 link->writeApproaching(od, lane->getID());
1280 }
1281 }
1282 }
1283 od.closeTag();
1284 }
1285
1286 // write SSM output
1288 dev->updateAndWriteOutput();
1289 }
1290
1291 // write ToC output
1293 if (dev->generatesOutput()) {
1294 dev->writeOutput();
1295 }
1296 }
1297
1298 if (OptionsCont::getOptions().isSet("collision-output")) {
1300 }
1301}
1302
1303
1304bool
1308
1309
1312 if (myPersonControl == nullptr) {
1314 }
1315 return *myPersonControl;
1316}
1317
1318
1321 if (myContainerControl == nullptr) {
1323 }
1324 return *myContainerControl;
1325}
1326
1329 myDynamicShapeUpdater = std::unique_ptr<MSDynamicShapeUpdater> (new MSDynamicShapeUpdater(*myShapeContainer));
1330 return myDynamicShapeUpdater.get();
1331}
1332
1335 if (myEdgeWeights == nullptr) {
1337 }
1338 return *myEdgeWeights;
1339}
1340
1341
1342void
1344 std::cout << "Step #" << time2string(myStep);
1345}
1346
1347
1348void
1350 if (myLogExecutionTime) {
1351 std::ostringstream oss;
1352 oss.setf(std::ios::fixed, std::ios::floatfield); // use decimal format
1353 oss.setf(std::ios::showpoint); // print decimal point
1354 oss << std::setprecision(gPrecision);
1355 if (mySimStepDuration != 0) {
1356 const double durationSec = (double)mySimStepDuration / 1000.;
1357 oss << " (" << mySimStepDuration << "ms ~= "
1358 << (TS / durationSec) << "*RT, ~"
1359 << ((double) myVehicleControl->getRunningVehicleNo() / durationSec);
1360 } else {
1361 oss << " (0ms ?*RT. ?";
1362 }
1363 oss << "UPS, ";
1364 if (TraCIServer::getInstance() != nullptr) {
1365 oss << "TraCI: " << myTraCIStepDuration << "ms, ";
1366 }
1367 oss << "vehicles TOT " << myVehicleControl->getDepartedVehicleNo()
1368 << " ACT " << myVehicleControl->getRunningVehicleNo()
1369 << " BUF " << myInserter->getWaitingVehicleNo()
1370 << ") ";
1371 std::string prev = "Step #" + time2string(myStep - DELTA_T);
1372 std::cout << oss.str().substr(0, 90 - prev.length());
1373 }
1374 std::cout << '\r';
1375}
1376
1377
1378void
1380 if (find(myVehicleStateListeners.begin(), myVehicleStateListeners.end(), listener) == myVehicleStateListeners.end()) {
1381 myVehicleStateListeners.push_back(listener);
1382 }
1383}
1384
1385
1386void
1388 std::vector<VehicleStateListener*>::iterator i = std::find(myVehicleStateListeners.begin(), myVehicleStateListeners.end(), listener);
1389 if (i != myVehicleStateListeners.end()) {
1390 myVehicleStateListeners.erase(i);
1391 }
1392}
1393
1394
1395void
1396MSNet::informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info) {
1397#ifdef HAVE_FOX
1398 ScopedLocker<> lock(myVehicleStateListenerMutex, MSGlobals::gNumThreads > 1);
1399#endif
1400 for (VehicleStateListener* const listener : myVehicleStateListeners) {
1401 listener->vehicleStateChanged(vehicle, to, info);
1402 }
1403}
1404
1405
1406void
1412
1413
1414void
1416 std::vector<TransportableStateListener*>::iterator i = std::find(myTransportableStateListeners.begin(), myTransportableStateListeners.end(), listener);
1417 if (i != myTransportableStateListeners.end()) {
1419 }
1420}
1421
1422
1423void
1424MSNet::informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info) {
1425#ifdef HAVE_FOX
1426 ScopedLocker<> lock(myTransportableStateListenerMutex, MSGlobals::gNumThreads > 1);
1427#endif
1429 listener->transportableStateChanged(transportable, to, info);
1430 }
1431}
1432
1433
1434bool
1435MSNet::registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos) {
1436 auto it = myCollisions.find(collider->getID());
1437 if (it != myCollisions.end()) {
1438 for (Collision& old : it->second) {
1439 if (old.victim == victim->getID()) {
1440 // collision from previous step continues
1441 old.continuationTime = myStep;
1442 return false;
1443 }
1444 }
1445 } else {
1446 // maybe the roles have been reversed
1447 auto it2 = myCollisions.find(victim->getID());
1448 if (it2 != myCollisions.end()) {
1449 for (Collision& old : it2->second) {
1450 if (old.victim == collider->getID()) {
1451 // collision from previous step continues (keep the old roles)
1452 old.continuationTime = myStep;
1453 return false;
1454 }
1455 }
1456 }
1457 }
1458 Collision c;
1459 c.victim = victim->getID();
1460 c.colliderType = collider->getVehicleType().getID();
1461 c.victimType = victim->getVehicleType().getID();
1462 c.colliderSpeed = collider->getSpeed();
1463 c.victimSpeed = victim->getSpeed();
1464 c.colliderFront = collider->getPosition();
1465 c.victimFront = victim->getPosition();
1466 c.colliderBack = collider->getPosition(-collider->getVehicleType().getLength());
1467 c.victimBack = victim->getPosition(-victim->getVehicleType().getLength());
1468 c.type = collisionType;
1469 c.lane = lane;
1470 c.pos = pos;
1471 c.time = myStep;
1473 myCollisions[collider->getID()].push_back(c);
1474 return true;
1475}
1476
1477
1478void
1480 for (auto it = myCollisions.begin(); it != myCollisions.end();) {
1481 for (auto it2 = it->second.begin(); it2 != it->second.end();) {
1482 if (it2->continuationTime != myStep) {
1483 it2 = it->second.erase(it2);
1484 } else {
1485 it2++;
1486 }
1487 }
1488 if (it->second.size() == 0) {
1489 it = myCollisions.erase(it);
1490 } else {
1491 it++;
1492 }
1493 }
1494}
1495
1496
1497bool
1499 if (category == SUMO_TAG_TRAIN_STOP) {
1500 category = SUMO_TAG_BUS_STOP;
1501 }
1502 const bool isNew = myStoppingPlaces[category].add(stop->getID(), stop);
1503 if (isNew && stop->getMyName() != "") {
1504 myNamedStoppingPlaces[category][stop->getMyName()].push_back(stop);
1505 }
1506 return isNew;
1507}
1508
1509
1510bool
1512 if (find(myTractionSubstations.begin(), myTractionSubstations.end(), substation) == myTractionSubstations.end()) {
1513 myTractionSubstations.push_back(substation);
1514 return true;
1515 }
1516 return false;
1517}
1518
1519
1521MSNet::getStoppingPlace(const std::string& id, const SumoXMLTag category) const {
1522 if (myStoppingPlaces.count(category) > 0) {
1523 return myStoppingPlaces.find(category)->second.get(id);
1524 }
1525 return nullptr;
1526}
1527
1528
1530MSNet::getStoppingPlace(const std::string& id) const {
1532 MSStoppingPlace* result = getStoppingPlace(id, category);
1533 if (result != nullptr) {
1534 return result;
1535 }
1536 }
1537 return nullptr;
1538}
1539
1540
1541std::string
1542MSNet::getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const {
1543 if (myStoppingPlaces.count(category) > 0) {
1544 for (const auto& it : myStoppingPlaces.find(category)->second) {
1545 MSStoppingPlace* stop = it.second;
1546 if (&stop->getLane() == lane && stop->getBeginLanePosition() - POSITION_EPS <= pos && stop->getEndLanePosition() + POSITION_EPS >= pos) {
1547 return stop->getID();
1548 }
1549 }
1550 }
1551 return "";
1552}
1553
1554
1555const std::vector<MSStoppingPlace*>&
1556MSNet::getStoppingPlaceAlternatives(const std::string& name, SumoXMLTag category) const {
1557 if (category == SUMO_TAG_TRAIN_STOP) {
1558 category = SUMO_TAG_BUS_STOP;
1559 }
1560 auto it = myNamedStoppingPlaces.find(category);
1561 if (it != myNamedStoppingPlaces.end()) {
1562 auto it2 = it->second.find(name);
1563 if (it2 != it->second.end()) {
1564 return it2->second;
1565 }
1566 }
1568}
1569
1570
1573 auto it = myStoppingPlaces.find(category);
1574 if (it != myStoppingPlaces.end()) {
1575 return it->second;
1576 } else {
1578 }
1579}
1580
1581
1582void
1585 OutputDevice& output = OutputDevice::getDeviceByOption("chargingstations-output");
1586 for (const auto& it : myStoppingPlaces.find(SUMO_TAG_CHARGING_STATION)->second) {
1587 static_cast<MSChargingStation*>(it.second)->writeChargingStationOutput(output);
1588 }
1589 }
1590}
1591
1592
1593void
1595 if (OptionsCont::getOptions().isSet("railsignal-block-output")) {
1596 OutputDevice& output = OutputDevice::getDeviceByOption("railsignal-block-output");
1597 for (auto tls : myLogics->getAllLogics()) {
1598 MSRailSignal* rs = dynamic_cast<MSRailSignal*>(tls);
1599 if (rs != nullptr) {
1600 rs->writeBlocks(output, false);
1601 }
1602 }
1603 MSDriveWay::writeDepatureBlocks(output, false);
1604 }
1605 if (OptionsCont::getOptions().isSet("railsignal-vehicle-output")) {
1606 OutputDevice& output = OutputDevice::getDeviceByOption("railsignal-vehicle-output");
1607 for (auto tls : myLogics->getAllLogics()) {
1608 MSRailSignal* rs = dynamic_cast<MSRailSignal*>(tls);
1609 if (rs != nullptr) {
1610 rs->writeBlocks(output, true);
1611 }
1612 }
1613 MSDriveWay::writeDepatureBlocks(output, true);
1614 }
1615}
1616
1617
1618void
1621 OutputDevice& output = OutputDevice::getDeviceByOption("overheadwiresegments-output");
1622 for (const auto& it : myStoppingPlaces.find(SUMO_TAG_OVERHEAD_WIRE_SEGMENT)->second) {
1623 static_cast<MSOverheadWire*>(it.second)->writeOverheadWireSegmentOutput(output);
1624 }
1625 }
1626}
1627
1628
1629void
1631 if (myTractionSubstations.size() > 0) {
1632 OutputDevice& output = OutputDevice::getDeviceByOption("substations-output");
1633 output.setPrecision(OptionsCont::getOptions().getInt("substations-output.precision"));
1634 for (auto& it : myTractionSubstations) {
1635 it->writeTractionSubstationOutput(output);
1636 }
1637 }
1638}
1639
1640
1642MSNet::findTractionSubstation(const std::string& substationId) {
1643 for (std::vector<MSTractionSubstation*>::iterator it = myTractionSubstations.begin(); it != myTractionSubstations.end(); ++it) {
1644 if ((*it)->getID() == substationId) {
1645 return *it;
1646 }
1647 }
1648 return nullptr;
1649}
1650
1651
1653MSNet::getRouterTT(int rngIndex, const Prohibitions& prohibited) const {
1654 if (MSGlobals::gNumSimThreads == 1) {
1655 rngIndex = 0;
1656 }
1657 if (myRouterTT.count(rngIndex) == 0) {
1658 const std::string routingAlgorithm = OptionsCont::getOptions().getString("routing-algorithm");
1659 if (routingAlgorithm == "dijkstra") {
1660 myRouterTT[rngIndex] = new DijkstraRouter<MSEdge, SUMOVehicle>(MSEdge::getAllEdges(), true, &MSNet::getTravelTime, nullptr, false, nullptr, true);
1661 } else if (routingAlgorithm == "CCH") {
1662 // free-flow CCH metrics per vehicle type; every query a shared
1663 // metric cannot serve (TraCI edge weights, non-default routing
1664 // modes, prohibitions beyond live closures) routes on the exact
1665 // embedded fallback -- see MSRoutingEngine::getFreeflowCCHMetric
1670 &MSNet::getTravelTime, true, fallback);
1671 } else {
1672 if (routingAlgorithm != "astar") {
1673 WRITE_WARNINGF(TL("TraCI and Triggers cannot use routing algorithm '%'. using 'astar' instead."), routingAlgorithm);
1674 }
1676 }
1677 }
1678 myRouterTT[rngIndex]->prohibit(prohibited);
1679 return *myRouterTT[rngIndex];
1680}
1681
1682
1684MSNet::getRouterEffort(int rngIndex, const Prohibitions& prohibited) const {
1685 if (MSGlobals::gNumSimThreads == 1) {
1686 rngIndex = 0;
1687 }
1688 if (myRouterEffort.count(rngIndex) == 0) {
1690 }
1691 myRouterEffort[rngIndex]->prohibit(prohibited);
1692 return *myRouterEffort[rngIndex];
1693}
1694
1695
1697MSNet::getPedestrianRouter(int rngIndex, const Prohibitions& prohibited) const {
1698 if (MSGlobals::gNumSimThreads == 1) {
1699 rngIndex = 0;
1700 }
1701 if (myPedestrianRouter.count(rngIndex) == 0) {
1702 myPedestrianRouter[rngIndex] = new MSPedestrianRouter();
1703 }
1704 myPedestrianRouter[rngIndex]->prohibit(prohibited);
1705 return *myPedestrianRouter[rngIndex];
1706}
1707
1708
1710MSNet::getIntermodalRouter(int rngIndex, const int routingMode, const Prohibitions& prohibited) const {
1711 if (MSGlobals::gNumSimThreads == 1) {
1712 rngIndex = 0;
1713 }
1715 const int key = rngIndex * oc.getInt("thread-rngs") + routingMode;
1716 if (myIntermodalRouter.count(key) == 0) {
1718 const std::string routingAlgorithm = OptionsCont::getOptions().getString("routing-algorithm");
1719 const double taxiWait = STEPS2TIME(string2time(OptionsCont::getOptions().getString("persontrip.taxi.waiting-time")));
1720 if (routingMode == libsumo::ROUTING_MODE_COMBINED) {
1721 myIntermodalRouter[key] = new MSTransportableRouter(MSNet::adaptIntermodalRouter, carWalk, taxiWait, routingAlgorithm, routingMode, new FareModul());
1722 } else {
1723 myIntermodalRouter[key] = new MSTransportableRouter(MSNet::adaptIntermodalRouter, carWalk, taxiWait, routingAlgorithm, routingMode);
1724 }
1725 }
1726 myIntermodalRouter[key]->prohibit(prohibited);
1727 return *myIntermodalRouter[key];
1728}
1729
1730
1731void
1733 for (auto& router : myIntermodalRouter) {
1734 delete router.second;
1735 }
1736 myIntermodalRouter.clear();
1737}
1738
1739
1740void
1742 double taxiWait = STEPS2TIME(string2time(OptionsCont::getOptions().getString("persontrip.taxi.waiting-time")));
1743 // add access to all parking areas
1744 EffortCalculator* const external = router.getExternalEffort();
1745 for (const auto& stopType : myInstance->myStoppingPlaces) {
1746 // add access to all stopping places
1747 const SumoXMLTag element = stopType.first;
1748 for (const auto& i : stopType.second) {
1749 const MSEdge* const edge = &i.second->getLane().getEdge();
1750 router.getNetwork()->addAccess(i.first, edge, i.second->getBeginLanePosition(), i.second->getEndLanePosition(),
1751 0., element, false, taxiWait);
1752 if (element == SUMO_TAG_BUS_STOP) {
1753 // add access to all public transport stops
1754 for (const auto& a : i.second->getAllAccessPos()) {
1755 router.getNetwork()->addAccess(i.first, &a.lane->getEdge(), a.startPos, a.endPos, a.length, element, true, taxiWait);
1756 }
1757 if (external != nullptr) {
1758 external->addStop(router.getNetwork()->getStopEdge(i.first)->getNumericalID(), *i.second);
1759 }
1760 }
1761 }
1762 }
1765 // add access to transfer from walking to taxi-use
1767 for (MSEdge* edge : myInstance->getEdgeControl().getEdges()) {
1768 if ((edge->getPermissions() & SVC_PEDESTRIAN) != 0 && (edge->getPermissions() & SVC_TAXI) != 0) {
1769 router.getNetwork()->addCarAccess(edge, SVC_TAXI, taxiWait);
1770 }
1771 }
1772 }
1773}
1774
1775
1776bool
1778 const MSEdgeVector& edges = myEdges->getEdges();
1779 for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) {
1780 for (std::vector<MSLane*>::const_iterator i = (*e)->getLanes().begin(); i != (*e)->getLanes().end(); ++i) {
1781 if ((*i)->getShape().hasElevation()) {
1782 return true;
1783 }
1784 }
1785 }
1786 return false;
1787}
1788
1789
1790bool
1792 for (const MSEdge* e : myEdges->getEdges()) {
1793 if (e->getFunction() == SumoXMLEdgeFunc::WALKINGAREA) {
1794 return true;
1795 }
1796 }
1797 return false;
1798}
1799
1800
1801bool
1803 for (const MSEdge* e : myEdges->getEdges()) {
1804 if (e->getBidiEdge() != nullptr) {
1805 return true;
1806 }
1807 }
1808 return false;
1809}
1810
1811bool
1812MSNet::warnOnce(const std::string& typeAndID) {
1813 if (myWarnedOnce.find(typeAndID) == myWarnedOnce.end()) {
1814 myWarnedOnce[typeAndID] = true;
1815 return true;
1816 }
1817 return false;
1818}
1819
1820
1823 auto loader = myRouteLoaders->getFirstLoader();
1824 if (loader != nullptr) {
1825 return dynamic_cast<MSMapMatcher*>(loader->getRouteHandler());
1826 } else {
1827 return nullptr;
1828 }
1829}
1830
1831void
1834 clearState(string2time(oc.getString("begin")), true);
1836 // load traffic from additional files
1837 for (std::string file : oc.getStringVector("additional-files")) {
1838 // ignore failure on parsing calibrator flow
1839 MSRouteHandler rh(file, true);
1840 const long before = PROGRESS_BEGIN_TIME_MESSAGE("Loading traffic from '" + file + "'");
1841 if (!XMLSubSys::runParser(rh, file, false)) {
1842 throw ProcessError(TLF("Loading of % failed.", file));
1843 }
1844 PROGRESS_TIME_MESSAGE(before);
1845 }
1846 delete myRouteLoaders;
1848 updateGUI();
1849}
1850
1851
1853MSNet::loadState(const std::string& fileName, const bool catchExceptions) {
1854 // load time only
1855 const SUMOTime newTime = MSStateHandler::MSStateTimeHandler::getTime(fileName);
1856 // clean up state
1857 clearState(newTime);
1858 // load state
1859 MSStateHandler h(fileName, 0);
1860 XMLSubSys::runParser(h, fileName, false, false, false, catchExceptions);
1861 if (MsgHandler::getErrorInstance()->wasInformed()) {
1862 throw ProcessError(TLF("Loading state from '%' failed.", fileName));
1863 }
1864 // reset route loaders
1865 delete myRouteLoaders;
1867 // prevent loading errors on rewound route file
1869
1870 updateGUI();
1871 return newTime;
1872}
1873
1874
1875/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ TAXI_PICKUP_ANYWHERE
taxi customer may be picked up anywhere
std::vector< MSEdge * > MSEdgeVector
Definition MSEdge.h:73
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSTransportableRouter
PedestrianRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSPedestrianRouter
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:289
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:288
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition MsgHandler.h:292
#define TL(string)
Definition MsgHandler.h:304
#define PROGRESS_TIME_MESSAGE(before)
Definition MsgHandler.h:293
#define TLF(string,...)
Definition MsgHandler.h:306
std::string elapsedMs2string(long long int t)
convert ms to string for log output
Definition SUMOTime.cpp:145
SUMOTime DELTA_T
Definition SUMOTime.cpp:38
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define STEPS2TIME(x)
Definition SUMOTime.h:58
#define SIMSTEP
Definition SUMOTime.h:69
#define TS
Definition SUMOTime.h:45
#define SIMTIME
Definition SUMOTime.h:70
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_OVERHEAD_WIRE_SEGMENT
An overhead wire segment.
@ SUMO_TAG_PERSON
@ SUMO_ATTR_MAXIMUMBATTERYCAPACITY
Maxium battery capacity.
@ SUMO_ATTR_VEHICLE
@ SUMO_ATTR_RECUPERATIONENABLE
@ SUMO_ATTR_ID
bool gRoutingPreferences
Definition StdDefs.cpp:37
int gPrecision
the precision for floating point outputs
Definition StdDefs.cpp:27
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Definition StdDefs.h:71
T MAX2(T a, T b)
Definition StdDefs.h:86
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition ToString.h:314
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:49
Computes the shortest path through a network using the A* algorithm.
Definition AStarRouter.h:76
Contraction-hierarchy router over the edge graph mapped by GRAPH.
Definition CCHRouter.h:83
Computes the shortest path through a network using the Dijkstra algorithm.
the effort calculator interface
virtual void addStop(const int stopEdge, const Parameterised &params)=0
int getNumericalID() const
void addCarAccess(const E *edge, SUMOVehicleClass svc, double traveltime)
Adds access edges for transfering from walking to vehicle use.
void addAccess(const std::string &stopId, const E *stopEdge, const double startPos, const double endPos, const double length, const SumoXMLTag category, bool isAccess, double taxiWait)
Adds access edges for stopping places to the intermodal network.
_IntermodalEdge * getStopEdge(const std::string &stopId) const
Returns the associated stop edge.
EffortCalculator * getExternalEffort() const
Network * getNetwork() const
int getCarWalkTransfer() const
The main mesocopic simulation loop.
Definition MELoop.h:47
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
Definition MELoop.cpp:63
void clearState()
Remove all vehicles before quick-loading state.
Definition MELoop.cpp:298
A single mesoscopic segment (cell)
Definition MESegment.h:50
static void write(OutputDevice &of, const SUMOTime timestep)
Writes the complete network state into the given device.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
int getRoutingMode() const
return routing mode (configures router choice but also handling of transient permission changes)
static void write(OutputDevice &of, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
static void cleanup()
cleanup remaining data structures
static void write(OutputDevice &of, bool end=false)
Writes the recently completed charging events.
Detectors container; responsible for string and output generation.
void writeOutput(SUMOTime step, bool closing)
Writes the output to be generated within the given time step.
void clearState(SUMOTime step)
Remove all vehicles before quick-loading state.
void updateDetectors(const SUMOTime step)
Computes detector values.
void close(SUMOTime step)
Closes the detector outputs.
static void cleanup()
removes remaining vehicleInformation in sVehicles
A device which collects info on the vehicle trip (mainly on departure and arrival)
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in kWh.
A device which collects info on the vehicle trip (mainly on departure and arrival)
static const std::set< MSDevice_SSM *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing SSM devices
static void cleanup()
Clean up remaining devices instances.
static bool hasFleet()
returns whether taxis have been loaded
static bool hasServableReservations()
check whether there are still (servable) reservations in the system
The ToC Device controls transition of control between automated and manual driving.
static void cleanup()
Closes root tags of output files.
static const std::set< MSDevice_ToC *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing ToC devices
static void writeStatistics(OutputDevice &od)
write statistic output to (xml) file
static std::string printStatistics()
get statistics for printing to stdout
static void generateOutputForUnfinished()
generate output for vehicles which are still in the network
static void writePendingOutput(const bool includeUnfinished)
generate vehroute output for pending vehicles at sim end, either due to sorting or because they are s...
static void cleanupAll()
perform cleanup for all devices
Definition MSDevice.cpp:149
static void clearState()
static void writeDepatureBlocks(OutputDevice &od, bool writeVehicles)
static void init()
static void cleanup()
Stores edges and lanes, performs moving of vehicle.
void setJunctionApproaches()
Register junction approaches for all vehicles after velocities have been planned. This is a prerequis...
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
const MSEdgeVector & getEdges() const
Returns loaded edges.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step....
void changeLanes(const SUMOTime t)
Moves (precomputes) critical vehicles.
A road/street connecting two junctions.
Definition MSEdge.h:77
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:1144
static void clear()
Clears the dictionary.
Definition MSEdge.cpp:1150
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition MSEdge.h:485
A storage for edge travel times and efforts.
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
static void writeAggregated(OutputDevice &of, SUMOTime timestep, int precision)
static void write(OutputDevice &of, const SUMOVehicle *veh, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
static void write(OutputDevice &of, SUMOTime timestep)
Writes emission values into the given device.
Stores time-dependant events and executes them at the proper time.
virtual void execute(SUMOTime time)
Executes time-dependant commands.
void clearState(SUMOTime currentTime, SUMOTime newTime)
Remove all events before quick-loading state.
static void write(OutputDevice &of, const SUMOTime timestep, const SumoXMLTag tag=SUMO_TAG_NOTHING)
Writes the position and the angle of each vehicle into the given device.
static void write(OutputDevice &of, SUMOTime timestep)
Dumping a hugh List of Parameters available in the Simulation.
static bool gUseMesoSim
Definition MSGlobals.h:106
static double gWeightsSeparateTurns
Whether turning specific weights are estimated (and how much)
Definition MSGlobals.h:180
static bool gOverheadWireRecuperation
Definition MSGlobals.h:127
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition MSGlobals.h:115
static bool gStateLoaded
Information whether a state has been loaded.
Definition MSGlobals.h:103
static bool gCheck4Accidents
Definition MSGlobals.h:88
static bool gClearState
whether the simulation is in the process of clearing state (MSNet::clearState)
Definition MSGlobals.h:146
static bool gHaveEmissions
Whether emission output of some type is needed (files or GUI)
Definition MSGlobals.h:186
static int gNumSimThreads
how many threads to use for simulation
Definition MSGlobals.h:149
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition MSGlobals.h:81
static int gNumThreads
how many threads to use
Definition MSGlobals.h:152
Inserts vehicles into the network when their departure time is reached.
void adaptIntermodalRouter(MSTransportableRouter &router) const
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
bool hasFlow(const std::string &id) const
checks whether the given flow still exists
void determineCandidates(SUMOTime time)
Checks for all vehicles whether they can be emitted.
int getPendingFlowCount() const
Returns the number of flows that are still active.
void clearState()
Remove all vehicles before quick-loading state.
Container for junctions; performs operations on all stored junctions.
Representation of a lane in the micro simulation.
Definition MSLane.h:84
static void clear()
Clears the dictionary.
Definition MSLane.cpp:2551
static const std::map< std::string, MSLaneSpeedTrigger * > & getInstances()
return all MSLaneSpeedTrigger instances
Interface for objects listening to transportable state changes.
Definition MSNet.h:728
Interface for objects listening to vehicle state changes.
Definition MSNet.h:669
The simulated network and simulation perfomer.
Definition MSNet.h:89
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition MSNet.h:1035
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition MSNet.h:973
MSMapMatcher * getMapMatcher() const
Definition MSNet.cpp:1822
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition MSNet.cpp:155
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition MSNet.cpp:1812
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=nullptr)
Constructor.
Definition MSNet.cpp:222
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1853
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition MSNet.h:959
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition MSNet.h:928
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition MSNet.cpp:1387
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition MSNet.h:897
std::map< std::string, std::map< std::string, double > > myVTypePreferences
Definition MSNet.h:1008
void informTransportableStateListener(const MSTransportable *const transportable, TransportableState to, const std::string &info="")
Informs all added listeners about a transportable's state change.
Definition MSNet.cpp:1424
SUMOTime myStateDumpPeriod
The period for writing state.
Definition MSNet.h:992
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition MSNet.h:1059
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition MSNet.cpp:1619
void writeChargingStationOutput() const
write charging station output
Definition MSNet.cpp:1583
SUMOTime myStateLoaderTime
Definition MSNet.h:909
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition MSNet.h:1076
bool checkBidiEdges()
check whether bidirectional edges occur in the network
Definition MSNet.cpp:1802
VehicleState
Definition of a vehicle state.
Definition MSNet.h:636
int myLogStepPeriod
Period between successive step-log outputs.
Definition MSNet.h:964
SUMOTime myStep
Current time step.
Definition MSNet.h:900
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:201
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition MSNet.h:1026
bool addStoppingPlace(SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition MSNet.cpp:1498
void addPreference(const std::string &routingType, SUMOVehicleClass svc, double prio)
add edge type specific routing preference
Definition MSNet.cpp:422
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition MSNet.h:942
SUMOTime getLoaderTime() const
Definition MSNet.cpp:1147
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition MSNet.cpp:1511
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition MSNet.h:1063
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:209
void removeOutdatedCollisions()
remove collisions from the previous simulation step
Definition MSNet.cpp:1479
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition MSNet.h:934
std::map< const MSEdge *, RouterProhibition > Prohibitions
Definition MSNet.h:132
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition MSNet.h:990
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition MSNet.h:948
std::string myStateDumpSuffix
Definition MSNet.h:995
const std::vector< MSStoppingPlace * > & getStoppingPlaceAlternatives(const std::string &name, SumoXMLTag category) const
Definition MSNet.cpp:1556
bool checkElevation()
check all lanes for elevation data
Definition MSNet.cpp:1777
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1710
std::map< SumoXMLTag, std::map< std::string, std::vector< MSStoppingPlace * > > > myNamedStoppingPlaces
dictionary of named stopping places
Definition MSNet.h:1038
static const std::vector< MSStoppingPlace * > myEmptyStoppingPlaceVector
Definition MSNet.h:1060
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition MSNet.cpp:1415
SimulationState adaptToState(const SimulationState state, const bool isLibsumo=false) const
Called after a simulation step, this method adapts the current simulation state if necessary.
Definition MSNet.cpp:1016
void closeBuilding(const OptionsCont &oc, MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool junctionHigherSpeeds, const MMVersion &version)
Closes the network's building process.
Definition MSNet.cpp:274
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition MSNet.h:962
MMVersion myVersion
the network version
Definition MSNet.h:1029
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition MSNet.h:946
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1320
MSVehicleRouter & getRouterTT(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1653
SimulationState
Possible states of a simulation - running or stopped with different reasons.
Definition MSNet.h:94
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
Definition MSNet.h:110
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
Definition MSNet.h:102
@ SIMSTATE_LOADING
The simulation is loading.
Definition MSNet.h:96
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition MSNet.h:106
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
Definition MSNet.h:104
@ SIMSTATE_INTERRUPTED
An external interrupt occurred.
Definition MSNet.h:108
@ SIMSTATE_RUNNING
The simulation is running.
Definition MSNet.h:98
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
Definition MSNet.h:100
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition MSNet.h:1072
static const std::string STAGE_MOVEMENTS
Definition MSNet.h:870
bool hasFlow(const std::string &id) const
return whether the given flow is known
Definition MSNet.cpp:463
int myMaxTeleports
Maximum number of teleports.
Definition MSNet.h:915
long mySimStepDuration
Definition MSNet.h:967
double getPreference(const std::string &routingType, const SUMOVTypeParameter &pars) const
retriefe edge type specific routing preference
Definition MSNet.cpp:392
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition MSNet.h:944
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:1037
std::string getStoppingPlaceID(const MSLane *lane, const double pos, const SumoXMLTag category) const
Returns the stop of the given category close to the given position.
Definition MSNet.cpp:1542
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition MSNet.h:1014
void writeSubstationOutput() const
write electrical substation output
Definition MSNet.cpp:1630
static const std::string STAGE_INSERTIONS
Definition MSNet.h:872
std::map< SUMOVehicleClass, std::map< std::string, double > > myVClassPreferences
Preferences for routing.
Definition MSNet.h:1007
long long int myPersonsMoved
Definition MSNet.h:977
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1832
MSPedestrianRouter & getPedestrianRouter(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1697
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition MSNet.h:926
static void clearAll()
Clears all dictionaries.
Definition MSNet.cpp:1062
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:215
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
Definition MSNet.cpp:647
void resetIntermodalRouter() const
force reconstruction of intermodal network
Definition MSNet.cpp:1732
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:334
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition MSNet.h:932
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition MSNet.h:1081
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
Definition MSNet.cpp:382
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition MSNet.cpp:764
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition MSNet.cpp:1521
bool myHasElevation
Whether the network contains elevation data.
Definition MSNet.h:1020
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition MSNet.cpp:169
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition MSNet.h:930
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition MSNet.h:1047
void writeOutput()
Write netstate, summary and detector output.
Definition MSNet.cpp:1158
virtual void updateGUI() const
update view after simulation.loadState
Definition MSNet.h:624
void setLoaderTime(SUMOTime time)
Definition MSNet.cpp:1152
bool myAmInterrupted
whether an interrupt occurred
Definition MSNet.h:918
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
Definition MSNet.cpp:808
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition MSNet.cpp:1379
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition MSNet.cpp:1093
void preSimStepOutput() const
Prints the current step number.
Definition MSNet.cpp:1343
void writeCollisions() const
write collision output to (xml) file
Definition MSNet.cpp:618
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition MSNet.h:986
void writeSummaryOutput(bool finalStep=false)
write summary-output to (xml) file
Definition MSNet.cpp:696
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition MSNet.cpp:1407
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition MSNet.h:1041
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition MSNet.h:1032
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition MSNet.cpp:1334
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition MSNet.h:1004
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition MSNet.h:988
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition MSNet.cpp:435
void writeRailSignalBlocks() const
write rail signal block output
Definition MSNet.cpp:1594
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition MSNet.h:936
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition MSNet.cpp:1305
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition MSNet.h:976
static const std::string STAGE_REMOTECONTROL
Definition MSNet.h:873
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
Definition MSNet.cpp:1396
std::map< int, MSTransportableRouter * > myIntermodalRouter
Definition MSNet.h:1073
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition MSNet.h:1044
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition MSNet.cpp:986
long myTraCIStepDuration
The last simulation step duration.
Definition MSNet.h:967
TransportableState
Definition of a transportable state.
Definition MSNet.h:713
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:455
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition MSNet.h:940
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
Definition MSNet.h:912
static const std::string STAGE_LANECHANGE
Definition MSNet.h:871
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition MSNet.cpp:376
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition MSNet.h:1011
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition MSNet.h:950
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition MSNet.cpp:1328
virtual ~MSNet()
Destructor.
Definition MSNet.cpp:309
std::map< int, MSVehicleRouter * > myRouterEffort
Definition MSNet.h:1071
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition MSNet.cpp:1642
static MSNet * myInstance
Unique instance of MSNet.
Definition MSNet.h:894
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:402
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition MSNet.h:938
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition MSNet.cpp:1349
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1311
bool registerCollision(const SUMOTrafficObject *collider, const SUMOTrafficObject *victim, const std::string &collisionType, const MSLane *lane, double pos)
register collision and return whether it was the first one involving these vehicles
Definition MSNet.cpp:1435
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition MSNet.h:869
void loadRoutes()
loads routes for the next few steps
Definition MSNet.cpp:512
std::string myStateDumpPrefix
name components for periodic state
Definition MSNet.h:994
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition MSNet.h:1017
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:445
long mySimBeginMillis
The overall simulation duration.
Definition MSNet.h:970
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition MSNet.h:1023
std::map< int, MSVehicleRouter * > myRouterTT
Definition MSNet.h:1070
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
Definition MSNet.cpp:440
void postMoveStep()
Performs the parts of the simulation step which happen after the move.
Definition MSNet.cpp:957
bool hasInternalLinks() const
return whether the network contains internal links
Definition MSNet.h:811
const std::string generateStatistics(const SUMOTime start, const long now)
Writes performance output and running vehicle stats.
Definition MSNet.cpp:518
bool checkWalkingarea()
check all lanes for type walkingArea
Definition MSNet.cpp:1791
static void adaptIntermodalRouter(MSTransportableRouter &router)
Definition MSNet.cpp:1741
CollisionMap myCollisions
collisions in the current time step
Definition MSNet.h:1050
MSVehicleRouter & getRouterEffort(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1684
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition MSNet.cpp:1572
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition MSNet.cpp:470
Definition of overhead wire segment.
static void finish(OutputDevice &of, SUMOTime timestep)
Writes the last (possibly incomplete) aggregation interval and clears the collected samples.
static void write(OutputDevice &of, SUMOTime timestep)
Export the queueing length in front of a junction (very experimental!)
static void cleanup()
clean up state
static MSRailSignalControl & getInstance()
void updateSignals(SUMOTime t)
update active rail signals
static void clearState()
Perform resets events when quick-loading state.
void resetWaitRelations()
reset all waiting-for relationships at the start of the simulation step
A signal for rails.
void writeBlocks(OutputDevice &od, bool writeVehicles) const
write rail signal block output for all links and driveways
Parser and container for routes during their loading.
static void dict_clearState()
Decrement all route references before quick-loading state.
Definition MSRoute.cpp:308
static void clear()
Clears the dictionary (delete all known routes, too)
Definition MSRoute.cpp:181
static bool haveExtras()
static double getEffortBike(const MSEdge *const e, const SUMOVehicle *const v, double t)
static MSCCHGraph * ensureCCHGraph()
the shared CCH topology, built on first demand (used by MSNet::getRouterTT to construct its CCH route...
static void cleanupCCH()
tears down the CCH state (myCCHLive/myCCHFreeflow/myCCHGraph) only – the ref vehicles owned by the CC...
static void applyExtras(const MSEdge *const e, const SUMOVehicle *const v, SUMOTime step, double &effort)
apply cost modifications from randomness, priorityFactor and preferences
static bool hasBikeSpeeds()
whether the router collects bicycle speeds
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
static const RoutingKit::CustomizableContractionHierarchyMetric * getFreeflowCCHMetric(SUMOVehicleClass vClass, SUMOTime time, const SUMOVehicle *veh)
the free-flow CCH metric for MSNet's routers (TraCI / triggers / GUI), keyed by vehicle type and fill...
static double getEffortExtra(const MSEdge *const e, const SUMOVehicle *const v, double t)
static SUMOTime getTime(const std::string &fileName)
parse time from state file
Parser and output filter for routes and vehicles state saving and loading.
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
static bool active()
Definition MSStopOut.h:55
static void cleanup()
Definition MSStopOut.cpp:51
void generateOutputForUnfinished()
generate output for vehicles which are still stopped at simulation end
static MSStopOut * getInstance()
Definition MSStopOut.h:61
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
const std::string & getMyName() const
A class that stores and controls tls and switching of their programs.
void clearState(SUMOTime time, bool quickReload=false)
Clear all tls states before quick-loading state.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
Traction substation powering one or more overhead wire sections.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
bool hasTransportables() const
checks whether any transportable waits to finish her plan
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
int getEndedNumber() const
Returns the number of transportables that exited the simulation.
void checkWaiting(MSNet *net, const SUMOTime time)
checks whether any transportables waiting time is over
int getArrivedNumber() const
Returns the number of transportables that arrived at their destination.
int getTeleportCount() const
Returns the number of teleports transportables did.
int getLoadedNumber() const
Returns the number of build transportables.
int getWaitingUntilNumber() const
Returns the number of transportables waiting for a specified amount of time.
int getTeleportsWrongDest() const
return the number of teleports of transportables riding to the wrong destination
void abortAnyWaitingForVehicle()
aborts the plan for any transportable that is still waiting for a ride
bool hasNonWaiting() const
checks whether any transportable is still engaged in walking / stopping
int getMovingNumber() const
Returns the number of transportables moving by themselvs (i.e. walking)
int getJammedNumber() const
Returns the number of times a transportables was jammed.
void clearState()
Resets transportables when quick-loading state.
int getTeleportsAbortWait() const
return the number of teleports due to excessive waiting for a ride
int getDiscardedNumber() const
Returns the number of discarded transportables.
int getRidingNumber() const
Returns the number of transportables riding a vehicle.
static const std::map< std::string, MSTriggeredRerouter * > & getInstances()
return all rerouter instances
static void write(OutputDevice &of, SUMOTime timestep)
Produce a VTK output to use with Tools like ParaView.
static void cleanup()
Static cleanup.
The class responsible for building and deletion of vehicles.
void adaptIntermodalRouter(MSTransportableRouter &router) const
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void removePending()
Removes a vehicle after it has ended.
double getTotalTravelTime() const
Returns the total travel time.
int getLoadedVehicleNo() const
Returns the number of build vehicles.
int getCollisionCount() const
return the number of collisions
int getTeleportsWrongLane() const
return the number of teleports due to vehicles stuck on the wrong lane
int getStoppedVehiclesCount() const
return the number of vehicles that are currently stopped
int getTeleportsYield() const
return the number of teleports due to vehicles stuck on a minor road
void clearState(const bool reinit)
Remove all vehicles before quick-loading state.
int getEmergencyBrakingCount() const
return the number of emergency stops
int getEmergencyStops() const
return the number of emergency stops
double getTotalDepartureDelay() const
Returns the total departure delay.
virtual std::pair< double, double > getVehicleMeanSpeeds() const
get current absolute and relative mean vehicle speed in the network
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
int getArrivedVehicleNo() const
Returns the number of arrived vehicles.
int getActiveVehicleCount() const
Returns the number of build vehicles that have not been removed or need to wait for a passenger or a ...
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
int getTeleportsJam() const
return the number of teleports due to jamming
int getEndedVehicleNo() const
Returns the number of removed vehicles.
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
int getTeleportCount() const
return the number of teleports (including collisions)
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
int getDiscardedVehicleNo() const
Returns the number of discarded vehicles.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
void clearState()
Remove all vehicles before quick-loading state.
const std::string & getID() const
Returns the name of the vehicle type.
double getLength() const
Get vehicle's length [m].
static void write(OutputDevice &of, const MSEdgeControl &ec, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
static void initRandomness()
initializes all RNGs
const std::string & getID() const
Returns the id.
Definition Named.h:73
A map of named object pointers.
A storage for options typed value containers)
Definition OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition OptionsIO.cpp:59
An output device that encapsulates an ofstream.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
static void closeAll(bool keepErrorRetrievers=false)
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
SUMORouteLoader * getFirstLoader() const
return a route loader
void loadNext(SUMOTime step)
loads the next routes up to and including the given time step
SUMOTime getCurrentLoadTime() const
void setCurrentLoadTime(SUMOTime time)
Representation of a vehicle, person, or container.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual MSDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or nullptr if not.
virtual double getSpeed() const =0
Returns the object's current speed.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
Structure representing possible vehicle parameter.
SUMOVehicleClass vehicleClass
The vehicle's class.
std::string id
The vehicle type's id.
Representation of a vehicle.
Definition SUMOVehicle.h:63
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
static int parseCarWalkTransfer(const OptionsCont &oc, const bool hasTaxi)
A scoped lock which only triggers on condition.
Storage for geometrical objects.
void clearState()
Remove all dynamics before quick-loading state.
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition SysUtils.cpp:45
TraCI server used to control sumo by a remote TraCI client.
Definition TraCIServer.h:59
static bool wasClosed()
check whether close was requested
SUMOTime getTargetTime() const
Definition TraCIServer.h:64
static TraCIServer * getInstance()
Definition TraCIServer.h:68
std::vector< std::string > & getLoadArgs()
void cleanup()
clean up subscriptions
int processCommands(const SUMOTime step, const bool afterMove=false)
process all commands until the next SUMO simulation step. It is guaranteed that t->getTargetTime() >=...
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
static void cleanup()
Definition Helper.cpp:700
static int postProcessRemoteControl()
return number of remote-controlled entities
Definition Helper.cpp:1415
TRACI_CONST int CMD_EXECUTEMOVE
TRACI_CONST int ROUTING_MODE_AGGREGATED
TRACI_CONST int ROUTING_MODE_AGGREGATED_CUSTOM
TRACI_CONST int ROUTING_MODE_COMBINED
edge type specific meso parameters
Definition MESegment.h:58
collision tracking
Definition MSNet.h:114
double victimSpeed
Definition MSNet.h:119
Position colliderFront
Definition MSNet.h:120
const MSLane * lane
Definition MSNet.h:125
Position victimBack
Definition MSNet.h:123
std::string victimType
Definition MSNet.h:117
SUMOTime continuationTime
Definition MSNet.h:128
Position victimFront
Definition MSNet.h:121
std::string type
Definition MSNet.h:124
std::string colliderType
Definition MSNet.h:116
std::string victim
Definition MSNet.h:115
double colliderSpeed
Definition MSNet.h:118
Position colliderBack
Definition MSNet.h:122
SUMOTime time
Definition MSNet.h:127