Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSEdge.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/****************************************************************************/
22// A road/street connecting two junctions
23/****************************************************************************/
24#pragma once
25#include <config.h>
26
27#include <vector>
28#include <map>
29#include <string>
30#include <unordered_map>
31#include <iostream>
32#ifdef HAVE_FOX
34#endif
35#include <utils/common/Named.h>
39#include <utils/geom/Boundary.h>
44#include "MSNet.h"
45
46
47// ===========================================================================
48// class declarations
49// ===========================================================================
50class Boundary;
51class OutputDevice;
52class SUMOVehicle;
54class MSVehicle;
55class MSLane;
56class MSLaneChanger;
57class MSPerson;
58class MSJunction;
59class MSEdge;
60class MSTransportable;
61
62
63// ===========================================================================
64// class definitions
65// ===========================================================================
74typedef std::vector<MSEdge*> MSEdgeVector;
75typedef std::vector<const MSEdge*> ConstMSEdgeVector;
76typedef std::vector<std::pair<const MSEdge*, const MSEdge*> > MSConstEdgePairVector;
77
78class MSEdge : public Named, public Parameterised {
79private:
81 typedef std::vector<std::pair<SVCPermissions, std::shared_ptr<const std::vector<MSLane*> > > > AllowedLanesCont;
82
84 typedef std::map<const MSEdge*, AllowedLanesCont> AllowedLanesByTarget;
85
86
87public:
88 friend class MSLaneChangerSublane; // needs access to myLaneChanger
89
101 MSEdge(const std::string& id, int numericalID, const SumoXMLEdgeFunc function,
102 const std::string& streetName, const std::string& edgeType,
103 const std::string& routingType, int priority, double distance);
104
105
107 virtual ~MSEdge();
108
109
115 void initialize(const std::vector<MSLane*>* lanes);
116
117
120 void recalcCache();
121
122
124 virtual void closeBuilding();
125
127 void buildLaneChanger();
128
129 /* @brief returns whether initializing a lane change is permitted on this edge
130 * @note Has to be called after all successors and predecessors have been set (after closeBuilding())
131 */
132 bool allowsLaneChanging() const;
133
136
143 MSLane* leftLane(const MSLane* const lane) const;
144
145
152 MSLane* rightLane(const MSLane* const lane) const;
153
154
162 MSLane* parallelLane(const MSLane* const lane, int offset, bool includeOpposite = true) const;
163
164
169 inline const std::vector<MSLane*>& getLanes() const {
170 return *myLanes;
171 }
172
173 inline int getNumLanes() const {
174 return (int)myLanes->size();
175 }
176
178 int getNumDrivingLanes() const;
179
181 int getVehicleNumber() const;
182
184 bool isEmpty() const;
185
187 std::vector<const SUMOVehicle*> getVehicles() const;
188
189 double getBruttoOccupancy() const;
190
192 double getFlow() const;
193
195 double getWaitingSeconds() const;
196
198 double getOccupancy() const;
199
205 inline const std::set<MSTransportable*, ComparatorNumericalIdLess>& getPersons() const {
206 return myPersons;
207 }
208
213 std::vector<MSTransportable*> getSortedPersons(SUMOTime timestep, bool includeRiding = false) const;
214
215
220 std::vector<MSTransportable*> getSortedContainers(SUMOTime timestep, bool includeRiding = false) const;
221
230 const std::vector<MSLane*>* allowedLanes(const MSEdge& destination,
231 SUMOVehicleClass vclass = SVC_IGNORING, bool ignoreTransientPermissions = false) const;
232
233
234
242 const std::vector<MSLane*>* allowedLanes(SUMOVehicleClass vclass = SVC_IGNORING) const;
243 const std::vector<MSLane*>* allowedLanes(SUMOVehicleClass vclass, bool ignoreTransientPermissions) const;
244
245 inline bool isConnectedTo(const MSEdge& destination, SUMOVehicleClass vclass, bool ignoreTransientPermissions = false) const {
246 const std::vector<MSLane*>* const lanes = allowedLanes(destination, vclass, ignoreTransientPermissions);
247 return lanes != nullptr && !lanes->empty();
248 }
250
251
252
255
261 return myFunction;
262 }
263
265 inline bool isNormal() const {
267 }
268
270 inline bool isInternal() const {
272 }
273
275 inline bool isCrossing() const {
277 }
278
279
281 void checkAndRegisterBiDirEdge(const std::string& bidiID = "");
282
284 inline const MSEdge* getBidiEdge() const {
285 return myBidiEdge;
286 }
287
289 inline bool isWalkingArea() const {
291 }
292
293 inline bool isTazConnector() const {
295 }
296
297 void setOtherTazConnector(const MSEdge* edge) {
298 myOtherTazConnector = edge;
299 }
300
302 return myOtherTazConnector;
303 }
304
308 inline int getNumericalID() const {
309 return myNumericalID;
310 }
311
312
315 const std::string& getStreetName() const {
316 return myStreetName;
317 }
318
321 const std::string& getEdgeType() const {
322 return myEdgeType;
323 }
324
327 const std::string& getRoutingType() const {
328 return myRoutingType.empty() ? myEdgeType : myRoutingType;
329 }
330
331 double getPreference(const SUMOVTypeParameter& pars) const;
332
333 // @brief try to infer edge type for internal edges
334 void inferEdgeType();
335
338 int getPriority() const {
339 return myPriority;
340 }
341
345 double getDistance() const {
346 return myDistance;
347 }
348
351 double getDistanceAt(double pos) const;
352
353 bool hasDistance() const {
354 return myDistance != 0;
355 }
357
361 void setCrossingEdges(const std::vector<std::string>& crossingEdges) {
362 myCrossingEdges.clear();
363 myCrossingEdges.insert(myCrossingEdges.begin(), crossingEdges.begin(), crossingEdges.end());
364 }
365
369 const std::vector<std::string>& getCrossingEdges() const {
370 return myCrossingEdges;
371 }
372
373
376
382 void addSuccessor(MSEdge* edge, const MSEdge* via = nullptr);
383
384 void resetTAZ(MSJunction* junction);
385
389 int getNumSuccessors() const {
390 return (int) mySuccessors.size();
391 }
392
393
399
404 const MSConstEdgePairVector& getViaSuccessors(SUMOVehicleClass vClass = SVC_IGNORING, bool ignoreTransientPermissions = false) const;
405
406
411 int getNumPredecessors() const {
412 return (int) myPredecessors.size();
413 }
414
415
420 return myPredecessors;
421 }
422
423
425 return myFromJunction;
426 }
427
428 const MSJunction* getToJunction() const {
429 return myToJunction;
430 }
431
432
433 void setJunctions(MSJunction* from, MSJunction* to);
435
436
437
440
444 bool isVaporizing() const {
445 return myVaporizationRequests > 0;
446 }
447
448
459
460
472
473
482 double getCurrentTravelTime(const double minSpeed = NUMERICAL_EPS) const;
483
484
486 inline double getMinimumTravelTime(const SUMOVehicle* const veh) const {
488 return 0;
489 } else if (veh != 0) {
491 } else {
492 return myEmptyTraveltime;
493 }
494 }
495
496 double getTimePenalty() const {
497 return myTimePenalty;
498 }
499
507 static inline double getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, double time) {
508 return MSNet::getInstance()->getTravelTime(edge, veh, time);
509 }
510
511 static double getTravelTimeAggregated(const MSEdge* const edge, const SUMOVehicle* const veh, double time);
512
515 double getRoutingSpeed() const;
516
517
520
540 bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false, const bool forceCheck = false) const;
541
543 bool validateDepartSpeed(SUMOVehicle& v) const;
544
564 MSLane* getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos) const;
565
579 MSLane* getProbableLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos, double maxSpeed) const;
580
581
592 MSLane* getDepartLane(MSVehicle& veh) const;
593
594 /* @brief get the rightmost lane that allows the given vClass or nullptr
595 * @param[in] defaultFirst Whether the first lane should be returned if all lanes are forbidden
596 */
597 MSLane* getFirstAllowed(SUMOVehicleClass vClass, bool defaultFirst = false, int routingMode = 0) const;
598
601
608
609
613 inline void setLastFailedInsertionTime(SUMOTime time) const {
615 }
617
618
620 void changeLanes(SUMOTime t) const;
621
622
624 const MSEdge* getInternalFollowingEdge(const MSEdge* followerAfterInternal, SUMOVehicleClass vClass) const;
625
626
628 double getInternalFollowingLengthTo(const MSEdge* followerAfterInternal, SUMOVehicleClass vClass) const;
629
631 const MSEdge* getNormalBefore() const;
632
634 const MSEdge* getNormalSuccessor() const;
635
637 inline bool prohibits(const SUMOVehicle* const vehicle) const {
638 if (vehicle == nullptr) {
639 return false;
640 }
641 const SUMOVehicleClass svc = vehicle->getVClass();
642 return (vehicle->ignoreTransientPermissions()
643 ? (myOriginalCombinedPermissions & svc) != svc
644 : (myCombinedPermissions & svc) != svc);
645 }
646
647 bool hasTransientPermissions() const;
648
654 inline bool restricts(const SUMOVehicle* const /* vehicle */) const {
655 return false;
656 }
657
661 }
662
666 double getWidth() const {
667 return myWidth;
668 }
669
671 const std::vector<double> getSubLaneSides() const {
672 return mySublaneSides;
673 }
674
675 void rebuildAllowedLanes(const bool onInit = false, bool updateVehicles = false);
676
677 void rebuildAllowedTargets(const bool updateVehicles = true);
678
679
685 double getDistanceTo(const MSEdge* other, const bool doBoundaryEstimate = false) const;
686
687
689 static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
690
691
695 inline double getLength() const {
696 return myLength;
697 }
698
699
701 double getMinLength() const;
702
703
708 double getSpeedLimit() const;
709
714 double getSpeedLimit(SUMOVehicleClass svc) const;
715
717 double getLengthGeometryFactor() const;
718
724 void setMaxSpeed(const double val, const bool modified = true, const double jamThreshold = -1);
725
729 void setFrictionCoefficient(double val) const;
730
736 double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const;
737
738
739 virtual void addTransportable(MSTransportable* t) const;
740
741 virtual void removeTransportable(MSTransportable* t) const;
742
743 inline bool isRoundabout() const {
744 return myAmRoundabout;
745 }
746
748 myAmRoundabout = true;
749 }
750
751 void markDelayed() const {
752 myAmDelayed = true;
753 }
754
755 // return whether there have been vehicles on this or the bidi edge (if there is any) at least once
756 inline bool isDelayed() const {
757 return myAmDelayed || (myBidiEdge != nullptr && myBidiEdge->myAmDelayed);
758 }
759
760 bool hasLaneChanger() const {
761 return myLaneChanger != nullptr;
762 }
763
765 std::pair<double, SUMOTime> getLastBlocked(int index) const;
766
768 bool canChangeToOpposite() const;
769
771 const MSEdge* getOppositeEdge() const;
772
774 double getMeanSpeed() const;
775
777 double getMeanFriction() const;
778
780 double getMeanSpeedBike() const;
781
783 bool hasMinorLink() const;
784
786 bool isFringe() const {
787 return myAmFringe;
788 }
789
791 bool hasChangeProhibitions(SUMOVehicleClass svc, int index) const;
792
794 virtual bool isSelected() const {
795 return false;
796 }
797
799 virtual void lock() const {}
800
802 virtual void unlock() const {};
803
805 void addWaiting(SUMOVehicle* vehicle) const;
806
808 void removeWaiting(const SUMOVehicle* vehicle) const;
809
810 /* @brief returns a vehicle that is waiting for a for a person or a container at this edge at the given position
811 * @param[in] transportable The person or container that wants to ride
812 * @param[in] position The vehicle shall be positioned in the interval [position - t, position + t], where t is some tolerance
813 */
814 SUMOVehicle* getWaitingVehicle(MSTransportable* transportable, const double position) const;
815
817 void clearState();
818
820
824
825 static int& getDefaultDepartLane() {
826 return myDefaultDepartLane;
827 }
828
832 static bool dictionary(const std::string& id, MSEdge* edge);
833
835 static MSEdge* dictionary(const std::string_view& id);
836
838 static MSEdge* dictionaryHint(const std::string& id, const int startIdx);
839
841 static const MSEdgeVector& getAllEdges();
842
844 static void clear();
845
847 static void insertIDs(std::vector<std::string>& into);
848
850
852 myMesoIgnoredVClasses = ignored;
853 }
854
855public:
858
867 static void parseEdgesList(const std::string& desc, ConstMSEdgeVector& into,
868 const std::string& rid);
869
870
877 static void parseEdgesList(const std::vector<std::string>& desc, ConstMSEdgeVector& into,
878 const std::string& rid);
880
881
888
895
896 const std::map<const MEVehicle*, std::pair<double, int> >& getMesoPositions() const;
897
898 inline void invalidateMesoCache() const {
900 }
901
902protected:
907 public:
909 explicit by_id_sorter() { }
910
912 int operator()(const MSEdge* const e1, const MSEdge* const e2) const {
913 return e1->getNumericalID() < e2->getNumericalID();
914 }
915
916 };
917
922 public:
924 explicit transportable_by_position_sorter(SUMOTime timestep): myTime(timestep) { }
925
927 int operator()(const MSTransportable* const c1, const MSTransportable* const c2) const;
928 private:
930 };
931
932
934 double getDepartPosBound(const MSVehicle& veh, bool upper = true) const;
935
936protected:
938 const int myNumericalID;
939
941 std::shared_ptr<const std::vector<MSLane*> > myLanes;
942
945
948
951
954
958 mutable std::set<int> myFailedInsertionMemory;
959
961 std::vector<std::string> myCrossingEdges;
962
965
967
970
974
976 mutable std::set<MSTransportable*, ComparatorNumericalIdLess> myPersons;
977
979 mutable std::set<MSTransportable*, ComparatorNumericalIdLess> myContainers;
980
983
987
991
996
1001
1005
1008
1010 std::string myStreetName;
1011
1013 std::string myEdgeType;
1014
1016 std::string myRoutingType;
1017
1019 const int myPriority;
1020
1022 const double myDistance;
1023
1025 double myWidth;
1026
1028 double myLength;
1029
1032
1035
1037 mutable bool myAmDelayed;
1038
1041
1044
1046 std::vector<double> mySublaneSides;
1047
1050
1052 typedef std::map< std::string, MSEdge* > DictType;
1053
1058 static std::unordered_map<std::string_view, MSEdge*> myHashDict;
1059
1064
1066
1070
1071
1073 mutable std::map<SUMOVehicleClass, MSEdgeVector> myClassesSuccessorMap;
1074
1076 mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myClassesViaSuccessorMap;
1077 mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myOrigClassesViaSuccessorMap;
1078
1081
1083 mutable std::vector<SUMOVehicle*> myWaiting;
1084
1086 mutable std::map<const MEVehicle*, std::pair<double, int> > myCachedMesoPos;
1087
1090
1091#ifdef HAVE_FOX
1093 mutable FXMutex myWaitingMutex;
1094
1096 mutable FXMutex mySuccessorMutex;
1097#endif
1098
1099private:
1100
1103
1107
1110
1112 MSEdge& operator=(const MSEdge&) = delete;
1113
1114 void setBidiLanes();
1115
1116 bool isSuperposable(const MSEdge* other);
1117
1118 void addToAllowed(const SVCPermissions permissions, std::shared_ptr<const std::vector<MSLane*> > allowedLanes, AllowedLanesCont& laneCont) const;
1119};
long long int SUMOTime
Definition GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:75
std::vector< std::pair< const MSEdge *, const MSEdge * > > MSConstEdgePairVector
Definition MSEdge.h:76
std::vector< MSEdge * > MSEdgeVector
Definition MSEdge.h:74
const SVCPermissions SVCAll
all VClasses are allowed
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
DepartLaneDefinition
Possible ways to choose a lane on depart.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Sorts edges by their ids.
Definition MSEdge.h:906
by_id_sorter()
constructor
Definition MSEdge.h:909
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition MSEdge.h:912
Sorts transportables by their positions.
Definition MSEdge.h:921
transportable_by_position_sorter(SUMOTime timestep)
constructor
Definition MSEdge.h:924
int operator()(const MSTransportable *const c1, const MSTransportable *const c2) const
comparing operator
Definition MSEdge.cpp:1316
A road/street connecting two junctions.
Definition MSEdge.h:78
void setCrossingEdges(const std::vector< std::string > &crossingEdges)
Sets the crossed edge ids for a crossing edge.
Definition MSEdge.h:361
virtual void unlock() const
release exclusive access to the mesoscopic state
Definition MSEdge.h:802
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition MSEdge.h:1010
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:1157
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
Definition MSEdge.cpp:1555
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition MSEdge.h:794
void addToAllowed(const SVCPermissions permissions, std::shared_ptr< const std::vector< MSLane * > > allowedLanes, AllowedLanesCont &laneCont) const
Definition MSEdge.cpp:302
void changeLanes(SUMOTime t) const
Performs lane changing on this edge.
Definition MSEdge.cpp:962
const int myPriority
the priority of the edge (used during network creation)
Definition MSEdge.h:1019
double getBruttoOccupancy() const
Definition MSEdge.cpp:1692
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition MSEdge.h:995
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
Definition MSEdge.h:389
double getFlow() const
return flow based on meanSpeed
Definition MSEdge.cpp:1679
const MSEdge * myOtherTazConnector
the other taz-connector if this edge isTazConnector, otherwise nullptr
Definition MSEdge.h:1007
Boundary myBoundary
The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start ...
Definition MSEdge.h:1080
double myWidth
Edge width [m].
Definition MSEdge.h:1025
AllowedLanesByTarget myAllowedTargets
From target edge to lanes allowed to be used to reach it.
Definition MSEdge.h:989
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition MSEdge.h:275
MSLane * getDepartLane(MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition MSEdge.cpp:713
SUMOTime myLastFailedInsertionTime
The time of last insertion failure.
Definition MSEdge.h:953
std::set< MSTransportable *, ComparatorNumericalIdLess > myContainers
Containers on the edge.
Definition MSEdge.h:979
void setOtherTazConnector(const MSEdge *edge)
Definition MSEdge.h:297
SUMOTime myLastCacheUpdate
time stamp of mesoscopic vehicle positions
Definition MSEdge.h:1089
void setMaxSpeed(const double val, const bool modified=true, const double jamThreshold=-1)
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
Definition MSEdge.cpp:1261
int getPriority() const
Returns the priority of the edge.
Definition MSEdge.h:338
std::pair< double, SUMOTime > getLastBlocked(int index) const
retrieve properties of a blocked vehicle that wants to chane to the lane with the given index
Definition MSEdge.cpp:1760
static void clear()
Clears the dictionary.
Definition MSEdge.cpp:1163
void inferEdgeType()
Definition MSEdge.cpp:1710
static void setMesoIgnoredVClasses(SVCPermissions ignored)
Definition MSEdge.h:851
const int myNumericalID
This edge's numerical id.
Definition MSEdge.h:938
void setJunctions(MSJunction *from, MSJunction *to)
Definition MSEdge.cpp:1402
double getMeanSpeedBike() const
get the mean speed of all bicycles on this edge
Definition MSEdge.cpp:1081
static MSEdgeVector myEdges
Static list of edges.
Definition MSEdge.h:1063
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition MSEdge.h:659
AllowedLanesCont myAllowed
Associative container from vehicle class to allowed-lanes.
Definition MSEdge.h:985
double myEmptyTraveltime
the traveltime on the empty edge (cached value for speedup)
Definition MSEdge.h:1031
bool myAmFringe
whether this edge is at the network fringe
Definition MSEdge.h:1043
static double getTravelTimeAggregated(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Definition MSEdge.cpp:1704
MSJunction * myToJunction
Definition MSEdge.h:973
void checkAndRegisterBiDirEdge(const std::string &bidiID="")
check and register the opposite superposable edge if any
Definition MSEdge.cpp:1460
virtual ~MSEdge()
Destructor.
Definition MSEdge.cpp:98
double getDepartPosBound(const MSVehicle &veh, bool upper=true) const
return upper bound for the depart position on this edge
Definition MSEdge.cpp:653
const double myDistance
the kilometrage/mileage at the start of the edge
Definition MSEdge.h:1022
void setFrictionCoefficient(double val) const
Sets a new friction coefficient COF for all lanes [later to be (used by TraCI and MSCalibrator)].
void clearState()
Remove all transportables before quick-loading state.
Definition MSEdge.cpp:1775
MSLane * getDepartLaneMeso(SUMOVehicle &veh) const
consider given departLane parameter (only for validating speeds)
Definition MSEdge.cpp:701
const std::string & getStreetName() const
Returns the street name of the edge.
Definition MSEdge.h:315
static DepartLaneDefinition & getDefaultDepartLaneDefinition()
Definition MSEdge.h:821
bool hasTransientPermissions() const
Definition MSEdge.cpp:1754
const std::set< MSTransportable *, ComparatorNumericalIdLess > & getPersons() const
Returns this edge's persons set.
Definition MSEdge.h:205
const MSEdge * myBidiEdge
the oppositing superposable edge
Definition MSEdge.h:1102
MSLane * leftLane(const MSLane *const lane) const
Returns the lane left to the one given, 0 if the given lane is leftmost.
Definition MSEdge.cpp:487
static double getTravelTimeStatic(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition MSEdge.h:507
std::string myEdgeType
the type of the edge (optionally used during network creation)
Definition MSEdge.h:1013
RailEdge< MSEdge, SUMOVehicle > * getRailwayRoutingEdge() const
Definition MSEdge.h:889
bool isWalkingArea() const
return whether this edge is walking area
Definition MSEdge.h:289
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition MSEdge.h:169
int getNumDrivingLanes() const
return the number of lanes that permit non-weak modes if the edge allows non weak modes and the numbe...
Definition MSEdge.cpp:1597
bool isDelayed() const
Definition MSEdge.h:756
const MSEdge * getOppositeEdge() const
Returns the opposite direction edge if on exists else a nullptr.
Definition MSEdge.cpp:1423
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
Definition MSEdge.cpp:1183
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition MSEdge.cpp:1249
void addSuccessor(MSEdge *edge, const MSEdge *via=nullptr)
Adds an edge to the list of edges which may be reached from this edge and to the incoming of the othe...
Definition MSEdge.cpp:1327
bool isFringe() const
return whether this edge is at the fringe of the network
Definition MSEdge.h:786
std::vector< SUMOVehicle * > myWaiting
List of waiting vehicles.
Definition MSEdge.h:1083
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
Definition MSEdge.cpp:1017
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Get the allowed lanes to reach the destination-edge.
Definition MSEdge.cpp:516
void invalidateMesoCache() const
Definition MSEdge.h:898
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition MSEdge.h:284
double getInternalFollowingLengthTo(const MSEdge *followerAfterInternal, SUMOVehicleClass vClass) const
returns the length of all internal edges on the junction until reaching the non-internal edge followe...
Definition MSEdge.cpp:992
bool isNormal() const
return whether this edge is an internal edge
Definition MSEdge.h:265
bool restricts(const SUMOVehicle *const) const
Returns whether this edge has restriction parameters forbidding the given vehicle to pass it The rest...
Definition MSEdge.h:654
ReversedEdge< MSEdge, SUMOVehicle > * getReversedRoutingEdge() const
Definition MSEdge.h:882
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
Definition MSEdge.cpp:1290
void postLoadInitLaneChanger()
Definition MSEdge.cpp:253
bool isSuperposable(const MSEdge *other)
Definition MSEdge.cpp:1515
bool validateDepartSpeed(SUMOVehicle &v) const
check whether the given departSpeed is valid for this edge
Definition MSEdge.cpp:802
const std::vector< std::string > & getCrossingEdges() const
Gets the crossed edge ids.
Definition MSEdge.h:369
double getDistanceTo(const MSEdge *other, const bool doBoundaryEstimate=false) const
optimistic air distance heuristic for use in routing
Definition MSEdge.cpp:1210
std::string myRoutingType
the routing type of the edge (used to look up vType and vClass specific routing preferences)
Definition MSEdge.h:1016
static MSEdge * dictionaryHint(const std::string &id, const int startIdx)
Returns the MSEdge associated to the key id giving a hint with a numerical id.
Definition MSEdge.cpp:1144
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition MSEdge.h:944
double getOccupancy() const
return mean occupancy on this edges lanes or segments
Definition MSEdge.cpp:1657
static int myDefaultDepartLane
Definition MSEdge.h:1068
const MSConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Returns the following edges with internal vias, restricted by vClass.
Definition MSEdge.cpp:1372
std::vector< MSTransportable * > getSortedContainers(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's containers sorted by pos.
Definition MSEdge.cpp:1308
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition MSEdge.h:947
MSLane * getProbableLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass, double departPos, double maxSpeed) const
Finds the most probable lane allowing the vehicle class.
Definition MSEdge.cpp:615
void recalcCache()
Recalculates the cached values.
Definition MSEdge.cpp:123
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is returned; should pr...
Definition MSEdge.cpp:1235
SVCPermissions myOriginalCombinedPermissions
The original union of lane permissions for this edge (before temporary modifications)
Definition MSEdge.h:1000
MSEdge & operator=(const MSEdge &)=delete
assignment operator.
bool myAmDelayed
whether this edge had a vehicle with less than max speed on it
Definition MSEdge.h:1037
SVCPermissions myOriginalMinimumPermissions
The original intersection of lane permissions for this edge (before temporary modifications)
Definition MSEdge.h:998
std::map< SUMOVehicleClass, MSEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition MSEdge.h:1073
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition MSEdge.cpp:576
static int & getDefaultDepartLane()
Definition MSEdge.h:825
MSEdgeVector myPredecessors
The preceeding edges.
Definition MSEdge.h:969
bool hasChangeProhibitions(SUMOVehicleClass svc, int index) const
return whether this edge prohibits changing for the given vClass when starting on the given lane inde...
Definition MSEdge.cpp:1445
void rebuildAllowedTargets(const bool updateVehicles=true)
Definition MSEdge.cpp:419
bool hasLaneChanger() const
Definition MSEdge.h:760
static SVCPermissions myMesoIgnoredVClasses
Definition MSEdge.h:1065
std::vector< std::pair< SVCPermissions, std::shared_ptr< const std::vector< MSLane * > > > > AllowedLanesCont
"Map" from vehicle class to allowed lanes
Definition MSEdge.h:81
const MSJunction * getToJunction() const
Definition MSEdge.h:428
double getLength() const
return the length of the edge
Definition MSEdge.h:695
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition MSEdge.cpp:106
bool myHaveTransientPermissions
whether transient permission changes were applied to this edge or a predecessor
Definition MSEdge.h:1003
std::vector< std::string > myCrossingEdges
The crossed edges id for a crossing edge. On not crossing edges it is empty.
Definition MSEdge.h:961
virtual void closeBuilding()
Definition MSEdge.cpp:209
static SVCPermissions getMesoPermissions(SVCPermissions p, SVCPermissions ignoreIgnored=0)
Definition MSEdge.cpp:317
bool canChangeToOpposite() const
whether this edge allows changing to the opposite direction edge
Definition MSEdge.cpp:1413
std::set< int > myFailedInsertionMemory
A cache for the rejected insertion attempts. Used to assure that no further insertion attempts are ma...
Definition MSEdge.h:958
const MSJunction * getFromJunction() const
Definition MSEdge.h:424
double getMeanSpeed() const
get the mean speed
Definition MSEdge.cpp:1027
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition MSEdge.h:1057
std::set< MSTransportable *, ComparatorNumericalIdLess > myPersons
Persons on the edge for drawing and pushbutton.
Definition MSEdge.h:976
bool isTazConnector() const
Definition MSEdge.h:293
MSEdge(const MSEdge &)
Invalidated copy constructor.
int getNumLanes() const
Definition MSEdge.h:173
double getDistanceAt(double pos) const
Returns the kilometrage/mileage at the given offset along the edge.
Definition MSEdge.cpp:1747
const std::string & getRoutingType() const
Returns the type of the edge.
Definition MSEdge.h:327
MSConstEdgePairVector myViaSuccessors
Definition MSEdge.h:966
std::map< const MEVehicle *, std::pair< double, int > > myCachedMesoPos
Mesoscopic vehicle positions.
Definition MSEdge.h:1086
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition MSEdge.h:486
void setBidiLanes()
Definition MSEdge.cpp:1490
MSEdgeVector mySuccessors
The succeeding edges.
Definition MSEdge.h:964
static DepartLaneDefinition myDefaultDepartLaneDefinition
Definition MSEdge.h:1067
static std::unordered_map< std::string_view, MSEdge * > myHashDict
Definition MSEdge.h:1058
bool isRoundabout() const
Definition MSEdge.h:743
bool isInternal() const
return whether this edge is an internal edge
Definition MSEdge.h:270
bool prohibits(const SUMOVehicle *const vehicle) const
Returns whether the vehicle (class) is not allowed on the edge.
Definition MSEdge.h:637
MSLane * rightLane(const MSLane *const lane) const
Returns the lane right to the one given, 0 if the given lane is rightmost.
Definition MSEdge.cpp:493
double getMinLength() const
return the minimum length of all lanes (only differs from getLength for curved internal lanes)
Definition MSEdge.cpp:1838
double getWidth() const
Returns the edges's width (sum over all lanes)
Definition MSEdge.h:666
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition MSEdge.cpp:1101
std::map< SUMOVehicleClass, MSConstEdgePairVector > myOrigClassesViaSuccessorMap
Definition MSEdge.h:1077
AllowedLanesByTarget myOrigAllowedTargets
Definition MSEdge.h:990
int getNumericalID() const
Returns the numerical id of the edge.
Definition MSEdge.h:308
void resetTAZ(MSJunction *junction)
Definition MSEdge.cpp:186
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition MSEdge.h:444
bool insertVehicle(SUMOVehicle &v, SUMOTime time, const bool checkOnly=false, const bool forceCheck=false) const
Tries to insert the given vehicle into the network.
Definition MSEdge.cpp:839
static const Position getStopPosition(const SUMOVehicleParameter::Stop &stop)
return the coordinates of the center of the given stop
Definition MSEdge.cpp:1229
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition MSEdge.cpp:1534
MSLane * parallelLane(const MSLane *const lane, int offset, bool includeOpposite=true) const
Returns the lane with the given offset parallel to the given lane one or 0 if it does not exist.
Definition MSEdge.cpp:499
ReversedEdge< MSEdge, SUMOVehicle > * myReversedRoutingEdge
a reversed version for backward routing
Definition MSEdge.h:1105
double getTimePenalty() const
Definition MSEdge.h:496
const std::string & getEdgeType() const
Returns the type of the edge.
Definition MSEdge.h:321
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition MSEdge.cpp:1117
std::vector< const SUMOVehicle * > getVehicles() const
return vehicles on this edges lanes or segments
Definition MSEdge.cpp:1578
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge's sublanes.
Definition MSEdge.h:671
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition MSEdge.cpp:1175
const MSEdge * getOtherTazConnector() const
Definition MSEdge.h:301
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition MSEdge.cpp:1254
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition MSEdge.cpp:569
MSJunction * myFromJunction
the junctions for this edge
Definition MSEdge.h:972
double getMeanFriction() const
get the mean friction over the lanes
Definition MSEdge.cpp:1068
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition MSEdge.h:1052
bool isConnectedTo(const MSEdge &destination, SUMOVehicleClass vclass, bool ignoreTransientPermissions=false) const
Definition MSEdge.h:245
bool hasMinorLink() const
whether any lane has a minor link
Definition MSEdge.cpp:1433
double getPreference(const SUMOVTypeParameter &pars) const
Definition MSEdge.cpp:1769
std::map< SUMOVehicleClass, MSConstEdgePairVector > myClassesViaSuccessorMap
The successors available for a given vClass.
Definition MSEdge.h:1076
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition MSEdge.cpp:1007
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
Definition MSEdge.cpp:1615
void markDelayed() const
Definition MSEdge.h:751
const std::map< const MEVehicle *, std::pair< double, int > > & getMesoPositions() const
Definition MSEdge.cpp:1783
const MSEdgeVector & getPredecessors() const
Definition MSEdge.h:419
virtual void removeTransportable(MSTransportable *t) const
Definition MSEdge.cpp:1281
SUMOTime getLastFailedInsertionTime() const
Returns the last time a vehicle could not be inserted.
Definition MSEdge.h:605
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition MSEdge.h:260
bool allowsLaneChanging() const
Definition MSEdge.cpp:280
bool isEmpty() const
whether this edge has no vehicles
Definition MSEdge.cpp:1621
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal, SUMOVehicleClass vClass) const
Definition MSEdge.cpp:970
void buildLaneChanger()
Has to be called after all successors and predecessors have been set (after closeBuilding())
Definition MSEdge.cpp:260
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition MSEdge.cpp:1111
virtual void lock() const
grant exclusive access to the mesoscopic state
Definition MSEdge.h:799
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
Definition MSEdge.cpp:1543
bool hasDistance() const
Definition MSEdge.h:353
MSLane * getFirstAllowed(SUMOVehicleClass vClass, bool defaultFirst=false, int routingMode=0) const
Definition MSEdge.cpp:791
std::vector< double > mySublaneSides
the right side for each sublane on this edge
Definition MSEdge.h:1046
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition MSEdge.cpp:1342
std::shared_ptr< const std::vector< MSLane * > > myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane,...
Definition MSEdge.h:941
AllowedLanesCont myOrigAllowed
Definition MSEdge.h:986
double getWaitingSeconds() const
return accumulated waiting time for all vehicles on this edges lanes or segments
Definition MSEdge.cpp:1641
int myVaporizationRequests
Vaporizer counter.
Definition MSEdge.h:950
int getNumPredecessors() const
Returns the number of edges this edge is connected to.
Definition MSEdge.h:411
double myTimePenalty
flat penalty when computing traveltime
Definition MSEdge.h:1034
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition MSEdge.h:993
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass, double departPos) const
Finds the emptiest lane allowing the vehicle class.
Definition MSEdge.cpp:583
void rebuildAllowedLanes(const bool onInit=false, bool updateVehicles=false)
Definition MSEdge.cpp:324
std::map< const MSEdge *, AllowedLanesCont > AllowedLanesByTarget
Succeeding edges (keys) and allowed lanes to reach these edges (values).
Definition MSEdge.h:84
void markAsRoundabout()
Definition MSEdge.h:747
bool myAmRoundabout
whether this edge belongs to a roundabout
Definition MSEdge.h:1040
virtual void addTransportable(MSTransportable *t) const
Definition MSEdge.cpp:1272
double getDistance() const
Returns the kilometrage/mileage encoding at the start of the edge (negative values encode descending ...
Definition MSEdge.h:345
void setLastFailedInsertionTime(SUMOTime time) const
Sets the last time a vehicle could not be inserted.
Definition MSEdge.h:613
RailEdge< MSEdge, SUMOVehicle > * myRailwayRoutingEdge
Definition MSEdge.h:1106
double myLength
the length of the edge (cached value for speedup)
Definition MSEdge.h:1028
The base class for an intersection.
Definition MSJunction.h:58
Performs lane changing of vehicles.
Performs lane changing of vehicles.
Representation of a lane in the micro simulation.
Definition MSLane.h:84
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:201
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition MSNet.cpp:169
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
Base class for objects which have an id.
Definition Named.h:53
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
the edge type representing backward edges
Definition RailEdge.h:38
the edge type representing backward edges
Representation of a vehicle, person, or container.
virtual bool ignoreTransientPermissions() const
Returns whether this object is ignoring transient permission changes (during routing)
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
Structure representing possible vehicle parameter.
Representation of a vehicle.
Definition SUMOVehicle.h:63
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.