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 <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 typedef std::map<const MSEdge*, RouterProhibition> Prohibitions;
133
134public:
139 static MSNet* getInstance();
140
144 virtual bool isGUINet() const {
145 return false;
146 }
147
149 static void initStatic();
150
152 static void cleanupStatic();
153
154
158 static bool hasInstance() {
159 return myInstance != nullptr;
160 }
161
162
177 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
178 MSEventControl* endOfTimestepEvents,
179 MSEventControl* insertionEvents,
180 ShapeContainer* shapeCont = nullptr);
181
182
184 virtual ~MSNet();
185
186
202 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions,
203 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc,
204 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
205 bool hasInternalLinks,
206 bool junctionHigherSpeeds,
207 const MMVersion& version);
208
209
213 bool hasPermissions() const {
214 return myHavePermissions;
215 }
216
217
220 myHavePermissions = true;
221 }
222
223
229 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed);
230
231
237 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const;
238
240 double getPreference(const std::string& routingType, const SUMOVTypeParameter& pars) const;
241
243 void addPreference(const std::string& routingType, SUMOVehicleClass svc, double prio);
245 void addPreference(const std::string& routingType, std::string vType, double prio);
246
251 void addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType);
252
256 const MESegment::MesoEdgeType& getMesoType(const std::string& typeID);
257
261 static void clearAll();
262
264 bool hasFlow(const std::string& id) const;
265
274
275
279 void simulationStep(const bool onlyMove = false);
280
282 void loadRoutes();
283
284
289 const std::string generateStatistics(const SUMOTime start, const long now);
290
292 void writeCollisions() const;
293
295 void writeStatistics(const SUMOTime start, const long now) const;
296
298 void writeSummaryOutput(bool finalStep = false);
299
306 void closeSimulation(SUMOTime start, const std::string& reason = "");
307
308
315
316
322 SimulationState adaptToState(const SimulationState state, const bool isLibsumo = false) const;
323
324
328 static std::string getStateMessage(SimulationState state);
329
330
335 return myStep;
336 }
337
338
342 inline void setCurrentTimeStep(const SUMOTime step) {
343 myStep = step;
344 }
345
346
350 void clearState(const SUMOTime step, bool quickReload = false);
351
352
353 SUMOTime getLoaderTime() const;
354
355 void setLoaderTime(SUMOTime time);
356
359 return myStateLoaderTime;
360 }
361
365 void writeOutput();
366
367
371 bool logSimulationDuration() const;
372
373
374
376
377
382 void preSimStepOutput() const;
383
384
389 void postSimStepOutput() const;
390 //}
391
392
393
396
405
406
416
419 bool hasPersons() const {
420 return myPersonControl != nullptr;
421 }
422
432
435 bool hasContainers() const {
436 return myContainerControl != nullptr;
437 }
438
439
446 return *myEdges;
447 }
448
449
458
459
468
469
476 return *myLogics;
477 }
478
479
488
489
498
499
508
509
518
519
528
535
540
548
551
562 bool addStoppingPlace(SumoXMLTag category, MSStoppingPlace* stop);
563
564
574
575
581 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const;
582
587 MSStoppingPlace* getStoppingPlace(const std::string& id) const;
588
595 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const;
596
597 /* @brief returns all stopping places of that category with the same (non-empty) name attribute
598 */
599 const std::vector<MSStoppingPlace*>& getStoppingPlaceAlternatives(const std::string& name, SumoXMLTag category) const;
601
603
605 void writeChargingStationOutput() const;
606
608 void writeRailSignalBlocks() const;
609
612
615
617 void writeSubstationOutput() const;
618
620 virtual bool isSelected(const MSTrafficLightLogic*) const {
621 return false;
622 }
624 virtual void updateGUI() const { }
625
627 SUMOTime loadState(const std::string& fileName, const bool catchExceptions);
628
630 void quickReload();
631
634
664
665
670 public:
673
676
682 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0;
683
684 };
685
686
691
692
697
698
705 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "");
707
708
711
723
724
729 public:
732
735
741 virtual void transportableStateChanged(const MSTransportable* const transportable, TransportableState to, const std::string& info = "") = 0;
742
743 };
744
745
750
751
756
757
764 void informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info = "");
766
767
769 bool registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos);
770
772 return myCollisions;
773 }
774
775
783 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t);
784
785
793 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t);
794
795
796 /* @brief get the router, initialize on first use
797 * @param[in] prohibited The vector of forbidden edges (optional)
798 */
799 MSVehicleRouter& getRouterTT(int rngIndex, const Prohibitions& prohibited = {}) const;
800 MSVehicleRouter& getRouterEffort(int rngIndex, const Prohibitions& prohibited = {}) const;
801 MSPedestrianRouter& getPedestrianRouter(int rngIndex, const Prohibitions& prohibited = {}) const;
802 MSTransportableRouter& getIntermodalRouter(int rngIndex, const int routingMode = 0, const Prohibitions& prohibited = {}) const;
803
805 void resetIntermodalRouter() const;
806
807 static void adaptIntermodalRouter(MSTransportableRouter& router);
808
809
811 bool hasInternalLinks() const {
812 return myHasInternalLinks;
813 }
814
818 }
819
821 bool hasElevation() const {
822 return myHasElevation;
823 }
824
826 bool hasPedestrianNetwork() const {
828
829 }
831 bool hasBidiEdges() const {
832 return myHasBidiEdges;
833 }
834
837 return myVersion;
838 }
839
841 bool warnOnce(const std::string& typeAndID);
842
843 void interrupt() {
844 myAmInterrupted = true;
845 }
846
847 bool isInterrupted() const {
848 return myAmInterrupted;
849 }
850
852 virtual bool skipFinalReset() const {
853 return false;
854 }
855
857
859 MSTractionSubstation* findTractionSubstation(const std::string& substationId);
860
862 static const std::string STAGE_EVENTS;
863 static const std::string STAGE_MOVEMENTS;
864 static const std::string STAGE_LANECHANGE;
865 static const std::string STAGE_INSERTIONS;
866 static const std::string STAGE_REMOTECONTROL;
867
868protected:
870 bool checkElevation();
871
873 bool checkWalkingarea();
874
876 bool checkBidiEdges();
877
880
883 void postMoveStep();
884
885protected:
888
891
894
895 /* @brief the time for rejecting vehicle that departed in the past are were already loaded.
896 * When not loading state, this value is the simulation begin time.
897 * When loading state, this is the time up to which vehicles have been
898 * loaded before saving state. This is typically after the state time.
899 * The state will include vehicles up to this time and they should not be
900 * loaded again from a route file. Uniqueness of ids is not a sufficient
901 * guard against loading again because these vehicles could arrive shortly after state loading. */
903
906
909
912
913
914
917
945
946
947
950
953
958
961
964
967
969 long long int myVehiclesMoved;
970 long long int myPersonsMoved;
971 //}
972
973
974
977
979 std::vector<SUMOTime> myStateDumpTimes;
981 std::vector<std::string> myStateDumpFiles;
983 std::vector<std::string> myPeriodicStateFiles;
987 std::string myStateDumpPrefix;
988 std::string myStateDumpSuffix;
990
991
992
995
997 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions;
998
1000 std::map<SUMOVehicleClass, std::map<std::string, double> > myVClassPreferences;
1001 std::map<std::string, std::map<std::string, double> > myVTypePreferences;
1002
1004 std::map<std::string, MESegment::MesoEdgeType> myMesoEdgeTypes;
1005
1008
1011
1014
1017
1020
1023
1026
1028 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces;
1029
1031 std::map<SumoXMLTag, std::map<std::string, std::vector<MSStoppingPlace*> > > myNamedStoppingPlaces;
1032
1034 std::vector<MSTractionSubstation*> myTractionSubstations;
1035
1037 std::vector<VehicleStateListener*> myVehicleStateListeners;
1038
1040 std::vector<TransportableStateListener*> myTransportableStateListeners;
1041
1044
1045#ifdef HAVE_FOX
1047 FXMutex myVehicleStateListenerMutex;
1048
1050 FXMutex myTransportableStateListenerMutex;
1051#endif
1053 static const std::vector<MSStoppingPlace*> myEmptyStoppingPlaceVector;
1054
1056 std::map<std::string, bool> myWarnedOnce;
1057
1058 /* @brief The router instance for routing by trigger and by traci
1059 * @note MSDevice_Routing has its own instance since it uses a different weight function
1060 * @note we provide one member for every switchable router type
1061 * because the class structure makes it inconvenient to use a superclass
1062 */
1063 mutable std::map<int, MSVehicleRouter*> myRouterTT;
1064 mutable std::map<int, MSVehicleRouter*> myRouterEffort;
1065 mutable std::map<int, MSPedestrianRouter*> myPedestrianRouter;
1066 mutable std::map<int, MSTransportableRouter*> myIntermodalRouter;
1067
1069 mutable std::pair<bool, NamedRTree> myLanesRTree;
1070
1074 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater;
1075
1076private:
1078 MSNet(const MSNet&);
1079
1082
1083
1084};
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: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:728
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:731
virtual ~TransportableStateListener()
Destructor.
Definition MSNet.h:734
Interface for objects listening to vehicle state changes.
Definition MSNet.h:669
virtual ~VehicleStateListener()
Destructor.
Definition MSNet.h:675
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:672
The simulated network and simulation perfomer.
Definition MSNet.h:89
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition MSNet.h:1028
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition MSNet.h:966
MSMapMatcher * getMapMatcher() const
Definition MSNet.cpp:1787
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition MSNet.cpp:153
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition MSNet.cpp:1777
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1818
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition MSNet.h:952
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition MSNet.h:921
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition MSNet.cpp:1362
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition MSNet.h:890
std::map< std::string, std::map< std::string, double > > myVTypePreferences
Definition MSNet.h:1001
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:1399
SUMOTime myStateDumpPeriod
The period for writing state.
Definition MSNet.h:985
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition MSNet.h:1052
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition MSNet.cpp:1594
void writeChargingStationOutput() const
write charging station output
Definition MSNet.cpp:1558
SUMOTime myStateLoaderTime
Definition MSNet.h:902
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition MSNet.h:1069
bool checkBidiEdges()
check wether bidirectional edges occur in the network
Definition MSNet.cpp:1767
VehicleState
Definition of a vehicle state.
Definition MSNet.h:636
@ 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:957
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition MSNet.h:465
SUMOTime myStep
Current time step.
Definition MSNet.h:893
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:199
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather its wrapper) is selected in the GUI
Definition MSNet.h:620
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition MSNet.h:1019
const CollisionMap & getCollisions() const
Definition MSNet.h:771
bool addStoppingPlace(SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition MSNet.cpp:1473
void addPreference(const std::string &routingType, SUMOVehicleClass svc, double prio)
add edge type specific routing preference
Definition MSNet.cpp:409
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition MSNet.h:935
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition MSNet.h:495
SUMOTime getLoaderTime() const
Definition MSNet.cpp:1122
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition MSNet.cpp:1486
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition MSNet.h:1056
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:207
void removeOutdatedCollisions()
remove collisions from the previous simulation step
Definition MSNet.cpp:1454
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition MSNet.h:927
std::map< const MSEdge *, RouterProhibition > Prohibitions
Definition MSNet.h:132
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition MSNet.h:983
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition MSNet.h:941
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition MSNet.h:831
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:475
std::string myStateDumpSuffix
Definition MSNet.h:988
const std::vector< MSStoppingPlace * > & getStoppingPlaceAlternatives(const std::string &name, SumoXMLTag category) const
Definition MSNet.cpp:1531
bool checkElevation()
check all lanes for elevation data
Definition MSNet.cpp:1742
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition MSNet.h:994
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1675
std::map< SumoXMLTag, std::map< std::string, std::vector< MSStoppingPlace * > > > myNamedStoppingPlaces
dictionary of named stopping places
Definition MSNet.h:1031
static const std::vector< MSStoppingPlace * > myEmptyStoppingPlaceVector
Definition MSNet.h:1053
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition MSNet.h:505
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition MSNet.cpp:1390
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:991
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:272
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition MSNet.h:955
MMVersion myVersion
the network version
Definition MSNet.h:1022
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition MSNet.h:939
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1295
MMVersion getNetworkVersion() const
return the network version
Definition MSNet.h:836
MSVehicleRouter & getRouterTT(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1628
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 occurred.
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:515
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition MSNet.h:1065
static const std::string STAGE_MOVEMENTS
Definition MSNet.h:863
bool hasFlow(const std::string &id) const
return whether the given flow is known
Definition MSNet.cpp:450
int myMaxTeleports
Maximum number of teleports.
Definition MSNet.h:908
long mySimStepDuration
Definition MSNet.h:960
double getPreference(const std::string &routingType, const SUMOVTypeParameter &pars) const
retriefe edge type specific routing preference
Definition MSNet.cpp:379
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition MSNet.h:937
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:1012
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:1517
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition MSNet.h:1007
void interrupt()
Definition MSNet.h:843
void writeSubstationOutput() const
write electrical substation output
Definition MSNet.cpp:1605
static const std::string STAGE_INSERTIONS
Definition MSNet.h:865
std::map< SUMOVehicleClass, std::map< std::string, double > > myVClassPreferences
Preferences for routing.
Definition MSNet.h:1000
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition MSNet.h:485
long long int myPersonsMoved
Definition MSNet.h:970
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1797
MSPedestrianRouter & getPedestrianRouter(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1662
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition MSNet.h:919
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
Definition MSNet.h:816
static void clearAll()
Clears all dictionaries.
Definition MSNet.cpp:1037
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition MSNet.cpp:213
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
Definition MSNet.h:219
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
Definition MSNet.cpp:634
void resetIntermodalRouter() const
force reconstruction of intermodal network
Definition MSNet.cpp:1697
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:334
std::map< std::string, std::vector< Collision > > CollisionMap
Definition MSNet.h:131
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition MSNet.h:925
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition MSNet.h:1074
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:369
static bool hasInstance()
Returns whether the network was already constructed.
Definition MSNet.h:158
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition MSNet.cpp:751
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition MSNet.cpp:1496
bool myHasElevation
Whether the network contains elevation data.
Definition MSNet.h:1013
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition MSNet.cpp:167
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition MSNet.h:923
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition MSNet.h:1040
void writeOutput()
Write netstate, summary and detector output.
Definition MSNet.cpp:1133
virtual void updateGUI() const
update view after simulation.loadState
Definition MSNet.h:624
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition MSNet.h:342
void setLoaderTime(SUMOTime time)
Definition MSNet.cpp:1127
bool myAmInterrupted
whether an interrupt occurred
Definition MSNet.h:911
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
Definition MSNet.cpp:792
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition MSNet.cpp:1354
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition MSNet.cpp:1068
void preSimStepOutput() const
Prints the current step number.
Definition MSNet.cpp:1318
void writeCollisions() const
write collision output to (xml) file
Definition MSNet.cpp:605
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition MSNet.h:979
void writeSummaryOutput(bool finalStep=false)
write summary-output to (xml) file
Definition MSNet.cpp:683
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
Definition MSNet.h:532
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:435
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition MSNet.cpp:1382
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition MSNet.h:1034
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition MSNet.h:1025
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition MSNet.cpp:1309
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition MSNet.h:997
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition MSNet.h:981
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition MSNet.cpp:422
void writeRailSignalBlocks() const
write rail signal block output
Definition MSNet.cpp:1569
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition MSNet.h:929
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition MSNet.cpp:1280
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
Definition MSNet.h:826
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition MSNet.h:969
static const std::string STAGE_REMOTECONTROL
Definition MSNet.h:866
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:1371
bool isInterrupted() const
Definition MSNet.h:847
std::map< int, MSTransportableRouter * > myIntermodalRouter
Definition MSNet.h:1066
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition MSNet.h:1037
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition MSNet.cpp:961
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:419
long myTraCIStepDuration
The last simulation step duration.
Definition MSNet.h:960
TransportableState
Definition of a transportable state.
Definition MSNet.h:713
@ 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:455
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition MSNet.h:933
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:525
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
Definition MSNet.h:905
static const std::string STAGE_LANECHANGE
Definition MSNet.h:864
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:363
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
Definition MSNet.h:213
virtual bool skipFinalReset() const
gui may prevent final meanData reset to keep live data visible
Definition MSNet.h:852
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition MSNet.h:1004
SUMOTime getStateLoaderTime() const
return the next time for route loading the time of state loading
Definition MSNet.h:358
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition MSNet.h:943
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition MSNet.cpp:1303
virtual ~MSNet()
Destructor.
Definition MSNet.cpp:307
std::map< int, MSVehicleRouter * > myRouterEffort
Definition MSNet.h:1064
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition MSNet.cpp:1617
static MSNet * myInstance
Unique instance of MSNet.
Definition MSNet.h:887
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
Definition MSNet.h:611
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:402
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition MSNet.h:931
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition MSNet.cpp:1324
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1286
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:1410
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition MSNet.h:862
void loadRoutes()
loads routes for the next few steps
Definition MSNet.cpp:499
std::string myStateDumpPrefix
name components for periodic state
Definition MSNet.h:987
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition MSNet.h:1010
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:445
long mySimBeginMillis
The overall simulation duration.
Definition MSNet.h:963
virtual bool isGUINet() const
Returns whether this is a GUI Net.
Definition MSNet.h:144
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition MSNet.h:1016
std::map< int, MSVehicleRouter * > myRouterTT
Definition MSNet.h:1063
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:427
void postMoveStep()
Performs the parts of the simulation step which happen after the move.
Definition MSNet.cpp:932
bool hasInternalLinks() const
return whether the network contains internal links
Definition MSNet.h:811
const std::string generateStatistics(const SUMOTime start, const long now)
Writes performance output and running vehicle stats.
Definition MSNet.cpp:505
bool checkWalkingarea()
check all lanes for type walkingArea
Definition MSNet.cpp:1756
static void adaptIntermodalRouter(MSTransportableRouter &router)
Definition MSNet.cpp:1706
CollisionMap myCollisions
collisions in the current time step
Definition MSNet.h:1043
MSVehicleRouter & getRouterEffort(int rngIndex, const Prohibitions &prohibited={}) const
Definition MSNet.cpp:1649
bool hasElevation() const
return whether the network contains elevation data
Definition MSNet.h:821
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition MSNet.cpp:1547
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition MSNet.cpp:457
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.
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: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