Eclipse SUMO - Simulation of Urban MObility
MSNet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 /****************************************************************************/
26 // The simulated network and simulation perfomer
27 /****************************************************************************/
28 #include <config.h>
29 
30 #ifdef HAVE_VERSION_H
31 #include <version.h>
32 #endif
33 
34 #include <string>
35 #include <iostream>
36 #include <sstream>
37 #include <typeinfo>
38 #include <algorithm>
39 #include <cassert>
40 #include <vector>
41 #include <ctime>
42 
43 #include "trigger/MSTrigger.h"
44 #include "trigger/MSCalibrator.h"
46 #include "MSVehicleControl.h"
48 #include <utils/common/ToString.h>
49 #include <utils/common/SysUtils.h>
64 #include <utils/xml/XMLSubSys.h>
66 #include <libsumo/Simulation.h>
67 #include <mesosim/MELoop.h>
68 #include <mesosim/MESegment.h>
97 #include <utils/router/FareModul.h>
98 
100 #include "MSEdgeControl.h"
101 #include "MSJunctionControl.h"
102 #include "MSInsertionControl.h"
103 #include "MSDynamicShapeUpdater.h"
104 #include "MSEventControl.h"
105 #include "MSEdge.h"
106 #include "MSJunction.h"
107 #include "MSJunctionLogic.h"
108 #include "MSLane.h"
109 #include "MSVehicleTransfer.h"
110 #include "MSRoute.h"
111 #include "MSGlobals.h"
112 #include "MSEdgeWeightsStorage.h"
113 #include "MSStateHandler.h"
114 #include "MSFrame.h"
115 #include "MSParkingArea.h"
116 #include "MSStoppingPlace.h"
117 #include "MSNet.h"
118 
119 
120 // ===========================================================================
121 // debug constants
122 // ===========================================================================
123 //#define DEBUG_SIMSTEP
124 
125 
126 // ===========================================================================
127 // static member definitions
128 // ===========================================================================
129 MSNet* MSNet::myInstance = nullptr;
130 
131 const std::string MSNet::STAGE_EVENTS("events");
132 const std::string MSNet::STAGE_MOVEMENTS("move");
133 const std::string MSNet::STAGE_LANECHANGE("laneChange");
134 const std::string MSNet::STAGE_INSERTIONS("insertion");
135 
136 // ===========================================================================
137 // static member method definitions
138 // ===========================================================================
139 double
140 MSNet::getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t) {
141  double value;
142  const MSVehicle* const veh = dynamic_cast<const MSVehicle* const>(v);
143  if (veh != nullptr && veh->getWeightsStorage().retrieveExistingEffort(e, t, value)) {
144  return value;
145  }
146  if (getInstance()->getWeightsStorage().retrieveExistingEffort(e, t, value)) {
147  return value;
148  }
149  return 0;
150 }
151 
152 
153 double
154 MSNet::getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t) {
155  double value;
156  const MSVehicle* const veh = dynamic_cast<const MSVehicle* const>(v);
157  if (veh != nullptr && veh->getWeightsStorage().retrieveExistingTravelTime(e, t, value)) {
158  return value;
159  }
161  return value;
162  }
163  return e->getMinimumTravelTime(v);
164 }
165 
166 
167 // ---------------------------------------------------------------------------
168 // MSNet - methods
169 // ---------------------------------------------------------------------------
170 MSNet*
172  if (myInstance != nullptr) {
173  return myInstance;
174  }
175  throw ProcessError("A network was not yet constructed.");
176 }
177 
178 void
180  if (!MSGlobals::gUseMesoSim) {
182  }
183 }
184 
185 void
187  if (!MSGlobals::gUseMesoSim) {
189  }
190 }
191 
192 
193 MSNet::MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
194  MSEventControl* endOfTimestepEvents,
195  MSEventControl* insertionEvents,
196  ShapeContainer* shapeCont):
197  myAmInterrupted(false),
198  myVehiclesMoved(0),
199  myPersonsMoved(0),
200  myHavePermissions(false),
201  myHasInternalLinks(false),
202  myHasElevation(false),
203  myHasPedestrianNetwork(false),
204  myHasBidiEdges(false),
205  myEdgeDataEndTime(-1),
206  myDynamicShapeUpdater(nullptr) {
207  if (myInstance != nullptr) {
208  throw ProcessError("A network was already constructed.");
209  }
211  myStep = string2time(oc.getString("begin"));
212  myMaxTeleports = oc.getInt("max-num-teleports");
213  myLogExecutionTime = !oc.getBool("no-duration-log");
214  myLogStepNumber = !oc.getBool("no-step-log");
215  myLogStepPeriod = oc.getInt("step-log.period");
216  myInserter = new MSInsertionControl(*vc, string2time(oc.getString("max-depart-delay")), oc.getBool("eager-insert"), oc.getInt("max-num-vehicles"),
217  string2time(oc.getString("random-depart-offset")));
218  myVehicleControl = vc;
220  myEdges = nullptr;
221  myJunctions = nullptr;
222  myRouteLoaders = nullptr;
223  myLogics = nullptr;
224  myPersonControl = nullptr;
225  myContainerControl = nullptr;
226  myEdgeWeights = nullptr;
227  myShapeContainer = shapeCont == nullptr ? new ShapeContainer() : shapeCont;
228 
229  myBeginOfTimestepEvents = beginOfTimestepEvents;
230  myEndOfTimestepEvents = endOfTimestepEvents;
231  myInsertionEvents = insertionEvents;
232  myLanesRTree.first = false;
233 
235  MSGlobals::gMesoNet = new MELoop(string2time(oc.getString("meso-recheck")));
236  }
237  myInstance = this;
238  initStatic();
239 }
240 
241 
242 void
244  SUMORouteLoaderControl* routeLoaders,
245  MSTLLogicControl* tlc,
246  std::vector<SUMOTime> stateDumpTimes,
247  std::vector<std::string> stateDumpFiles,
248  bool hasInternalLinks,
249  bool hasNeighs,
250  double version) {
251  myEdges = edges;
252  myJunctions = junctions;
253  myRouteLoaders = routeLoaders;
254  myLogics = tlc;
255  // save the time the network state shall be saved at
256  myStateDumpTimes = stateDumpTimes;
257  myStateDumpFiles = stateDumpFiles;
258  myStateDumpPeriod = string2time(oc.getString("save-state.period"));
259  myStateDumpPrefix = oc.getString("save-state.prefix");
260  myStateDumpSuffix = oc.getString("save-state.suffix");
261 
262  // initialise performance computation
265  if (hasNeighs && MSGlobals::gLateralResolution > 0) {
266  throw ProcessError("Opposite direction driving does not work together with the sublane model.");
267  }
271  myVersion = version;
272 }
273 
274 
276  cleanupStatic();
277  // delete controls
278  delete myJunctions;
279  delete myDetectorControl;
280  // delete mean data
281  delete myEdges;
282  delete myInserter;
283  delete myLogics;
284  delete myRouteLoaders;
285  if (myPersonControl != nullptr) {
286  delete myPersonControl;
287  }
288  if (myContainerControl != nullptr) {
289  delete myContainerControl;
290  }
291  delete myVehicleControl; // must happen after deleting transportables
292  // delete events late so that vehicles can get rid of references first
294  myBeginOfTimestepEvents = nullptr;
295  delete myEndOfTimestepEvents;
296  myEndOfTimestepEvents = nullptr;
297  delete myInsertionEvents;
298  myInsertionEvents = nullptr;
299  delete myShapeContainer;
300  delete myEdgeWeights;
301  for (auto& router : myRouterTT) {
302  delete router.second;
303  }
304  myRouterTT.clear();
305  for (auto& router : myRouterEffort) {
306  delete router.second;
307  }
308  myRouterEffort.clear();
309  for (auto& router : myPedestrianRouter) {
310  delete router.second;
311  }
312  myPedestrianRouter.clear();
313  for (auto& router : myIntermodalRouter) {
314  delete router.second;
315  }
316  myIntermodalRouter.clear();
317  myLanesRTree.second.RemoveAll();
318  clearAll();
320  delete MSGlobals::gMesoNet;
321  }
322  myInstance = nullptr;
323 }
324 
325 
326 void
327 MSNet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) {
328  myRestrictions[id][svc] = speed;
329 }
330 
331 
332 const std::map<SUMOVehicleClass, double>*
333 MSNet::getRestrictions(const std::string& id) const {
334  std::map<std::string, std::map<SUMOVehicleClass, double> >::const_iterator i = myRestrictions.find(id);
335  if (i == myRestrictions.end()) {
336  return nullptr;
337  }
338  return &i->second;
339 }
340 
341 void
342 MSNet::addMesoType(const std::string& typeID, const MesoEdgeType& edgeType) {
343  myMesoEdgeTypes[typeID] = edgeType;
344 }
345 
346 const MSNet::MesoEdgeType&
347 MSNet::getMesoType(const std::string& typeID) {
348  if (myMesoEdgeTypes.count(typeID) == 0) {
349  // init defaults
350  const OptionsCont& oc = OptionsCont::getOptions();
351  MesoEdgeType edgeType;
352  edgeType.tauff = string2time(oc.getString("meso-tauff"));
353  edgeType.taufj = string2time(oc.getString("meso-taufj"));
354  edgeType.taujf = string2time(oc.getString("meso-taujf"));
355  edgeType.taujj = string2time(oc.getString("meso-taujj"));
356  edgeType.jamThreshold = oc.getFloat("meso-jam-threshold");
357  edgeType.junctionControl = oc.getBool("meso-junction-control");
358  edgeType.tlsPenalty = oc.getFloat("meso-tls-penalty");
359  edgeType.tlsFlowPenalty = oc.getFloat("meso-tls-flow-penalty");
360  edgeType.minorPenalty = string2time(oc.getString("meso-minor-penalty"));
361  edgeType.overtaking = oc.getBool("meso-overtaking");
362  myMesoEdgeTypes[typeID] = edgeType;
363  }
364  return myMesoEdgeTypes[typeID];
365 }
366 
369  // report the begin when wished
370  WRITE_MESSAGE("Simulation version " + std::string(VERSION_STRING) + " started with time: " + time2string(start));
371  // the simulation loop
373  // state loading may have changed the start time so we need to reinit it
374  myStep = start;
375  int numSteps = 0;
376  bool doStepLog = false;
377  while (state == SIMSTATE_RUNNING) {
378  doStepLog = myLogStepNumber && (numSteps % myLogStepPeriod == 0);
379  if (doStepLog) {
381  }
382  simulationStep();
383  if (doStepLog) {
385  }
386  state = adaptToState(simulationState(stop));
387 #ifdef DEBUG_SIMSTEP
388  std::cout << SIMTIME << " MSNet::simulate(" << start << ", " << stop << ")"
389  << "\n simulation state: " << getStateMessage(state)
390  << std::endl;
391 #endif
392  numSteps++;
393  }
394  if (myLogStepNumber && !doStepLog) {
395  // ensure some output on the last step
398  }
399  // exit simulation loop
400  if (myLogStepNumber) {
401  // start new line for final verbose output
402  std::cout << "\n";
403  }
404  closeSimulation(start, getStateMessage(state));
405  return state;
406 }
407 
408 
409 void
412 }
413 
414 
415 const std::string
417  std::ostringstream msg;
418  if (myLogExecutionTime) {
419  long duration = SysUtils::getCurrentMillis() - mySimBeginMillis;
420  // print performance notice
421  msg << "Performance: " << "\n" << " Duration: " << elapsedMs2string(duration) << "\n";
422  if (duration != 0) {
423  msg << " Real time factor: " << (STEPS2TIME(myStep - start) * 1000. / (double)duration) << "\n";
424  msg.setf(std::ios::fixed, std::ios::floatfield); // use decimal format
425  msg.setf(std::ios::showpoint); // print decimal point
426  msg << " UPS: " << ((double)myVehiclesMoved / ((double)duration / 1000)) << "\n";
427  if (myPersonsMoved > 0) {
428  msg << " UPS-Persons: " << ((double)myPersonsMoved / ((double)duration / 1000)) << "\n";
429  }
430  }
431  // print vehicle statistics
432  const std::string discardNotice = ((myVehicleControl->getLoadedVehicleNo() != myVehicleControl->getDepartedVehicleNo()) ?
433  " (Loaded: " + toString(myVehicleControl->getLoadedVehicleNo()) + ")" : "");
434  msg << "Vehicles: " << "\n"
435  << " Inserted: " << myVehicleControl->getDepartedVehicleNo() << discardNotice << "\n"
436  << " Running: " << myVehicleControl->getRunningVehicleNo() << "\n"
437  << " Waiting: " << myInserter->getWaitingVehicleNo() << "\n";
438 
440  // print optional teleport statistics
441  std::vector<std::string> reasons;
442  if (myVehicleControl->getCollisionCount() > 0) {
443  reasons.push_back("Collisions: " + toString(myVehicleControl->getCollisionCount()));
444  }
445  if (myVehicleControl->getTeleportsJam() > 0) {
446  reasons.push_back("Jam: " + toString(myVehicleControl->getTeleportsJam()));
447  }
448  if (myVehicleControl->getTeleportsYield() > 0) {
449  reasons.push_back("Yield: " + toString(myVehicleControl->getTeleportsYield()));
450  }
452  reasons.push_back("Wrong Lane: " + toString(myVehicleControl->getTeleportsWrongLane()));
453  }
454  msg << "Teleports: " << myVehicleControl->getTeleportCount() << " (" << joinToString(reasons, ", ") << ")\n";
455  }
456  if (myVehicleControl->getEmergencyStops() > 0) {
457  msg << "Emergency Stops: " << myVehicleControl->getEmergencyStops() << "\n";
458  }
459  if (myPersonControl != nullptr && myPersonControl->getLoadedNumber() > 0) {
460  msg << "Persons: " << "\n"
461  << " Inserted: " << myPersonControl->getLoadedNumber() << "\n"
462  << " Running: " << myPersonControl->getRunningNumber() << "\n";
463  if (myPersonControl->getJammedNumber() > 0) {
464  msg << " Jammed: " << myPersonControl->getJammedNumber() << "\n";
465  }
466  }
467  }
468  if (OptionsCont::getOptions().getBool("duration-log.statistics")) {
470  }
471  return msg.str();
472 }
473 
474 void
476  OutputDevice& od = OutputDevice::getDeviceByOption("statistic-output");
477  od.openTag("vehicles");
481  od.writeAttr("waiting", myInserter->getWaitingVehicleNo());
482  od.closeTag();
483  od.openTag("teleports");
488  od.closeTag();
489  od.openTag("safety");
490  od.writeAttr("collisions", myVehicleControl->getCollisionCount());
491  od.writeAttr("emergencyStops", myVehicleControl->getEmergencyStops());
492  od.closeTag();
493  od.openTag("persons");
494  od.writeAttr("loaded", myPersonControl != nullptr ? myPersonControl->getLoadedNumber() : 0);
495  od.writeAttr("running", myPersonControl != nullptr ? myPersonControl->getRunningNumber() : 0);
496  od.writeAttr("jammed", myPersonControl != nullptr ? myPersonControl->getJammedNumber() : 0);
497  od.closeTag();
498  if (OptionsCont::getOptions().isSet("tripinfo-output") || OptionsCont::getOptions().getBool("duration-log.statistics")) {
500  }
501 
502 }
503 
504 void
505 MSNet::closeSimulation(SUMOTime start, const std::string& reason) {
506  // report the end when wished
507  WRITE_MESSAGE("Simulation ended at time: " + time2string(getCurrentTimeStep()));
508  if (reason != "") {
509  WRITE_MESSAGE("Reason: " + reason);
510  }
512  if (OptionsCont::getOptions().getBool("vehroute-output.write-unfinished")) {
514  }
515  if (OptionsCont::getOptions().getBool("tripinfo-output.write-unfinished")) {
517  }
518  if (OptionsCont::getOptions().isSet("chargingstations-output")) {
520  }
521  if (OptionsCont::getOptions().isSet("overheadwiresegments-output")) {
523  }
524  if (OptionsCont::getOptions().isSet("substations-output")) {
526  }
527  if (OptionsCont::getOptions().isSet("railsignal-block-output")) {
529  }
530  if (myLogExecutionTime || OptionsCont::getOptions().getBool("duration-log.statistics")) {
532  }
533  if (OptionsCont::getOptions().isSet("statistic-output")) {
534  writeStatistics();
535  }
536 }
537 
538 
539 void
541 #ifdef DEBUG_SIMSTEP
542  std::cout << SIMTIME << ": MSNet::simulationStep() called"
543  << ", myStep = " << myStep
544  << std::endl;
545 #endif
547  if (t != nullptr) {
548  if (myLogExecutionTime) {
550  }
552 #ifdef DEBUG_SIMSTEP
553  bool loadRequested = !TraCI::getLoadArgs().empty();
554  assert(t->getTargetTime() >= myStep || loadRequested || TraCIServer::wasClosed());
555 #endif
556  if (myLogExecutionTime) {
558  }
559  if (TraCIServer::wasClosed()) {
560  return;
561  }
562  }
563 #ifdef DEBUG_SIMSTEP
564  std::cout << SIMTIME << ": TraCI target time: " << t->getTargetTime() << std::endl;
565 #endif
566  // execute beginOfTimestepEvents
567  if (myLogExecutionTime) {
569  }
570  // simulation state output
571  std::vector<SUMOTime>::iterator timeIt = std::find(myStateDumpTimes.begin(), myStateDumpTimes.end(), myStep);
572  if (timeIt != myStateDumpTimes.end()) {
573  const int dist = (int)distance(myStateDumpTimes.begin(), timeIt);
575  }
576  if (myStateDumpPeriod > 0 && myStep % myStateDumpPeriod == 0) {
577  std::string timeStamp = time2string(myStep);
578  std::replace(timeStamp.begin(), timeStamp.end(), ':', '-');
580  }
583 #ifdef HAVE_FOX
584  MSRoutingEngine::waitForAll();
585 #endif
588  }
589  // check whether the tls programs need to be switched
591 
595  } else {
596  // assure all lanes with vehicles are 'active'
598 
599  // compute safe velocities for all vehicles for the next few lanes
600  // also register ApproachingVehicleInformation for all links
602 
603  // register junction approaches based on planned velocities as basis for right-of-way decision
605 
606  // decide right-of-way and execute movements
610  }
611 
612  // vehicles may change lanes
614 
617  }
618  }
619  loadRoutes();
620 
621  // persons
622  if (myPersonControl != nullptr && myPersonControl->hasTransportables()) {
624  }
625  // containers
628  }
629  // insert vehicles
632 #ifdef HAVE_FOX
633  MSRoutingEngine::waitForAll();
634 #endif
637  //myEdges->patchActiveLanes(); // @note required to detect collisions on lanes that were empty before insertion. wasteful?
639  }
641 
642  // execute endOfTimestepEvents
644 
645  if (myLogExecutionTime) {
647  }
649  if (myLogExecutionTime) {
651  }
652  // update and write (if needed) detector values
653  writeOutput();
654 
655  if (myLogExecutionTime) {
658  if (myPersonControl != nullptr) {
660  }
661  }
662  myStep += DELTA_T;
663 }
664 
665 
668  if (TraCIServer::wasClosed()) {
670  }
671  if (TraCIServer::getInstance() != nullptr && !TraCIServer::getInstance()->getLoadArgs().empty()) {
672  return SIMSTATE_LOADING;
673  }
674  if ((stopTime < 0 || myStep > stopTime) && TraCIServer::getInstance() == nullptr && (stopTime > 0 || myStep > myEdgeDataEndTime)) {
676  && (myInserter->getPendingFlowCount() == 0)
677  && (myPersonControl == nullptr || !myPersonControl->hasNonWaiting())
681  }
682  }
683  if (stopTime >= 0 && myStep >= stopTime) {
685  }
688  }
689  if (myAmInterrupted) {
690  return SIMSTATE_INTERRUPTED;
691  }
692  return SIMSTATE_RUNNING;
693 }
694 
695 
698  if (state == SIMSTATE_LOADING) {
701  } else if (state != SIMSTATE_RUNNING && TraCIServer::getInstance() != nullptr && !TraCIServer::wasClosed()) {
702  // overrides SIMSTATE_END_STEP_REACHED, e.g. (TraCI ignore SUMO's --end option)
703  return SIMSTATE_RUNNING;
704  } else if (state == SIMSTATE_NO_FURTHER_VEHICLES) {
705  if (myPersonControl != nullptr) {
707  }
708  if (myContainerControl != nullptr) {
710  }
712  }
713  return state;
714 }
715 
716 
717 std::string
719  switch (state) {
721  return "";
723  return "The final simulation step has been reached.";
725  return "All vehicles have left the simulation.";
727  return "TraCI requested termination.";
729  return "An error occurred (see log).";
731  return "Interrupted.";
733  return "Too many teleports.";
735  return "TraCI issued load command.";
736  default:
737  return "Unknown reason.";
738  }
739 }
740 
741 
742 void
744  // clear container
745  MSEdge::clear();
746  MSLane::clear();
747  MSRoute::clear();
759  if (t != nullptr) {
760  t->cleanup();
761  }
764 }
765 
766 
767 void
772  MSRoute::dict_clearState(); // delete all routes after vehicles are deleted
775  for (int i = 0; i < MSEdge::dictSize(); i++) {
776  for (MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(*MSEdge::getAllEdges()[i]); s != nullptr; s = s->getNextSegment()) {
777  s->clearState();
778  }
779  }
780  } else {
781  for (int i = 0; i < MSEdge::dictSize(); i++) {
782  const std::vector<MSLane*>& lanes = MSEdge::getAllEdges()[i]->getLanes();
783  for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
784  (*it)->clearState();
785  }
786  }
787  }
788  myLogics->clearState();
792  for (auto& item : myStoppingPlaces) {
793  for (auto& item2 : item.second) {
794  item2.second->clearState();
795  }
796  }
800  myStep = step;
801 }
802 
803 
804 void
806  // update detector values
808  const OptionsCont& oc = OptionsCont::getOptions();
809 
810  // check state dumps
811  if (oc.isSet("netstate-dump")) {
813  oc.getInt("netstate-dump.precision"));
814  }
815 
816  // check fcd dumps
817  if (OptionsCont::getOptions().isSet("fcd-output")) {
819  }
820 
821  // check emission dumps
822  if (OptionsCont::getOptions().isSet("emission-output")) {
824  oc.getInt("emission-output.precision"));
825  }
826 
827  // battery dumps
828  if (OptionsCont::getOptions().isSet("battery-output")) {
830  oc.getInt("battery-output.precision"));
831  }
832 
833  // elecHybrid dumps
834  if (OptionsCont::getOptions().isSet("elechybrid-output")) {
835  std::string output = OptionsCont::getOptions().getString("elechybrid-output");
836 
837  if (oc.getBool("elechybrid-output.aggregated")) {
838  //build an aggregated xml files
840  oc.getInt("elechybrid-output.precision"));
841  } else {
842  // @TODORICE a necessity of placing here in MSNet.cpp ?
844  for (MSVehicleControl::constVehIt it = vc.loadedVehBegin(); it != vc.loadedVehEnd(); ++it) {
845  const SUMOVehicle* veh = it->second;
846  if (!veh->isOnRoad()) {
847  continue;
848  }
849  if (static_cast<MSDevice_ElecHybrid*>(veh->getDevice(typeid(MSDevice_ElecHybrid))) != nullptr) {
850  std::string vehID = veh->getID();
851  std::string filename2 = output + "_" + vehID + ".xml";
852  OutputDevice& dev = OutputDevice::getDevice(filename2);
853  std::map<SumoXMLAttr, std::string> attrs;
854  attrs[SUMO_ATTR_VEHICLE] = vehID;
856  dev.writeXMLHeader("elecHybrid-export", "", attrs);
857  MSElecHybridExport::write(OutputDevice::getDevice(filename2), veh, myStep, oc.getInt("elechybrid-output.precision"));
858  }
859  }
860  }
861  }
862 
863 
864  // check full dumps
865  if (OptionsCont::getOptions().isSet("full-output")) {
867  }
868 
869  // check queue dumps
870  if (OptionsCont::getOptions().isSet("queue-output")) {
872  }
873 
874  // check amitran dumps
875  if (OptionsCont::getOptions().isSet("amitran-output")) {
877  }
878 
879  // check vtk dumps
880  if (OptionsCont::getOptions().isSet("vtk-output")) {
881 
882  if (MSNet::getInstance()->getVehicleControl().getRunningVehicleNo() > 0) {
883  std::string timestep = time2string(myStep);
884  timestep = timestep.substr(0, timestep.length() - 3);
885  std::string output = OptionsCont::getOptions().getString("vtk-output");
886  std::string filename = output + "_" + timestep + ".vtp";
887 
888  OutputDevice_File dev = OutputDevice_File(filename, false);
889 
890  //build a huge mass of xml files
892 
893  }
894 
895  }
896 
897  // summary output
898  if (OptionsCont::getOptions().isSet("summary-output")) {
899  OutputDevice& od = OutputDevice::getDeviceByOption("summary-output");
900  int departedVehiclesNumber = myVehicleControl->getDepartedVehicleNo();
901  const double meanWaitingTime = departedVehiclesNumber != 0 ? myVehicleControl->getTotalDepartureDelay() / (double) departedVehiclesNumber : -1.;
902  int endedVehicleNumber = myVehicleControl->getEndedVehicleNo();
903  const double meanTravelTime = endedVehicleNumber != 0 ? myVehicleControl->getTotalTravelTime() / (double) endedVehicleNumber : -1.;
904  od.openTag("step");
905  od.writeAttr("time", time2string(myStep));
909  od.writeAttr("waiting", myInserter->getWaitingVehicleNo());
912  od.writeAttr("collisions", myVehicleControl->getCollisionCount());
913  od.writeAttr("teleports", myVehicleControl->getTeleportCount());
916  od.writeAttr("meanWaitingTime", meanWaitingTime);
917  od.writeAttr("meanTravelTime", meanTravelTime);
918  std::pair<double, double> meanSpeed = myVehicleControl->getVehicleMeanSpeeds();
919  od.writeAttr("meanSpeed", meanSpeed.first);
920  od.writeAttr("meanSpeedRelative", meanSpeed.second);
921  if (myLogExecutionTime) {
922  od.writeAttr("duration", mySimStepDuration);
923  }
924  od.closeTag();
925  }
926  if (OptionsCont::getOptions().isSet("person-summary-output")) {
927  OutputDevice& od = OutputDevice::getDeviceByOption("person-summary-output");
929  od.openTag("step");
930  od.writeAttr("time", time2string(myStep));
931  od.writeAttr("loaded", pc.getLoadedNumber());
932  od.writeAttr("inserted", pc.getDepartedNumber());
933  od.writeAttr("walking", pc.getMovingNumber());
934  od.writeAttr("waitingForRide", pc.getWaitingForVehicleNumber());
935  od.writeAttr("riding", pc.getRidingNumber());
936  od.writeAttr("stopping", pc.getWaitingUntilNumber());
937  od.writeAttr("jammed", pc.getJammedNumber());
938  od.writeAttr("ended", pc.getEndedNumber());
939  od.writeAttr("arrived", pc.getArrivedNumber());
940  if (myLogExecutionTime) {
941  od.writeAttr("duration", mySimStepDuration);
942  }
943  od.closeTag();
944 
945  }
946 
947  // write detector values
949 
950  // write link states
951  if (OptionsCont::getOptions().isSet("link-output")) {
952  OutputDevice& od = OutputDevice::getDeviceByOption("link-output");
953  od.openTag("timestep");
955  for (const MSEdge* const edge : myEdges->getEdges()) {
956  for (const MSLane* const lane : edge->getLanes()) {
957  for (const MSLink* const link : lane->getLinkCont()) {
958  link->writeApproaching(od, lane->getID());
959  }
960  }
961  }
962  od.closeTag();
963  }
964 
965  // write SSM output
967  dev->updateAndWriteOutput();
968  }
969 
970  // write ToC output
972  if (dev->generatesOutput()) {
973  dev->writeOutput();
974  }
975  }
976 }
977 
978 
979 bool
981  return myLogExecutionTime;
982 }
983 
984 
987  if (myPersonControl == nullptr) {
989  }
990  return *myPersonControl;
991 }
992 
993 
996  if (myContainerControl == nullptr) {
998  }
999  return *myContainerControl;
1000 }
1001 
1004  myDynamicShapeUpdater = std::unique_ptr<MSDynamicShapeUpdater> (new MSDynamicShapeUpdater(*myShapeContainer));
1005  return myDynamicShapeUpdater.get();
1006 }
1007 
1010  if (myEdgeWeights == nullptr) {
1012  }
1013  return *myEdgeWeights;
1014 }
1015 
1016 
1017 void
1019  std::cout << "Step #" << time2string(myStep);
1020 }
1021 
1022 
1023 void
1025  if (myLogExecutionTime) {
1026  std::ostringstream oss;
1027  oss.setf(std::ios::fixed, std::ios::floatfield); // use decimal format
1028  oss.setf(std::ios::showpoint); // print decimal point
1029  oss << std::setprecision(gPrecision);
1030  if (mySimStepDuration != 0) {
1031  const double durationSec = (double)mySimStepDuration / 1000.;
1032  oss << " (" << mySimStepDuration << "ms ~= "
1033  << (TS / durationSec) << "*RT, ~"
1034  << ((double) myVehicleControl->getRunningVehicleNo() / durationSec);
1035  } else {
1036  oss << " (0ms ?*RT. ?";
1037  }
1038  oss << "UPS, ";
1039  if (TraCIServer::getInstance() != nullptr) {
1040  oss << "TraCI: " << myTraCIStepDuration << "ms, ";
1041  }
1042  oss << "vehicles TOT " << myVehicleControl->getDepartedVehicleNo()
1043  << " ACT " << myVehicleControl->getRunningVehicleNo()
1044  << " BUF " << myInserter->getWaitingVehicleNo()
1045  << ") ";
1046  std::string prev = "Step #" + time2string(myStep - DELTA_T);
1047  std::cout << oss.str().substr(0, 90 - prev.length());
1048  }
1049  std::cout << '\r';
1050 }
1051 
1052 
1053 void
1055  if (find(myVehicleStateListeners.begin(), myVehicleStateListeners.end(), listener) == myVehicleStateListeners.end()) {
1056  myVehicleStateListeners.push_back(listener);
1057  }
1058 }
1059 
1060 
1061 void
1063  std::vector<VehicleStateListener*>::iterator i = std::find(myVehicleStateListeners.begin(), myVehicleStateListeners.end(), listener);
1064  if (i != myVehicleStateListeners.end()) {
1065  myVehicleStateListeners.erase(i);
1066  }
1067 }
1068 
1069 
1070 void
1071 MSNet::informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info) {
1072 #ifdef HAVE_FOX
1073  FXConditionalLock lock(myStateListenerMutex, MSGlobals::gNumThreads > 1);
1074 #endif
1075  for (VehicleStateListener* const listener : myVehicleStateListeners) {
1076  listener->vehicleStateChanged(vehicle, to, info);
1077  }
1078 }
1079 
1080 
1081 bool
1083  return myStoppingPlaces[category == SUMO_TAG_TRAIN_STOP ? SUMO_TAG_BUS_STOP : category].add(stop->getID(), stop);
1084 }
1085 
1086 
1087 bool
1089  if (find(myTractionSubstations.begin(), myTractionSubstations.end(), substation) == myTractionSubstations.end()) {
1090  myTractionSubstations.push_back(substation);
1091  return true;
1092  }
1093  return false;
1094 }
1095 
1096 
1098 MSNet::getStoppingPlace(const std::string& id, const SumoXMLTag category) const {
1099  if (myStoppingPlaces.count(category) > 0) {
1100  return myStoppingPlaces.find(category)->second.get(id);
1101  }
1102  return nullptr;
1103 }
1104 
1105 
1106 std::string
1107 MSNet::getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const {
1108  if (myStoppingPlaces.count(category) > 0) {
1109  for (const auto& it : myStoppingPlaces.find(category)->second) {
1110  MSStoppingPlace* stop = it.second;
1111  if (&stop->getLane() == lane && stop->getBeginLanePosition() - POSITION_EPS <= pos && stop->getEndLanePosition() + POSITION_EPS >= pos) {
1112  return stop->getID();
1113  }
1114  }
1115  }
1116  return "";
1117 }
1118 
1119 
1122  auto it = myStoppingPlaces.find(category);
1123  if (it != myStoppingPlaces.end()) {
1124  return it->second;
1125  } else {
1126  throw ProcessError("No stoppingPlace of type '" + toString(category) + "' found");
1127  }
1128 }
1129 
1130 
1131 void
1134  OutputDevice& output = OutputDevice::getDeviceByOption("chargingstations-output");
1135  for (const auto& it : myStoppingPlaces.find(SUMO_TAG_CHARGING_STATION)->second) {
1136  static_cast<MSChargingStation*>(it.second)->writeChargingStationOutput(output);
1137  }
1138  }
1139 }
1140 
1141 
1142 void
1144  OutputDevice& output = OutputDevice::getDeviceByOption("railsignal-block-output");
1145  for (auto tls : myLogics->getAllLogics()) {
1146  MSRailSignal* rs = dynamic_cast<MSRailSignal*>(tls);
1147  if (rs != nullptr) {
1148  rs->writeBlocks(output);
1149  }
1150  }
1151 }
1152 
1153 
1154 void
1157  OutputDevice& output = OutputDevice::getDeviceByOption("overheadwiresegments-output");
1158  for (const auto& it : myStoppingPlaces.find(SUMO_TAG_OVERHEAD_WIRE_SEGMENT)->second) {
1159  static_cast<MSOverheadWire*>(it.second)->writeOverheadWireSegmentOutput(output);
1160  }
1161  }
1162 }
1163 
1164 
1165 void
1168  OutputDevice& output = OutputDevice::getDeviceByOption("substations-output");
1169  for (const auto& it : myStoppingPlaces.find(SUMO_TAG_OVERHEAD_WIRE_SEGMENT)->second) {
1170  static_cast<MSOverheadWire*>(it.second)->writeOverheadWireSegmentOutput(output);
1171  }
1172  }
1173 }
1174 
1175 
1177 MSNet::findTractionSubstation(const std::string& substationId) {
1178  for (std::vector<MSTractionSubstation*>::iterator it = myTractionSubstations.begin(); it != myTractionSubstations.end(); ++it) {
1179  if ((*it)->getID() == substationId) {
1180  return *it;
1181  }
1182  }
1183  return nullptr;
1184 }
1185 
1186 
1187 bool
1188 MSNet::existTractionSubstation(const std::string& substationId) {
1189  for (std::vector<MSTractionSubstation*>::iterator it = myTractionSubstations.begin(); it != myTractionSubstations.end(); ++it) {
1190  if ((*it)->getID() == substationId) {
1191  return true;
1192  }
1193  }
1194  return false;
1195 }
1196 
1197 
1199 MSNet::getRouterTT(const int rngIndex, const MSEdgeVector& prohibited) const {
1200  if (myRouterTT.count(rngIndex) == 0) {
1201  const std::string routingAlgorithm = OptionsCont::getOptions().getString("routing-algorithm");
1202  if (routingAlgorithm == "dijkstra") {
1203  myRouterTT[rngIndex] = new DijkstraRouter<MSEdge, SUMOVehicle>(MSEdge::getAllEdges(), true, &MSNet::getTravelTime, nullptr, false, nullptr, true);
1204  } else {
1205  if (routingAlgorithm != "astar") {
1206  WRITE_WARNING("TraCI and Triggers cannot use routing algorithm '" + routingAlgorithm + "'. using 'astar' instead.");
1207  }
1208  myRouterTT[rngIndex] = new AStarRouter<MSEdge, SUMOVehicle>(MSEdge::getAllEdges(), true, &MSNet::getTravelTime, nullptr, true);
1209  }
1210  }
1211  myRouterTT[rngIndex]->prohibit(prohibited);
1212  return *myRouterTT[rngIndex];
1213 }
1214 
1215 
1217 MSNet::getRouterEffort(const int rngIndex, const MSEdgeVector& prohibited) const {
1218  if (myRouterEffort.count(rngIndex) == 0) {
1220  }
1221  myRouterEffort[rngIndex]->prohibit(prohibited);
1222  return *myRouterEffort[rngIndex];
1223 }
1224 
1225 
1227 MSNet::getPedestrianRouter(const int rngIndex, const MSEdgeVector& prohibited) const {
1228  if (myPedestrianRouter.count(rngIndex) == 0) {
1229  myPedestrianRouter[rngIndex] = new MSPedestrianRouter();
1230  }
1231  myPedestrianRouter[rngIndex]->prohibit(prohibited);
1232  return *myPedestrianRouter[rngIndex];
1233 }
1234 
1235 
1237 MSNet::getIntermodalRouter(const int rngIndex, const int routingMode, const MSEdgeVector& prohibited) const {
1238  const OptionsCont& oc = OptionsCont::getOptions();
1239  const int key = rngIndex * oc.getInt("thread-rngs") + routingMode;
1240  if (myIntermodalRouter.count(key) == 0) {
1241  int carWalk = 0;
1242  for (const std::string& opt : oc.getStringVector("persontrip.transfer.car-walk")) {
1243  if (opt == "parkingAreas") {
1245  } else if (opt == "ptStops") {
1247  } else if (opt == "allJunctions") {
1249  }
1250  }
1251  // XXX there is currently no reason to combine multiple values, thus getValueString rather than getStringVector
1252  const std::string& taxiDropoff = oc.getValueString("persontrip.transfer.taxi-walk");
1253  const std::string& taxiPickup = oc.getValueString("persontrip.transfer.walk-taxi");
1254  if (taxiDropoff == "") {
1255  if (MSDevice_Taxi::getTaxi() != nullptr) {
1257  }
1258  } else if (taxiDropoff == "ptStops") {
1260  } else if (taxiDropoff == "allJunctions") {
1262  }
1263  if (taxiPickup == "") {
1264  if (MSDevice_Taxi::getTaxi() != nullptr) {
1266  }
1267  } else if (taxiPickup == "ptStops") {
1269  } else if (taxiPickup == "allJunctions") {
1271  }
1272  const std::string routingAlgorithm = OptionsCont::getOptions().getString("routing-algorithm");
1273  double taxiWait = STEPS2TIME(string2time(OptionsCont::getOptions().getString("persontrip.taxi.waiting-time")));
1274  if (routingMode == libsumo::ROUTING_MODE_COMBINED) {
1275  myIntermodalRouter[key] = new MSIntermodalRouter(MSNet::adaptIntermodalRouter, carWalk, taxiWait, routingAlgorithm, routingMode, new FareModul());
1276  } else {
1277  myIntermodalRouter[key] = new MSIntermodalRouter(MSNet::adaptIntermodalRouter, carWalk, taxiWait, routingAlgorithm, routingMode);
1278  }
1279  }
1280  myIntermodalRouter[key]->prohibit(prohibited);
1281  return *myIntermodalRouter[key];
1282 }
1283 
1284 
1285 void
1287  double taxiWait = STEPS2TIME(string2time(OptionsCont::getOptions().getString("persontrip.taxi.waiting-time")));
1288  // add access to all parking areas
1289  for (const auto& i : myInstance->myStoppingPlaces[SUMO_TAG_PARKING_AREA]) {
1290  const MSEdge* const edge = &i.second->getLane().getEdge();
1291  router.getNetwork()->addAccess(i.first, edge, i.second->getAccessPos(edge), i.second->getAccessDistance(edge), SUMO_TAG_PARKING_AREA, false, taxiWait);
1292  }
1293  EffortCalculator* const external = router.getExternalEffort();
1294  // add access to all public transport stops
1295  for (const auto& i : myInstance->myStoppingPlaces[SUMO_TAG_BUS_STOP]) {
1296  const MSEdge* const edge = &i.second->getLane().getEdge();
1297  router.getNetwork()->addAccess(i.first, edge, i.second->getAccessPos(edge),
1298  i.second->getAccessDistance(edge), SUMO_TAG_BUS_STOP, false, taxiWait);
1299  for (const auto& a : i.second->getAllAccessPos()) {
1300  router.getNetwork()->addAccess(i.first, &std::get<0>(a)->getEdge(), std::get<1>(a), std::get<2>(a), SUMO_TAG_BUS_STOP, true, taxiWait);
1301  }
1302  if (external != nullptr) {
1303  external->addStop(router.getNetwork()->getStopEdge(i.first)->getNumericalID(), *i.second);
1304  }
1305  }
1308  // add access to transfer from walking to taxi-use
1310  for (MSEdge* edge : myInstance->getEdgeControl().getEdges()) {
1311  if ((edge->getPermissions() & SVC_PEDESTRIAN) != 0 && (edge->getPermissions() & SVC_TAXI) != 0) {
1312  router.getNetwork()->addCarAccess(edge, SVC_TAXI, taxiWait);
1313  }
1314  }
1315  }
1316 }
1317 
1318 
1319 bool
1321  const MSEdgeVector& edges = myEdges->getEdges();
1322  for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) {
1323  for (std::vector<MSLane*>::const_iterator i = (*e)->getLanes().begin(); i != (*e)->getLanes().end(); ++i) {
1324  if ((*i)->getShape().hasElevation()) {
1325  return true;
1326  }
1327  }
1328  }
1329  return false;
1330 }
1331 
1332 
1333 bool
1335  for (const MSEdge* e : myEdges->getEdges()) {
1336  if (e->getFunction() == SumoXMLEdgeFunc::WALKINGAREA) {
1337  return true;
1338  }
1339  }
1340  return false;
1341 }
1342 
1343 
1344 bool
1346  for (const MSEdge* e : myEdges->getEdges()) {
1347  if (e->getBidiEdge() != nullptr) {
1348  return true;
1349  }
1350  }
1351  return false;
1352 }
1353 
1354 bool
1355 MSNet::warnOnce(const std::string& typeAndID) {
1356  if (myWarnedOnce.find(typeAndID) == myWarnedOnce.end()) {
1357  myWarnedOnce[typeAndID] = true;
1358  return true;
1359  }
1360  return false;
1361 }
1362 
1363 
1364 /****************************************************************************/
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:73
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:278
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
std::string elapsedMs2string(long long int t)
convert ms to string for log output
Definition: SUMOTime.cpp:109
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define TS
Definition: SUMOTime.h:40
#define SIMTIME
Definition: SUMOTime.h:60
long long int SUMOTime
Definition: SUMOTime.h:31
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ 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_BUS_STOP
A bus stop.
@ 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_ATTR_MAXIMUMBATTERYCAPACITY
Maxium battery capacity.
@ SUMO_ATTR_VEHICLE
@ SUMO_ATTR_ID
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:25
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:250
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
Computes the shortest path through a network using the A* algorithm.
Definition: AStarRouter.h:76
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
A scoped lock which only triggers on condition.
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 pos, 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.
@ TAXI_PICKUP_ANYWHERE
taxi customer may be picked up anywhere
@ TAXI_DROPOFF_ANYWHERE
taxi customer may exit anywhere
@ PARKING_AREAS
parking areas
@ ALL_JUNCTIONS
junctions with edges allowing the additional mode
@ TAXI_PICKUP_PT
taxi customer may be picked up at public transport stop
@ PT_STOPS
public transport stops and access
@ TAXI_DROPOFF_PT
taxi customer may be picked up at public transport stop
EffortCalculator * getExternalEffort() const
Network * getNetwork() const
int getCarWalkTransfer() const
The main mesocopic simulation loop.
Definition: MELoop.h:46
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
Definition: MELoop.cpp:61
void clearState()
Remove all vehicles before quick-loading state.
Definition: MELoop.cpp:210
A single mesoscopic segment (cell)
Definition: MESegment.h:47
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.
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
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()
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)
Definition: MSDevice_SSM.h:54
static const std::set< MSDevice_SSM *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing SSM devices
static void cleanup()
Clean up remaining devices instances.
static bool hasServableReservations()
check whether there are still (servable) reservations in the system
static SUMOVehicle * getTaxi()
returns a taxi if any exist or nullptr
The ToC Device controls transition of control between automated and manual driving.
Definition: MSDevice_ToC.h:52
static void cleanup()
Closes root tags of output files.
static const std::set< MSDevice_ToC *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing ToC devices
Definition: MSDevice_ToC.h:91
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 generateOutputForUnfinished()
generate vehroute output for vehicles which are still in the network
static void cleanupAll()
perform cleanup for all devices
Definition: MSDevice.cpp:126
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:81
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
const MSEdgeVector & getEdges() const
Returns loaded edges.
void setJunctionApproaches(SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. This is a prerequis...
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
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:847
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:853
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:841
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition: MSEdge.h:450
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, int precision)
Writes the complete network state of the given edges 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, SUMOTime timestep, bool elevation)
Writes the position and the angle of each vehicle into the given device.
Definition: MSFCDExport.cpp:49
static void write(OutputDevice &of, SUMOTime timestep)
Dumping a hugh List of Parameters available in the Simulation.
static bool gUseMesoSim
Definition: MSGlobals.h:88
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:94
static double gLateralResolution
Definition: MSGlobals.h:82
static bool gCheck4Accidents
Definition: MSGlobals.h:73
static int gNumThreads
how many threads to use
Definition: MSGlobals.h:118
Inserts vehicles into the network when their departure time is reached.
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
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 adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
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:82
static void clear()
Clears the dictionary.
Definition: MSLane.cpp:1931
Interface for objects listening to vehicle state changes.
Definition: MSNet.h:620
The simulated network and simulation perfomer.
Definition: MSNet.h:89
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition: MSNet.h:868
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition: MSNet.cpp:140
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition: MSNet.cpp:1355
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterEffort
Definition: MSNet.h:890
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1237
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition: MSNet.h:801
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition: MSNet.h:770
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition: MSNet.cpp:1062
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition: MSNet.h:751
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition: MSNet.cpp:1082
SUMOTime myStateDumpPeriod
The period for writing state.
Definition: MSNet.h:829
const std::string generateStatistics(SUMOTime start)
Writes performance output and running vehicle stats.
Definition: MSNet.cpp:416
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition: MSNet.cpp:1155
void writeChargingStationOutput() const
write charging station output
Definition: MSNet.cpp:1132
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition: MSNet.h:895
bool checkBidiEdges()
check wether bidirectional edges occur in the network
Definition: MSNet.cpp:1345
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:587
int myLogStepPeriod
Period between successive step-log outputs.
Definition: MSNet.h:806
SUMOTime myStep
Current time step.
Definition: MSNet.h:754
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:171
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition: MSNet.h:856
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition: MSNet.h:784
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition: MSNet.cpp:1088
const MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
Definition: MSNet.cpp:347
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition: MSNet.h:882
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition: MSNet.cpp:179
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition: MSNet.h:776
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition: MSNet.h:790
double myVersion
the network version
Definition: MSNet.h:862
std::string myStateDumpSuffix
Definition: MSNet.h:832
bool checkElevation()
check all lanes for elevation data
Definition: MSNet.cpp:1320
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
Definition: MSNet.cpp:1188
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition: MSNet.h:804
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition: MSNet.h:788
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:995
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 occured.
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
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1199
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition: MSNet.h:891
static const std::string STAGE_MOVEMENTS
Definition: MSNet.h:905
int myMaxTeleports
Maximum number of teleports.
Definition: MSNet.h:757
long mySimStepDuration
Definition: MSNet.h:809
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:371
PedestrianRouter< MSEdge, MSLane, MSJunction, MSVehicle > MSPedestrianRouter
Definition: MSNet.h:113
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition: MSNet.h:786
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:718
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:1107
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition: MSNet.h:847
SimulationState adaptToState(const SimulationState state) const
Called after a simulation step, this method adapts the current simulation state if necessary.
Definition: MSNet.cpp:697
void writeSubstationOutput() const
write electrical substation output
Definition: MSNet.cpp:1166
static const std::string STAGE_INSERTIONS
Definition: MSNet.h:907
long long int myPersonsMoved
Definition: MSNet.h:816
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition: MSNet.h:768
std::map< std::string, MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition: MSNet.h:844
void addMesoType(const std::string &typeID, const MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition: MSNet.cpp:342
static void clearAll()
Clears all dictionaries.
Definition: MSNet.cpp:743
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition: MSNet.cpp:186
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSIntermodalRouter
Definition: MSNet.h:114
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:313
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition: MSNet.h:774
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition: MSNet.h:900
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:333
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition: MSNet.cpp:505
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition: MSNet.cpp:1098
void simulationStep()
Performs a single simulation step.
Definition: MSNet.cpp:540
bool myHasElevation
Whether the network contains elevation data.
Definition: MSNet.h:850
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:154
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition: MSNet.h:772
void writeOutput()
Write netstate, summary and detector output.
Definition: MSNet.cpp:805
bool myAmInterrupted
whether an interrupt occured
Definition: MSNet.h:760
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition: MSNet.cpp:1054
void preSimStepOutput() const
Prints the current step number.
Definition: MSNet.cpp:1018
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition: MSNet.h:414
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition: MSNet.h:825
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition: MSNet.h:871
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition: MSNet.h:865
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:1009
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition: MSNet.h:841
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition: MSNet.h:827
void writeRailSignalBlocks() const
write rail signal block output
Definition: MSNet.cpp:1143
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:424
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition: MSNet.h:778
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition: MSNet.cpp:980
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition: MSNet.h:815
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:1071
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition: MSNet.h:874
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition: MSNet.cpp:667
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, double version)
Closes the network's building process.
Definition: MSNet.cpp:243
long myTraCIStepDuration
The last simulation step duration.
Definition: MSNet.h:809
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition: MSNet.h:782
static const std::string STAGE_LANECHANGE
Definition: MSNet.h:906
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
Constructor.
Definition: MSNet.cpp:193
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: MSNet.cpp:327
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterTT
Definition: MSNet.h:889
static void adaptIntermodalRouter(MSIntermodalRouter &router)
Definition: MSNet.cpp:1286
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition: MSNet.h:792
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition: MSNet.cpp:1003
std::map< int, MSIntermodalRouter * > myIntermodalRouter
Definition: MSNet.h:892
virtual ~MSNet()
Destructor.
Definition: MSNet.cpp:275
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1227
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition: MSNet.cpp:1177
static MSNet * myInstance
Unique instance of MSNet.
Definition: MSNet.h:748
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition: MSNet.h:780
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition: MSNet.cpp:1024
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:986
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition: MSNet.h:904
void loadRoutes()
loads routes for the next few steps
Definition: MSNet.cpp:410
std::string myStateDumpPrefix
name components for periodic state
Definition: MSNet.h:831
void clearState(const SUMOTime step)
Resets events when quick-loading state.
Definition: MSNet.cpp:768
long mySimBeginMillis
The overall simulation duration.
Definition: MSNet.h:812
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition: MSNet.h:853
void writeStatistics() const
write statistic output to (xml) file
Definition: MSNet.cpp:475
bool hasInternalLinks() const
return whether the network contains internal links
Definition: MSNet.h:695
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1217
bool checkWalkingarea()
check all lanes for type walkingArea
Definition: MSNet.cpp:1334
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition: MSNet.cpp:1121
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition: MSNet.cpp:368
Definition of overhead wire segment.
static void write(OutputDevice &of, SUMOTime timestep)
Export the queueing length in front of a junction (very experimental!)
static void cleanup()
clean up state
A signal for rails.
Definition: MSRailSignal.h:46
void writeBlocks(OutputDevice &od) const
write rail signal block output for all links and driveways
static void recheckGreen()
final check for driveway compatibility of signals that switched green in this step
static void dict_clearState()
Decrement all route references before quick-loading state.
Definition: MSRoute.cpp:286
static void clear()
Clears the dictionary (delete all known routes, too)
Definition: MSRoute.cpp:178
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
static void cleanup()
Definition: MSStopOut.cpp:49
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
A class that stores and controls tls and switching of their programs.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void clearState()
Clear all tls states before quick-loading state.
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
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 getLoadedNumber() const
Returns the number of build transportables.
int getWaitingUntilNumber() const
Returns the number of transportables waiting for a specified amount of time.
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.
int getRidingNumber() const
Returns the number of transportables riding a vehicle.
static void cleanup()
properly deletes all trigger instances
Definition: MSTrigger.cpp:44
static void write(OutputDevice &of, SUMOTime timestep)
Produce a VTK output to use with Tools like ParaView.
Definition: MSVTKExport.cpp:41
static void init()
Static initalization.
Definition: MSVehicle.cpp:381
static void cleanup()
Static cleanup.
Definition: MSVehicle.cpp:386
The class responsible for building and deletion of vehicles.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
void clearState()
Remove all vehicles before quick-loading state.
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.
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
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
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 ...
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.
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.
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:47
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)
std::string getValueString(const std::string &name) const
Returns the string-value of the named option (all options)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:58
An output device that encapsulates an ofstream.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
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.
static void closeAll(bool keepErrorRetrievers=false)
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
void loadNext(SUMOTime step)
loads the next routes up to and including the given time step
Representation of a vehicle.
Definition: SUMOVehicle.h:58
virtual MSVehicleDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or 0.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
Storage for geometrical objects.
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:39
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
std::vector< std::string > & getLoadArgs()
Definition: TraCIServer.h:246
void cleanup()
clean up subscriptions
void processCommandsUntilSimStep(SUMOTime step)
process all commands until the next SUMO simulation step. It is guaranteed that t->getTargetTime() >=...
static TraCIServer * getInstance()
Definition: TraCIServer.h:68
static void postProcessRemoteControl()
Definition: Helper.cpp:1102
static void cleanup()
Definition: Helper.cpp:526
TRACI_CONST int ROUTING_MODE_COMBINED
edge type specific meso parameters
Definition: MSNet.h:117
bool junctionControl
Definition: MSNet.h:123
double jamThreshold
Definition: MSNet.h:122
SUMOTime taufj
Definition: MSNet.h:119
SUMOTime tauff
Definition: MSNet.h:118
SUMOTime taujj
Definition: MSNet.h:121
double tlsPenalty
Definition: MSNet.h:124
SUMOTime minorPenalty
Definition: MSNet.h:126
double tlsFlowPenalty
Definition: MSNet.h:125
SUMOTime taujf
Definition: MSNet.h:120