SUMO - Simulation of Urban MObility
MSNet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
15 // The simulated network and simulation perfomer
16 /****************************************************************************/
17 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
18 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
19 /****************************************************************************/
20 //
21 // This file is part of SUMO.
22 // SUMO is free software: you can redistribute it and/or modify
23 // it under the terms of the GNU General Public License as published by
24 // the Free Software Foundation, either version 3 of the License, or
25 // (at your option) any later version.
26 //
27 /****************************************************************************/
28 
29 
30 // ===========================================================================
31 // included modules
32 // ===========================================================================
33 #ifdef _MSC_VER
34 #include <windows_config.h>
35 #else
36 #include <config.h>
37 #endif
38 
39 #include <string>
40 #include <iostream>
41 #include <sstream>
42 #include <typeinfo>
43 #include <algorithm>
44 #include <cassert>
45 #include <vector>
46 #include <ctime>
47 
48 #include "trigger/MSTrigger.h"
49 #include "trigger/MSCalibrator.h"
51 #include "MSVehicleControl.h"
53 #include <utils/common/ToString.h>
54 #include <utils/common/SysUtils.h>
63 #include <utils/shapes/Polygon.h>
67 #include <utils/xml/XMLSubSys.h>
68 #include <mesosim/MELoop.h>
88 
89 #include "MSTransportableControl.h"
90 #include "MSEdgeControl.h"
91 #include "MSJunctionControl.h"
92 #include "MSInsertionControl.h"
93 #include "MSEventControl.h"
94 #include "MSEdge.h"
95 #include "MSJunction.h"
96 #include "MSJunctionLogic.h"
97 #include "MSLane.h"
98 #include "MSVehicleTransfer.h"
99 #include "MSRoute.h"
100 #include "MSGlobals.h"
101 #include "MSContainer.h"
102 #include "MSEdgeWeightsStorage.h"
103 #include "MSStateHandler.h"
104 #include "MSFrame.h"
105 #include "MSNet.h"
106 
107 #ifndef NO_TRACI
109 #include <traci-server/lib/TraCI.h>
110 #endif
111 
112 
113 // ===========================================================================
114 // static member definitions
115 // ===========================================================================
117 
118 const std::string MSNet::STAGE_EVENTS("events");
119 const std::string MSNet::STAGE_MOVEMENTS("move");
120 const std::string MSNet::STAGE_LANECHANGE("laneChange");
121 const std::string MSNet::STAGE_INSERTIONS("insertion");
122 
123 // ===========================================================================
124 // static member method definitions
125 // ===========================================================================
126 double
127 MSNet::getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t) {
128  double value;
129  const MSVehicle* const veh = dynamic_cast<const MSVehicle* const>(v);
130  if (veh != 0 && veh->getWeightsStorage().retrieveExistingEffort(e, t, value)) {
131  return value;
132  }
133  if (getInstance()->getWeightsStorage().retrieveExistingEffort(e, t, value)) {
134  return value;
135  }
136  return 0;
137 }
138 
139 
140 double
141 MSNet::getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t) {
142  double value;
143  const MSVehicle* const veh = dynamic_cast<const MSVehicle* const>(v);
144  if (veh != 0 && veh->getWeightsStorage().retrieveExistingTravelTime(e, t, value)) {
145  return value;
146  }
148  return value;
149  }
150  return e->getMinimumTravelTime(v);
151 }
152 
153 
154 // ---------------------------------------------------------------------------
155 // MSNet - methods
156 // ---------------------------------------------------------------------------
157 MSNet*
159  if (myInstance != 0) {
160  return myInstance;
161  }
162  throw ProcessError("A network was not yet constructed.");
163 }
164 
165 
166 MSNet::MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
167  MSEventControl* endOfTimestepEvents, MSEventControl* insertionEvents,
168  ShapeContainer* shapeCont):
169  myVehiclesMoved(0),
170  myHavePermissions(false),
171  myHasInternalLinks(false),
172  myHasElevation(false),
173  myRouterTTInitialized(false),
175  myRouterTTAStar(0),
176  myRouterEffort(0),
177  myPedestrianRouter(0) {
178  if (myInstance != 0) {
179  throw ProcessError("A network was already constructed.");
180  }
182  myStep = string2time(oc.getString("begin"));
183  myMaxTeleports = oc.getInt("max-num-teleports");
184  myLogExecutionTime = !oc.getBool("no-duration-log");
185  myLogStepNumber = !oc.getBool("no-step-log");
186  myInserter = new MSInsertionControl(*vc, string2time(oc.getString("max-depart-delay")), oc.getBool("eager-insert"), oc.getInt("max-num-vehicles"));
187  myVehicleControl = vc;
189  myEdges = 0;
190  myJunctions = 0;
191  myRouteLoaders = 0;
192  myLogics = 0;
193  myPersonControl = 0;
194  myContainerControl = 0;
195  myEdgeWeights = 0;
196  myShapeContainer = shapeCont == 0 ? new ShapeContainer() : shapeCont;
197 
198  myBeginOfTimestepEvents = beginOfTimestepEvents;
199  myEndOfTimestepEvents = endOfTimestepEvents;
200  myInsertionEvents = insertionEvents;
201  myLanesRTree.first = false;
202 
204  MSGlobals::gMesoNet = new MELoop(string2time(oc.getString("meso-recheck")));
205  }
206  myInstance = this;
207 }
208 
209 
210 void
212  SUMORouteLoaderControl* routeLoaders,
213  MSTLLogicControl* tlc,
214  std::vector<SUMOTime> stateDumpTimes,
215  std::vector<std::string> stateDumpFiles,
216  bool hasInternalLinks,
217  bool hasNeighs,
218  bool lefthand,
219  double version) {
220  myEdges = edges;
221  myJunctions = junctions;
222  myRouteLoaders = routeLoaders;
223  myLogics = tlc;
224  // save the time the network state shall be saved at
225  myStateDumpTimes = stateDumpTimes;
226  myStateDumpFiles = stateDumpFiles;
227  myStateDumpPeriod = string2time(oc.getString("save-state.period"));
228  myStateDumpPrefix = oc.getString("save-state.prefix");
229  myStateDumpSuffix = oc.getString("save-state.suffix");
230 
231  // set requests/responses
233 
234  // initialise performance computation
235  if (myLogExecutionTime) {
237  }
242  myVersion = version;
243 }
244 
245 
247  // delete events first maybe they do some cleanup
250  delete myEndOfTimestepEvents;
252  delete myInsertionEvents;
253  myInsertionEvents = 0;
254  // delete controls
255  delete myJunctions;
256  delete myDetectorControl;
257  // delete mean data
258  delete myEdges;
259  delete myInserter;
260  delete myLogics;
261  delete myRouteLoaders;
262  delete myVehicleControl;
263  if (myPersonControl != 0) {
264  delete myPersonControl;
265  }
266  if (myContainerControl != 0) {
267  delete myContainerControl;
268  }
269  delete myShapeContainer;
270  delete myEdgeWeights;
271  delete myRouterTTDijkstra;
272  delete myRouterTTAStar;
273  delete myRouterEffort;
274  if (myPedestrianRouter != 0) {
275  delete myPedestrianRouter;
276  }
277  myLanesRTree.second.RemoveAll();
278  clearAll();
280  delete MSGlobals::gMesoNet;
281  }
282 // delete myPedestrianRouter;
283  myInstance = 0;
284 }
285 
286 
287 void
288 MSNet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
289  myRestrictions[id][svc] = speed;
290 }
291 
292 
293 const std::map<SUMOVehicleClass, double>*
294 MSNet::getRestrictions(const std::string& id) const {
295  std::map<std::string, std::map<SUMOVehicleClass, double> >::const_iterator i = myRestrictions.find(id);
296  if (i == myRestrictions.end()) {
297  return 0;
298  }
299  return &i->second;
300 }
301 
302 
305  // report the begin when wished
306  WRITE_MESSAGE("Simulation started with time: " + time2string(start));
307  // the simulation loop
309  myStep = start;
310  // preload the routes especially for TraCI
311  loadRoutes();
312 #ifndef NO_TRACI
313 #ifdef HAVE_PYTHON
314  if (OptionsCont::getOptions().isSet("python-script")) {
315  TraCIServer::runEmbedded(OptionsCont::getOptions().getString("python-script"));
316  closeSimulation(start);
317  WRITE_MESSAGE("Simulation ended at time: " + time2string(getCurrentTimeStep()));
318  WRITE_MESSAGE("Reason: Script ended");
319  return state;
320  }
321 #endif
322 #endif
323  while (state == SIMSTATE_RUNNING) {
324  if (myLogStepNumber) {
326  }
327  simulationStep();
328  if (myLogStepNumber) {
330  }
331  state = simulationState(stop);
332 #ifndef NO_TRACI
333  if (state == SIMSTATE_LOADING) {
335  TraCI::getLoadArgs().clear();
336  } else if (state != SIMSTATE_RUNNING) {
337  if (OptionsCont::getOptions().getInt("remote-port") != 0 && !TraCIServer::wasClosed()) {
338  state = SIMSTATE_RUNNING;
339  }
340  }
341 #endif
342  }
343  // report the end when wished
344  WRITE_MESSAGE("Simulation ended at time: " + time2string(getCurrentTimeStep()));
345  WRITE_MESSAGE("Reason: " + getStateMessage(state));
346  // exit simulation loop
347  closeSimulation(start);
348  return state;
349 }
350 
351 void
354 }
355 
356 
357 void
359  if (myLogExecutionTime) {
360  long duration = SysUtils::getCurrentMillis() - mySimBeginMillis;
361  std::ostringstream msg;
362  // print performance notice
363  msg << "Performance: " << "\n" << " Duration: " << duration << "ms" << "\n";
364  if (duration != 0) {
365  msg << " Real time factor: " << (STEPS2TIME(myStep - start) * 1000. / (double)duration) << "\n";
366  msg.setf(std::ios::fixed , std::ios::floatfield); // use decimal format
367  msg.setf(std::ios::showpoint); // print decimal point
368  msg << " UPS: " << ((double)myVehiclesMoved / ((double)duration / 1000)) << "\n";
369  }
370  // print vehicle statistics
371  const std::string discardNotice = ((myVehicleControl->getLoadedVehicleNo() != myVehicleControl->getDepartedVehicleNo()) ?
372  " (Loaded: " + toString(myVehicleControl->getLoadedVehicleNo()) + ")" : "");
373  msg << "Vehicles: " << "\n"
374  << " Inserted: " << myVehicleControl->getDepartedVehicleNo() << discardNotice << "\n"
375  << " Running: " << myVehicleControl->getRunningVehicleNo() << "\n"
376  << " Waiting: " << myInserter->getWaitingVehicleNo() << "\n";
377 
379  // print optional teleport statistics
380  std::vector<std::string> reasons;
381  if (myVehicleControl->getCollisionCount() > 0) {
382  reasons.push_back("Collisions: " + toString(myVehicleControl->getCollisionCount()));
383  }
384  if (myVehicleControl->getTeleportsJam() > 0) {
385  reasons.push_back("Jam: " + toString(myVehicleControl->getTeleportsJam()));
386  }
387  if (myVehicleControl->getTeleportsYield() > 0) {
388  reasons.push_back("Yield: " + toString(myVehicleControl->getTeleportsYield()));
389  }
391  reasons.push_back("Wrong Lane: " + toString(myVehicleControl->getTeleportsWrongLane()));
392  }
393  msg << "Teleports: " << myVehicleControl->getTeleportCount() << " (" << joinToString(reasons, ", ") << ")\n";
394  }
395  if (myVehicleControl->getEmergencyStops() > 0) {
396  msg << "Emergency Stops: " << myVehicleControl->getEmergencyStops() << "\n";
397  }
398  if (myPersonControl != 0 && myPersonControl->getLoadedNumber() > 0) {
399  msg << "Persons: " << "\n"
400  << " Inserted: " << myPersonControl->getLoadedNumber() << "\n"
401  << " Running: " << myPersonControl->getRunningNumber() << "\n";
402  if (myPersonControl->getJammedNumber() > 0) {
403  msg << " Jammed: " << myPersonControl->getJammedNumber() << "\n";
404  }
405  }
406  if (OptionsCont::getOptions().getBool("duration-log.statistics")) {
408  }
409  WRITE_MESSAGE(msg.str());
410  }
412  if (OptionsCont::getOptions().getBool("vehroute-output.write-unfinished")) {
414  }
415  if (OptionsCont::getOptions().getBool("tripinfo-output.write-unfinished")) {
417  }
418  if (OptionsCont::getOptions().isSet("chargingstations-output")) {
420  }
421 }
422 
423 
424 void
426 #ifndef NO_TRACI
427  if (myLogExecutionTime) {
429  }
432  if (myLogExecutionTime) {
434  }
435  if (t != 0 && t->getTargetTime() != 0 && t->getTargetTime() < myStep) {
436  return;
437  }
438 #endif
439  // execute beginOfTimestepEvents
440  if (myLogExecutionTime) {
442  }
443  // simulation state output
444  std::vector<SUMOTime>::iterator timeIt = find(myStateDumpTimes.begin(), myStateDumpTimes.end(), myStep);
445  if (timeIt != myStateDumpTimes.end()) {
446  const int dist = (int)distance(myStateDumpTimes.begin(), timeIt);
448  }
449  if (myStateDumpPeriod > 0 && myStep % myStateDumpPeriod == 0) {
451  }
453 #ifdef HAVE_FOX
454  MSDevice_Routing::waitForAll();
455 #endif
458  }
459  // check whether the tls programs need to be switched
461 
464  } else {
465  // assure all lanes with vehicles are 'active'
467 
468  // compute safe velocities for all vehicles for the next few lanes
469  // also register ApproachingVehicleInformation for all links
471 
472  // decide right-of-way and execute movements
476  }
477 
478  // vehicles may change lanes
480 
483  }
484  }
485  loadRoutes();
486 
487  // persons
490  }
491  // containers
494  }
495  // insert vehicles
498 #ifdef HAVE_FOX
499  MSDevice_Routing::waitForAll();
500 #endif
503  //myEdges->patchActiveLanes(); // @note required to detect collisions on lanes that were empty before insertion. wasteful?
505  }
507 
508  // execute endOfTimestepEvents
510 
511 #ifndef NO_TRACI
512  if (TraCIServer::getInstance() != 0) {
513  if (myLogExecutionTime) {
515  }
517  if (myLogExecutionTime) {
519  }
520  }
521 #endif
522  // update and write (if needed) detector values
523  writeOutput();
524 
525  if (myLogExecutionTime) {
528  }
529  myStep += DELTA_T;
530 }
531 
532 
535 #ifndef NO_TRACI
536  if (TraCIServer::wasClosed()) {
538  }
539  if (!TraCI::getLoadArgs().empty()) {
540  return SIMSTATE_LOADING;
541  }
542  if ((stopTime < 0 || myStep > stopTime) && OptionsCont::getOptions().getInt("remote-port") == 0) {
543 #else
544  if (stopTime < 0 || myStep > stopTime) {
545 #endif
548  && (myInserter->getPendingFlowCount() == 0)
551  if (myPersonControl) {
553  }
554  if (myContainerControl) {
556  }
559  }
560  }
561  if (stopTime >= 0 && myStep >= stopTime) {
563  }
566  }
567  return SIMSTATE_RUNNING;
568 }
569 
570 
571 std::string
573  switch (state) {
575  return "";
577  return "The final simulation step has been reached.";
579  return "All vehicles have left the simulation.";
581  return "TraCI requested termination.";
583  return "An error occured (see log).";
585  return "Too many teleports.";
586  default:
587  return "Unknown reason.";
588  }
589 }
590 
591 
592 void
594  // clear container
595  MSEdge::clear();
596  MSLane::clear();
597  MSRoute::clear();
606 #ifndef NO_TRACI
608  if (t != 0) {
609  t->cleanup();
610  }
611 #endif
612 }
613 
614 
615 void
617  // update detector values
619  const OptionsCont& oc = OptionsCont::getOptions();
620 
621  // check state dumps
622  if (oc.isSet("netstate-dump")) {
624  oc.getInt("netstate-dump.precision"));
625  }
626 
627  // check fcd dumps
628  if (OptionsCont::getOptions().isSet("fcd-output")) {
630  }
631 
632  // check emission dumps
633  if (OptionsCont::getOptions().isSet("emission-output")) {
635  oc.getInt("emission-output.precision"));
636  }
637 
638  // battery dumps
639  if (OptionsCont::getOptions().isSet("battery-output")) {
641  oc.getInt("battery-output.precision"));
642  }
643 
644  // check full dumps
645  if (OptionsCont::getOptions().isSet("full-output")) {
647  }
648 
649  // check queue dumps
650  if (OptionsCont::getOptions().isSet("queue-output")) {
652  }
653 
654  // check amitran dumps
655  if (OptionsCont::getOptions().isSet("amitran-output")) {
657  }
658 
659  // check vtk dumps
660  if (OptionsCont::getOptions().isSet("vtk-output")) {
661 
662  if (MSNet::getInstance()->getVehicleControl().getRunningVehicleNo() > 0) {
663  std::string timestep = time2string(myStep);
664  timestep = timestep.substr(0, timestep.length() - 3);
665  std::string output = OptionsCont::getOptions().getString("vtk-output");
666  std::string filename = output + "_" + timestep + ".vtp";
667 
668  OutputDevice_File dev = OutputDevice_File(filename, false);
669 
670  //build a huge mass of xml files
672 
673  }
674 
675  }
676 
677  // summary output
678  if (OptionsCont::getOptions().isSet("summary-output")) {
679  OutputDevice& od = OutputDevice::getDeviceByOption("summary-output");
680  int departedVehiclesNumber = myVehicleControl->getDepartedVehicleNo();
681  const double meanWaitingTime = departedVehiclesNumber != 0 ? myVehicleControl->getTotalDepartureDelay() / (double) departedVehiclesNumber : -1.;
682  int endedVehicleNumber = myVehicleControl->getEndedVehicleNo();
683  const double meanTravelTime = endedVehicleNumber != 0 ? myVehicleControl->getTotalTravelTime() / (double) endedVehicleNumber : -1.;
685  .writeAttr("inserted", myVehicleControl->getDepartedVehicleNo()).writeAttr("running", myVehicleControl->getRunningVehicleNo())
686  .writeAttr("waiting", myInserter->getWaitingVehicleNo()).writeAttr("ended", myVehicleControl->getEndedVehicleNo())
687  .writeAttr("meanWaitingTime", meanWaitingTime).writeAttr("meanTravelTime", meanTravelTime);
688  if (myLogExecutionTime) {
689  od.writeAttr("duration", mySimStepDuration);
690  }
691  od.closeTag();
692  }
693 
694  // write detector values
696 
697  // write link states
698  if (OptionsCont::getOptions().isSet("link-output")) {
699  OutputDevice& od = OutputDevice::getDeviceByOption("link-output");
700  od.openTag("timestep");
702  const MSEdgeVector& edges = myEdges->getEdges();
703  for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
704  const std::vector<MSLane*>& lanes = (*i)->getLanes();
705  for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
706  const std::vector<MSLink*>& links = (*j)->getLinkCont();
707  for (std::vector<MSLink*>::const_iterator k = links.begin(); k != links.end(); ++k) {
708  (*k)->writeApproaching(od, (*j)->getID());
709  }
710  }
711  }
712  od.closeTag();
713  }
714 
715  // write SSM output
716  for (std::set<MSDevice*>::iterator di = MSDevice_SSM::getInstances().begin(); di != MSDevice_SSM::getInstances().end(); ++di) {
717  MSDevice_SSM* dev = static_cast<MSDevice_SSM*>(*di);
718  dev->updateAndWriteOutput();
719  }
720 }
721 
722 
723 bool
725  return myLogExecutionTime;
726 }
727 
728 
731  if (myPersonControl == 0) {
733  }
734  return *myPersonControl;
735 }
736 
739  if (myContainerControl == 0) {
741  }
742  return *myContainerControl;
743 }
744 
745 
748  if (myEdgeWeights == 0) {
750  }
751  return *myEdgeWeights;
752 }
753 
754 
755 void
757  std::cout << "Step #" << time2string(myStep);
758 }
759 
760 
761 void
763  if (myLogExecutionTime) {
764  std::ostringstream oss;
765  oss.setf(std::ios::fixed , std::ios::floatfield); // use decimal format
766  oss.setf(std::ios::showpoint); // print decimal point
767  oss << std::setprecision(gPrecision);
768  if (mySimStepDuration != 0) {
769  const double durationSec = (double)mySimStepDuration / 1000.;
770  oss << " (" << mySimStepDuration << "ms ~= "
771  << (TS / durationSec) << "*RT, ~"
772  << ((double) myVehicleControl->getRunningVehicleNo() / durationSec);
773  } else {
774  oss << " (0ms ?*RT. ?";
775  }
776  oss << "UPS, ";
777 #ifndef NO_TRACI
778  if (TraCIServer::getInstance() != 0) {
779  oss << "TraCI: " << myTraCIStepDuration << "ms, ";
780  }
781 #endif
782  oss << "vehicles TOT " << myVehicleControl->getDepartedVehicleNo()
783  << " ACT " << myVehicleControl->getRunningVehicleNo()
784  << " BUF " << myInserter->getWaitingVehicleNo()
785  << ") ";
786  std::string prev = "Step #" + time2string(myStep - DELTA_T);
787  std::cout << oss.str().substr(0, 78 - prev.length());
788  }
789  std::cout << '\r';
790 }
791 
792 
793 void
795  if (find(myVehicleStateListeners.begin(), myVehicleStateListeners.end(), listener) == myVehicleStateListeners.end()) {
796  myVehicleStateListeners.push_back(listener);
797  }
798 }
799 
800 
801 void
803  std::vector<VehicleStateListener*>::iterator i = find(myVehicleStateListeners.begin(), myVehicleStateListeners.end(), listener);
804  if (i != myVehicleStateListeners.end()) {
805  myVehicleStateListeners.erase(i);
806  }
807 }
808 
809 
810 void
812  for (std::vector<VehicleStateListener*>::iterator i = myVehicleStateListeners.begin(); i != myVehicleStateListeners.end(); ++i) {
813  (*i)->vehicleStateChanged(vehicle, to);
814  }
815 }
816 
817 
818 
819 // ------ Insertion and retrieval of bus stops ------
820 bool
822  return myBusStopDict.add(busStop->getID(), busStop);
823 }
824 
825 
827 MSNet::getBusStop(const std::string& id) const {
828  return myBusStopDict.get(id);
829 }
830 
831 
832 std::string
833 MSNet::getBusStopID(const MSLane* lane, const double pos) const {
834  const std::map<std::string, MSStoppingPlace*>& vals = myBusStopDict.getMyMap();
835  for (std::map<std::string, MSStoppingPlace*>::const_iterator it = vals.begin(); it != vals.end(); ++it) {
836  MSStoppingPlace* stop = it->second;
837  if (&stop->getLane() == lane && fabs(stop->getEndLanePosition() - pos) < POSITION_EPS) {
838  return stop->getID();
839  }
840  }
841  return "";
842 }
843 
844 // ------ Insertion and retrieval of container stops ------
845 bool
847  return myContainerStopDict.add(containerStop->getID(), containerStop);
848 }
849 
851 MSNet::getContainerStop(const std::string& id) const {
852  return myContainerStopDict.get(id);
853 }
854 
855 std::string
856 MSNet::getContainerStopID(const MSLane* lane, const double pos) const {
857  const std::map<std::string, MSStoppingPlace*>& vals = myContainerStopDict.getMyMap();
858  for (std::map<std::string, MSStoppingPlace*>::const_iterator it = vals.begin(); it != vals.end(); ++it) {
859  MSStoppingPlace* stop = it->second;
860  if (&stop->getLane() == lane && fabs(stop->getEndLanePosition() - pos) < POSITION_EPS) {
861  return stop->getID();
862  }
863  }
864  return "";
865 }
866 
867 // ------ Insertion and retrieval of container stops ------
868 bool
870  return myParkingAreaDict.add(parkingArea->getID(), parkingArea);
871 }
872 
874 MSNet::getParkingArea(const std::string& id) const {
875  return myParkingAreaDict.get(id);
876 }
877 
878 std::string
879 MSNet::getParkingAreaID(const MSLane* lane, const double pos) const {
880  const std::map<std::string, MSParkingArea*>& vals = myParkingAreaDict.getMyMap();
881  for (std::map<std::string, MSParkingArea*>::const_iterator it = vals.begin(); it != vals.end(); ++it) {
882  MSParkingArea* stop = it->second;
883  if (&stop->getLane() == lane && fabs(stop->getEndLanePosition() - pos) < POSITION_EPS) {
884  return stop->getID();
885  }
886  }
887  return "";
888 }
889 
890 bool
892  return myChargingStationDict.add(chargingStation->getID(), chargingStation);
893 }
894 
895 
897 MSNet::getChargingStation(const std::string& id) const {
898  return myChargingStationDict.get(id);
899 }
900 
901 
902 std::string
903 MSNet::getChargingStationID(const MSLane* lane, const double pos) const {
904  const std::map<std::string, MSChargingStation*>& vals = myChargingStationDict.getMyMap();
905  for (std::map<std::string, MSChargingStation*>::const_iterator it = vals.begin(); it != vals.end(); ++it) {
906  MSChargingStation* chargingStation = it->second;
907  if (&chargingStation->getLane() == lane && chargingStation->getBeginLanePosition() <= pos && chargingStation->getEndLanePosition() >= pos) {
908  return chargingStation->getID();
909  }
910  }
911  return "";
912 }
913 
914 
915 void
917  OutputDevice& output = OutputDevice::getDeviceByOption("chargingstations-output");
918  for (std::map<std::string, MSChargingStation*>::const_iterator it = myChargingStationDict.getMyMap().begin(); it != myChargingStationDict.getMyMap().end(); it++) {
919  it->second->writeChargingStationOutput(output);
920  }
921 }
922 
923 
925 MSNet::getRouterTT(const MSEdgeVector& prohibited) const {
926  if (!myRouterTTInitialized) {
927  myRouterTTInitialized = true;
928  const std::string routingAlgorithm = OptionsCont::getOptions().getString("routing-algorithm");
929  if (routingAlgorithm == "dijkstra") {
932  } else {
933  if (routingAlgorithm != "astar") {
934  WRITE_WARNING("TraCI and Triggers cannot use routing algorithm '" + routingAlgorithm + "'. using 'astar' instead.");
935  }
938  }
939  }
940  if (myRouterTTDijkstra != 0) {
941  myRouterTTDijkstra->prohibit(prohibited);
942  return *myRouterTTDijkstra;
943  } else {
944  assert(myRouterTTAStar != 0);
945  myRouterTTAStar->prohibit(prohibited);
946  return *myRouterTTAStar;
947  }
948 }
949 
950 
952 MSNet::getRouterEffort(const MSEdgeVector& prohibited) const {
953  if (myRouterEffort == 0) {
956  }
957  myRouterEffort->prohibit(prohibited);
958  return *myRouterEffort;
959 }
960 
961 
963 MSNet::getPedestrianRouter(const MSEdgeVector& prohibited) const {
964  if (myPedestrianRouter == 0) {
966  }
967  myPedestrianRouter->prohibit(prohibited);
968  return *myPedestrianRouter;
969 }
970 
971 
972 const NamedRTree&
974  if (!myLanesRTree.first) {
975  MSLane::fill(myLanesRTree.second);
976  myLanesRTree.first = true;
977  }
978  return myLanesRTree.second;
979 }
980 
981 
982 bool
984  const MSEdgeVector& edges = myEdges->getEdges();
985  for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) {
986  for (std::vector<MSLane*>::const_iterator i = (*e)->getLanes().begin(); i != (*e)->getLanes().end(); ++i) {
987  if ((*i)->getShape().hasElevation()) {
988  return true;
989  }
990  }
991  }
992  return false;
993 }
994 
995 /****************************************************************************/
std::string myStateDumpSuffix
Definition: MSNet.h:786
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.
Definition: MSXMLRawOut.cpp:55
A lane area vehicles can halt at.
Definition: MSParkingArea.h:66
AStarRouter< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > > * myRouterTTAStar
Definition: MSNet.h:834
static std::vector< std::string > & getLoadArgs()
Definition: TraCI.h:103
bool hasNonWaiting() const
checks whether any transportable is still engaged in walking / stopping
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
Computes the shortest path through a network using the Dijkstra algorithm.
void prohibit(const std::vector< E *> &toProhibit)
int getEndedVehicleNo() const
Returns the number of removed vehicles.
static const std::set< MSDevice * > & getInstances()
returns all currently existing SSM devices
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
double getBeginLanePosition() const
Returns the begin position of this stop.
Interface for objects listening to vehicle state changes.
Definition: MSNet.h:603
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void loadNext(SUMOTime step)
loads the next routes up to and including the given time step
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition: MSNet.cpp:802
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition: MSNet.h:743
NamedObjectCont< MSParkingArea * > myParkingAreaDict
Dictionary of parking areas.
Definition: MSNet.h:819
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
int getLoadedVehicleNo() const
Returns the number of build vehicles.
static void cleanup()
Clean up remaining devices instances.
A lane area vehicles can halt at.
const NamedRTree & getLanesRTree() const
Returns an RTree that contains lane IDs.
Definition: MSNet.cpp:973
virtual bool add(const std::string &id, T item)
Adds an item.
std::string getParkingAreaID(const MSLane *lane, const double pos) const
Returns the parking area close to the given position.
Definition: MSNet.cpp:879
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
int getLoadedNumber() const
Returns the number of build transportables.
static void fill(RTREE &into)
Fills the given RTree with lane instances.
Definition: MSLane.cpp:1411
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition: MSNet.h:725
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:30
void updateDetectors(const SUMOTime step)
Computes detector values.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
Definition: MSDevice_SSM.h:60
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition: MSNet.h:779
virtual void execute(SUMOTime time)
Executes time-dependant commands.
DijkstraRouterEffort< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > > * myRouterEffort
Definition: MSNet.h:835
T get(const std::string &id) const
Retrieves an item.
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition: MSNet.cpp:304
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition: MSNet.cpp:724
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:60
A RT-tree for efficient storing of SUMO&#39;s Named objects.
Definition: NamedRTree.h:72
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:74
bool addBusStop(MSStoppingPlace *busStop)
Adds a bus stop.
Definition: MSNet.cpp:821
bool hasNeighs() const
return whether the network contains explicit neighbor lanes
Definition: MSNet.h:683
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:158
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
MSPedestrianRouterDijkstra & getPedestrianRouter(const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:963
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition: MSNet.h:792
std::string getChargingStationID(const MSLane *lane, const double pos) const
Returns the charging station close to the given position.
Definition: MSNet.cpp:903
SUMOTime DELTA_T
Definition: SUMOTime.cpp:40
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition: MSNet.h:731
The final simulation step has been performed.
Definition: MSNet.h:105
void writeOutput(SUMOTime step, bool closing)
Writes the output to be generated within the given time step.
double myVersion
the network version
Definition: MSNet.h:810
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition: MSNet.h:781
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition: MSNet.h:758
int getActiveVehicleCount() const
Returns the number of build vehicles that have not been removed or need to wait for a passenger or a ...
Storage for geometrical objects.
bool addParkingArea(MSParkingArea *parkingArea)
Adds a parking area.
Definition: MSNet.cpp:869
static const std::string STAGE_LANECHANGE
Definition: MSNet.h:846
void cleanup()
clean up subscriptions
static void write(OutputDevice &of, SUMOTime timestep)
Dumping a hugh List of Parameters available in the Simulation.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::string getContainerStopID(const MSLane *lane, const double pos) const
Returns the container stop close to the given position.
Definition: MSNet.cpp:856
NamedObjectCont< MSStoppingPlace * > myContainerStopDict
Dictionary of container stops.
Definition: MSNet.h:816
const std::string & getID() const
Returns the id.
Definition: Named.h:66
#define TS
Definition: SUMOTime.h:52
Detectors container; responsible for string and output generation.
bool myLefthand
Whether the network was built for left-hand traffic.
Definition: MSNet.h:807
A storage for edge travel times and efforts.
MSChargingStation * getChargingStation(const std::string &id) const
Returns the named charging station.
Definition: MSNet.cpp:897
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition: MSNet.cpp:794
SimulationState
Possible states of a simulation - running or stopped with different reasons.
Definition: MSNet.h:99
MSPedestrianRouterDijkstra * myPedestrianRouter
Definition: MSNet.h:836
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
The simulated network and simulation perfomer.
Definition: MSNet.h:94
Computes the shortest path through a network using the Dijkstra algorithm.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:62
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition: MSNet.h:747
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition: MSNet.h:840
Container for junctions; performs operations on all stored junctions.
std::string getBusStopID(const MSLane *lane, const double pos) const
Returns the bus stop close to the given position.
Definition: MSNet.cpp:833
DijkstraRouterTT< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > > * myRouterTTDijkstra
Definition: MSNet.h:833
static bool gCheck4Accidents
Definition: MSGlobals.h:83
static void write(OutputDevice &of, SUMOTime timestep)
Export the queueing length in front of a junction (very experimental!)
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:738
static void write(OutputDevice &of, SUMOTime timestep, bool elevation)
Writes the position and the angle of each vehicle into the given device.
Definition: MSFCDExport.cpp:53
void postProcessVTD()
void writeChargingStationOutput() const
write charging station output
Definition: MSNet.cpp:916
A class that stores and controls tls and switching of their programs.
A road/street connecting two junctions.
Definition: MSEdge.h:80
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double version() const
return the network version
Definition: MSNet.h:698
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition: MSNet.h:770
double getEndLanePosition() const
Returns the end position of this stop.
The simulation does not contain further vehicles.
Definition: MSNet.h:107
static void generateOutputForUnfinished()
generate output for vehicles which are still in the network
An error occured during the simulation step.
Definition: MSNet.h:111
double getTotalDepartureDelay() const
Returns the total departure delay.
static void clear()
Clears the dictionary (delete all known routes, too)
Definition: MSRoute.cpp:174
The main mesocopic simulation loop.
Definition: MELoop.h:56
void writeOutput()
Write netstate, summary and detector output.
Definition: MSNet.cpp:616
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
SimulationState simulationState(SUMOTime stopTime) const
Called after a simulation step, this method returns the current simulation state. ...
Definition: MSNet.cpp:534
static std::string printStatistics()
get statistics for printing to stdout
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition: MSNet.h:737
Representation of a vehicle.
Definition: SUMOVehicle.h:67
bool myHasNeighs
Whether the network contains explicit neighbor lanes.
Definition: MSNet.h:801
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition: MSNet.h:711
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:730
void prohibit(const std::vector< E *> &toProhibit)
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:141
void closeSimulation(SUMOTime start)
Closes the simulation (all files, connections, etc.)
Definition: MSNet.cpp:358
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition: MSNet.h:795
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition: MSNet.h:761
int getTeleportsYield() const
return the number of teleports due to vehicles stuck on a minor road
An output device that encapsulates an ofstream.
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:767
SUMOTime getTargetTime()
Definition: TraCIServer.h:80
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:310
const IDMap & getMyMap() const
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition: MSNet.h:739
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition: MSNet.cpp:762
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition: MSEdge.h:433
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:74
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:294
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition: MSNet.h:735
static void write(OutputDevice &of, SUMOTime timestep)
Produce a VTK output to use with Tools like ParaView.
Definition: MSVTKExport.cpp:56
The connection to a client was closed by the client.
Definition: MSNet.h:109
The simulation is running.
Definition: MSNet.h:103
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:257
int getEmergencyStops() const
return the number of emergency stops
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:47
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: MSNet.cpp:288
#define POSITION_EPS
Definition: config.h:175
bool hasInternalLinks() const
return whether the network contains internal links
Definition: MSNet.h:678
bool hasTransportables() const
checks whether any transportable waits to finish her plan
void updateAndWriteOutput()
This is called once per time step in MSNet::writeOutput() and collects the surrounding vehicles...
int getTeleportsJam() const
return the number of teleports due to jamming
static void cleanup()
properly deletes all trigger instances
Definition: MSTrigger.cpp:47
PedestrianRouterDijkstra< MSEdge, MSLane, MSJunction, MSVehicle > MSPedestrianRouterDijkstra
Definition: MSNet.h:117
double getTotalTravelTime() const
Returns the total travel time.
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:74
static void generateOutputForUnfinished()
generate vehroute output for vehicles which are still in the network
bool lefthand() const
return whether the network was built for lefthand traffic
Definition: MSNet.h:693
SUMOTime myStateDumpPeriod
The period for writing state.
Definition: MSNet.h:783
int getTeleportsWrongLane() const
return the number of teleports due to vehicles stuck on the wrong lane
Inserts vehicles into the network when their departure time is reached.
long myTraCIStepDuration
The last simulation step duration.
Definition: MSNet.h:764
void postloadInitContainer()
Closes building of junctions.
int myMaxTeleports
Maximum number of teleports.
Definition: MSNet.h:717
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:576
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 hasNeighs, bool lefthand, double version)
Closes the network&#39;s building process.
Definition: MSNet.cpp:211
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
static const std::string STAGE_MOVEMENTS
Definition: MSNet.h:845
static void processCommandsUntilSimStep(SUMOTime step)
process all commands until a simulation step is wanted
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition: MSNet.h:825
static MSNet * myInstance
Unique instance of MSNet.
Definition: MSNet.h:708
MSStoppingPlace * getContainerStop(const std::string &id) const
Returns the named container stop.
Definition: MSNet.cpp:851
bool isEmpty()
Returns whether events are in the que.
static void clearAll()
Clears all dictionaries.
Definition: MSNet.cpp:593
The simulation is loading.
Definition: MSNet.h:101
bool myRouterTTInitialized
Definition: MSNet.h:832
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
bool addContainerStop(MSStoppingPlace *containerStop)
Adds a container stop.
Definition: MSNet.cpp:846
bool addChargingStation(MSChargingStation *chargingStation)
Adds a chargingg station.
Definition: MSNet.cpp:891
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
void close(SUMOTime step)
Closes the detector outputs.
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition: MSNet.h:729
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition: MSNet.h:733
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
void abortWaiting()
aborts the plan for any transportable that is still waiting for a ride
static void clear()
Clears the dictionary.
Definition: MSLane.cpp:1394
static void write(OutputDevice &of, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition: MSNet.h:727
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:761
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool checkElevation()
check all lanes for elevation data
Definition: MSNet.cpp:983
int getPendingFlowCount() const
Returns the number of flows that are still active.
static void cleanup()
remove state at simulation end
Definition: MSPModel.cpp:81
void preSimStepOutput() const
Prints the current step number.
Definition: MSNet.cpp:756
static TraCIServer * getInstance()
Definition: TraCIServer.h:83
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition: MSNet.h:741
A storage for options typed value containers)
Definition: OptionsCont.h:99
static void cleanup()
removes remaining vehicleInformation in sVehicles
MSEdgeWeightsStorage * myEdgeWeights
The net&#39;s knowledge about edge efforts/travel times;.
Definition: MSNet.h:749
The simulation had too many teleports.
Definition: MSNet.h:113
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
Constructor.
Definition: MSNet.cpp:166
void checkWaiting(MSNet *net, const SUMOTime time)
checks whether any transportables waiting time is over
static void write(OutputDevice &of, const SUMOTime timestep)
Writes the complete network state into the given device.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:113
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle&#39;s state change.
Definition: MSNet.cpp:811
static void cleanup()
cleanup remaining data structures
const MSEdgeVector & getEdges() const
Returns loaded edges.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:693
long mySimBeginMillis
The overall simulation duration.
Definition: MSNet.h:767
virtual ~MSNet()
Destructor.
Definition: MSNet.cpp:246
bool myHasElevation
Whether the network contains elevation data.
Definition: MSNet.h:804
static void write(OutputDevice &of, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
std::string myStateDumpPrefix
name components for periodic state
Definition: MSNet.h:785
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
static void cleanup()
deletes the router instance
bool closeTag()
Closes the most recently opened tag.
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:572
NamedObjectCont< MSChargingStation * > myChargingStationDict
Dictionary of charging Stations.
Definition: MSNet.h:822
long long int SUMOTime
Definition: TraCIDefs.h:52
SUMOTime myStep
Current time step.
Definition: MSNet.h:714
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:925
The class responsible for building and deletion of vehicles.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
void simulationStep()
Performs a single simulation step.
Definition: MSNet.cpp:425
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:46
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
const MSLane & getLane() const
Returns the lane this stop is located at.
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
Definition: MELoop.cpp:69
void loadRoutes()
loads routes for the next few steps
Definition: MSNet.cpp:352
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
static const std::string STAGE_INSERTIONS
Definition: MSNet.h:847
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition: MSNet.h:745
static bool gUseMesoSim
Definition: MSGlobals.h:98
int getCollisionCount() const
return the number of collisions
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
long mySimStepDuration
Definition: MSNet.h:764
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
Definition: MSNet.cpp:827
NamedObjectCont< MSStoppingPlace * > myBusStopDict
Dictionary of bus stops.
Definition: MSNet.h:813
static bool wasClosed()
check whether close was requested
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterEffort(const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:952
int getTeleportCount() const
return the number of teleports (including collisions)
Stores time-dependant events and executes them at the proper time.
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition: MSNet.h:798
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:228
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static void cleanup()
remove state at simulation end
void determineCandidates(SUMOTime time)
Checks for all vehicles whether they can be emitted.
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition: MSNet.cpp:127
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net&#39;s internal edge travel times/efforts container.
Definition: MSNet.cpp:747
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition: MSNet.h:844
int getJammedNumber() const
Returns the number of times a transportables was jammed.
MSParkingArea * getParkingArea(const std::string &id) const
Returns the named parking area.
Definition: MSNet.cpp:874