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.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
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>
36 #include <utils/common/SUMOTime.h>
38 #include <utils/geom/Boundary.h>
40 #include <utils/router/RailEdge.h>
43 #include "MSNet.h"
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class Boundary;
50 class OutputDevice;
51 class SUMOVehicle;
53 class MSVehicle;
54 class MSLane;
55 class MSLaneChanger;
56 class MSPerson;
57 class MSJunction;
58 class MSEdge;
59 class MSTransportable;
60 
61 
62 // ===========================================================================
63 // class definitions
64 // ===========================================================================
73 typedef std::vector<MSEdge*> MSEdgeVector;
74 typedef std::vector<const MSEdge*> ConstMSEdgeVector;
75 typedef std::vector<std::pair<const MSEdge*, const MSEdge*> > MSConstEdgePairVector;
76 
77 class MSEdge : public Named, public Parameterised {
78 private:
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 
86 public:
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  std::vector<const SUMOVehicle*> getVehicles() const;
181 
182  double getBruttoOccupancy() const;
183 
185  double getFlow() const;
186 
188  double getWaitingSeconds() const;
189 
191  double getOccupancy() const;
192 
198  inline const std::set<MSTransportable*>& getPersons() const {
199  return myPersons;
200  }
201 
206  std::vector<MSTransportable*> getSortedPersons(SUMOTime timestep, bool includeRiding = false) const;
207 
208 
213  std::vector<MSTransportable*> getSortedContainers(SUMOTime timestep, bool includeRiding = false) const;
214 
223  const std::vector<MSLane*>* allowedLanes(const MSEdge& destination,
224  SUMOVehicleClass vclass = SVC_IGNORING) const;
225 
226 
227 
235  const std::vector<MSLane*>* allowedLanes(SUMOVehicleClass vclass = SVC_IGNORING) const;
236 
237  inline bool isConnectedTo(const MSEdge& destination, SUMOVehicleClass vclass) const {
238  const std::vector<MSLane*>* const lanes = allowedLanes(destination, vclass);
239  return lanes != nullptr && !lanes->empty();
240  }
242 
243 
244 
247 
252  inline SumoXMLEdgeFunc getFunction() const {
253  return myFunction;
254  }
255 
257  inline bool isNormal() const {
259  }
260 
262  inline bool isInternal() const {
264  }
265 
267  inline bool isCrossing() const {
269  }
270 
271 
273  void checkAndRegisterBiDirEdge(const std::string& bidiID = "");
274 
276  inline const MSEdge* getBidiEdge() const {
277  return myBidiEdge;
278  }
279 
281  inline bool isWalkingArea() const {
283  }
284 
285  inline bool isTazConnector() const {
287  }
288 
289  void setOtherTazConnector(const MSEdge* edge) {
290  myOtherTazConnector = edge;
291  }
292 
293  const MSEdge* getOtherTazConnector() const {
294  return myOtherTazConnector;
295  }
296 
300  inline int getNumericalID() const {
301  return myNumericalID;
302  }
303 
304 
307  const std::string& getStreetName() const {
308  return myStreetName;
309  }
310 
313  const std::string& getEdgeType() const {
314  return myEdgeType;
315  }
316 
317  // @brief try to infer edge type for internal edges
318  void inferEdgeType();
319 
322  int getPriority() const {
323  return myPriority;
324  }
325 
328  double getDistance() const {
329  return myDistance;
330  }
332 
336  void setCrossingEdges(const std::vector<std::string>& crossingEdges) {
337  myCrossingEdges.clear();
338  myCrossingEdges.insert(myCrossingEdges.begin(), crossingEdges.begin(), crossingEdges.end());
339  }
340 
344  const std::vector<std::string>& getCrossingEdges() const {
345  return myCrossingEdges;
346  }
347 
348 
351 
357  void addSuccessor(MSEdge* edge, const MSEdge* via = nullptr);
358 
362  int getNumSuccessors() const {
363  return (int) mySuccessors.size();
364  }
365 
366 
372 
378 
379 
384  int getNumPredecessors() const {
385  return (int) myPredecessors.size();
386  }
387 
388 
392  const MSEdgeVector& getPredecessors() const {
393  return myPredecessors;
394  }
395 
396 
397  const MSJunction* getFromJunction() const {
398  return myFromJunction;
399  }
400 
401  const MSJunction* getToJunction() const {
402  return myToJunction;
403  }
404 
405 
406  void setJunctions(MSJunction* from, MSJunction* to);
408 
409 
410 
413 
417  bool isVaporizing() const {
418  return myVaporizationRequests > 0;
419  }
420 
421 
432 
433 
445 
446 
455  double getCurrentTravelTime(const double minSpeed = NUMERICAL_EPS) const;
456 
457 
459  inline double getMinimumTravelTime(const SUMOVehicle* const veh) const {
461  return 0;
462  } else if (veh != 0) {
464  } else {
465  return myEmptyTraveltime;
466  }
467  }
468 
469 
477  static inline double getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, double time) {
478  return MSNet::getInstance()->getTravelTime(edge, veh, time);
479  }
480 
481  static double getTravelTimeAggregated(const MSEdge* const edge, const SUMOVehicle* const veh, double time);
482 
485  double getRoutingSpeed() const;
486 
487 
490 
510  bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false, const bool forceCheck = false) const;
511 
513  bool validateDepartSpeed(SUMOVehicle& v) const;
514 
534  MSLane* getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos) const;
535 
536 
548 
551 
557  }
558 
559 
563  inline void setLastFailedInsertionTime(SUMOTime time) const {
565  }
567 
568 
570  void changeLanes(SUMOTime t) const;
571 
572 
574  const MSEdge* getInternalFollowingEdge(const MSEdge* followerAfterInternal) const;
575 
576 
578  double getInternalFollowingLengthTo(const MSEdge* followerAfterInternal) const;
579 
581  const MSEdge* getNormalBefore() const;
582 
584  const MSEdge* getNormalSuccessor() const;
585 
587  inline bool prohibits(const SUMOVehicle* const vehicle) const {
588  if (vehicle == nullptr) {
589  return false;
590  }
591  const SUMOVehicleClass svc = vehicle->getVClass();
592  return (myCombinedPermissions & svc) != svc;
593  }
594 
600  inline bool restricts(const SUMOVehicle* const /* vehicle */) const {
601  return false;
602  }
603 
606  return myCombinedPermissions;
607  }
608 
612  double getWidth() const {
613  return myWidth;
614  }
615 
617  const std::vector<double> getSubLaneSides() const {
618  return mySublaneSides;
619  }
620 
621  void rebuildAllowedLanes();
622 
623  void rebuildAllowedTargets(const bool updateVehicles = true);
624 
625 
631  double getDistanceTo(const MSEdge* other, const bool doBoundaryEstimate = false) const;
632 
633 
635  static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
636 
637 
641  inline double getLength() const {
642  return myLength;
643  }
644 
645 
650  double getSpeedLimit() const;
651 
653  double getLengthGeometryFactor() const;
654 
658  void setMaxSpeed(double val) const;
659 
665  double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const;
666 
667 
668  virtual void addPerson(MSTransportable* p) const;
669 
670  virtual void removePerson(MSTransportable* p) const;
671 
673  virtual void addContainer(MSTransportable* container) const {
674  myContainers.insert(container);
675  }
676 
678  virtual void removeContainer(MSTransportable* container) const {
679  std::set<MSTransportable*>::iterator i = myContainers.find(container);
680  if (i != myContainers.end()) {
681  myContainers.erase(i);
682  }
683  }
684 
685  inline bool isRoundabout() const {
686  return myAmRoundabout;
687  }
688 
690  myAmRoundabout = true;
691  }
692 
693  void markDelayed() const {
694  myAmDelayed = true;
695  }
696 
697  // return whether there have been vehicles on this edge at least once
698  inline bool isDelayed() const {
699  return myAmDelayed || myBidiEdge == nullptr || myBidiEdge->myAmDelayed;
700  }
701 
702  bool hasLaneChanger() const {
703  return myLaneChanger != 0;
704  }
705 
707  bool canChangeToOpposite() const;
708 
710  const MSEdge* getOppositeEdge() const;
711 
713  double getMeanSpeed() const;
714 
716  double getMeanSpeedBike() const;
717 
719  bool hasMinorLink() const;
720 
722  bool isFringe() const {
723  return myAmFringe;
724  }
725 
727  virtual bool isSelected() const {
728  return false;
729  }
730 
732  virtual void lock() const {}
733 
735  virtual void unlock() const {};
736 
738  void addWaiting(SUMOVehicle* vehicle) const;
739 
741  void removeWaiting(const SUMOVehicle* vehicle) const;
742 
743  /* @brief returns a vehicle that is waiting for a for a person or a container at this edge at the given position
744  * @param[in] transportable The person or container that wants to ride
745  * @param[in] position The vehicle shall be positioned in the interval [position - t, position + t], where t is some tolerance
746  */
747  SUMOVehicle* getWaitingVehicle(MSTransportable* transportable, const double position) const;
748 
750  void updateMesoType();
751 
755  static bool dictionary(const std::string& id, MSEdge* edge);
756 
758  static MSEdge* dictionary(const std::string& id);
759 
761  static int dictSize();
762 
764  static const MSEdgeVector& getAllEdges();
765 
767  static void clear();
768 
770  static void insertIDs(std::vector<std::string>& into);
771 
772  static SVCPermissions getMesoPermissions(SVCPermissions p, SVCPermissions ignoreIgnored = 0);
773 
774  static void setMesoIgnoredVClasses(SVCPermissions ignored) {
775  myMesoIgnoredVClasses = ignored;
776  }
777 
778 public:
781 
790  static void parseEdgesList(const std::string& desc, ConstMSEdgeVector& into,
791  const std::string& rid);
792 
793 
800  static void parseEdgesList(const std::vector<std::string>& desc, ConstMSEdgeVector& into,
801  const std::string& rid);
803 
804 
806  if (myReversedRoutingEdge == nullptr) {
808  }
809  return myReversedRoutingEdge;
810  }
811 
813  if (myRailwayRoutingEdge == nullptr) {
815  }
816  return myRailwayRoutingEdge;
817  }
818 
819 protected:
823  class by_id_sorter {
824  public:
826  explicit by_id_sorter() { }
827 
829  int operator()(const MSEdge* const e1, const MSEdge* const e2) const {
830  return e1->getNumericalID() < e2->getNumericalID();
831  }
832 
833  };
834 
839  public:
841  explicit transportable_by_position_sorter(SUMOTime timestep): myTime(timestep) { }
842 
844  int operator()(const MSTransportable* const c1, const MSTransportable* const c2) const;
845  private:
847  };
848 
849 
851  double getDepartPosBound(const MSVehicle& veh, bool upper = true) const;
852 
853 protected:
855  const int myNumericalID;
856 
858  std::shared_ptr<const std::vector<MSLane*> > myLanes;
859 
862 
865 
868 
871 
875  mutable std::set<int> myFailedInsertionMemory;
876 
878  std::vector<std::string> myCrossingEdges;
879 
882 
884 
887 
891 
893  mutable std::set<MSTransportable*> myPersons;
894 
896  mutable std::set<MSTransportable*> myContainers;
897 
900 
903 
906 
912 
915 
917  std::string myStreetName;
918 
920  std::string myEdgeType;
921 
923  const int myPriority;
924 
926  const double myDistance;
927 
929  double myWidth;
930 
932  double myLength;
933 
936 
939 
941  mutable bool myAmDelayed;
942 
945 
948 
950  std::vector<double> mySublaneSides;
951 
954 
956  typedef std::map< std::string, MSEdge* > DictType;
957 
961  static DictType myDict;
962 
967 
970 
971 
973  mutable std::map<SUMOVehicleClass, MSEdgeVector> myClassesSuccessorMap;
974 
976  mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myClassesViaSuccessorMap;
977 
980 
982  mutable std::vector<SUMOVehicle*> myWaiting;
983 
984 #ifdef HAVE_FOX
986  mutable FXMutex myWaitingMutex;
987 
989  mutable FXMutex mySuccessorMutex;
990 #endif
991 
992 private:
993 
996 
1000 
1002  MSEdge(const MSEdge&);
1003 
1005  MSEdge& operator=(const MSEdge&) = delete;
1006 
1007  bool isSuperposable(const MSEdge* other);
1008 
1009  void addToAllowed(const SVCPermissions permissions, std::shared_ptr<const std::vector<MSLane*> > allowedLanes, AllowedLanesCont& laneCont) const;
1010 };
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
long long int SUMOTime
Definition: SUMOTime.h:32
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:823
by_id_sorter()
constructor
Definition: MSEdge.h:826
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition: MSEdge.h:829
Sorts transportables by their positions.
Definition: MSEdge.h:838
transportable_by_position_sorter(SUMOTime timestep)
constructor
Definition: MSEdge.h:841
int operator()(const MSTransportable *const c1, const MSTransportable *const c2) const
comparing operator
Definition: MSEdge.cpp:1058
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:336
virtual void unlock() const
release exclusive access to the mesoscopic state
Definition: MSEdge.h:735
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:917
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:918
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
Definition: MSEdge.cpp:1251
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition: MSEdge.h:727
void addToAllowed(const SVCPermissions permissions, std::shared_ptr< const std::vector< MSLane * > > allowedLanes, AllowedLanesCont &laneCont) const
Definition: MSEdge.cpp:249
void changeLanes(SUMOTime t) const
Performs lane changing on this edge.
Definition: MSEdge.cpp:753
const int myPriority
the priority of the edge (used during network creation)
Definition: MSEdge.h:923
double getBruttoOccupancy() const
Definition: MSEdge.cpp:1351
bool isConnectedTo(const MSEdge &destination, SUMOVehicleClass vclass) const
Definition: MSEdge.h:237
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:910
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
Definition: MSEdge.h:362
double getFlow() const
return flow based on meanSpead
Definition: MSEdge.cpp:1338
const MSEdge * myOtherTazConnector
the other taz-connector if this edge isTazConnector, otherwise nullptr
Definition: MSEdge.h:914
Boundary myBoundary
The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start ...
Definition: MSEdge.h:979
double myWidth
Edge width [m].
Definition: MSEdge.h:929
AllowedLanesByTarget myAllowedTargets
From target edge to lanes allowed to be used to reach it.
Definition: MSEdge.h:905
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition: MSEdge.h:267
MSLane * getDepartLane(MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:541
SUMOTime myLastFailedInsertionTime
The time of last insertion failure.
Definition: MSEdge.h:870
void setOtherTazConnector(const MSEdge *edge)
Definition: MSEdge.h:289
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:678
int getPriority() const
Returns the priority of the edge.
Definition: MSEdge.h:322
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:924
void inferEdgeType()
Definition: MSEdge.cpp:1369
static void setMesoIgnoredVClasses(SVCPermissions ignored)
Definition: MSEdge.h:774
const MSEdge * getOtherTazConnector() const
Definition: MSEdge.h:293
const int myNumericalID
This edge's numerical id.
Definition: MSEdge.h:855
void setJunctions(MSJunction *from, MSJunction *to)
Definition: MSEdge.cpp:1144
double getMeanSpeedBike() const
get the mean speed of all bicycles on this edge
Definition: MSEdge.cpp:850
static MSEdgeVector myEdges
Static list of edges.
Definition: MSEdge.h:966
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition: MSEdge.h:605
AllowedLanesCont myAllowed
Associative container from vehicle class to allowed-lanes.
Definition: MSEdge.h:902
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:392
double myEmptyTraveltime
the traveltime on the empty edge (cached value for speedup)
Definition: MSEdge.h:935
void updateMesoType()
update meso segment parameters
Definition: MSEdge.cpp:200
bool myAmFringe
whether this edge is at the network fringe
Definition: MSEdge.h:947
static double getTravelTimeAggregated(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Definition: MSEdge.cpp:1363
MSJunction * myToJunction
Definition: MSEdge.h:890
void checkAndRegisterBiDirEdge(const std::string &bidiID="")
check and register the opposite superposable edge if any
Definition: MSEdge.cpp:1186
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:912
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:486
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:307
const double myDistance
the kilometrage/mileage at the start of the edge
Definition: MSEdge.h:926
ReversedEdge< MSEdge, SUMOVehicle > * getReversedRoutingEdge() const
Definition: MSEdge.h:805
MSLane * getDepartLaneMeso(SUMOVehicle &veh) const
consider given departLane parameter (only for validating speeds)
Definition: MSEdge.cpp:530
const MSEdge * myBidiEdge
the oppositing superposable edge
Definition: MSEdge.h:995
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:379
static double getTravelTimeStatic(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: MSEdge.h:477
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal) const
Definition: MSEdge.cpp:761
std::string myEdgeType
the type of the edge (optionally used during network creation)
Definition: MSEdge.h:920
bool isWalkingArea() const
return whether this edge is walking area
Definition: MSEdge.h:281
bool isDelayed() const
Definition: MSEdge.h:698
const MSEdge * getOppositeEdge() const
Returns the opposite direction edge if on exists else a nullptr.
Definition: MSEdge.cpp:1163
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:942
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSEdge.cpp:997
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:1069
bool isFringe() const
return whether this edge is at the fringe of the network
Definition: MSEdge.h:722
std::vector< SUMOVehicle * > myWaiting
List of waiting vehicles.
Definition: MSEdge.h:982
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
Definition: MSEdge.cpp:804
const std::set< MSTransportable * > & getPersons() const
Returns this edge's persons set.
Definition: MSEdge.h:198
bool isNormal() const
return whether this edge is an internal edge
Definition: MSEdge.h:257
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:600
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.cpp:1019
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
Definition: MSEdge.cpp:1032
bool isSuperposable(const MSEdge *other)
Definition: MSEdge.cpp:1211
bool validateDepartSpeed(SUMOVehicle &v) const
check whether the given departSpeed is valid for this edge
Definition: MSEdge.cpp:603
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:408
double getDistanceTo(const MSEdge *other, const bool doBoundaryEstimate=false) const
optimistic air distance heuristic for use in routing
Definition: MSEdge.cpp:965
const MSConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges with internal vias, restricted by vClass.
Definition: MSEdge.cpp:1114
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:861
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
double getOccupancy() const
return mean occupancy on this edges lanes or segments
Definition: MSEdge.cpp:1316
std::vector< MSTransportable * > getSortedContainers(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's containers sorted by pos.
Definition: MSEdge.cpp:1050
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:864
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:896
void recalcCache()
Recalculates the cached values.
Definition: MSEdge.cpp:116
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:990
const MSJunction * getFromJunction() const
Definition: MSEdge.h:397
bool myAmDelayed
whether this edge had a vehicle with less than max speed on it
Definition: MSEdge.h:941
std::map< SUMOVehicleClass, MSEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:973
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:447
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:886
void rebuildAllowedTargets(const bool updateVehicles=true)
Definition: MSEdge.cpp:312
bool hasLaneChanger() const
Definition: MSEdge.h:702
static SVCPermissions myMesoIgnoredVClasses
Definition: MSEdge.h:968
std::vector< std::pair< SVCPermissions, std::shared_ptr< const std::vector< MSLane * > > > > AllowedLanesCont
"Map" from vehicle class to allowed lanes
Definition: MSEdge.h:80
void rebuildAllowedLanes()
Definition: MSEdge.cpp:271
double getLength() const
return the length of the edge
Definition: MSEdge.h:641
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:99
std::vector< std::string > myCrossingEdges
The crossed edges id for a crossing edge. On not crossing edges it is empty.
Definition: MSEdge.h:878
virtual void closeBuilding()
Definition: MSEdge.cpp:152
static SVCPermissions getMesoPermissions(SVCPermissions p, SVCPermissions ignoreIgnored=0)
Definition: MSEdge.cpp:264
bool canChangeToOpposite() const
whether this edge allows changing to the opposite direction edge
Definition: MSEdge.cpp:1155
std::set< int > myFailedInsertionMemory
A cache for the rejected insertion attempts. Used to assure that no further insertion attempts are ma...
Definition: MSEdge.h:875
double getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:814
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:961
bool isTazConnector() const
Definition: MSEdge.h:285
MSEdge(const MSEdge &)
Invalidated copy constructor.
int getNumLanes() const
Definition: MSEdge.h:172
MSConstEdgePairVector myViaSuccessors
Definition: MSEdge.h:883
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition: MSEdge.h:459
MSEdge & operator=(const MSEdge &)=delete
assignment operator.
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:673
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:881
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:893
bool isRoundabout() const
Definition: MSEdge.h:685
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:262
bool prohibits(const SUMOVehicle *const vehicle) const
Returns whether the vehicle (class) is not allowed on the edge.
Definition: MSEdge.h:587
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:385
double getWidth() const
Returns the edges's width (sum over all lanes)
Definition: MSEdge.h:612
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:869
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:300
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:417
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:641
static const Position getStopPosition(const SUMOVehicleParameter::Stop &stop)
return the coordinates of the center of the given stop
Definition: MSEdge.cpp:984
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition: MSEdge.cpp:1230
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:391
ReversedEdge< MSEdge, SUMOVehicle > * myReversedRoutingEdge
a reversed version for backward routing
Definition: MSEdge.h:998
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:885
std::vector< const SUMOVehicle * > getVehicles() const
return vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1274
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:934
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:1002
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:440
MSJunction * myFromJunction
the junctions for this edge
Definition: MSEdge.h:889
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition: MSEdge.h:956
bool hasMinorLink() const
whether any lane has a minor link
Definition: MSEdge.cpp:1173
const std::vector< std::string > & getCrossingEdges() const
Gets the crossed edge ids.
Definition: MSEdge.h:344
std::map< SUMOVehicleClass, MSConstEdgePairVector > myClassesViaSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:976
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition: MSEdge.cpp:794
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1294
void markDelayed() const
Definition: MSEdge.h:693
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:313
RailEdge< MSEdge, SUMOVehicle > * getRailwayRoutingEdge() const
Definition: MSEdge.h:812
double getInternalFollowingLengthTo(const MSEdge *followerAfterInternal) const
returns the length of all internal edges on the junction until reaching the non-internal edge followe...
Definition: MSEdge.cpp:779
SUMOTime getLastFailedInsertionTime() const
Returns the last time a vehicle could not be inserted.
Definition: MSEdge.h:555
const MSJunction * getToJunction() const
Definition: MSEdge.h:401
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:252
bool allowsLaneChanging() const
Definition: MSEdge.cpp:227
void setMaxSpeed(double val) const
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
Definition: MSEdge.cpp:1009
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
void buildLaneChanger()
Has to be called after all sucessors and predecessors have been set (after closeBuilding())
Definition: MSEdge.cpp:209
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge's sublanes.
Definition: MSEdge.h:617
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:879
virtual void lock() const
grant exclusive access to the mesoscopic state
Definition: MSEdge.h:732
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
Definition: MSEdge.cpp:1239
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition: MSEdge.h:276
std::vector< double > mySublaneSides
the right side for each sublane on this edge
Definition: MSEdge.h:950
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:1084
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:858
double getWaitingSeconds() const
return accumated waiting time for all vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1300
int myVaporizationRequests
Vaporizer counter.
Definition: MSEdge.h:867
int getNumPredecessors() const
Returns the number of edges this edge is connected to.
Definition: MSEdge.h:384
double myTimePenalty
flat penalty when computing traveltime
Definition: MSEdge.h:938
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:908
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass, double departPos) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:454
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:689
bool myAmRoundabout
whether this edge belongs to a roundabout
Definition: MSEdge.h:944
double getDistance() const
Returns the kilometrage/mileage at the start of the edge.
Definition: MSEdge.h:328
void setLastFailedInsertionTime(SUMOTime time) const
Sets the last time a vehicle could not be inserted.
Definition: MSEdge.h:563
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.cpp:1024
RailEdge< MSEdge, SUMOVehicle > * myRailwayRoutingEdge
Definition: MSEdge.h:999
double myLength
the length of the edge (cached value for speedup)
Definition: MSEdge.h:932
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:82
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:174
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:157
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:75
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:60
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.