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-2024 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
114 struct Collision {
115 std::string victim;
116 std::string colliderType;
117 std::string victimType;
120 std::string type;
121 const MSLane* lane;
122 double pos;
124 };
125
126 typedef std::map<std::string, std::vector<Collision> > CollisionMap;
127
128public:
133 static MSNet* getInstance();
134
138 virtual bool isGUINet() const {
139 return false;
140 }
141
143 static void initStatic();
144
146 static void cleanupStatic();
147
148
152 static bool hasInstance() {
153 return myInstance != nullptr;
154 }
155
156
171 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
172 MSEventControl* endOfTimestepEvents,
173 MSEventControl* insertionEvents,
174 ShapeContainer* shapeCont = 0);
175
176
178 virtual ~MSNet();
179
180
196 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions,
197 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc,
198 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
199 bool hasInternalLinks,
200 bool junctionHigherSpeeds,
201 const MMVersion& version);
202
203
207 bool hasPermissions() const {
208 return myHavePermissions;
209 }
210
211
214 myHavePermissions = true;
215 }
216
217
223 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed);
224
225
231 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const;
232
237 void addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType);
238
242 const MESegment::MesoEdgeType& getMesoType(const std::string& typeID);
243
247 static void clearAll();
248
250 bool hasFlow(const std::string& id) const;
251
260
261
265 void simulationStep(const bool onlyMove = false);
266
268 void loadRoutes();
269
270
275 const std::string generateStatistics(const SUMOTime start, const long now);
276
278 void writeCollisions() const;
279
281 void writeStatistics(const SUMOTime start, const long now) const;
282
284 void writeSummaryOutput();
285
292 void closeSimulation(SUMOTime start, const std::string& reason = "");
293
294
301
302
308 SimulationState adaptToState(const SimulationState state, const bool isLibsumo = false) const;
309
310
314 static std::string getStateMessage(SimulationState state);
315
316
321 return myStep;
322 }
323
324
328 inline void setCurrentTimeStep(const SUMOTime step) {
329 myStep = step;
330 }
331
332
336 void clearState(const SUMOTime step, bool quickReload = false);
337
341 void writeOutput();
342
343
347 bool logSimulationDuration() const;
348
349
350
352
353
358 void preSimStepOutput() const;
359
360
365 void postSimStepOutput() const;
366 //}
367
368
369
372
381
382
392
395 bool hasPersons() const {
396 return myPersonControl != nullptr;
397 }
398
408
411 bool hasContainers() const {
412 return myContainerControl != nullptr;
413 }
414
415
422 return *myEdges;
423 }
424
425
434
435
444
445
452 return *myLogics;
453 }
454
455
464
465
474
475
484
485
494
495
504
511
516
524
527
538 bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace* stop);
539
540
550
551
557 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const;
558
563 MSStoppingPlace* getStoppingPlace(const std::string& id) const;
564
571 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const;
573
575
577 void writeChargingStationOutput() const;
578
580 void writeRailSignalBlocks() const;
581
584
587
589 void writeSubstationOutput() const;
590
592 virtual bool isSelected(const MSTrafficLightLogic*) const {
593 return false;
594 }
596 virtual void updateGUI() const { }
597
599 SUMOTime loadState(const std::string& fileName, const bool catchExceptions);
600
602 void quickReload();
603
606
636
637
642 public:
645
648
654 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0;
655
656 };
657
658
663
664
669
670
677 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "");
679
680
683
695
696
701 public:
704
707
713 virtual void transportableStateChanged(const MSTransportable* const transportable, TransportableState to, const std::string& info = "") = 0;
714
715 };
716
717
722
723
728
729
736 void informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info = "");
738
739
741 bool registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos);
742
744 return myCollisions;
745 }
746
747
755 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t);
756
757
765 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t);
766
767
768 /* @brief get the router, initialize on first use
769 * @param[in] prohibited The vector of forbidden edges (optional)
770 */
771 MSVehicleRouter& getRouterTT(const int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
772 MSVehicleRouter& getRouterEffort(const int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
773 MSPedestrianRouter& getPedestrianRouter(const int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
774 MSTransportableRouter& getIntermodalRouter(const int rngIndex, const int routingMode = 0, const MSEdgeVector& prohibited = MSEdgeVector()) const;
775
776 static void adaptIntermodalRouter(MSTransportableRouter& router);
777
778
780 bool hasInternalLinks() const {
781 return myHasInternalLinks;
782 }
783
787 }
788
790 bool hasElevation() const {
791 return myHasElevation;
792 }
793
795 bool hasPedestrianNetwork() const {
797
798 }
800 bool hasBidiEdges() const {
801 return myHasBidiEdges;
802 }
803
806 return myVersion;
807 }
808
810 bool warnOnce(const std::string& typeAndID);
811
812 void interrupt() {
813 myAmInterrupted = true;
814 }
815
816 bool isInterrupted() const {
817 return myAmInterrupted;
818 }
819
821 virtual bool skipFinalReset() const {
822 return false;
823 }
824
826
828 MSTractionSubstation* findTractionSubstation(const std::string& substationId);
829
831 bool existTractionSubstation(const std::string& substationId);
832
834 static const std::string STAGE_EVENTS;
835 static const std::string STAGE_MOVEMENTS;
836 static const std::string STAGE_LANECHANGE;
837 static const std::string STAGE_INSERTIONS;
838 static const std::string STAGE_REMOTECONTROL;
839
840protected:
842 bool checkElevation();
843
845 bool checkWalkingarea();
846
848 bool checkBidiEdges();
849
852
855 void postMoveStep();
856
857protected:
860
863
866
869
872
875
876
877
880
908
909
910
913
916
921
924
927
930
932 long long int myVehiclesMoved;
933 long long int myPersonsMoved;
934 //}
935
936
937
940
942 std::vector<SUMOTime> myStateDumpTimes;
944 std::vector<std::string> myStateDumpFiles;
946 std::vector<std::string> myPeriodicStateFiles;
950 std::string myStateDumpPrefix;
951 std::string myStateDumpSuffix;
953
954
955
958
960 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions;
961
963 std::map<std::string, MESegment::MesoEdgeType> myMesoEdgeTypes;
964
967
970
973
976
979
982
985
988
990 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces;
991
993 std::vector<MSTractionSubstation*> myTractionSubstations;
994
996 std::vector<VehicleStateListener*> myVehicleStateListeners;
997
999 std::vector<TransportableStateListener*> myTransportableStateListeners;
1000
1003
1004#ifdef HAVE_FOX
1006 FXMutex myVehicleStateListenerMutex;
1007
1009 FXMutex myTransportableStateListenerMutex;
1010#endif
1012
1014 std::map<std::string, bool> myWarnedOnce;
1015
1016 /* @brief The router instance for routing by trigger and by traci
1017 * @note MSDevice_Routing has its own instance since it uses a different weight function
1018 * @note we provide one member for every switchable router type
1019 * because the class structure makes it inconvenient to use a superclass
1020 */
1021 mutable std::map<int, MSVehicleRouter*> myRouterTT;
1022 mutable std::map<int, MSVehicleRouter*> myRouterEffort;
1023 mutable std::map<int, MSPedestrianRouter*> myPedestrianRouter;
1024 mutable std::map<int, MSTransportableRouter*> myIntermodalRouter;
1025
1027 mutable std::pair<bool, NamedRTree> myLanesRTree;
1028
1032 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater;
1033
1034private:
1036 MSNet(const MSNet&);
1037
1040
1041
1042};
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:700
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:703
virtual ~TransportableStateListener()
Destructor.
Definition MSNet.h:706
Interface for objects listening to vehicle state changes.
Definition MSNet.h:641
virtual ~VehicleStateListener()
Destructor.
Definition MSNet.h:647
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:644
The simulated network and simulation perfomer.
Definition MSNet.h:89
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition MSNet.h:990
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition MSNet.h:929
MSMapMatcher * getMapMatcher() const
Definition MSNet.cpp:1646
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:1636
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1677
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition MSNet.h:915
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition MSNet.h:884
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition MSNet.cpp:1266
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition MSNet.h:862
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition MSNet.cpp:1365
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:1303
SUMOTime myStateDumpPeriod
The period for writing state.
Definition MSNet.h:948
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition MSNet.h:1011
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition MSNet.cpp:1463
void writeChargingStationOutput() const
write charging station output
Definition MSNet.cpp:1427
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition MSNet.h:1027
bool checkBidiEdges()
check wether bidirectional edges occur in the network
Definition MSNet.cpp:1626
VehicleState
Definition of a vehicle state.
Definition MSNet.h:608
@ 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:920
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition MSNet.h:441
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1536
SUMOTime myStep
Current time step.
Definition MSNet.h:865
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:592
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition MSNet.h:978
const CollisionMap & getCollisions() const
Definition MSNet.h:743
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition MSNet.h:898
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition MSNet.h:471
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition MSNet.cpp:1371
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition MSNet.h:1014
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:1346
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition MSNet.h:890
MSVehicleRouter & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1526
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition MSNet.h:946
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition MSNet.h:904
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition MSNet.h:800
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:451
std::string myStateDumpSuffix
Definition MSNet.h:951
bool checkElevation()
check all lanes for elevation data
Definition MSNet.cpp:1601
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition MSNet.h:957
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
Definition MSNet.cpp:1497
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition MSNet.h:481
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition MSNet.cpp:1294
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:914
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:918
MMVersion myVersion
the network version
Definition MSNet.h:984
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition MSNet.h:902
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1199
MMVersion getNetworkVersion() const
return the network version
Definition MSNet.h:805
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:491
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition MSNet.h:1023
static const std::string STAGE_MOVEMENTS
Definition MSNet.h:835
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:871
long mySimStepDuration
Definition MSNet.h:923
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition MSNet.h:900
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:935
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:1402
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition MSNet.h:966
void interrupt()
Definition MSNet.h:812
void writeSubstationOutput() const
write electrical substation output
Definition MSNet.cpp:1474
static const std::string STAGE_INSERTIONS
Definition MSNet.h:837
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition MSNet.h:461
long long int myPersonsMoved
Definition MSNet.h:933
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1656
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition MSNet.h:882
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
Definition MSNet.h:785
MSTransportableRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1546
static void clearAll()
Clears all dictionaries.
Definition MSNet.cpp:960
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:213
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
Definition MSNet.cpp:562
void writeSummaryOutput()
write summary-output to (xml) file
Definition MSNet.cpp:612
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:320
std::map< std::string, std::vector< Collision > > CollisionMap
Definition MSNet.h:126
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition MSNet.h:888
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition MSNet.h:1032
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:152
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition MSNet.cpp:676
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition MSNet.cpp:1381
bool myHasElevation
Whether the network contains elevation data.
Definition MSNet.h:972
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:886
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition MSNet.h:999
void writeOutput()
Write netstate, summary and detector output.
Definition MSNet.cpp:1045
virtual void updateGUI() const
update view after simulation.loadState
Definition MSNet.h:596
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition MSNet.h:328
bool myAmInterrupted
whether an interrupt occured
Definition MSNet.h:874
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
Definition MSNet.cpp:715
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition MSNet.cpp:1258
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition MSNet.cpp:991
void preSimStepOutput() const
Prints the current step number.
Definition MSNet.cpp:1222
void writeCollisions() const
write collision output to (xml) file
Definition MSNet.cpp:540
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition MSNet.h:942
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
Definition MSNet.h:508
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:411
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition MSNet.cpp:1286
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition MSNet.h:993
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition MSNet.h:987
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition MSNet.cpp:1213
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition MSNet.h:960
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition MSNet.h:944
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:1438
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition MSNet.h:892
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition MSNet.cpp:1184
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
Definition MSNet.h:795
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition MSNet.h:932
static const std::string STAGE_REMOTECONTROL
Definition MSNet.h:838
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:1275
bool isInterrupted() const
Definition MSNet.h:816
std::map< int, MSTransportableRouter * > myIntermodalRouter
Definition MSNet.h:1024
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition MSNet.h:996
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition MSNet.cpp:884
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:395
long myTraCIStepDuration
The last simulation step duration.
Definition MSNet.h:923
TransportableState
Definition of a transportable state.
Definition MSNet.h:685
@ 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:431
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition MSNet.h:896
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:501
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
Definition MSNet.h:868
static const std::string STAGE_LANECHANGE
Definition MSNet.h:836
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(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition MSNet.cpp:1508
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
Definition MSNet.h:207
virtual bool skipFinalReset() const
gui may prevent final meanData reset to keep live data visible
Definition MSNet.h:821
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition MSNet.h:963
bool myLefthand
Whether the network was built for left-hand traffic.
Definition MSNet.h:981
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition MSNet.h:906
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition MSNet.cpp:1207
virtual ~MSNet()
Destructor.
Definition MSNet.cpp:292
std::map< int, MSVehicleRouter * > myRouterEffort
Definition MSNet.h:1022
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition MSNet.cpp:1486
static MSNet * myInstance
Unique instance of MSNet.
Definition MSNet.h:859
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
Definition MSNet.h:583
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:378
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition MSNet.h:894
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition MSNet.cpp:1228
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1190
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:1314
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition MSNet.h:834
void loadRoutes()
loads routes for the next few steps
Definition MSNet.cpp:438
std::string myStateDumpPrefix
name components for periodic state
Definition MSNet.h:950
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition MSNet.h:969
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:421
long mySimBeginMillis
The overall simulation duration.
Definition MSNet.h:926
virtual bool isGUINet() const
Returns whether this is a GUI Net.
Definition MSNet.h:138
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition MSNet.h:975
std::map< int, MSVehicleRouter * > myRouterTT
Definition MSNet.h:1021
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:855
bool hasInternalLinks() const
return whether the network contains internal links
Definition MSNet.h:780
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:1615
static void adaptIntermodalRouter(MSTransportableRouter &router)
Definition MSNet.cpp:1565
CollisionMap myCollisions
collisions in the current time step
Definition MSNet.h:1002
bool hasElevation() const
return whether the network contains elevation data
Definition MSNet.h:790
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition MSNet.cpp:1416
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.
Representation of a vehicle, person, or container.
Representation of a vehicle.
Definition SUMOVehicle.h:62
Storage for geometrical objects.
edge type specific meso parameters
Definition MESegment.h:55
collision tracking
Definition MSNet.h:114
double victimSpeed
Definition MSNet.h:119
const MSLane * lane
Definition MSNet.h:121
std::string victimType
Definition MSNet.h:117
std::string type
Definition MSNet.h:120
std::string colliderType
Definition MSNet.h:116
std::string victim
Definition MSNet.h:115
double colliderSpeed
Definition MSNet.h:118
SUMOTime time
Definition MSNet.h:123