Eclipse SUMO - Simulation of Urban MObility
MSNet.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
25// The simulated network and simulation performer
26/****************************************************************************/
27#pragma once
28#include <config.h>
29
30#include <typeinfo>
31#include <vector>
32#include <map>
33#include <string>
34#include <fstream>
35#include <iostream>
36#include <cmath>
37#include <iomanip>
38#include <memory>
44#include <mesosim/MESegment.h>
45#include "MSJunction.h"
46
47
48// ===========================================================================
49// class declarations
50// ===========================================================================
51class MSEdge;
52class MSEdgeControl;
53class MSEventControl;
59class MSTransportable;
60class MSVehicle;
61class MSRoute;
62class MSLane;
66class ShapeContainer;
68class PolygonDynamics;
70class SUMOVehicle;
73class MSStoppingPlace;
74template<class E, class L, class N, class V>
76template<class E, class L, class N, class V>
78class OptionsCont;
79
80
81// ===========================================================================
82// class definitions
83// ===========================================================================
88class MSNet : public Parameterised {
89public:
110 };
111
114
116 struct Collision {
117 std::string victim;
118 std::string colliderType;
119 std::string victimType;
122 std::string type;
123 const MSLane* lane;
124 double pos;
126 };
127
128 typedef std::map<std::string, std::vector<Collision> > CollisionMap;
129
130public:
135 static MSNet* getInstance();
136
140 virtual bool isGUINet() const {
141 return false;
142 }
143
145 static void initStatic();
146
148 static void cleanupStatic();
149
150
154 static bool hasInstance() {
155 return myInstance != nullptr;
156 }
157
158
173 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
174 MSEventControl* endOfTimestepEvents,
175 MSEventControl* insertionEvents,
176 ShapeContainer* shapeCont = 0);
177
178
180 virtual ~MSNet();
181
182
198 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions,
199 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc,
200 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
201 bool hasInternalLinks,
202 bool junctionHigherSpeeds,
203 double version);
204
205
209 bool hasPermissions() const {
210 return myHavePermissions;
211 }
212
213
216 myHavePermissions = true;
217 }
218
219
225 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed);
226
227
233 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const;
234
239 void addMesoType(const std::string& typeID, const MESegment::MesoEdgeType& edgeType);
240
244 const MESegment::MesoEdgeType& getMesoType(const std::string& typeID);
245
249 static void clearAll();
250
251
260
261
265 void simulationStep();
266
267
269 void loadRoutes();
270
271
276 const std::string generateStatistics(SUMOTime start);
277
279 void writeCollisions() const;
280
282 void writeStatistics() const;
283
285 void writeSummaryOutput();
286
293 void closeSimulation(SUMOTime start, const std::string& reason = "");
294
295
302
303
309 SimulationState adaptToState(const SimulationState state, const bool isLibsumo = false) const;
310
311
315 static std::string getStateMessage(SimulationState state);
316
317
322 return myStep;
323 }
324
325
329 inline void setCurrentTimeStep(const SUMOTime step) {
330 myStep = step;
331 }
332
333
337 void clearState(const SUMOTime step, bool quickReload = false);
338
342 void writeOutput();
343
344
348 bool logSimulationDuration() const;
349
350
351
353
354
359 void preSimStepOutput() const;
360
361
366 void postSimStepOutput() const;
367 //}
368
369
370
373
380 return *myVehicleControl;
381 }
382
383
393
396 bool hasPersons() const {
397 return myPersonControl != nullptr;
398 }
399
409
412 bool hasContainers() const {
413 return myContainerControl != nullptr;
414 }
415
416
423 return *myEdges;
424 }
425
426
433 return *myInserter;
434 }
435
436
443 return *myDetectorControl;
444 }
445
446
453 return *myLogics;
454 }
455
456
463 return *myJunctions;
464 }
465
466
474 }
475
476
484 }
485
486
493 return myInsertionEvents;
494 }
495
496
503 return *myShapeContainer;
504 }
505
510 return myDynamicShapeUpdater.get();
511 }
512
517
525
528
539 bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace* stop);
540
541
551
552
558 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const;
559
566 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const;
568
570
572 void writeChargingStationOutput() const;
573
575 void writeRailSignalBlocks() const;
576
579
582
584 void writeSubstationOutput() const;
585
587 virtual bool isSelected(const MSTrafficLightLogic*) const {
588 return false;
589 }
591 virtual void updateGUI() const { }
592
594 SUMOTime loadState(const std::string& fileName);
595
597 void quickReload();
598
601
603 enum class VehicleState {
605 BUILT,
607 DEPARTED,
609 STARTING_TELEPORT,
611 ENDING_TELEPORT,
613 ARRIVED,
615 NEWROUTE,
617 STARTING_PARKING,
619 ENDING_PARKING,
621 STARTING_STOP,
623 ENDING_STOP,
625 COLLISION,
627 EMERGENCYSTOP,
629 MANEUVERING
630 };
631
632
637 public:
640
643
649 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0;
650
651 };
652
653
658
659
664
665
672 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "");
674
675
678
682 PERSON_DEPARTED,
684 PERSON_ARRIVED,
686 CONTAINER_DEPARTED,
688 CONTAINER_ARRIVED
689 };
690
691
696 public:
699
702
708 virtual void transportableStateChanged(const MSTransportable* const transportable, TransportableState to, const std::string& info = "") = 0;
709
710 };
711
712
717
718
723
724
731 void informTransportableStateListener(const MSTransportable* const transportable, TransportableState to, const std::string& info = "");
733
734
736 bool registerCollision(const SUMOTrafficObject* collider, const SUMOTrafficObject* victim, const std::string& collisionType, const MSLane* lane, double pos);
737
739 return myCollisions;
740 }
741
742
750 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t);
751
752
760 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t);
761
762
763 /* @brief get the router, initialize on first use
764 * @param[in] prohibited The vector of forbidden edges (optional)
765 */
767 const MSEdgeVector& prohibited = MSEdgeVector()) const;
769 const MSEdgeVector& prohibited = MSEdgeVector()) const;
770 MSPedestrianRouter& getPedestrianRouter(const int rngIndex, const MSEdgeVector& prohibited = MSEdgeVector()) const;
771 MSIntermodalRouter& getIntermodalRouter(const int rngIndex, const int routingMode = 0, const MSEdgeVector& prohibited = MSEdgeVector()) const;
772
773 static void adaptIntermodalRouter(MSIntermodalRouter& router);
774
775
777 bool hasInternalLinks() const {
778 return myHasInternalLinks;
779 }
780
784 }
785
787 bool hasElevation() const {
788 return myHasElevation;
789 }
790
792 bool hasPedestrianNetwork() const {
794
795 }
797 bool hasBidiEdges() const {
798 return myHasBidiEdges;
799 }
800
802 double getNetworkVersion() const {
803 return myVersion;
804 }
805
807 bool warnOnce(const std::string& typeAndID);
808
809 void interrupt() {
810 myAmInterrupted = true;
811 }
812
813 bool isInterrupted() const {
814 return myAmInterrupted;
815 }
816
818 MSTractionSubstation* findTractionSubstation(const std::string& substationId);
819
821 bool existTractionSubstation(const std::string& substationId);
822
824 static const std::string STAGE_EVENTS;
825 static const std::string STAGE_MOVEMENTS;
826 static const std::string STAGE_LANECHANGE;
827 static const std::string STAGE_INSERTIONS;
828 static const std::string STAGE_REMOTECONTROL;
829
830protected:
832 bool checkElevation();
833
835 bool checkWalkingarea();
836
838 bool checkBidiEdges();
839
842
843protected:
846
849
852
855
858
859
860
863
891
892
893
896
899
904
907
910
913
915 long long int myVehiclesMoved;
916 long long int myPersonsMoved;
917 //}
918
919
920
923
925 std::vector<SUMOTime> myStateDumpTimes;
927 std::vector<std::string> myStateDumpFiles;
929 std::vector<std::string> myPeriodicStateFiles;
933 std::string myStateDumpPrefix;
934 std::string myStateDumpSuffix;
936
937
938
941
943 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions;
944
946 std::map<std::string, MESegment::MesoEdgeType> myMesoEdgeTypes;
947
950
953
956
959
962
965
967 double myVersion;
968
971
973 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces;
974
976 std::vector<MSTractionSubstation*> myTractionSubstations;
977
979 std::vector<VehicleStateListener*> myVehicleStateListeners;
980
982 std::vector<TransportableStateListener*> myTransportableStateListeners;
983
986
987#ifdef HAVE_FOX
989 FXMutex myVehicleStateListenerMutex;
990
992 FXMutex myTransportableStateListenerMutex;
993#endif
995
997 std::map<std::string, bool> myWarnedOnce;
998
999 /* @brief The router instance for routing by trigger and by traci
1000 * @note MSDevice_Routing has its own instance since it uses a different weight function
1001 * @note we provide one member for every switchable router type
1002 * because the class structure makes it inconvenient to use a superclass
1003 */
1004 mutable std::map<int, SUMOAbstractRouter<MSEdge, SUMOVehicle>*> myRouterTT;
1005 mutable std::map<int, SUMOAbstractRouter<MSEdge, SUMOVehicle>*> myRouterEffort;
1006 mutable std::map<int, MSPedestrianRouter*> myPedestrianRouter;
1007 mutable std::map<int, MSIntermodalRouter*> myIntermodalRouter;
1008
1010 mutable std::pair<bool, NamedRTree> myLanesRTree;
1011
1015 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater;
1016
1017private:
1019 MSNet(const MSNet&);
1020
1023
1024
1025};
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.
Detectors container; responsible for string and output generation.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:81
A road/street connecting two junctions.
Definition: MSEdge.h:77
A storage for edge travel times and efforts.
Stores time-dependant events and executes them at the proper time.
Inserts vehicles into the network when their departure time is reached.
Container for junctions; performs operations on all stored junctions.
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
Interface for objects listening to transportable state changes.
Definition: MSNet.h:695
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:698
virtual ~TransportableStateListener()
Destructor.
Definition: MSNet.h:701
Interface for objects listening to vehicle state changes.
Definition: MSNet.h:636
virtual ~VehicleStateListener()
Destructor.
Definition: MSNet.h:642
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:639
The simulated network and simulation perfomer.
Definition: MSNet.h:88
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
Definition: MSNet.h:973
long myTraCIMillis
The overall time spent waiting for traci operations including.
Definition: MSNet.h:912
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
Definition: MSNet.cpp:149
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
Definition: MSNet.cpp:1547
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterEffort
Definition: MSNet.h:1005
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1427
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
Definition: MSNet.h:898
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition: MSNet.h:867
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
Definition: MSNet.cpp:1172
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
Definition: MSNet.h:848
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition: MSNet.cpp:1271
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:1209
SUMOTime myStateDumpPeriod
The period for writing state.
Definition: MSNet.h:931
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
Definition: MSNet.h:994
const std::string generateStatistics(SUMOTime start)
Writes performance output and running vehicle stats.
Definition: MSNet.cpp:432
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
Definition: MSNet.cpp:1344
void writeChargingStationOutput() const
write charging station output
Definition: MSNet.cpp:1321
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
Definition: MSNet.h:1010
bool checkBidiEdges()
check wether bidirectional edges occur in the network
Definition: MSNet.cpp:1537
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:603
int myLogStepPeriod
Period between successive step-log outputs.
Definition: MSNet.h:903
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:442
SUMOTime myStep
Current time step.
Definition: MSNet.h:851
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather it's wrapper) is selected in the GUI
Definition: MSNet.h:587
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
Definition: MSNet.h:961
const CollisionMap & getCollisions() const
Definition: MSNet.h:738
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Definition: MSNet.h:881
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:472
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
Definition: MSNet.cpp:1277
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
Definition: MSNet.h:997
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
Definition: MSNet.cpp:191
void removeOutdatedCollisions()
remove collisions from the previous simulation step
Definition: MSNet.cpp:1252
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition: MSNet.h:873
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
Definition: MSNet.h:929
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
Definition: MSNet.h:887
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
Definition: MSNet.h:797
double myVersion
the network version
Definition: MSNet.h:967
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:452
std::string myStateDumpSuffix
Definition: MSNet.h:934
bool checkElevation()
check all lanes for elevation data
Definition: MSNet.cpp:1512
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
Definition: MSNet.h:940
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
Definition: MSNet.cpp:1378
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition: MSNet.h:482
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
Definition: MSNet.cpp:1200
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:829
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
Definition: MSNet.h:901
MSEventControl * myInsertionEvents
Controls insertion events;.
Definition: MSNet.h:885
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:1105
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, double version)
Closes the network's building process.
Definition: MSNet.cpp:256
SimulationState
Possible states of a simulation - running or stopped with different reasons.
Definition: MSNet.h:93
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
Definition: MSNet.h:109
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
Definition: MSNet.h:101
@ SIMSTATE_LOADING
The simulation is loading.
Definition: MSNet.h:95
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition: MSNet.h:105
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
Definition: MSNet.h:103
@ SIMSTATE_INTERRUPTED
An external interrupt occured.
Definition: MSNet.h:107
@ SIMSTATE_RUNNING
The simulation is running.
Definition: MSNet.h:97
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
Definition: MSNet.h:99
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
Definition: MSNet.h:492
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1389
std::map< int, MSPedestrianRouter * > myPedestrianRouter
Definition: MSNet.h:1006
static const std::string STAGE_MOVEMENTS
Definition: MSNet.h:825
int myMaxTeleports
Maximum number of teleports.
Definition: MSNet.h:854
long mySimStepDuration
Definition: MSNet.h:906
PedestrianRouter< MSEdge, MSLane, MSJunction, MSVehicle > MSPedestrianRouter
Definition: MSNet.h:112
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
Definition: MSNet.h:883
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:850
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:1296
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
Definition: MSNet.h:949
void interrupt()
Definition: MSNet.h:809
double getNetworkVersion() const
return the network version
Definition: MSNet.h:802
void writeSubstationOutput() const
write electrical substation output
Definition: MSNet.cpp:1355
static const std::string STAGE_INSERTIONS
Definition: MSNet.h:827
SUMOTime loadState(const std::string &fileName)
load state from file and return new time
Definition: MSNet.cpp:1576
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition: MSNet.h:462
long long int myPersonsMoved
Definition: MSNet.h:916
void quickReload()
reset state to the beginning without reloading the network
Definition: MSNet.cpp:1556
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition: MSNet.h:865
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
Definition: MSNet.h:782
static void clearAll()
Clears all dictionaries.
Definition: MSNet.cpp:875
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
Definition: MSNet.cpp:198
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
Definition: MSNet.h:215
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSIntermodalRouter
Definition: MSNet.h:113
void writeSummaryOutput()
write summary-output to (xml) file
Definition: MSNet.cpp:555
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:321
std::map< std::string, std::vector< Collision > > CollisionMap
Definition: MSNet.h:128
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
Definition: MSNet.h:871
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
Definition: MSNet.h:1015
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:349
static bool hasInstance()
Returns whether the network was already constructed.
Definition: MSNet.h:154
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition: MSNet.cpp:618
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition: MSNet.cpp:1287
void simulationStep()
Performs a single simulation step.
Definition: MSNet.cpp:656
bool myHasElevation
Whether the network contains elevation data.
Definition: MSNet.h:955
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:163
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition: MSNet.h:869
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
Definition: MSNet.h:982
void writeOutput()
Write netstate, summary and detector output.
Definition: MSNet.cpp:956
virtual void updateGUI() const
update view after simulation.loadState
Definition: MSNet.h:591
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition: MSNet.h:329
bool myAmInterrupted
whether an interrupt occured
Definition: MSNet.h:857
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition: MSNet.cpp:1164
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
Definition: MSNet.cpp:905
void preSimStepOutput() const
Prints the current step number.
Definition: MSNet.cpp:1128
void writeCollisions() const
write collision output to (xml) file
Definition: MSNet.cpp:502
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
Definition: MSNet.h:925
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
Definition: MSNet.h:509
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:412
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
Definition: MSNet.cpp:1192
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
Definition: MSNet.h:976
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition: MSNet.h:970
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:1119
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
Definition: MSNet.h:943
std::vector< std::string > myStateDumpFiles
The names for the state files.
Definition: MSNet.h:927
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
Definition: MSNet.cpp:358
void writeRailSignalBlocks() const
write rail signal block output
Definition: MSNet.cpp:1332
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition: MSNet.h:875
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition: MSNet.cpp:1090
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
Definition: MSNet.h:792
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition: MSNet.h:915
static const std::string STAGE_REMOTECONTROL
Definition: MSNet.h:828
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:1181
bool isInterrupted() const
Definition: MSNet.h:813
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
Definition: MSNet.h:979
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
Definition: MSNet.cpp:799
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:396
long myTraCIStepDuration
The last simulation step duration.
Definition: MSNet.h:906
TransportableState
Definition of a transportable state.
Definition: MSNet.h:680
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:432
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition: MSNet.h:879
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:502
static const std::string STAGE_LANECHANGE
Definition: MSNet.h:826
MSNet(const MSNet &)
Invalidated copy constructor.
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
Constructor.
Definition: MSNet.cpp:205
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: MSNet.cpp:343
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
Definition: MSNet.h:209
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterTT
Definition: MSNet.h:1004
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
Definition: MSNet.h:946
static void adaptIntermodalRouter(MSIntermodalRouter &router)
Definition: MSNet.cpp:1476
bool myLefthand
Whether the network was built for left-hand traffic.
Definition: MSNet.h:964
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
Definition: MSNet.h:889
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
Definition: MSNet.cpp:1113
std::map< int, MSIntermodalRouter * > myIntermodalRouter
Definition: MSNet.h:1007
virtual ~MSNet()
Destructor.
Definition: MSNet.cpp:291
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1417
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
Definition: MSNet.cpp:1367
static MSNet * myInstance
Unique instance of MSNet.
Definition: MSNet.h:845
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
Definition: MSNet.h:578
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:379
MSInsertionControl * myInserter
Controls vehicle insertion;.
Definition: MSNet.h:877
void postSimStepOutput() const
Prints the statistics of the step at its end.
Definition: MSNet.cpp:1134
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1096
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:1220
static const std::string STAGE_EVENTS
string constants for simstep stages
Definition: MSNet.h:824
void loadRoutes()
loads routes for the next few steps
Definition: MSNet.cpp:426
std::string myStateDumpPrefix
name components for periodic state
Definition: MSNet.h:933
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
Definition: MSNet.h:952
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition: MSNet.h:422
long mySimBeginMillis
The overall simulation duration.
Definition: MSNet.h:909
virtual bool isGUINet() const
Returns whether this is a GUI Net.
Definition: MSNet.h:140
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
Definition: MSNet.h:958
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:363
void writeStatistics() const
write statistic output to (xml) file
Definition: MSNet.cpp:524
bool hasInternalLinks() const
return whether the network contains internal links
Definition: MSNet.h:777
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1407
bool checkWalkingarea()
check all lanes for type walkingArea
Definition: MSNet.cpp:1526
CollisionMap myCollisions
collisions in the current time step
Definition: MSNet.h:985
bool hasElevation() const
return whether the network contains elevation data
Definition: MSNet.h:787
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition: MSNet.cpp:1310
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition: MSNet.cpp:384
A lane area vehicles can halt at.
A class that stores and controls tls and switching of their programs.
Traction substaction powering one or more overhead wire sections.
The parent class for traffic light logics.
The class responsible for building and deletion of vehicles.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
A storage for options typed value containers)
Definition: OptionsCont.h:89
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
Representation of a vehicle, person, or container.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Storage for geometrical objects.
edge type specific meso parameters
Definition: MESegment.h:55
collision tracking
Definition: MSNet.h:116
double victimSpeed
Definition: MSNet.h:121
const MSLane * lane
Definition: MSNet.h:123
std::string victimType
Definition: MSNet.h:119
double pos
Definition: MSNet.h:124
std::string type
Definition: MSNet.h:122
std::string colliderType
Definition: MSNet.h:118
std::string victim
Definition: MSNet.h:117
double colliderSpeed
Definition: MSNet.h:120
SUMOTime time
Definition: MSNet.h:125