Eclipse SUMO - Simulation of Urban MObility
MSNet.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
25// The simulated network and simulation performer
26/****************************************************************************/
27#pragma once
28#include <config.h>
29
30#include <typeinfo>
31#include <vector>
32#include <map>
33#include <string>
34#include <fstream>
35#include <iostream>
36#include <cmath>
37#include <iomanip>
38#include <memory>
44#include <mesosim/MESegment.h>
45#include "MSJunction.h"
46
47
48// ===========================================================================
49// class declarations
50// ===========================================================================
51class MSEdge;
52class MSEdgeControl;
53class MSEventControl;
59class MSTransportable;
60class MSVehicle;
61class MSRoute;
62class MSLane;
66class ShapeContainer;
68class PolygonDynamics;
70class SUMOVehicle;
73class MSStoppingPlace;
74template<class E, class L, class N, class V>
76template<class E, class L, class N, class V>
78class OptionsCont;
79
80
81// ===========================================================================
82// class definitions
83// ===========================================================================
88class MSNet : public Parameterised {
89public:
110 };
111
114
116 struct Collision {
117 std::string victim;
118 std::string colliderType;
119 std::string victimType;
122 std::string type;
123 const MSLane* lane;
124 double pos;
126 };
127
128 typedef std::map<std::string, std::vector<Collision> > CollisionMap;
129
130public:
135 static MSNet* getInstance();
136
140 virtual bool isGUINet() const {
141 return false;
142 }
143
145 static void initStatic();
146
148 static void cleanupStatic();
149
150
154 static bool hasInstance() {
155 return myInstance != nullptr;
156 }
157
158
173 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
174 MSEventControl* endOfTimestepEvents,
175 MSEventControl* insertionEvents,
176 ShapeContainer* shapeCont = 0);
177
178
180 virtual ~MSNet();
181
182
198 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions,
199 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc,
200 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
201 bool hasInternalLinks,
202 bool junctionHigherSpeeds,
203 const MMVersion& version);
204
205
209 bool hasPermissions() const {
210 return myHavePermissions;
211 }
212
213
216 myHavePermissions = true;
217 }
218
219
225 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed);
226
227
233 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const;
234
239 void addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType);
240
244 const MESegment::MesoEdgeType& getMesoType(const std::string& typeID);
245
249 static void clearAll();
250
251
260
261
265 void simulationStep(const bool onlyMove = false);
266
268 void loadRoutes();
269
270
275 const std::string generateStatistics(const SUMOTime start, const long now);
276
278 void writeCollisions() const;
279
281 void writeStatistics(const SUMOTime start, const long now) const;
282
284 void writeSummaryOutput();
285
292 void closeSimulation(SUMOTime start, const std::string& reason = "");
293
294
301
302
308 SimulationState adaptToState(const SimulationState state, const bool isLibsumo = false) const;
309
310
314 static std::string getStateMessage(SimulationState state);
315
316
321 return myStep;
322 }
323
324
328 inline void setCurrentTimeStep(const SUMOTime step) {
329 myStep = step;
330 }
331
332
336 void clearState(const SUMOTime step, bool quickReload = false);
337
341 void writeOutput();
342
343
347 bool logSimulationDuration() const;
348
349
350
352
353
358 void preSimStepOutput() const;
359
360
365 void postSimStepOutput() const;
366 //}
367
368
369
372
379 return *myVehicleControl;
380 }
381
382
392
395 bool hasPersons() const {
396 return myPersonControl != nullptr;
397 }
398
408
411 bool hasContainers() const {
412 return myContainerControl != nullptr;
413 }
414
415
422 return *myEdges;
423 }
424
425
432 return *myInserter;
433 }
434
435
442 return *myDetectorControl;
443 }
444
445
452 return *myLogics;
453 }
454
455
462 return *myJunctions;
463 }
464
465
473 }
474
475
483 }
484
485
492 return myInsertionEvents;
493 }
494
495
502 return *myShapeContainer;
503 }
504
509 return myDynamicShapeUpdater.get();
510 }
511
516
524
527
538 bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace* stop);
539
540
550
551
557 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const;
558
565 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const;
567
569
571 void writeChargingStationOutput() const;
572
574 void writeRailSignalBlocks() const;
575
578
581
583 void writeSubstationOutput() const;
584
586 virtual bool isSelected(const MSTrafficLightLogic*) const {
587 return false;
588 }
590 virtual void updateGUI() const { }
591
593 SUMOTime loadState(const std::string& fileName, const bool catchExceptions);
594
596 void quickReload();
597
600
602 enum class VehicleState {
604 BUILT,
606 DEPARTED,
608 STARTING_TELEPORT,
610 ENDING_TELEPORT,
612 ARRIVED,
614 NEWROUTE,
616 STARTING_PARKING,
618 ENDING_PARKING,
620 STARTING_STOP,
622 ENDING_STOP,
624 COLLISION,
626 EMERGENCYSTOP,
628 MANEUVERING
629 };
630
631
636 public:
639
642
648 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0;
649
650 };
651
652
657
658
663
664
671 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "");
673
674
677
681 PERSON_DEPARTED,
683 PERSON_ARRIVED,
685 CONTAINER_DEPARTED,
687 CONTAINER_ARRIVED
688 };
689
690
695 public:
698
701
707 virtual void transportableStateChanged(const MSTransportable* const transportable, TransportableState to, const std::string& info = "") = 0;
708
709 };
710
711
716
717
722
723
730 void informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info = "");
732
733
735 bool registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos);
736
738 return myCollisions;
739 }
740
741
749 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t);
750
751
759 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t);
760
761
762 /* @brief get the router, initialize on first use
763 * @param[in] prohibited The vector of forbidden edges (optional)
764 */
766 const MSEdgeVector& prohibited = MSEdgeVector()) const;
768 const MSEdgeVector& prohibited = MSEdgeVector()) const;
769 MSPedestrianRouter& getPedestrianRouter(const int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
770 MSIntermodalRouter& getIntermodalRouter(const int rngIndex, const int routingMode = 0, const MSEdgeVector& prohibited = MSEdgeVector()) const;
771
772 static void adaptIntermodalRouter(MSIntermodalRouter& router);
773
774
776 bool hasInternalLinks() const {
777 return myHasInternalLinks;
778 }
779
783 }
784
786 bool hasElevation() const {
787 return myHasElevation;
788 }
789
791 bool hasPedestrianNetwork() const {
793
794 }
796 bool hasBidiEdges() const {
797 return myHasBidiEdges;
798 }
799
802 return myVersion;
803 }
804
806 bool warnOnce(const std::string& typeAndID);
807
808 void interrupt() {
809 myAmInterrupted = true;
810 }
811
812 bool isInterrupted() const {
813 return myAmInterrupted;
814 }
815
817 MSTractionSubstation* findTractionSubstation(const std::string& substationId);
818
820 bool existTractionSubstation(const std::string& substationId);
821
823 static const std::string STAGE_EVENTS;
824 static const std::string STAGE_MOVEMENTS;
825 static const std::string STAGE_LANECHANGE;
826 static const std::string STAGE_INSERTIONS;
827 static const std::string STAGE_REMOTECONTROL;
828
829protected:
831 bool checkElevation();
832
834 bool checkWalkingarea();
835
837 bool checkBidiEdges();
838
841
844 void postMoveStep();
845
846protected:
849
852
855
858
861
864
865
866
869
897
898
899
902
905
910
913
916
919
921 long long int myVehiclesMoved;
922 long long int myPersonsMoved;
923 //}
924
925
926
929
931 std::vector<SUMOTime> myStateDumpTimes;
933 std::vector<std::string> myStateDumpFiles;
935 std::vector<std::string> myPeriodicStateFiles;
939 std::string myStateDumpPrefix;
940 std::string myStateDumpSuffix;
942
943
944
947
949 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions;
950
952 std::map<std::string, MESegment::MesoEdgeType> myMesoEdgeTypes;
953
956
959
962
965
968
971
974
977
979 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces;
980
982 std::vector<MSTractionSubstation*> myTractionSubstations;
983
985 std::vector<VehicleStateListener*> myVehicleStateListeners;
986
988 std::vector<TransportableStateListener*> myTransportableStateListeners;
989
992
993#ifdef HAVE_FOX
995 FXMutex myVehicleStateListenerMutex;
996
998 FXMutex myTransportableStateListenerMutex;
999#endif
1001
1003 std::map<std::string, bool> myWarnedOnce;
1004
1005 /* @brief The router instance for routing by trigger and by traci
1006 * @note MSDevice_Routing has its own instance since it uses a different weight function
1007 * @note we provide one member for every switchable router type
1008 * because the class structure makes it inconvenient to use a superclass
1009 */
1010 mutable std::map<int, SUMOAbstractRouter<MSEdge, SUMOVehicle>*> myRouterTT;
1011 mutable std::map<int, SUMOAbstractRouter<MSEdge, SUMOVehicle>*> myRouterEffort;
1012 mutable std::map<int, MSPedestrianRouter*> myPedestrianRouter;
1013 mutable std::map<int, MSIntermodalRouter*> myIntermodalRouter;
1014
1016 mutable std::pair<bool, NamedRTree> myLanesRTree;
1017
1021 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater;
1022
1023private:
1025 MSNet(const MSNet&);
1026
1029
1030
1031};
long long int SUMOTime
Definition: GUI.h:36
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:73
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Definition: StdDefs.h:67
Detectors container; responsible for string and output generation.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:81
A road/street connecting two junctions.
Definition: MSEdge.h:77
A storage for edge travel times and efforts.
Stores time-dependant events and executes them at the proper time.
Inserts vehicles into the network when their departure time is reached.
Container for junctions; performs operations on all stored junctions.
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
Interface for objects listening to transportable state changes.
Definition: MSNet.h:694
virtual void transportableStateChanged(const MSTransportable *const transportable, TransportableState to, const std::string &info="")=0
Called if a transportable changes its state.
TransportableStateListener()
Constructor.
Definition: MSNet.h:697
virtual ~TransportableStateListener()
Destructor.
Definition: MSNet.h:700
Interface for objects listening to vehicle state changes.
Definition: MSNet.h:635
virtual ~VehicleStateListener()
Destructor.
Definition: MSNet.h:641
virtual void vehicleStateChanged(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")=0
Called if a vehicle changes its state.
VehicleStateListener()
Constructor.
Definition: MSNet.h:638
The simulated network and simulation perfomer.
Definition: MSNet.h:88
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition: MSNet.h:979
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition: MSNet.h:918
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition: MSNet.cpp:149
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition: MSNet.cpp:1610
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition: MSNet.cpp:1640
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterEffort
Definition: MSNet.h:1011
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1490
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition: MSNet.h:904
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition: MSNet.h:873
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition: MSNet.cpp:1235
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition: MSNet.h:851
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition: MSNet.cpp:1334
void informTransportableStateListener(const MSTransportable *const transportable, TransportableState to, const std::string &info="")
Informs all added listeners about a transportable's state change.
Definition: MSNet.cpp:1272
SUMOTime myStateDumpPeriod
The period for writing state.
Definition: MSNet.h:937
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition: MSNet.h:1000
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition: MSNet.cpp:1407
void writeChargingStationOutput() const
write charging station output
Definition: MSNet.cpp:1384
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition: MSNet.h:1016
bool checkBidiEdges()
check wether bidirectional edges occur in the network
Definition: MSNet.cpp:1600
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:602
int myLogStepPeriod
Period between successive step-log outputs.
Definition: MSNet.h:909
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:441
SUMOTime myStep
Current time step.
Definition: MSNet.h:854
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather it's wrapper) is selected in the GUI
Definition: MSNet.h:586
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition: MSNet.h:967
const CollisionMap & getCollisions() const
Definition: MSNet.h:737
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition: MSNet.h:887
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:471
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition: MSNet.cpp:1340
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition: MSNet.h:1003
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition: MSNet.cpp:191
void removeOutdatedCollisions()
remove collisions from the previous simulation step
Definition: MSNet.cpp:1315
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition: MSNet.h:879
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition: MSNet.h:935
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition: MSNet.h:893
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition: MSNet.h:796
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:451
std::string myStateDumpSuffix
Definition: MSNet.h:940
bool checkElevation()
check all lanes for elevation data
Definition: MSNet.cpp:1575
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition: MSNet.h:946
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
Definition: MSNet.cpp:1441
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition: MSNet.h:481
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition: MSNet.cpp:1263
SimulationState adaptToState(const SimulationState state, const bool isLibsumo=false) const
Called after a simulation step, this method adapts the current simulation state if necessary.
Definition: MSNet.cpp:890
void closeBuilding(const OptionsCont &oc, MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool junctionHigherSpeeds, const MMVersion &version)
Closes the network's building process.
Definition: MSNet.cpp:256
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition: MSNet.h:907
MMVersion myVersion
the network version
Definition: MSNet.h:973
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition: MSNet.h:891
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:1168
MMVersion getNetworkVersion() const
return the network version
Definition: MSNet.h:801
SimulationState
Possible states of a simulation - running or stopped with different reasons.
Definition: MSNet.h:93
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
Definition: MSNet.h:109
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
Definition: MSNet.h:101
@ SIMSTATE_LOADING
The simulation is loading.
Definition: MSNet.h:95
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition: MSNet.h:105
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
Definition: MSNet.h:103
@ SIMSTATE_INTERRUPTED
An external interrupt occured.
Definition: MSNet.h:107
@ SIMSTATE_RUNNING
The simulation is running.
Definition: MSNet.h:97
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
Definition: MSNet.h:99
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
Definition: MSNet.h:491
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1452
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition: MSNet.h:1012
static const std::string STAGE_MOVEMENTS
Definition: MSNet.h:824
int myMaxTeleports
Maximum number of teleports.
Definition: MSNet.h:860
long mySimStepDuration
Definition: MSNet.h:912
PedestrianRouter< MSEdge, MSLane, MSJunction, MSVehicle > MSPedestrianRouter
Definition: MSNet.h:112
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition: MSNet.h:889
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:911
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:1359
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition: MSNet.h:955
void interrupt()
Definition: MSNet.h:808
void writeSubstationOutput() const
write electrical substation output
Definition: MSNet.cpp:1418
static const std::string STAGE_INSERTIONS
Definition: MSNet.h:826
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition: MSNet.h:461
long long int myPersonsMoved
Definition: MSNet.h:922
void quickReload()
reset state to the beginning without reloading the network
Definition: MSNet.cpp:1619
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition: MSNet.h:871
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
Definition: MSNet.h:781
static void clearAll()
Clears all dictionaries.
Definition: MSNet.cpp:936
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition: MSNet.cpp:198
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
Definition: MSNet.h:215
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
Definition: MSNet.cpp:547
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSIntermodalRouter
Definition: MSNet.h:113
void writeSummaryOutput()
write summary-output to (xml) file
Definition: MSNet.cpp:596
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:320
std::map< std::string, std::vector< Collision > > CollisionMap
Definition: MSNet.h:128
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition: MSNet.h:877
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition: MSNet.h:1021
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:351
static bool hasInstance()
Returns whether the network was already constructed.
Definition: MSNet.h:154
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition: MSNet.cpp:660
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition: MSNet.cpp:1350
bool myHasElevation
Whether the network contains elevation data.
Definition: MSNet.h:961
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:163
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition: MSNet.h:875
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition: MSNet.h:988
void writeOutput()
Write netstate, summary and detector output.
Definition: MSNet.cpp:1019
virtual void updateGUI() const
update view after simulation.loadState
Definition: MSNet.h:590
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition: MSNet.h:328
bool myAmInterrupted
whether an interrupt occured
Definition: MSNet.h:863
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
Definition: MSNet.cpp:697
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition: MSNet.cpp:1227
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition: MSNet.cpp:966
void preSimStepOutput() const
Prints the current step number.
Definition: MSNet.cpp:1191
void writeCollisions() const
write collision output to (xml) file
Definition: MSNet.cpp:525
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition: MSNet.h:931
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
Definition: MSNet.h:508
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:411
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition: MSNet.cpp:1255
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition: MSNet.h:982
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition: MSNet.h:976
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:1182
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition: MSNet.h:949
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition: MSNet.h:933
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition: MSNet.cpp:360
void writeRailSignalBlocks() const
write rail signal block output
Definition: MSNet.cpp:1395
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition: MSNet.h:881
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition: MSNet.cpp:1153
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
Definition: MSNet.h:791
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition: MSNet.h:921
static const std::string STAGE_REMOTECONTROL
Definition: MSNet.h:827
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:1244
bool isInterrupted() const
Definition: MSNet.h:812
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition: MSNet.h:985
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition: MSNet.cpp:860
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:395
long myTraCIStepDuration
The last simulation step duration.
Definition: MSNet.h:912
TransportableState
Definition of a transportable state.
Definition: MSNet.h:679
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:431
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition: MSNet.h:885
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:501
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
Definition: MSNet.h:857
static const std::string STAGE_LANECHANGE
Definition: MSNet.h:825
MSNet(const MSNet &)
Invalidated copy constructor.
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
Constructor.
Definition: MSNet.cpp:205
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: MSNet.cpp:345
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
Definition: MSNet.h:209
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterTT
Definition: MSNet.h:1010
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition: MSNet.h:952
static void adaptIntermodalRouter(MSIntermodalRouter &router)
Definition: MSNet.cpp:1539
bool myLefthand
Whether the network was built for left-hand traffic.
Definition: MSNet.h:970
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition: MSNet.h:895
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition: MSNet.cpp:1176
std::map< int, MSIntermodalRouter * > myIntermodalRouter
Definition: MSNet.h:1013
virtual ~MSNet()
Destructor.
Definition: MSNet.cpp:291
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1480
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition: MSNet.cpp:1430
static MSNet * myInstance
Unique instance of MSNet.
Definition: MSNet.h:848
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
Definition: MSNet.h:577
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:378
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition: MSNet.h:883
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition: MSNet.cpp:1197
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1159
bool registerCollision(const SUMOTrafficObject *collider, const SUMOTrafficObject *victim, const std::string &collisionType, const MSLane *lane, double pos)
register collision and return whether it was the first one involving these vehicles
Definition: MSNet.cpp:1283
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition: MSNet.h:823
void loadRoutes()
loads routes for the next few steps
Definition: MSNet.cpp:428
std::string myStateDumpPrefix
name components for periodic state
Definition: MSNet.h:939
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition: MSNet.h:958
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition: MSNet.h:421
long mySimBeginMillis
The overall simulation duration.
Definition: MSNet.h:915
virtual bool isGUINet() const
Returns whether this is a GUI Net.
Definition: MSNet.h:140
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition: MSNet.h:964
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
Definition: MSNet.cpp:365
void postMoveStep()
Performs the parts of the simulation step which happen after the move.
Definition: MSNet.cpp:831
bool hasInternalLinks() const
return whether the network contains internal links
Definition: MSNet.h:776
const std::string generateStatistics(const SUMOTime start, const long now)
Writes performance output and running vehicle stats.
Definition: MSNet.cpp:434
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1470
bool checkWalkingarea()
check all lanes for type walkingArea
Definition: MSNet.cpp:1589
CollisionMap myCollisions
collisions in the current time step
Definition: MSNet.h:991
bool hasElevation() const
return whether the network contains elevation data
Definition: MSNet.h:786
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition: MSNet.cpp:1373
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition: MSNet.cpp:386
A lane area vehicles can halt at.
A class that stores and controls tls and switching of their programs.
Traction substaction powering one or more overhead wire sections.
The parent class for traffic light logics.
The class responsible for building and deletion of vehicles.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
A storage for options typed value containers)
Definition: OptionsCont.h:89
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
Representation of a vehicle, person, or container.
Representation of a vehicle.
Definition: SUMOVehicle.h:62
Storage for geometrical objects.
edge type specific meso parameters
Definition: MESegment.h:55
collision tracking
Definition: MSNet.h:116
double victimSpeed
Definition: MSNet.h:121
const MSLane * lane
Definition: MSNet.h:123
std::string victimType
Definition: MSNet.h:119
double pos
Definition: MSNet.h:124
std::string type
Definition: MSNet.h:122
std::string colliderType
Definition: MSNet.h:118
std::string victim
Definition: MSNet.h:117
double colliderSpeed
Definition: MSNet.h:120
SUMOTime time
Definition: MSNet.h:125