Eclipse SUMO - Simulation of Urban MObility
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-2023 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, int priority,
102 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 getVehicleNumber() const;
178
180 bool isEmpty() const;
181
183 std::vector<const SUMOVehicle*> getVehicles() const;
184
185 double getBruttoOccupancy() const;
186
188 double getFlow() const;
189
191 double getWaitingSeconds() const;
192
194 double getOccupancy() const;
195
201 inline const std::set<MSTransportable*, ComparatorNumericalIdLess>& getPersons() const {
202 return myPersons;
203 }
204
209 std::vector<MSTransportable*> getSortedPersons(SUMOTime timestep, bool includeRiding = false) const;
210
211
216 std::vector<MSTransportable*> getSortedContainers(SUMOTime timestep, bool includeRiding = false) const;
217
226 const std::vector<MSLane*>* allowedLanes(const MSEdge& destination,
227 SUMOVehicleClass vclass = SVC_IGNORING) const;
228
229
230
238 const std::vector<MSLane*>* allowedLanes(SUMOVehicleClass vclass = SVC_IGNORING) const;
239
240 inline bool isConnectedTo(const MSEdge& destination, SUMOVehicleClass vclass) const {
241 const std::vector<MSLane*>* const lanes = allowedLanes(destination, vclass);
242 return lanes != nullptr && !lanes->empty();
243 }
245
246
247
250
256 return myFunction;
257 }
258
260 inline bool isNormal() const {
262 }
263
265 inline bool isInternal() const {
267 }
268
270 inline bool isCrossing() const {
272 }
273
274
276 void checkAndRegisterBiDirEdge(const std::string& bidiID = "");
277
279 inline const MSEdge* getBidiEdge() const {
280 return myBidiEdge;
281 }
282
284 inline bool isWalkingArea() const {
286 }
287
288 inline bool isTazConnector() const {
290 }
291
292 void setOtherTazConnector(const MSEdge* edge) {
293 myOtherTazConnector = edge;
294 }
295
297 return myOtherTazConnector;
298 }
299
303 inline int getNumericalID() const {
304 return myNumericalID;
305 }
306
307
310 const std::string& getStreetName() const {
311 return myStreetName;
312 }
313
316 const std::string& getEdgeType() const {
317 return myEdgeType;
318 }
319
320 // @brief try to infer edge type for internal edges
321 void inferEdgeType();
322
325 int getPriority() const {
326 return myPriority;
327 }
328
332 double getDistance() const {
333 return myDistance;
334 }
335
338 double getDistanceAt(double pos) const;
339
340 bool hasDistance() const {
341 return myDistance != 0;
342 }
344
348 void setCrossingEdges(const std::vector<std::string>& crossingEdges) {
349 myCrossingEdges.clear();
350 myCrossingEdges.insert(myCrossingEdges.begin(), crossingEdges.begin(), crossingEdges.end());
351 }
352
356 const std::vector<std::string>& getCrossingEdges() const {
357 return myCrossingEdges;
358 }
359
360
363
369 void addSuccessor(MSEdge* edge, const MSEdge* via = nullptr);
370
371 void resetTAZ(MSJunction* junction);
372
376 int getNumSuccessors() const {
377 return (int) mySuccessors.size();
378 }
379
380
386
392
393
398 int getNumPredecessors() const {
399 return (int) myPredecessors.size();
400 }
401
402
407 return myPredecessors;
408 }
409
410
412 return myFromJunction;
413 }
414
415 const MSJunction* getToJunction() const {
416 return myToJunction;
417 }
418
419
420 void setJunctions(MSJunction* from, MSJunction* to);
422
423
424
427
431 bool isVaporizing() const {
432 return myVaporizationRequests > 0;
433 }
434
435
446
447
459
460
469 double getCurrentTravelTime(const double minSpeed = NUMERICAL_EPS) const;
470
471
473 inline double getMinimumTravelTime(const SUMOVehicle* const veh) const {
475 return 0;
476 } else if (veh != 0) {
478 } else {
479 return myEmptyTraveltime;
480 }
481 }
482
483 double getTimePenalty() const {
484 return myTimePenalty;
485 }
486
494 static inline double getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, double time) {
495 return MSNet::getInstance()->getTravelTime(edge, veh, time);
496 }
497
498 static double getTravelTimeAggregated(const MSEdge* const edge, const SUMOVehicle* const veh, double time);
499
502 double getRoutingSpeed() const;
503
504
507
527 bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false, const bool forceCheck = false) const;
528
530 bool validateDepartSpeed(SUMOVehicle& v) const;
531
551 MSLane* getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos) const;
552
553
565
568
574 }
575
576
580 inline void setLastFailedInsertionTime(SUMOTime time) const {
582 }
584
585
587 void changeLanes(SUMOTime t) const;
588
589
591 const MSEdge* getInternalFollowingEdge(const MSEdge* followerAfterInternal, SUMOVehicleClass vClass) const;
592
593
595 double getInternalFollowingLengthTo(const MSEdge* followerAfterInternal, SUMOVehicleClass vClass) const;
596
598 const MSEdge* getNormalBefore() const;
599
601 const MSEdge* getNormalSuccessor() const;
602
604 inline bool prohibits(const SUMOVehicle* const vehicle) const {
605 if (vehicle == nullptr) {
606 return false;
607 }
608 const SUMOVehicleClass svc = vehicle->getVClass();
609 return (myCombinedPermissions & svc) != svc;
610 }
611
617 inline bool restricts(const SUMOVehicle* const /* vehicle */) const {
618 return false;
619 }
620
624 }
625
629 double getWidth() const {
630 return myWidth;
631 }
632
634 const std::vector<double> getSubLaneSides() const {
635 return mySublaneSides;
636 }
637
638 void rebuildAllowedLanes(const bool onInit = false);
639
640 void rebuildAllowedTargets(const bool updateVehicles = true);
641
642
648 double getDistanceTo(const MSEdge* other, const bool doBoundaryEstimate = false) const;
649
650
652 static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
653
654
658 inline double getLength() const {
659 return myLength;
660 }
661
662
667 double getSpeedLimit() const;
668
670 double getLengthGeometryFactor() const;
671
675 void setMaxSpeed(double val) const;
676
680 void setFrictionCoefficient(double val) const;
681
687 double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const;
688
689
690 virtual void addTransportable(MSTransportable* t) const;
691
692 virtual void removeTransportable(MSTransportable* t) const;
693
694 inline bool isRoundabout() const {
695 return myAmRoundabout;
696 }
697
699 myAmRoundabout = true;
700 }
701
702 void markDelayed() const {
703 myAmDelayed = true;
704 }
705
706 // return whether there have been vehicles on this or the bidi edge (if there is any) at least once
707 inline bool isDelayed() const {
708 return myAmDelayed || (myBidiEdge != nullptr && myBidiEdge->myAmDelayed);
709 }
710
711 bool hasLaneChanger() const {
712 return myLaneChanger != nullptr;
713 }
714
716 bool canChangeToOpposite() const;
717
719 const MSEdge* getOppositeEdge() const;
720
722 double getMeanSpeed() const;
723
725 double getMeanFriction() const;
726
728 double getMeanSpeedBike() const;
729
731 bool hasMinorLink() const;
732
734 bool isFringe() const {
735 return myAmFringe;
736 }
737
739 virtual bool isSelected() const {
740 return false;
741 }
742
744 virtual void lock() const {}
745
747 virtual void unlock() const {};
748
750 void addWaiting(SUMOVehicle* vehicle) const;
751
753 void removeWaiting(const SUMOVehicle* vehicle) const;
754
755 /* @brief returns a vehicle that is waiting for a for a person or a container at this edge at the given position
756 * @param[in] transportable The person or container that wants to ride
757 * @param[in] position The vehicle shall be positioned in the interval [position - t, position + t], where t is some tolerance
758 */
759 SUMOVehicle* getWaitingVehicle(MSTransportable* transportable, const double position) const;
760
762 void clearState();
763
765 void updateMesoType();
766
770 static bool dictionary(const std::string& id, MSEdge* edge);
771
773 static MSEdge* dictionary(const std::string& id);
774
776 static MSEdge* dictionaryHint(const std::string& id, const int startIdx);
777
779 static const MSEdgeVector& getAllEdges();
780
782 static void clear();
783
785 static void insertIDs(std::vector<std::string>& into);
786
788
790 myMesoIgnoredVClasses = ignored;
791 }
792
793public:
796
805 static void parseEdgesList(const std::string& desc, ConstMSEdgeVector& into,
806 const std::string& rid);
807
808
815 static void parseEdgesList(const std::vector<std::string>& desc, ConstMSEdgeVector& into,
816 const std::string& rid);
818
819
821 if (myReversedRoutingEdge == nullptr) {
823 }
825 }
826
828 if (myRailwayRoutingEdge == nullptr) {
830 }
832 }
833
834protected:
839 public:
841 explicit by_id_sorter() { }
842
844 int operator()(const MSEdge* const e1, const MSEdge* const e2) const {
845 return e1->getNumericalID() < e2->getNumericalID();
846 }
847
848 };
849
854 public:
856 explicit transportable_by_position_sorter(SUMOTime timestep): myTime(timestep) { }
857
859 int operator()(const MSTransportable* const c1, const MSTransportable* const c2) const;
860 private:
862 };
863
864
866 double getDepartPosBound(const MSVehicle& veh, bool upper = true) const;
867
868protected:
870 const int myNumericalID;
871
873 std::shared_ptr<const std::vector<MSLane*> > myLanes;
874
877
880
883
886
890 mutable std::set<int> myFailedInsertionMemory;
891
893 std::vector<std::string> myCrossingEdges;
894
897
899
902
906
908 mutable std::set<MSTransportable*, ComparatorNumericalIdLess> myPersons;
909
911 mutable std::set<MSTransportable*, ComparatorNumericalIdLess> myContainers;
912
915
918
921
927
930
932 std::string myStreetName;
933
935 std::string myEdgeType;
936
938 const int myPriority;
939
941 const double myDistance;
942
944 double myWidth;
945
947 double myLength;
948
951
954
956 mutable bool myAmDelayed;
957
960
963
965 std::vector<double> mySublaneSides;
966
969
971 typedef std::map< std::string, MSEdge* > DictType;
972
977
982
985
986
988 mutable std::map<SUMOVehicleClass, MSEdgeVector> myClassesSuccessorMap;
989
991 mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myClassesViaSuccessorMap;
992
995
997 mutable std::vector<SUMOVehicle*> myWaiting;
998
999#ifdef HAVE_FOX
1001 mutable FXMutex myWaitingMutex;
1002
1004 mutable FXMutex mySuccessorMutex;
1005#endif
1006
1007private:
1008
1011
1015
1018
1020 MSEdge& operator=(const MSEdge&) = delete;
1021
1022 void setBidiLanes();
1023
1024 bool isSuperposable(const MSEdge* other);
1025
1026 void addToAllowed(const SVCPermissions permissions, std::shared_ptr<const std::vector<MSLane*> > allowedLanes, AllowedLanesCont& laneCont) const;
1027};
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
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
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:838
by_id_sorter()
constructor
Definition: MSEdge.h:841
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition: MSEdge.h:844
Sorts transportables by their positions.
Definition: MSEdge.h:853
transportable_by_position_sorter(SUMOTime timestep)
constructor
Definition: MSEdge.h:856
int operator()(const MSTransportable *const c1, const MSTransportable *const c2) const
comparing operator
Definition: MSEdge.cpp:1130
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:348
virtual void unlock() const
release exclusive access to the mesoscopic state
Definition: MSEdge.h:747
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:932
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:984
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
Definition: MSEdge.cpp:1355
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition: MSEdge.h:739
void addToAllowed(const SVCPermissions permissions, std::shared_ptr< const std::vector< MSLane * > > allowedLanes, AllowedLanesCont &laneCont) const
Definition: MSEdge.cpp:278
void changeLanes(SUMOTime t) const
Performs lane changing on this edge.
Definition: MSEdge.cpp:790
const int myPriority
the priority of the edge (used during network creation)
Definition: MSEdge.h:938
double getBruttoOccupancy() const
Definition: MSEdge.cpp:1475
bool isConnectedTo(const MSEdge &destination, SUMOVehicleClass vclass) const
Definition: MSEdge.h:240
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:925
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
Definition: MSEdge.h:376
double getFlow() const
return flow based on meanSpead
Definition: MSEdge.cpp:1462
const MSEdge * myOtherTazConnector
the other taz-connector if this edge isTazConnector, otherwise nullptr
Definition: MSEdge.h:929
Boundary myBoundary
The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start ...
Definition: MSEdge.h:994
double myWidth
Edge width [m].
Definition: MSEdge.h:944
AllowedLanesByTarget myAllowedTargets
From target edge to lanes allowed to be used to reach it.
Definition: MSEdge.h:920
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition: MSEdge.h:270
MSLane * getDepartLane(MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:575
SUMOTime myLastFailedInsertionTime
The time of last insertion failure.
Definition: MSEdge.h:885
std::set< MSTransportable *, ComparatorNumericalIdLess > myContainers
Containers on the edge.
Definition: MSEdge.h:911
void setOtherTazConnector(const MSEdge *edge)
Definition: MSEdge.h:292
int getPriority() const
Returns the priority of the edge.
Definition: MSEdge.h:325
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:990
void inferEdgeType()
Definition: MSEdge.cpp:1493
static void setMesoIgnoredVClasses(SVCPermissions ignored)
Definition: MSEdge.h:789
const int myNumericalID
This edge's numerical id.
Definition: MSEdge.h:870
void setJunctions(MSJunction *from, MSJunction *to)
Definition: MSEdge.cpp:1216
double getMeanSpeedBike() const
get the mean speed of all bicycles on this edge
Definition: MSEdge.cpp:909
static MSEdgeVector myEdges
Static list of edges.
Definition: MSEdge.h:981
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition: MSEdge.h:622
AllowedLanesCont myAllowed
Associative container from vehicle class to allowed-lanes.
Definition: MSEdge.h:917
double myEmptyTraveltime
the traveltime on the empty edge (cached value for speedup)
Definition: MSEdge.h:950
void updateMesoType()
update meso segment parameters
Definition: MSEdge.cpp:229
bool myAmFringe
whether this edge is at the network fringe
Definition: MSEdge.h:962
static double getTravelTimeAggregated(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Definition: MSEdge.cpp:1487
MSJunction * myToJunction
Definition: MSEdge.h:905
void checkAndRegisterBiDirEdge(const std::string &bidiID="")
check and register the opposite superposable edge if any
Definition: MSEdge.cpp:1260
virtual ~MSEdge()
Destructor.
Definition: MSEdge.cpp:93
double getDepartPosBound(const MSVehicle &veh, bool upper=true) const
return upper bound for the depart position on this edge
Definition: MSEdge.cpp:517
const double myDistance
the kilometrage/mileage at the start of the edge
Definition: MSEdge.h:941
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:1536
MSLane * getDepartLaneMeso(SUMOVehicle &veh) const
consider given departLane parameter (only for validating speeds)
Definition: MSEdge.cpp:564
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:310
const std::set< MSTransportable *, ComparatorNumericalIdLess > & getPersons() const
Returns this edge's persons set.
Definition: MSEdge.h:201
const MSEdge * myBidiEdge
the oppositing superposable edge
Definition: MSEdge.h:1010
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:410
static double getTravelTimeStatic(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: MSEdge.h:494
std::string myEdgeType
the type of the edge (optionally used during network creation)
Definition: MSEdge.h:935
RailEdge< MSEdge, SUMOVehicle > * getRailwayRoutingEdge() const
Definition: MSEdge.h:827
bool isWalkingArea() const
return whether this edge is walking area
Definition: MSEdge.h:284
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
bool isDelayed() const
Definition: MSEdge.h:707
const MSEdge * getOppositeEdge() const
Returns the opposite direction edge if on exists else a nullptr.
Definition: MSEdge.cpp:1237
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:1008
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSEdge.cpp:1063
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:1141
bool isFringe() const
return whether this edge is at the fringe of the network
Definition: MSEdge.h:734
std::vector< SUMOVehicle * > myWaiting
List of waiting vehicles.
Definition: MSEdge.h:997
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
Definition: MSEdge.cpp:845
void rebuildAllowedLanes(const bool onInit=false)
Definition: MSEdge.cpp:300
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition: MSEdge.h:279
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:820
bool isNormal() const
return whether this edge is an internal edge
Definition: MSEdge.h:260
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:617
ReversedEdge< MSEdge, SUMOVehicle > * getReversedRoutingEdge() const
Definition: MSEdge.h:820
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
Definition: MSEdge.cpp:1104
bool isSuperposable(const MSEdge *other)
Definition: MSEdge.cpp:1315
bool validateDepartSpeed(SUMOVehicle &v) const
check whether the given departSpeed is valid for this edge
Definition: MSEdge.cpp:637
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
Definition: MSEdge.cpp:439
const std::vector< std::string > & getCrossingEdges() const
Gets the crossed edge ids.
Definition: MSEdge.h:356
double getDistanceTo(const MSEdge *other, const bool doBoundaryEstimate=false) const
optimistic air distance heuristic for use in routing
Definition: MSEdge.cpp:1031
const MSConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges with internal vias, restricted by vClass.
Definition: MSEdge.cpp:1186
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:971
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:876
double getOccupancy() const
return mean occupancy on this edges lanes or segments
Definition: MSEdge.cpp:1440
std::vector< MSTransportable * > getSortedContainers(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's containers sorted by pos.
Definition: MSEdge.cpp:1122
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:879
void recalcCache()
Recalculates the cached values.
Definition: MSEdge.cpp:118
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:1056
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:956
std::map< SUMOVehicleClass, MSEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:988
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:478
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:901
void rebuildAllowedTargets(const bool updateVehicles=true)
Definition: MSEdge.cpp:343
bool hasLaneChanger() const
Definition: MSEdge.h:711
static SVCPermissions myMesoIgnoredVClasses
Definition: MSEdge.h:983
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:415
double getLength() const
return the length of the edge
Definition: MSEdge.h:658
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:101
std::vector< std::string > myCrossingEdges
The crossed edges id for a crossing edge. On not crossing edges it is empty.
Definition: MSEdge.h:893
virtual void closeBuilding()
Definition: MSEdge.cpp:185
static SVCPermissions getMesoPermissions(SVCPermissions p, SVCPermissions ignoreIgnored=0)
Definition: MSEdge.cpp:293
bool canChangeToOpposite() const
whether this edge allows changing to the opposite direction edge
Definition: MSEdge.cpp:1227
std::set< int > myFailedInsertionMemory
A cache for the rejected insertion attempts. Used to assure that no further insertion attempts are ma...
Definition: MSEdge.h:890
const MSJunction * getFromJunction() const
Definition: MSEdge.h:411
double getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:855
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:976
std::set< MSTransportable *, ComparatorNumericalIdLess > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:908
bool isTazConnector() const
Definition: MSEdge.h:288
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:1530
MSConstEdgePairVector myViaSuccessors
Definition: MSEdge.h:898
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition: MSEdge.h:473
void setBidiLanes()
Definition: MSEdge.cpp:1290
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:896
bool isRoundabout() const
Definition: MSEdge.h:694
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:265
bool prohibits(const SUMOVehicle *const vehicle) const
Returns whether the vehicle (class) is not allowed on the edge.
Definition: MSEdge.h:604
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:416
double getWidth() const
Returns the edges's width (sum over all lanes)
Definition: MSEdge.h:629
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:929
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:303
void resetTAZ(MSJunction *junction)
Definition: MSEdge.cpp:162
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:431
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:675
static const Position getStopPosition(const SUMOVehicleParameter::Stop &stop)
return the coordinates of the center of the given stop
Definition: MSEdge.cpp:1050
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition: MSEdge.cpp:1334
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:422
ReversedEdge< MSEdge, SUMOVehicle > * myReversedRoutingEdge
a reversed version for backward routing
Definition: MSEdge.h:1013
double getTimePenalty() const
Definition: MSEdge.h:483
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:316
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:945
std::vector< const SUMOVehicle * > getVehicles() const
return vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1378
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge's sublanes.
Definition: MSEdge.h:634
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:1000
const MSEdge * getOtherTazConnector() const
Definition: MSEdge.h:296
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:1068
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:471
MSJunction * myFromJunction
the junctions for this edge
Definition: MSEdge.h:904
double getMeanFriction() const
get the mean friction over the lanes
Definition: MSEdge.cpp:896
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition: MSEdge.h:971
bool hasMinorLink() const
whether any lane has a minor link
Definition: MSEdge.cpp:1247
std::map< SUMOVehicleClass, MSConstEdgePairVector > myClassesViaSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:991
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition: MSEdge.cpp:835
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1398
void markDelayed() const
Definition: MSEdge.h:702
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:406
virtual void removeTransportable(MSTransportable *t) const
Definition: MSEdge.cpp:1095
SUMOTime getLastFailedInsertionTime() const
Returns the last time a vehicle could not be inserted.
Definition: MSEdge.h:572
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:255
bool allowsLaneChanging() const
Definition: MSEdge.cpp:256
void setMaxSpeed(double val) const
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
Definition: MSEdge.cpp:1075
bool isEmpty() const
whether this edge has no vehicles
Definition: MSEdge.cpp:1404
MSEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, double distance)
Constructor.
Definition: MSEdge.cpp:67
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal, SUMOVehicleClass vClass) const
Definition: MSEdge.cpp:798
void buildLaneChanger()
Has to be called after all sucessors and predecessors have been set (after closeBuilding())
Definition: MSEdge.cpp:238
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:939
virtual void lock() const
grant exclusive access to the mesoscopic state
Definition: MSEdge.h:744
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
Definition: MSEdge.cpp:1343
bool hasDistance() const
Definition: MSEdge.h:340
std::vector< double > mySublaneSides
the right side for each sublane on this edge
Definition: MSEdge.h:965
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:1156
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:873
double getWaitingSeconds() const
return accumated waiting time for all vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1424
int myVaporizationRequests
Vaporizer counter.
Definition: MSEdge.h:882
int getNumPredecessors() const
Returns the number of edges this edge is connected to.
Definition: MSEdge.h:398
double myTimePenalty
flat penalty when computing traveltime
Definition: MSEdge.h:953
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:923
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass, double departPos) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:485
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:698
bool myAmRoundabout
whether this edge belongs to a roundabout
Definition: MSEdge.h:959
virtual void addTransportable(MSTransportable *t) const
Definition: MSEdge.cpp:1086
double getDistance() const
Returns the kilometrage/mileage encoding at the start of the edge (negative values encode descending ...
Definition: MSEdge.h:332
void setLastFailedInsertionTime(SUMOTime time) const
Sets the last time a vehicle could not be inserted.
Definition: MSEdge.h:580
RailEdge< MSEdge, SUMOVehicle > * myRailwayRoutingEdge
Definition: MSEdge.h:1014
double myLength
the length of the edge (cached value for speedup)
Definition: MSEdge.h:947
The base class for an intersection.
Definition: MSJunction.h:58
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:45
MSVehicle * veh(ConstChangerIt ce) const
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:183
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
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.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Representation of a vehicle, person, or container.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
Representation of a vehicle.
Definition: SUMOVehicle.h:62
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.