Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MSNet.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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 "MSRouterDefs.h"
46#include "MSJunction.h"
47
48
49// ===========================================================================
50// class declarations
51// ===========================================================================
52class MSEdge;
53class MSEdgeControl;
54class MSEventControl;
60class MSTransportable;
61class MSVehicle;
62class MSRoute;
63class MSLane;
67class ShapeContainer;
69class PolygonDynamics;
71class SUMOVehicle;
74class MSStoppingPlace;
75template<class E, class L, class N, class V>
77template<class E, class L, class N, class V>
79class OptionsCont;
80
81
82// ===========================================================================
83// class definitions
84// ===========================================================================
89class MSNet : public Parameterised {
90public:
112
130
131 typedef std::map<std::string, std::vector<Collision> > CollisionMap;
132
133public:
138 static MSNet* getInstance();
139
143 virtual bool isGUINet() const {
144 return false;
145 }
146
148 static void initStatic();
149
151 static void cleanupStatic();
152
153
157 static bool hasInstance() {
158 return myInstance != nullptr;
159 }
160
161
176 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
177 MSEventControl* endOfTimestepEvents,
178 MSEventControl* insertionEvents,
179 ShapeContainer* shapeCont = 0);
180
181
183 virtual ~MSNet();
184
185
201 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions,
202 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc,
203 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
204 bool hasInternalLinks,
205 bool junctionHigherSpeeds,
206 const MMVersion& version);
207
208
212 bool hasPermissions() const {
213 return myHavePermissions;
214 }
215
216
219 myHavePermissions = true;
220 }
221
222
228 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed);
229
230
236 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const;
237
242 void addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType);
243
247 const MESegment::MesoEdgeType& getMesoType(const std::string& typeID);
248
252 static void clearAll();
253
255 bool hasFlow(const std::string& id) const;
256
265
266
270 void simulationStep(const bool onlyMove = false);
271
273 void loadRoutes();
274
275
280 const std::string generateStatistics(const SUMOTime start, const long now);
281
283 void writeCollisions() const;
284
286 void writeStatistics(const SUMOTime start, const long now) const;
287
289 void writeSummaryOutput();
290
297 void closeSimulation(SUMOTime start, const std::string& reason = "");
298
299
306
307
313 SimulationState adaptToState(const SimulationState state, const bool isLibsumo = false) const;
314
315
319 static std::string getStateMessage(SimulationState state);
320
321
326 return myStep;
327 }
328
329
333 inline void setCurrentTimeStep(const SUMOTime step) {
334 myStep = step;
335 }
336
337
341 void clearState(const SUMOTime step, bool quickReload = false);
342
346 void writeOutput();
347
348
352 bool logSimulationDuration() const;
353
354
355
357
358
363 void preSimStepOutput() const;
364
365
370 void postSimStepOutput() const;
371 //}
372
373
374
377
386
387
397
400 bool hasPersons() const {
401 return myPersonControl != nullptr;
402 }
403
413
416 bool hasContainers() const {
417 return myContainerControl != nullptr;
418 }
419
420
427 return *myEdges;
428 }
429
430
439
440
449
450
457 return *myLogics;
458 }
459
460
469
470
479
480
489
490
499
500
509
516
521
529
532
543 bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace* stop);
544
545
555
556
562 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const;
563
568 MSStoppingPlace* getStoppingPlace(const std::string& id) const;
569
576 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const;
578
580
582 void writeChargingStationOutput() const;
583
585 void writeRailSignalBlocks() const;
586
589
592
594 void writeSubstationOutput() const;
595
597 virtual bool isSelected(const MSTrafficLightLogic*) const {
598 return false;
599 }
601 virtual void updateGUI() const { }
602
604 SUMOTime loadState(const std::string& fileName, const bool catchExceptions);
605
607 void quickReload();
608
611
641
642
647 public:
650
653
659 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0;
660
661 };
662
663
668
669
674
675
682 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "");
684
685
688
700
701
706 public:
709
712
718 virtual void transportableStateChanged(const MSTransportable* const transportable, TransportableState to, const std::string& info = "") = 0;
719
720 };
721
722
727
728
733
734
741 void informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info = "");
743
744
746 bool registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos);
747
749 return myCollisions;
750 }
751
752
760 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t);
761
762
770 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t);
771
772
773 /* @brief get the router, initialize on first use
774 * @param[in] prohibited The vector of forbidden edges (optional)
775 */
776 MSVehicleRouter& getRouterTT(int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
777 MSVehicleRouter& getRouterEffort(int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
778 MSPedestrianRouter& getPedestrianRouter(int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
779 MSTransportableRouter& getIntermodalRouter(int rngIndex, const int routingMode = 0, const MSEdgeVector& prohibited = MSEdgeVector()) const;
780
781 static void adaptIntermodalRouter(MSTransportableRouter& router);
782
783
785 bool hasInternalLinks() const {
786 return myHasInternalLinks;
787 }
788
792 }
793
795 bool hasElevation() const {
796 return myHasElevation;
797 }
798
800 bool hasPedestrianNetwork() const {
802
803 }
805 bool hasBidiEdges() const {
806 return myHasBidiEdges;
807 }
808
811 return myVersion;
812 }
813
815 bool warnOnce(const std::string& typeAndID);
816
817 void interrupt() {
818 myAmInterrupted = true;
819 }
820
821 bool isInterrupted() const {
822 return myAmInterrupted;
823 }
824
826 virtual bool skipFinalReset() const {
827 return false;
828 }
829
831
833 MSTractionSubstation* findTractionSubstation(const std::string& substationId);
834
836 bool existTractionSubstation(const std::string& substationId);
837
839 static const std::string STAGE_EVENTS;
840 static const std::string STAGE_MOVEMENTS;
841 static const std::string STAGE_LANECHANGE;
842 static const std::string STAGE_INSERTIONS;
843 static const std::string STAGE_REMOTECONTROL;
844
845protected:
847 bool checkElevation();
848
850 bool checkWalkingarea();
851
853 bool checkBidiEdges();
854
857
860 void postMoveStep();
861
862protected:
865
868
871
874
877
880
881
882
885
913
914
915
918
921
926
929
932
935
937 long long int myVehiclesMoved;
938 long long int myPersonsMoved;
939 //}
940
941
942
945
947 std::vector<SUMOTime> myStateDumpTimes;
949 std::vector<std::string> myStateDumpFiles;
951 std::vector<std::string> myPeriodicStateFiles;
955 std::string myStateDumpPrefix;
956 std::string myStateDumpSuffix;
958
959
960
963
965 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions;
966
968 std::map<std::string, MESegment::MesoEdgeType> myMesoEdgeTypes;
969
972
975
978
981
984
987
990
993
995 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces;
996
998 std::vector<MSTractionSubstation*> myTractionSubstations;
999
1001 std::vector<VehicleStateListener*> myVehicleStateListeners;
1002
1004 std::vector<TransportableStateListener*> myTransportableStateListeners;
1005
1008
1009#ifdef HAVE_FOX
1011 FXMutex myVehicleStateListenerMutex;
1012
1014 FXMutex myTransportableStateListenerMutex;
1015#endif
1017
1019 std::map<std::string, bool> myWarnedOnce;
1020
1021 /* @brief The router instance for routing by trigger and by traci
1022 * @note MSDevice_Routing has its own instance since it uses a different weight function
1023 * @note we provide one member for every switchable router type
1024 * because the class structure makes it inconvenient to use a superclass
1025 */
1026 mutable std::map<int, MSVehicleRouter*> myRouterTT;
1027 mutable std::map<int, MSVehicleRouter*> myRouterEffort;
1028 mutable std::map<int, MSPedestrianRouter*> myPedestrianRouter;
1029 mutable std::map<int, MSTransportableRouter*> myIntermodalRouter;
1030
1032 mutable std::pair<bool, NamedRTree> myLanesRTree;
1033
1037 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater;
1038
1039private:
1041 MSNet(const MSNet&);
1042
1045
1046
1047};
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.
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:705
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:708
virtual ~TransportableStateListener()
Destructor.
Definition MSNet.h:711
Interface for objects listening to vehicle state changes.
Definition MSNet.h:646
virtual ~VehicleStateListener()
Destructor.
Definition MSNet.h:652
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:649
The simulated network and simulation perfomer.
Definition MSNet.h:89
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition MSNet.h:995
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition MSNet.h:934
MSMapMatcher * getMapMatcher() const
Definition MSNet.cpp:1681
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition MSNet.cpp:152
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition MSNet.cpp:1671
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1712
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition MSNet.h:920
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition MSNet.h:889
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition MSNet.cpp:1277
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition MSNet.h:867
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition MSNet.cpp:1388
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:1314
SUMOTime myStateDumpPeriod
The period for writing state.
Definition MSNet.h:953
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition MSNet.h:1016
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition MSNet.cpp:1486
void writeChargingStationOutput() const
write charging station output
Definition MSNet.cpp:1450
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition MSNet.h:1032
bool checkBidiEdges()
check wether bidirectional edges occur in the network
Definition MSNet.cpp:1661
VehicleState
Definition of a vehicle state.
Definition MSNet.h:613
@ ENDING_PARKING
The vehicle ends to park.
@ STARTING_STOP
The vehicles starts to stop.
@ BUILT
The vehicle was built, but has not yet departed.
@ STARTING_PARKING
The vehicles starts to park.
@ NEWROUTE
The vehicle got a new route.
@ STARTING_TELEPORT
The vehicle started to teleport.
@ ENDING_STOP
The vehicle ends to stop.
@ ENDING_TELEPORT
The vehicle ended being teleported.
@ ARRIVED
The vehicle arrived at his destination (is deleted)
@ DEPARTED
The vehicle has departed (was inserted into the network)
@ COLLISION
The vehicle is involved in a collision.
@ EMERGENCYSTOP
The vehicle had to brake harder than permitted.
@ MANEUVERING
Vehicle maneuvering either entering or exiting a parking space.
int myLogStepPeriod
Period between successive step-log outputs.
Definition MSNet.h:925
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition MSNet.h:446
SUMOTime myStep
Current time step.
Definition MSNet.h:870
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:186
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather its wrapper) is selected in the GUI
Definition MSNet.h:597
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition MSNet.h:983
const CollisionMap & getCollisions() const
Definition MSNet.h:748
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition MSNet.h:903
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition MSNet.h:476
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition MSNet.cpp:1394
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition MSNet.h:1019
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:194
void removeOutdatedCollisions()
remove collisions from the previous simulation step
Definition MSNet.cpp:1369
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition MSNet.h:895
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition MSNet.h:951
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition MSNet.h:909
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition MSNet.h:805
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:456
std::string myStateDumpSuffix
Definition MSNet.h:956
bool checkElevation()
check all lanes for elevation data
Definition MSNet.cpp:1636
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition MSNet.h:962
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
Definition MSNet.cpp:1520
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition MSNet.h:486
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition MSNet.cpp:1305
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:925
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:257
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition MSNet.h:923
MMVersion myVersion
the network version
Definition MSNet.h:989
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition MSNet.h:907
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1210
MMVersion getNetworkVersion() const
return the network version
Definition MSNet.h:810
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
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
Definition MSNet.h:496
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition MSNet.h:1028
static const std::string STAGE_MOVEMENTS
Definition MSNet.h:840
bool hasFlow(const std::string &id) const
return whether the given flow is known
Definition MSNet.cpp:389
int myMaxTeleports
Maximum number of teleports.
Definition MSNet.h:876
long mySimStepDuration
Definition MSNet.h:928
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition MSNet.h:905
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:946
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:1425
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition MSNet.h:971
void interrupt()
Definition MSNet.h:817
void writeSubstationOutput() const
write electrical substation output
Definition MSNet.cpp:1497
static const std::string STAGE_INSERTIONS
Definition MSNet.h:842
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition MSNet.h:466
MSVehicleRouter & getRouterEffort(int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1552
long long int myPersonsMoved
Definition MSNet.h:938
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1691
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition MSNet.h:887
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
Definition MSNet.h:790
static void clearAll()
Clears all dictionaries.
Definition MSNet.cpp:971
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:199
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
Definition MSNet.h:218
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
Definition MSNet.cpp:573
void writeSummaryOutput()
write summary-output to (xml) file
Definition MSNet.cpp:623
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:325
std::map< std::string, std::vector< Collision > > CollisionMap
Definition MSNet.h:131
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition MSNet.h:893
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition MSNet.h:1037
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:353
static bool hasInstance()
Returns whether the network was already constructed.
Definition MSNet.h:157
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition MSNet.cpp:687
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition MSNet.cpp:1404
bool myHasElevation
Whether the network contains elevation data.
Definition MSNet.h:977
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition MSNet.cpp:166
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition MSNet.h:891
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition MSNet.h:1004
void writeOutput()
Write netstate, summary and detector output.
Definition MSNet.cpp:1056
virtual void updateGUI() const
update view after simulation.loadState
Definition MSNet.h:601
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition MSNet.h:333
bool myAmInterrupted
whether an interrupt occured
Definition MSNet.h:879
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
Definition MSNet.cpp:726
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition MSNet.cpp:1269
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition MSNet.cpp:1002
void preSimStepOutput() const
Prints the current step number.
Definition MSNet.cpp:1233
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1578
void writeCollisions() const
write collision output to (xml) file
Definition MSNet.cpp:544
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition MSNet.h:947
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
Definition MSNet.h:513
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:416
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition MSNet.cpp:1297
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition MSNet.h:998
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition MSNet.h:992
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition MSNet.cpp:1224
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition MSNet.h:965
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition MSNet.h:949
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition MSNet.cpp:362
void writeRailSignalBlocks() const
write rail signal block output
Definition MSNet.cpp:1461
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition MSNet.h:897
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition MSNet.cpp:1195
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
Definition MSNet.h:800
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition MSNet.h:937
static const std::string STAGE_REMOTECONTROL
Definition MSNet.h:843
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:1286
bool isInterrupted() const
Definition MSNet.h:821
std::map< int, MSTransportableRouter * > myIntermodalRouter
Definition MSNet.h:1029
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition MSNet.h:1001
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition MSNet.cpp:895
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:400
long myTraCIStepDuration
The last simulation step duration.
Definition MSNet.h:928
TransportableState
Definition of a transportable state.
Definition MSNet.h:690
@ CONTAINER_DEPARTED
The transportable container has departed (was inserted into the network)
@ PERSON_DEPARTED
The transportable person has departed (was inserted into the network)
@ PERSON_ARRIVED
The transportable person arrived at his destination (is deleted)
@ CONTAINER_ARRIVED
The transportable container arrived at his destination (is deleted)
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:436
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition MSNet.h:901
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:506
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
Definition MSNet.h:873
static const std::string STAGE_LANECHANGE
Definition MSNet.h:841
MSNet(const MSNet &)
Invalidated copy constructor.
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition MSNet.cpp:347
MSVehicleRouter & getRouterTT(int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1531
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
Definition MSNet.h:212
virtual bool skipFinalReset() const
gui may prevent final meanData reset to keep live data visible
Definition MSNet.h:826
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition MSNet.h:968
bool myLefthand
Whether the network was built for left-hand traffic.
Definition MSNet.h:986
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition MSNet.h:911
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition MSNet.cpp:1218
virtual ~MSNet()
Destructor.
Definition MSNet.cpp:292
std::map< int, MSVehicleRouter * > myRouterEffort
Definition MSNet.h:1027
MSPedestrianRouter & getPedestrianRouter(int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1565
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition MSNet.cpp:1509
static MSNet * myInstance
Unique instance of MSNet.
Definition MSNet.h:864
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
Definition MSNet.h:588
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:383
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition MSNet.h:899
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition MSNet.cpp:1239
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1201
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:1325
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition MSNet.h:839
void loadRoutes()
loads routes for the next few steps
Definition MSNet.cpp:438
std::string myStateDumpPrefix
name components for periodic state
Definition MSNet.h:955
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition MSNet.h:974
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:426
long mySimBeginMillis
The overall simulation duration.
Definition MSNet.h:931
virtual bool isGUINet() const
Returns whether this is a GUI Net.
Definition MSNet.h:143
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition MSNet.h:980
std::map< int, MSVehicleRouter * > myRouterTT
Definition MSNet.h:1026
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:367
void postMoveStep()
Performs the parts of the simulation step which happen after the move.
Definition MSNet.cpp:866
bool hasInternalLinks() const
return whether the network contains internal links
Definition MSNet.h:785
const std::string generateStatistics(const SUMOTime start, const long now)
Writes performance output and running vehicle stats.
Definition MSNet.cpp:444
bool checkWalkingarea()
check all lanes for type walkingArea
Definition MSNet.cpp:1650
static void adaptIntermodalRouter(MSTransportableRouter &router)
Definition MSNet.cpp:1600
CollisionMap myCollisions
collisions in the current time step
Definition MSNet.h:1007
bool hasElevation() const
return whether the network contains elevation data
Definition MSNet.h:795
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition MSNet.cpp:1439
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition MSNet.cpp:396
A lane area vehicles can halt at.
A class that stores and controls tls and switching of their programs.
Traction substation 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 map of named object pointers.
A storage for options typed value containers)
Definition OptionsCont.h:89
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
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:57
collision tracking
Definition MSNet.h:114
double victimSpeed
Definition MSNet.h:119
Position colliderFront
Definition MSNet.h:120
const MSLane * lane
Definition MSNet.h:125
Position victimBack
Definition MSNet.h:123
std::string victimType
Definition MSNet.h:117
SUMOTime continuationTime
Definition MSNet.h:128
Position victimFront
Definition MSNet.h:121
std::string type
Definition MSNet.h:124
std::string colliderType
Definition MSNet.h:116
std::string victim
Definition MSNet.h:115
double colliderSpeed
Definition MSNet.h:118
Position colliderBack
Definition MSNet.h:122
SUMOTime time
Definition MSNet.h:127