Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
25// The simulated network and simulation performer
26/****************************************************************************/
27#pragma once
28#include <config.h>
29
30#include <typeinfo>
31#include <vector>
32#include <map>
33#include <mutex>
34#include <string>
35#include <fstream>
36#include <iostream>
37#include <cmath>
38#include <iomanip>
39#include <memory>
45#include <mesosim/MESegment.h>
46#include "MSRouterDefs.h"
47#include "MSJunction.h"
48
49
50// ===========================================================================
51// class declarations
52// ===========================================================================
53class MSEdge;
54class MSEdgeControl;
55class MSEventControl;
61class MSTransportable;
62class MSVehicle;
63class MSRoute;
64class MSLane;
68class ShapeContainer;
70class PolygonDynamics;
72class SUMOVehicle;
75class MSStoppingPlace;
76template<class E, class L, class N, class V>
78template<class E, class L, class N, class V>
80class OptionsCont;
81
82
83// ===========================================================================
84// class definitions
85// ===========================================================================
90class MSNet : public Parameterised {
91public:
113
131
132 typedef std::map<std::string, std::vector<Collision> > CollisionMap;
133 typedef std::map<const MSEdge*, RouterProhibition> Prohibitions;
134
135public:
140 static MSNet* getInstance();
141
145 virtual bool isGUINet() const {
146 return false;
147 }
148
150 static void initStatic();
151
153 static void cleanupStatic();
154
155
159 static bool hasInstance() {
160 return myInstance != nullptr;
161 }
162
163
178 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
179 MSEventControl* endOfTimestepEvents,
180 MSEventControl* insertionEvents,
181 ShapeContainer* shapeCont = nullptr);
182
183
185 virtual ~MSNet();
186
187
203 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions,
204 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc,
205 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
206 bool hasInternalLinks,
207 bool junctionHigherSpeeds,
208 const MMVersion& version);
209
210
214 bool hasPermissions() const {
215 return myHavePermissions;
216 }
217
218
221 myHavePermissions = true;
222 }
223
224
230 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed);
231
232
238 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const;
239
241 double getPreference(const std::string& routingType, const SUMOVTypeParameter& pars) const;
242
244 void addPreference(const std::string& routingType, SUMOVehicleClass svc, double prio);
246 void addPreference(const std::string& routingType, std::string vType, double prio);
247
252 void addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType);
253
257 const MESegment::MesoEdgeType& getMesoType(const std::string& typeID);
258
262 static void clearAll();
263
265 bool hasFlow(const std::string& id) const;
266
275
276
280 void simulationStep(const bool onlyMove = false);
281
283 void loadRoutes();
284
285
290 const std::string generateStatistics(const SUMOTime start, const long now);
291
293 void writeCollisions() const;
294
296 void writeStatistics(const SUMOTime start, const long now) const;
297
299 void writeSummaryOutput(bool finalStep = false);
300
307 void closeSimulation(SUMOTime start, const std::string& reason = "");
308
309
316
317
323 SimulationState adaptToState(const SimulationState state, const bool isLibsumo = false) const;
324
325
329 static std::string getStateMessage(SimulationState state);
330
331
336 return myStep;
337 }
338
339
343 inline void setCurrentTimeStep(const SUMOTime step) {
344 myStep = step;
345 }
346
347
351 void clearState(const SUMOTime step, bool quickReload = false);
352
353
354 SUMOTime getLoaderTime() const;
355
356 void setLoaderTime(SUMOTime time);
357
360 return myStateLoaderTime;
361 }
362
366 void writeOutput();
367
368
372 bool logSimulationDuration() const;
373
374
375
377
378
383 void preSimStepOutput() const;
384
385
390 void postSimStepOutput() const;
391 //}
392
393
394
397
406
407
417
420 bool hasPersons() const {
421 return myPersonControl != nullptr;
422 }
423
433
436 bool hasContainers() const {
437 return myContainerControl != nullptr;
438 }
439
440
447 return *myEdges;
448 }
449
450
459
460
469
470
477 return *myLogics;
478 }
479
480
489
490
499
500
509
510
519
520
529
536
541
549
552
563 bool addStoppingPlace(SumoXMLTag category, MSStoppingPlace* stop);
564
565
575
576
582 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const;
583
588 MSStoppingPlace* getStoppingPlace(const std::string& id) const;
589
596 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const;
597
598 /* @brief returns all stopping places of that category with the same (non-empty) name attribute
599 */
600 const std::vector<MSStoppingPlace*>& getStoppingPlaceAlternatives(const std::string& name, SumoXMLTag category) const;
602
604
606 void writeChargingStationOutput() const;
607
609 void writeRailSignalBlocks() const;
610
613
616
618 void writeSubstationOutput() const;
619
621 virtual bool isSelected(const MSTrafficLightLogic*) const {
622 return false;
623 }
625 virtual void updateGUI() const { }
626
628 SUMOTime loadState(const std::string& fileName, const bool catchExceptions);
629
631 void quickReload();
632
635
665
666
671 public:
674
677
683 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0;
684
685 };
686
687
692
693
698
699
706 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "");
708
709
712
724
725
730 public:
733
736
742 virtual void transportableStateChanged(const MSTransportable* const transportable, TransportableState to, const std::string& info = "") = 0;
743
744 };
745
746
751
752
757
758
765 void informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info = "");
767
768
770 bool registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos);
771
773 return myCollisions;
774 }
775
776
784 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t);
785
786
794 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t);
795
796
797 /* @brief get the router, initialize on first use
798 * @param[in] prohibited The vector of forbidden edges (optional)
799 */
800 MSVehicleRouter& getRouterTT(int rngIndex, const Prohibitions& prohibited = {}) const;
801 MSVehicleRouter& getRouterEffort(int rngIndex, const Prohibitions& prohibited = {}) const;
802 MSPedestrianRouter& getPedestrianRouter(int rngIndex, const Prohibitions& prohibited = {}) const;
803 MSTransportableRouter& getIntermodalRouter(int rngIndex, const int routingMode = 0, const Prohibitions& prohibited = {}) const;
804
806 void resetIntermodalRouter() const;
807
808 static void adaptIntermodalRouter(MSTransportableRouter& router);
809
810
812 bool hasInternalLinks() const {
813 return myHasInternalLinks;
814 }
815
819 }
820
822 bool hasElevation() const {
823 return myHasElevation;
824 }
825
827 bool hasPedestrianNetwork() const {
829
830 }
832 bool hasBidiEdges() const {
833 return myHasBidiEdges;
834 }
835
838 return myVersion;
839 }
840
842 bool warnOnce(const std::string& typeAndID);
843
844 void interrupt() {
845 myAmInterrupted = true;
846 }
847
848 bool isInterrupted() const {
849 return myAmInterrupted;
850 }
851
853 virtual bool skipFinalReset() const {
854 return false;
855 }
856
858 virtual void lockPendingEmits() const {}
859
861 virtual void unlockPendingEmits() const {}
862
863
865
867 MSTractionSubstation* findTractionSubstation(const std::string& substationId);
868
870 static const std::string STAGE_EVENTS;
871 static const std::string STAGE_MOVEMENTS;
872 static const std::string STAGE_LANECHANGE;
873 static const std::string STAGE_INSERTIONS;
874 static const std::string STAGE_REMOTECONTROL;
875
876protected:
878 bool checkElevation();
879
881 bool checkWalkingarea();
882
884 bool checkBidiEdges();
885
888
891 void postMoveStep();
892
893protected:
896
899
902
903 /* @brief the time for rejecting vehicle that departed in the past are were already loaded.
904 * When not loading state, this value is the simulation begin time.
905 * When loading state, this is the time up to which vehicles have been
906 * loaded before saving state. This is typically after the state time.
907 * The state will include vehicles up to this time and they should not be
908 * loaded again from a route file. Uniqueness of ids is not a sufficient
909 * guard against loading again because these vehicles could arrive shortly after state loading. */
911
914
917
920
921
922
925
953
954
955
958
961
966
969
972
975
977 long long int myVehiclesMoved;
978 long long int myPersonsMoved;
979 //}
980
981
982
985
987 std::vector<SUMOTime> myStateDumpTimes;
989 std::vector<std::string> myStateDumpFiles;
991 std::vector<std::string> myPeriodicStateFiles;
995 std::string myStateDumpPrefix;
996 std::string myStateDumpSuffix;
998
999
1000
1003
1005 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions;
1006
1008 std::map<SUMOVehicleClass, std::map<std::string, double> > myVClassPreferences;
1009 std::map<std::string, std::map<std::string, double> > myVTypePreferences;
1010
1012 std::map<std::string, MESegment::MesoEdgeType> myMesoEdgeTypes;
1013
1016
1019
1022
1025
1028
1031
1034
1036 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces;
1037
1039 std::map<SumoXMLTag, std::map<std::string, std::vector<MSStoppingPlace*> > > myNamedStoppingPlaces;
1040
1042 std::vector<MSTractionSubstation*> myTractionSubstations;
1043
1045 std::vector<VehicleStateListener*> myVehicleStateListeners;
1046
1048 std::vector<TransportableStateListener*> myTransportableStateListeners;
1049
1052
1053#ifdef HAVE_FOX
1055 FXMutex myVehicleStateListenerMutex;
1056
1058 FXMutex myTransportableStateListenerMutex;
1059#endif
1061 static const std::vector<MSStoppingPlace*> myEmptyStoppingPlaceVector;
1062
1064 std::map<std::string, bool> myWarnedOnce;
1065
1066 /* @brief The router instance for routing by trigger and by traci
1067 * @note MSDevice_Routing has its own instance since it uses a different weight function
1068 * @note we provide one member for every switchable router type
1069 * because the class structure makes it inconvenient to use a superclass
1070 */
1071 mutable std::map<int, MSVehicleRouter*> myRouterTT;
1072 mutable std::map<int, MSVehicleRouter*> myRouterEffort;
1073 mutable std::map<int, MSPedestrianRouter*> myPedestrianRouter;
1074 mutable std::map<int, MSTransportableRouter*> myIntermodalRouter;
1076 mutable std::mutex myRouterMutex;
1077
1079 mutable std::pair<bool, NamedRTree> myLanesRTree;
1080
1084 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater;
1085
1086private:
1088 MSNet(const MSNet&);
1089
1092
1093
1094};
long long int SUMOTime
Definition GUI.h:36
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:71
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:78
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:729
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:732
virtual ~TransportableStateListener()
Destructor.
Definition MSNet.h:735
Interface for objects listening to vehicle state changes.
Definition MSNet.h:670
virtual ~VehicleStateListener()
Destructor.
Definition MSNet.h:676
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:673
The simulated network and simulation perfomer.
Definition MSNet.h:90
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition MSNet.h:1036
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition MSNet.h:974
MSMapMatcher * getMapMatcher() const
Definition MSNet.cpp:1853
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition MSNet.cpp:155
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition MSNet.cpp:1843
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1886
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition MSNet.h:960
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition MSNet.h:929
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition MSNet.cpp:1393
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition MSNet.h:898
std::map< std::string, std::map< std::string, double > > myVTypePreferences
Definition MSNet.h:1009
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:1430
SUMOTime myStateDumpPeriod
The period for writing state.
Definition MSNet.h:993
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition MSNet.h:1060
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition MSNet.cpp:1625
void writeChargingStationOutput() const
write charging station output
Definition MSNet.cpp:1589
std::mutex myRouterMutex
guards finding and building the routers above, which the simulation threads (rerouters,...
Definition MSNet.h:1076
SUMOTime myStateLoaderTime
Definition MSNet.h:910
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition MSNet.h:1079
bool checkBidiEdges()
check whether bidirectional edges occur in the network
Definition MSNet.cpp:1833
VehicleState
Definition of a vehicle state.
Definition MSNet.h:637
@ 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:965
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition MSNet.h:466
SUMOTime myStep
Current time step.
Definition MSNet.h:901
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:201
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather its wrapper) is selected in the GUI
Definition MSNet.h:621
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition MSNet.h:1027
const CollisionMap & getCollisions() const
Definition MSNet.h:772
bool addStoppingPlace(SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition MSNet.cpp:1504
void addPreference(const std::string &routingType, SUMOVehicleClass svc, double prio)
add edge type specific routing preference
Definition MSNet.cpp:422
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition MSNet.h:943
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition MSNet.h:496
SUMOTime getLoaderTime() const
Definition MSNet.cpp:1153
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition MSNet.cpp:1517
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition MSNet.h:1064
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:209
void removeOutdatedCollisions()
remove collisions from the previous simulation step
Definition MSNet.cpp:1485
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition MSNet.h:935
std::map< const MSEdge *, RouterProhibition > Prohibitions
Definition MSNet.h:133
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition MSNet.h:991
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition MSNet.h:949
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition MSNet.h:832
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:476
std::string myStateDumpSuffix
Definition MSNet.h:996
const std::vector< MSStoppingPlace * > & getStoppingPlaceAlternatives(const std::string &name, SumoXMLTag category) const
Definition MSNet.cpp:1562
bool checkElevation()
check all lanes for elevation data
Definition MSNet.cpp:1808
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition MSNet.h:1002
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1734
std::map< SumoXMLTag, std::map< std::string, std::vector< MSStoppingPlace * > > > myNamedStoppingPlaces
dictionary of named stopping places
Definition MSNet.h:1039
static const std::vector< MSStoppingPlace * > myEmptyStoppingPlaceVector
Definition MSNet.h:1061
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition MSNet.h:506
virtual void unlockPendingEmits() const
release exclusive access to pending emits
Definition MSNet.h:861
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition MSNet.cpp:1421
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:1017
void closeBuilding(const OptionsCont &oc, MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool junctionHigherSpeeds, const MMVersion &version)
Closes the network's building process.
Definition MSNet.cpp:274
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition MSNet.h:963
MMVersion myVersion
the network version
Definition MSNet.h:1030
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition MSNet.h:947
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1326
MMVersion getNetworkVersion() const
return the network version
Definition MSNet.h:837
MSVehicleRouter & getRouterTT(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1659
SimulationState
Possible states of a simulation - running or stopped with different reasons.
Definition MSNet.h:95
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
Definition MSNet.h:111
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
Definition MSNet.h:103
@ SIMSTATE_LOADING
The simulation is loading.
Definition MSNet.h:97
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition MSNet.h:107
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
Definition MSNet.h:105
@ SIMSTATE_INTERRUPTED
An external interrupt occurred.
Definition MSNet.h:109
@ SIMSTATE_RUNNING
The simulation is running.
Definition MSNet.h:99
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
Definition MSNet.h:101
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
Definition MSNet.h:516
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition MSNet.h:1073
static const std::string STAGE_MOVEMENTS
Definition MSNet.h:871
bool hasFlow(const std::string &id) const
return whether the given flow is known
Definition MSNet.cpp:464
int myMaxTeleports
Maximum number of teleports.
Definition MSNet.h:916
long mySimStepDuration
Definition MSNet.h:968
double getPreference(const std::string &routingType, const SUMOVTypeParameter &pars) const
retriefe edge type specific routing preference
Definition MSNet.cpp:392
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition MSNet.h:945
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:1038
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:1548
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition MSNet.h:1015
void interrupt()
Definition MSNet.h:844
void writeSubstationOutput() const
write electrical substation output
Definition MSNet.cpp:1636
static const std::string STAGE_INSERTIONS
Definition MSNet.h:873
std::map< SUMOVehicleClass, std::map< std::string, double > > myVClassPreferences
Preferences for routing.
Definition MSNet.h:1008
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition MSNet.h:486
long long int myPersonsMoved
Definition MSNet.h:978
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1863
MSPedestrianRouter & getPedestrianRouter(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1715
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition MSNet.h:927
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
Definition MSNet.h:817
static void clearAll()
Clears all dictionaries.
Definition MSNet.cpp:1063
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:215
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
Definition MSNet.h:220
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
Definition MSNet.cpp:648
void resetIntermodalRouter() const
force reconstruction of intermodal network
Definition MSNet.cpp:1762
virtual void lockPendingEmits() const
grant exclusive access to pending emits
Definition MSNet.h:858
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:335
std::map< std::string, std::vector< Collision > > CollisionMap
Definition MSNet.h:132
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition MSNet.h:933
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition MSNet.h:1084
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
Definition MSNet.cpp:382
static bool hasInstance()
Returns whether the network was already constructed.
Definition MSNet.h:159
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition MSNet.cpp:765
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition MSNet.cpp:1527
bool myHasElevation
Whether the network contains elevation data.
Definition MSNet.h:1021
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition MSNet.cpp:169
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition MSNet.h:931
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition MSNet.h:1048
void writeOutput()
Write netstate, summary and detector output.
Definition MSNet.cpp:1164
virtual void updateGUI() const
update view after simulation.loadState
Definition MSNet.h:625
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition MSNet.h:343
void setLoaderTime(SUMOTime time)
Definition MSNet.cpp:1158
bool myAmInterrupted
whether an interrupt occurred
Definition MSNet.h:919
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
Definition MSNet.cpp:809
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition MSNet.cpp:1385
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition MSNet.cpp:1094
void preSimStepOutput() const
Prints the current step number.
Definition MSNet.cpp:1349
void writeCollisions() const
write collision output to (xml) file
Definition MSNet.cpp:619
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition MSNet.h:987
void writeSummaryOutput(bool finalStep=false)
write summary-output to (xml) file
Definition MSNet.cpp:697
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
Definition MSNet.h:533
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:436
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition MSNet.cpp:1413
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition MSNet.h:1042
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition MSNet.h:1033
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition MSNet.cpp:1340
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition MSNet.h:1005
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition MSNet.h:989
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition MSNet.cpp:435
void writeRailSignalBlocks() const
write rail signal block output
Definition MSNet.cpp:1600
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition MSNet.h:937
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition MSNet.cpp:1311
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
Definition MSNet.h:827
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition MSNet.h:977
static const std::string STAGE_REMOTECONTROL
Definition MSNet.h:874
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:1402
bool isInterrupted() const
Definition MSNet.h:848
std::map< int, MSTransportableRouter * > myIntermodalRouter
Definition MSNet.h:1074
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition MSNet.h:1045
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition MSNet.cpp:987
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:420
long myTraCIStepDuration
The last simulation step duration.
Definition MSNet.h:968
TransportableState
Definition of a transportable state.
Definition MSNet.h:714
@ 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:456
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition MSNet.h:941
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:526
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
Definition MSNet.h:913
static const std::string STAGE_LANECHANGE
Definition MSNet.h:872
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:376
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
Definition MSNet.h:214
virtual bool skipFinalReset() const
gui may prevent final meanData reset to keep live data visible
Definition MSNet.h:853
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition MSNet.h:1012
SUMOTime getStateLoaderTime() const
return the next time for route loading the time of state loading
Definition MSNet.h:359
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition MSNet.h:951
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition MSNet.cpp:1334
virtual ~MSNet()
Destructor.
Definition MSNet.cpp:309
std::map< int, MSVehicleRouter * > myRouterEffort
Definition MSNet.h:1072
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition MSNet.cpp:1648
static MSNet * myInstance
Unique instance of MSNet.
Definition MSNet.h:895
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
Definition MSNet.h:612
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:403
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition MSNet.h:939
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition MSNet.cpp:1355
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1317
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:1441
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition MSNet.h:870
void loadRoutes()
loads routes for the next few steps
Definition MSNet.cpp:513
std::string myStateDumpPrefix
name components for periodic state
Definition MSNet.h:995
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition MSNet.h:1018
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:446
long mySimBeginMillis
The overall simulation duration.
Definition MSNet.h:971
virtual bool isGUINet() const
Returns whether this is a GUI Net.
Definition MSNet.h:145
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition MSNet.h:1024
std::map< int, MSVehicleRouter * > myRouterTT
Definition MSNet.h:1071
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
Definition MSNet.cpp:440
void postMoveStep()
Performs the parts of the simulation step which happen after the move.
Definition MSNet.cpp:958
bool hasInternalLinks() const
return whether the network contains internal links
Definition MSNet.h:812
const std::string generateStatistics(const SUMOTime start, const long now)
Writes performance output and running vehicle stats.
Definition MSNet.cpp:519
bool checkWalkingarea()
check all lanes for type walkingArea
Definition MSNet.cpp:1822
static void adaptIntermodalRouter(MSTransportableRouter &router)
Definition MSNet.cpp:1772
CollisionMap myCollisions
collisions in the current time step
Definition MSNet.h:1051
MSVehicleRouter & getRouterEffort(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1696
bool hasElevation() const
return whether the network contains elevation data
Definition MSNet.h:822
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition MSNet.cpp:1578
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition MSNet.cpp:471
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:92
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.
Structure representing possible vehicle parameter.
Representation of a vehicle.
Definition SUMOVehicle.h:63
Storage for geometrical objects.
edge type specific meso parameters
Definition MESegment.h:58
collision tracking
Definition MSNet.h:115
double victimSpeed
Definition MSNet.h:120
Position colliderFront
Definition MSNet.h:121
const MSLane * lane
Definition MSNet.h:126
Position victimBack
Definition MSNet.h:124
std::string victimType
Definition MSNet.h:118
SUMOTime continuationTime
Definition MSNet.h:129
Position victimFront
Definition MSNet.h:122
std::string type
Definition MSNet.h:125
std::string colliderType
Definition MSNet.h:117
std::string victim
Definition MSNet.h:116
double colliderSpeed
Definition MSNet.h:119
Position colliderBack
Definition MSNet.h:123
SUMOTime time
Definition MSNet.h:128