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-2025 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 <iostream>
31#ifdef HAVE_FOX
33#endif
34#include <utils/common/Named.h>
38#include <utils/geom/Boundary.h>
43#include "MSNet.h"
44
45
46// ===========================================================================
47// class declarations
48// ===========================================================================
49class Boundary;
50class OutputDevice;
51class SUMOVehicle;
53class MSVehicle;
54class MSLane;
55class MSLaneChanger;
56class MSPerson;
57class MSJunction;
58class MSEdge;
59class MSTransportable;
60
61
62// ===========================================================================
63// class definitions
64// ===========================================================================
73typedef std::vector<MSEdge*> MSEdgeVector;
74typedef std::vector<const MSEdge*> ConstMSEdgeVector;
75typedef std::vector<std::pair<const MSEdge*, const MSEdge*> > MSConstEdgePairVector;
76
77class MSEdge : public Named, public Parameterised {
78private:
80 typedef std::vector<std::pair<SVCPermissions, std::shared_ptr<const std::vector<MSLane*> > > > AllowedLanesCont;
81
83 typedef std::map<const MSEdge*, AllowedLanesCont> AllowedLanesByTarget;
84
85
86public:
87 friend class MSLaneChangerSublane; // needs access to myLaneChanger
88
100 MSEdge(const std::string& id, int numericalID, const SumoXMLEdgeFunc function,
101 const std::string& streetName, const std::string& edgeType,
102 const std::string& routingType, int priority, double distance);
103
104
106 virtual ~MSEdge();
107
108
114 void initialize(const std::vector<MSLane*>* lanes);
115
116
119 void recalcCache();
120
121
123 virtual void closeBuilding();
124
126 void buildLaneChanger();
127
128 /* @brief returns whether initizliaing a lane change is permitted on this edge
129 * @note Has to be called after all sucessors and predecessors have been set (after closeBuilding())
130 */
131 bool allowsLaneChanging() const;
132
135
142 MSLane* leftLane(const MSLane* const lane) const;
143
144
151 MSLane* rightLane(const MSLane* const lane) const;
152
153
161 MSLane* parallelLane(const MSLane* const lane, int offset, bool includeOpposite = true) const;
162
163
168 inline const std::vector<MSLane*>& getLanes() const {
169 return *myLanes;
170 }
171
172 inline int getNumLanes() const {
173 return (int)myLanes->size();
174 }
175
177 int getNumDrivingLanes() const;
178
180 int getVehicleNumber() const;
181
183 bool isEmpty() const;
184
186 std::vector<const SUMOVehicle*> getVehicles() const;
187
188 double getBruttoOccupancy() const;
189
191 double getFlow() const;
192
194 double getWaitingSeconds() const;
195
197 double getOccupancy() const;
198
204 inline const std::set<MSTransportable*, ComparatorNumericalIdLess>& getPersons() const {
205 return myPersons;
206 }
207
212 std::vector<MSTransportable*> getSortedPersons(SUMOTime timestep, bool includeRiding = false) const;
213
214
219 std::vector<MSTransportable*> getSortedContainers(SUMOTime timestep, bool includeRiding = false) const;
220
229 const std::vector<MSLane*>* allowedLanes(const MSEdge& destination,
230 SUMOVehicleClass vclass = SVC_IGNORING, bool ignoreTransientPermissions = false) const;
231
232
233
241 const std::vector<MSLane*>* allowedLanes(SUMOVehicleClass vclass = SVC_IGNORING) const;
242
243 inline bool isConnectedTo(const MSEdge& destination, SUMOVehicleClass vclass, bool ignoreTransientPermissions = false) const {
244 const std::vector<MSLane*>* const lanes = allowedLanes(destination, vclass, ignoreTransientPermissions);
245 return lanes != nullptr && !lanes->empty();
246 }
248
249
250
253
259 return myFunction;
260 }
261
263 inline bool isNormal() const {
265 }
266
268 inline bool isInternal() const {
270 }
271
273 inline bool isCrossing() const {
275 }
276
277
279 void checkAndRegisterBiDirEdge(const std::string& bidiID = "");
280
282 inline const MSEdge* getBidiEdge() const {
283 return myBidiEdge;
284 }
285
287 inline bool isWalkingArea() const {
289 }
290
291 inline bool isTazConnector() const {
293 }
294
295 void setOtherTazConnector(const MSEdge* edge) {
296 myOtherTazConnector = edge;
297 }
298
300 return myOtherTazConnector;
301 }
302
306 inline int getNumericalID() const {
307 return myNumericalID;
308 }
309
310
313 const std::string& getStreetName() const {
314 return myStreetName;
315 }
316
319 const std::string& getEdgeType() const {
320 return myEdgeType;
321 }
322
325 const std::string& getRoutingType() const {
326 return myRoutingType.empty() ? myEdgeType : myRoutingType;
327 }
328
329 double getPreference(const SUMOVTypeParameter& pars) const;
330
331 // @brief try to infer edge type for internal edges
332 void inferEdgeType();
333
336 int getPriority() const {
337 return myPriority;
338 }
339
343 double getDistance() const {
344 return myDistance;
345 }
346
349 double getDistanceAt(double pos) const;
350
351 bool hasDistance() const {
352 return myDistance != 0;
353 }
355
359 void setCrossingEdges(const std::vector<std::string>& crossingEdges) {
360 myCrossingEdges.clear();
361 myCrossingEdges.insert(myCrossingEdges.begin(), crossingEdges.begin(), crossingEdges.end());
362 }
363
367 const std::vector<std::string>& getCrossingEdges() const {
368 return myCrossingEdges;
369 }
370
371
374
380 void addSuccessor(MSEdge* edge, const MSEdge* via = nullptr);
381
382 void resetTAZ(MSJunction* junction);
383
387 int getNumSuccessors() const {
388 return (int) mySuccessors.size();
389 }
390
391
397
402 const MSConstEdgePairVector& getViaSuccessors(SUMOVehicleClass vClass = SVC_IGNORING, bool ignoreTransientPermissions = false) const;
403
404
409 int getNumPredecessors() const {
410 return (int) myPredecessors.size();
411 }
412
413
418 return myPredecessors;
419 }
420
421
423 return myFromJunction;
424 }
425
426 const MSJunction* getToJunction() const {
427 return myToJunction;
428 }
429
430
431 void setJunctions(MSJunction* from, MSJunction* to);
433
434
435
438
442 bool isVaporizing() const {
443 return myVaporizationRequests > 0;
444 }
445
446
457
458
470
471
480 double getCurrentTravelTime(const double minSpeed = NUMERICAL_EPS) const;
481
482
484 inline double getMinimumTravelTime(const SUMOVehicle* const veh) const {
486 return 0;
487 } else if (veh != 0) {
489 } else {
490 return myEmptyTraveltime;
491 }
492 }
493
494 double getTimePenalty() const {
495 return myTimePenalty;
496 }
497
505 static inline double getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, double time) {
506 return MSNet::getInstance()->getTravelTime(edge, veh, time);
507 }
508
509 static double getTravelTimeAggregated(const MSEdge* const edge, const SUMOVehicle* const veh, double time);
510
513 double getRoutingSpeed() const;
514
515
518
538 bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false, const bool forceCheck = false) const;
539
541 bool validateDepartSpeed(SUMOVehicle& v) const;
542
562 MSLane* getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos) const;
563
577 MSLane* getProbableLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos, double maxSpeed) const;
578
579
590 MSLane* getDepartLane(MSVehicle& veh) const;
591
592 /* @brief get the rightmost lane that allows the given vClass or nullptr
593 * @param[in] defaultFirst Whether the first lane should be returned if all lanes are forbidden
594 */
595 MSLane* getFirstAllowed(SUMOVehicleClass vClass, bool defaultFirst = false) const;
596
599
606
607
611 inline void setLastFailedInsertionTime(SUMOTime time) const {
613 }
615
616
618 void changeLanes(SUMOTime t) const;
619
620
622 const MSEdge* getInternalFollowingEdge(const MSEdge* followerAfterInternal, SUMOVehicleClass vClass) const;
623
624
626 double getInternalFollowingLengthTo(const MSEdge* followerAfterInternal, SUMOVehicleClass vClass) const;
627
629 const MSEdge* getNormalBefore() const;
630
632 const MSEdge* getNormalSuccessor() const;
633
635 inline bool prohibits(const SUMOVehicle* const vehicle) const {
636 if (vehicle == nullptr) {
637 return false;
638 }
639 const SUMOVehicleClass svc = vehicle->getVClass();
640 return (vehicle->ignoreTransientPermissions()
641 ? (myOriginalCombinedPermissions & svc) != svc
642 : (myCombinedPermissions & svc) != svc);
643 }
644
645 bool hasTransientPermissions() const;
646
652 inline bool restricts(const SUMOVehicle* const /* vehicle */) const {
653 return false;
654 }
655
659 }
660
664 double getWidth() const {
665 return myWidth;
666 }
667
669 const std::vector<double> getSubLaneSides() const {
670 return mySublaneSides;
671 }
672
673 void rebuildAllowedLanes(const bool onInit = false, bool updateVehicles = false);
674
675 void rebuildAllowedTargets(const bool updateVehicles = true);
676
677
683 double getDistanceTo(const MSEdge* other, const bool doBoundaryEstimate = false) const;
684
685
687 static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
688
689
693 inline double getLength() const {
694 return myLength;
695 }
696
697
702 double getSpeedLimit() const;
703
705 double getLengthGeometryFactor() const;
706
710 void setMaxSpeed(double val, double jamThreshold = -1);
711
715 void setFrictionCoefficient(double val) const;
716
722 double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const;
723
724
725 virtual void addTransportable(MSTransportable* t) const;
726
727 virtual void removeTransportable(MSTransportable* t) const;
728
729 inline bool isRoundabout() const {
730 return myAmRoundabout;
731 }
732
734 myAmRoundabout = true;
735 }
736
737 void markDelayed() const {
738 myAmDelayed = true;
739 }
740
741 // return whether there have been vehicles on this or the bidi edge (if there is any) at least once
742 inline bool isDelayed() const {
743 return myAmDelayed || (myBidiEdge != nullptr && myBidiEdge->myAmDelayed);
744 }
745
746 bool hasLaneChanger() const {
747 return myLaneChanger != nullptr;
748 }
749
751 std::pair<double, SUMOTime> getLastBlocked(int index) const;
752
754 bool canChangeToOpposite() const;
755
757 const MSEdge* getOppositeEdge() const;
758
760 double getMeanSpeed() const;
761
763 double getMeanFriction() const;
764
766 double getMeanSpeedBike() const;
767
769 bool hasMinorLink() const;
770
772 bool isFringe() const {
773 return myAmFringe;
774 }
775
777 bool hasChangeProhibitions(SUMOVehicleClass svc, int index) const;
778
780 virtual bool isSelected() const {
781 return false;
782 }
783
785 virtual void lock() const {}
786
788 virtual void unlock() const {};
789
791 void addWaiting(SUMOVehicle* vehicle) const;
792
794 void removeWaiting(const SUMOVehicle* vehicle) const;
795
796 /* @brief returns a vehicle that is waiting for a for a person or a container at this edge at the given position
797 * @param[in] transportable The person or container that wants to ride
798 * @param[in] position The vehicle shall be positioned in the interval [position - t, position + t], where t is some tolerance
799 */
800 SUMOVehicle* getWaitingVehicle(MSTransportable* transportable, const double position) const;
801
803 void clearState();
804
806 void updateMesoType();
807
811
812 static int& getDefaultDepartLane() {
813 return myDefaultDepartLane;
814 }
815
819 static bool dictionary(const std::string& id, MSEdge* edge);
820
822 static MSEdge* dictionary(const std::string& id);
823
825 static MSEdge* dictionaryHint(const std::string& id, const int startIdx);
826
828 static const MSEdgeVector& getAllEdges();
829
831 static void clear();
832
834 static void insertIDs(std::vector<std::string>& into);
835
837
839 myMesoIgnoredVClasses = ignored;
840 }
841
842public:
845
854 static void parseEdgesList(const std::string& desc, ConstMSEdgeVector& into,
855 const std::string& rid);
856
857
864 static void parseEdgesList(const std::vector<std::string>& desc, ConstMSEdgeVector& into,
865 const std::string& rid);
867
868
875
882
883protected:
888 public:
890 explicit by_id_sorter() { }
891
893 int operator()(const MSEdge* const e1, const MSEdge* const e2) const {
894 return e1->getNumericalID() < e2->getNumericalID();
895 }
896
897 };
898
903 public:
905 explicit transportable_by_position_sorter(SUMOTime timestep): myTime(timestep) { }
906
908 int operator()(const MSTransportable* const c1, const MSTransportable* const c2) const;
909 private:
911 };
912
913
915 double getDepartPosBound(const MSVehicle& veh, bool upper = true) const;
916
917protected:
919 const int myNumericalID;
920
922 std::shared_ptr<const std::vector<MSLane*> > myLanes;
923
926
929
932
935
939 mutable std::set<int> myFailedInsertionMemory;
940
942 std::vector<std::string> myCrossingEdges;
943
946
948
951
955
957 mutable std::set<MSTransportable*, ComparatorNumericalIdLess> myPersons;
958
960 mutable std::set<MSTransportable*, ComparatorNumericalIdLess> myContainers;
961
964
968
972
977
982
986
989
991 std::string myStreetName;
992
994 std::string myEdgeType;
995
997 std::string myRoutingType;
998
1000 const int myPriority;
1001
1003 const double myDistance;
1004
1006 double myWidth;
1007
1009 double myLength;
1010
1013
1016
1018 mutable bool myAmDelayed;
1019
1022
1025
1027 std::vector<double> mySublaneSides;
1028
1031
1033 typedef std::map< std::string, MSEdge* > DictType;
1034
1039
1044
1046
1050
1051
1053 mutable std::map<SUMOVehicleClass, MSEdgeVector> myClassesSuccessorMap;
1054
1056 mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myClassesViaSuccessorMap;
1057 mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myOrigClassesViaSuccessorMap;
1058
1061
1063 mutable std::vector<SUMOVehicle*> myWaiting;
1064
1065#ifdef HAVE_FOX
1067 mutable FXMutex myWaitingMutex;
1068
1070 mutable FXMutex mySuccessorMutex;
1071#endif
1072
1073private:
1074
1077
1081
1084
1086 MSEdge& operator=(const MSEdge&) = delete;
1087
1088 void setBidiLanes();
1089
1090 bool isSuperposable(const MSEdge* other);
1091
1092 void addToAllowed(const SVCPermissions permissions, std::shared_ptr<const std::vector<MSLane*> > allowedLanes, AllowedLanesCont& laneCont) const;
1093};
long long int SUMOTime
Definition GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:74
std::vector< std::pair< const MSEdge *, const MSEdge * > > MSConstEdgePairVector
Definition MSEdge.h:75
std::vector< MSEdge * > MSEdgeVector
Definition MSEdge.h:73
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:887
by_id_sorter()
constructor
Definition MSEdge.h:890
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition MSEdge.h:893
Sorts transportables by their positions.
Definition MSEdge.h:902
transportable_by_position_sorter(SUMOTime timestep)
constructor
Definition MSEdge.h:905
int operator()(const MSTransportable *const c1, const MSTransportable *const c2) const
comparing operator
Definition MSEdge.cpp:1242
A road/street connecting two junctions.
Definition MSEdge.h:77
void setCrossingEdges(const std::vector< std::string > &crossingEdges)
Sets the crossed edge ids for a crossing edge.
Definition MSEdge.h:359
virtual void unlock() const
release exclusive access to the mesoscopic state
Definition MSEdge.h:788
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition MSEdge.h:991
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:1096
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
Definition MSEdge.cpp:1482
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition MSEdge.h:780
void addToAllowed(const SVCPermissions permissions, std::shared_ptr< const std::vector< MSLane * > > allowedLanes, AllowedLanesCont &laneCont) const
Definition MSEdge.cpp:303
void changeLanes(SUMOTime t) const
Performs lane changing on this edge.
Definition MSEdge.cpp:902
const int myPriority
the priority of the edge (used during network creation)
Definition MSEdge.h:1000
double getBruttoOccupancy() const
Definition MSEdge.cpp:1619
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition MSEdge.h:976
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
Definition MSEdge.h:387
double getFlow() const
return flow based on meanSpead
Definition MSEdge.cpp:1606
const MSEdge * myOtherTazConnector
the other taz-connector if this edge isTazConnector, otherwise nullptr
Definition MSEdge.h:988
Boundary myBoundary
The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start ...
Definition MSEdge.h:1060
double myWidth
Edge width [m].
Definition MSEdge.h:1006
AllowedLanesByTarget myAllowedTargets
From target edge to lanes allowed to be used to reach it.
Definition MSEdge.h:970
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition MSEdge.h:273
MSLane * getDepartLane(MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition MSEdge.cpp:657
SUMOTime myLastFailedInsertionTime
The time of last insertion failure.
Definition MSEdge.h:934
std::set< MSTransportable *, ComparatorNumericalIdLess > myContainers
Containers on the edge.
Definition MSEdge.h:960
void setOtherTazConnector(const MSEdge *edge)
Definition MSEdge.h:295
int getPriority() const
Returns the priority of the edge.
Definition MSEdge.h:336
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:1687
static void clear()
Clears the dictionary.
Definition MSEdge.cpp:1102
void inferEdgeType()
Definition MSEdge.cpp:1637
static void setMesoIgnoredVClasses(SVCPermissions ignored)
Definition MSEdge.h:838
const int myNumericalID
This edge's numerical id.
Definition MSEdge.h:919
void setJunctions(MSJunction *from, MSJunction *to)
Definition MSEdge.cpp:1329
double getMeanSpeedBike() const
get the mean speed of all bicycles on this edge
Definition MSEdge.cpp:1021
static MSEdgeVector myEdges
Static list of edges.
Definition MSEdge.h:1043
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition MSEdge.h:657
AllowedLanesCont myAllowed
Associative container from vehicle class to allowed-lanes.
Definition MSEdge.h:966
double myEmptyTraveltime
the traveltime on the empty edge (cached value for speedup)
Definition MSEdge.h:1012
void updateMesoType()
update meso segment parameters
Definition MSEdge.cpp:252
bool myAmFringe
whether this edge is at the network fringe
Definition MSEdge.h:1024
static double getTravelTimeAggregated(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Definition MSEdge.cpp:1631
MSJunction * myToJunction
Definition MSEdge.h:954
void checkAndRegisterBiDirEdge(const std::string &bidiID="")
check and register the opposite superposable edge if any
Definition MSEdge.cpp:1387
virtual ~MSEdge()
Destructor.
Definition MSEdge.cpp:97
double getDepartPosBound(const MSVehicle &veh, bool upper=true) const
return upper bound for the depart position on this edge
Definition MSEdge.cpp:599
const double myDistance
the kilometrage/mileage at the start of the edge
Definition MSEdge.h:1003
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:1701
MSLane * getDepartLaneMeso(SUMOVehicle &veh) const
consider given departLane parameter (only for validating speeds)
Definition MSEdge.cpp:646
const std::string & getStreetName() const
Returns the street name of the edge.
Definition MSEdge.h:313
static DepartLaneDefinition & getDefaultDepartLaneDefinition()
Definition MSEdge.h:808
bool hasTransientPermissions() const
Definition MSEdge.cpp:1681
const std::set< MSTransportable *, ComparatorNumericalIdLess > & getPersons() const
Returns this edge's persons set.
Definition MSEdge.h:204
const MSEdge * myBidiEdge
the oppositing superposable edge
Definition MSEdge.h:1076
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:453
static double getTravelTimeStatic(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition MSEdge.h:505
std::string myEdgeType
the type of the edge (optionally used during network creation)
Definition MSEdge.h:994
RailEdge< MSEdge, SUMOVehicle > * getRailwayRoutingEdge() const
Definition MSEdge.h:876
bool isWalkingArea() const
return whether this edge is walking area
Definition MSEdge.h:287
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition MSEdge.h:168
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:1524
bool isDelayed() const
Definition MSEdge.h:742
const MSEdge * getOppositeEdge() const
Returns the opposite direction edge if on exists else a nullptr.
Definition MSEdge.cpp:1350
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:1120
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition MSEdge.cpp:1175
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:1253
bool isFringe() const
return whether this edge is at the fringe of the network
Definition MSEdge.h:772
std::vector< SUMOVehicle * > myWaiting
List of waiting vehicles.
Definition MSEdge.h:1063
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
Definition MSEdge.cpp:957
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:482
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition MSEdge.h:282
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:932
bool isNormal() const
return whether this edge is an internal edge
Definition MSEdge.h:263
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:652
ReversedEdge< MSEdge, SUMOVehicle > * getReversedRoutingEdge() const
Definition MSEdge.h:869
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
Definition MSEdge.cpp:1216
bool isSuperposable(const MSEdge *other)
Definition MSEdge.cpp:1442
bool validateDepartSpeed(SUMOVehicle &v) const
check whether the given departSpeed is valid for this edge
Definition MSEdge.cpp:746
const std::vector< std::string > & getCrossingEdges() const
Gets the crossed edge ids.
Definition MSEdge.h:367
double getDistanceTo(const MSEdge *other, const bool doBoundaryEstimate=false) const
optimistic air distance heuristic for use in routing
Definition MSEdge.cpp:1143
void setMaxSpeed(double val, double jamThreshold=-1)
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
Definition MSEdge.cpp:1187
std::string myRoutingType
the routing type of the edge (used to look up vType and vClass specific routing preferences)
Definition MSEdge.h:997
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:1083
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition MSEdge.h:925
double getOccupancy() const
return mean occupancy on this edges lanes or segments
Definition MSEdge.cpp:1584
static int myDefaultDepartLane
Definition MSEdge.h:1048
const MSConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Returns the following edges with internal vias, restricted by vClass.
Definition MSEdge.cpp:1298
std::vector< MSTransportable * > getSortedContainers(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's containers sorted by pos.
Definition MSEdge.cpp:1234
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition MSEdge.h:928
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:561
void recalcCache()
Recalculates the cached values.
Definition MSEdge.cpp:122
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
Definition MSEdge.cpp:1168
SVCPermissions myOriginalCombinedPermissions
The original union of lane permissions for this edge (before temporary modifications)
Definition MSEdge.h:981
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:1018
SVCPermissions myOriginalMinimumPermissions
The original intersection of lane permissions for this edge (before temporary modifications)
Definition MSEdge.h:979
std::map< SUMOVehicleClass, MSEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition MSEdge.h:1053
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition MSEdge.cpp:522
static int & getDefaultDepartLane()
Definition MSEdge.h:812
MSEdgeVector myPredecessors
The preceeding edges.
Definition MSEdge.h:950
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:1372
void rebuildAllowedTargets(const bool updateVehicles=true)
Definition MSEdge.cpp:386
bool hasLaneChanger() const
Definition MSEdge.h:746
static SVCPermissions myMesoIgnoredVClasses
Definition MSEdge.h:1045
std::vector< std::pair< SVCPermissions, std::shared_ptr< const std::vector< MSLane * > > > > AllowedLanesCont
"Map" from vehicle class to allowed lanes
Definition MSEdge.h:80
const MSJunction * getToJunction() const
Definition MSEdge.h:426
double getLength() const
return the length of the edge
Definition MSEdge.h:693
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition MSEdge.cpp:105
bool myHaveTransientPermissions
whether transient permission changes were applied to this edge or a predecessor
Definition MSEdge.h:984
std::vector< std::string > myCrossingEdges
The crossed edges id for a crossing edge. On not crossing edges it is empty.
Definition MSEdge.h:942
virtual void closeBuilding()
Definition MSEdge.cpp:208
static SVCPermissions getMesoPermissions(SVCPermissions p, SVCPermissions ignoreIgnored=0)
Definition MSEdge.cpp:318
bool canChangeToOpposite() const
whether this edge allows changing to the opposite direction edge
Definition MSEdge.cpp:1340
std::set< int > myFailedInsertionMemory
A cache for the rejected insertion attempts. Used to assure that no further insertion attempts are ma...
Definition MSEdge.h:939
const MSJunction * getFromJunction() const
Definition MSEdge.h:422
double getMeanSpeed() const
get the mean speed
Definition MSEdge.cpp:967
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition MSEdge.h:1038
std::set< MSTransportable *, ComparatorNumericalIdLess > myPersons
Persons on the edge for drawing and pushbutton.
Definition MSEdge.h:957
bool isTazConnector() const
Definition MSEdge.h:291
MSEdge(const MSEdge &)
Invalidated copy constructor.
int getNumLanes() const
Definition MSEdge.h:172
double getDistanceAt(double pos) const
Returns the kilometrage/mileage at the given offset along the edge.
Definition MSEdge.cpp:1674
const std::string & getRoutingType() const
Returns the type of the edge.
Definition MSEdge.h:325
MSConstEdgePairVector myViaSuccessors
Definition MSEdge.h:947
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition MSEdge.h:484
void setBidiLanes()
Definition MSEdge.cpp:1417
MSEdgeVector mySuccessors
The succeeding edges.
Definition MSEdge.h:945
static DepartLaneDefinition myDefaultDepartLaneDefinition
Definition MSEdge.h:1047
bool isRoundabout() const
Definition MSEdge.h:729
bool isInternal() const
return whether this edge is an internal edge
Definition MSEdge.h:268
bool prohibits(const SUMOVehicle *const vehicle) const
Returns whether the vehicle (class) is not allowed on the edge.
Definition MSEdge.h:635
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:459
double getWidth() const
Returns the edges's width (sum over all lanes)
Definition MSEdge.h:664
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition MSEdge.cpp:1041
std::map< SUMOVehicleClass, MSConstEdgePairVector > myOrigClassesViaSuccessorMap
Definition MSEdge.h:1057
AllowedLanesByTarget myOrigAllowedTargets
Definition MSEdge.h:971
int getNumericalID() const
Returns the numerical id of the edge.
Definition MSEdge.h:306
void resetTAZ(MSJunction *junction)
Definition MSEdge.cpp:185
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition MSEdge.h:442
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:783
static const Position getStopPosition(const SUMOVehicleParameter::Stop &stop)
return the coordinates of the center of the given stop
Definition MSEdge.cpp:1162
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition MSEdge.cpp:1461
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:465
ReversedEdge< MSEdge, SUMOVehicle > * myReversedRoutingEdge
a reversed version for backward routing
Definition MSEdge.h:1079
double getTimePenalty() const
Definition MSEdge.h:494
const std::string & getEdgeType() const
Returns the type of the edge.
Definition MSEdge.h:319
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:1057
std::vector< const SUMOVehicle * > getVehicles() const
return vehicles on this edges lanes or segments
Definition MSEdge.cpp:1505
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge's sublanes.
Definition MSEdge.h:669
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition MSEdge.cpp:1112
const MSEdge * getOtherTazConnector() const
Definition MSEdge.h:299
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition MSEdge.cpp:1180
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition MSEdge.cpp:515
MSJunction * myFromJunction
the junctions for this edge
Definition MSEdge.h:953
double getMeanFriction() const
get the mean friction over the lanes
Definition MSEdge.cpp:1008
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition MSEdge.h:1033
bool isConnectedTo(const MSEdge &destination, SUMOVehicleClass vclass, bool ignoreTransientPermissions=false) const
Definition MSEdge.h:243
bool hasMinorLink() const
whether any lane has a minor link
Definition MSEdge.cpp:1360
double getPreference(const SUMOVTypeParameter &pars) const
Definition MSEdge.cpp:1696
std::map< SUMOVehicleClass, MSConstEdgePairVector > myClassesViaSuccessorMap
The successors available for a given vClass.
Definition MSEdge.h:1056
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition MSEdge.cpp:947
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
Definition MSEdge.cpp:1542
void markDelayed() const
Definition MSEdge.h:737
const MSEdgeVector & getPredecessors() const
Definition MSEdge.h:417
virtual void removeTransportable(MSTransportable *t) const
Definition MSEdge.cpp:1207
SUMOTime getLastFailedInsertionTime() const
Returns the last time a vehicle could not be inserted.
Definition MSEdge.h:603
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition MSEdge.h:258
bool allowsLaneChanging() const
Definition MSEdge.cpp:281
bool isEmpty() const
whether this edge has no vehicles
Definition MSEdge.cpp:1548
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal, SUMOVehicleClass vClass) const
Definition MSEdge.cpp:910
void buildLaneChanger()
Has to be called after all sucessors and predecessors have been set (after closeBuilding())
Definition MSEdge.cpp:261
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition MSEdge.cpp:1051
virtual void lock() const
grant exclusive access to the mesoscopic state
Definition MSEdge.h:785
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
Definition MSEdge.cpp:1470
bool hasDistance() const
Definition MSEdge.h:351
MSLane * getFirstAllowed(SUMOVehicleClass vClass, bool defaultFirst=false) const
Definition MSEdge.cpp:735
std::vector< double > mySublaneSides
the right side for each sublane on this edge
Definition MSEdge.h:1027
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition MSEdge.cpp:1268
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:922
AllowedLanesCont myOrigAllowed
Definition MSEdge.h:967
double getWaitingSeconds() const
return accumated waiting time for all vehicles on this edges lanes or segments
Definition MSEdge.cpp:1568
int myVaporizationRequests
Vaporizer counter.
Definition MSEdge.h:931
int getNumPredecessors() const
Returns the number of edges this edge is connected to.
Definition MSEdge.h:409
double myTimePenalty
flat penalty when computing traveltime
Definition MSEdge.h:1015
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition MSEdge.h:974
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass, double departPos) const
Finds the emptiest lane allowing the vehicle class.
Definition MSEdge.cpp:529
void rebuildAllowedLanes(const bool onInit=false, bool updateVehicles=false)
Definition MSEdge.cpp:325
std::map< const MSEdge *, AllowedLanesCont > AllowedLanesByTarget
Succeeding edges (keys) and allowed lanes to reach these edges (values).
Definition MSEdge.h:83
void markAsRoundabout()
Definition MSEdge.h:733
bool myAmRoundabout
whether this edge belongs to a roundabout
Definition MSEdge.h:1021
virtual void addTransportable(MSTransportable *t) const
Definition MSEdge.cpp:1198
double getDistance() const
Returns the kilometrage/mileage encoding at the start of the edge (negative values encode descending ...
Definition MSEdge.h:343
void setLastFailedInsertionTime(SUMOTime time) const
Sets the last time a vehicle could not be inserted.
Definition MSEdge.h:611
RailEdge< MSEdge, SUMOVehicle > * myRailwayRoutingEdge
Definition MSEdge.h:1080
double myLength
the length of the edge (cached value for speedup)
Definition MSEdge.h:1009
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:186
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
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
Base class for objects which have an id.
Definition Named.h:54
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:62
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.