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-2020 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
32 #include <fx.h>
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:
98  MSEdge(const std::string& id, int numericalID, const SumoXMLEdgeFunc function,
99  const std::string& streetName, const std::string& edgeType, int priority,
100  double distance);
101 
102 
104  virtual ~MSEdge();
105 
106 
112  void initialize(const std::vector<MSLane*>* lanes);
113 
114 
117  void recalcCache();
118 
119 
121  virtual void closeBuilding();
122 
124  void buildLaneChanger();
125 
126  /* @brief returns whether initizliaing a lane change is permitted on this edge
127  * @note Has to be called after all sucessors and predecessors have been set (after closeBuilding())
128  */
129  bool allowsLaneChanging() const;
130 
133 
140  MSLane* leftLane(const MSLane* const lane) const;
141 
142 
149  MSLane* rightLane(const MSLane* const lane) const;
150 
151 
159  MSLane* parallelLane(const MSLane* const lane, int offset, bool includeOpposite = true) const;
160 
161 
166  inline const std::vector<MSLane*>& getLanes() const {
167  return *myLanes;
168  }
169 
171  int getVehicleNumber() const;
172 
174  std::vector<const SUMOVehicle*> getVehicles() const;
175 
176  double getBruttoOccupancy() const;
177 
179  double getFlow() const;
180 
182  double getWaitingSeconds() const;
183 
185  double getOccupancy() const;
186 
192  inline const std::set<MSTransportable*>& getPersons() const {
193  return myPersons;
194  }
195 
200  std::vector<MSTransportable*> getSortedPersons(SUMOTime timestep, bool includeRiding = false) const;
201 
202 
207  std::vector<MSTransportable*> getSortedContainers(SUMOTime timestep, bool includeRiding = false) const;
208 
217  const std::vector<MSLane*>* allowedLanes(const MSEdge& destination,
218  SUMOVehicleClass vclass = SVC_IGNORING) const;
219 
220 
221 
229  const std::vector<MSLane*>* allowedLanes(SUMOVehicleClass vclass = SVC_IGNORING) const;
230 
231  inline bool isConnectedTo(const MSEdge& destination, SUMOVehicleClass vclass) const {
232  const std::vector<MSLane*>* const lanes = allowedLanes(destination, vclass);
233  return lanes != nullptr && !lanes->empty();
234  }
236 
237 
238 
241 
246  inline SumoXMLEdgeFunc getFunction() const {
247  return myFunction;
248  }
249 
251  inline bool isNormal() const {
253  }
254 
256  inline bool isInternal() const {
258  }
259 
261  inline bool isCrossing() const {
263  }
264 
265 
267  void checkAndRegisterBiDirEdge(const std::string& bidiID = "");
268 
270  inline const MSEdge* getBidiEdge() const {
271  return myBidiEdge;
272  }
273 
275  inline bool isWalkingArea() const {
277  }
278 
279  inline bool isTazConnector() const {
281  }
282 
283  void setOtherTazConnector(const MSEdge* edge) {
284  myOtherTazConnector = edge;
285  }
286 
287  const MSEdge* getOtherTazConnector() const {
288  return myOtherTazConnector;
289  }
290 
294  inline int getNumericalID() const {
295  return myNumericalID;
296  }
297 
298 
301  const std::string& getStreetName() const {
302  return myStreetName;
303  }
304 
307  const std::string& getEdgeType() const {
308  return myEdgeType;
309  }
310 
313  int getPriority() const {
314  return myPriority;
315  }
316 
319  double getDistance() const {
320  return myDistance;
321  }
323 
327  void setCrossingEdges(const std::vector<std::string>& crossingEdges) {
328  myCrossingEdges.clear();
329  myCrossingEdges.insert(myCrossingEdges.begin(), crossingEdges.begin(), crossingEdges.end());
330  }
331 
335  const std::vector<std::string>& getCrossingEdges() const {
336  return myCrossingEdges;
337  }
338 
339 
342 
348  void addSuccessor(MSEdge* edge, const MSEdge* via = nullptr);
349 
353  int getNumSuccessors() const {
354  return (int) mySuccessors.size();
355  }
356 
357 
363 
369 
370 
375  int getNumPredecessors() const {
376  return (int) myPredecessors.size();
377  }
378 
379 
383  const MSEdgeVector& getPredecessors() const {
384  return myPredecessors;
385  }
386 
387 
388  const MSJunction* getFromJunction() const {
389  return myFromJunction;
390  }
391 
392  const MSJunction* getToJunction() const {
393  return myToJunction;
394  }
395 
396 
397  void setJunctions(MSJunction* from, MSJunction* to);
399 
400 
401 
404 
408  bool isVaporizing() const {
409  return myVaporizationRequests > 0;
410  }
411 
412 
423 
424 
436 
437 
446  double getCurrentTravelTime(const double minSpeed = NUMERICAL_EPS) const;
447 
448 
450  inline double getMinimumTravelTime(const SUMOVehicle* const veh) const {
452  return 0;
453  } else if (veh != 0) {
454  return getLength() / getVehicleMaxSpeed(veh) + myTimePenalty;
455  } else {
456  return myEmptyTraveltime;
457  }
458  }
459 
460 
468  static inline double getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, double time) {
469  return MSNet::getInstance()->getTravelTime(edge, veh, time);
470  }
471 
472  static double getTravelTimeAggregated(const MSEdge* const edge, const SUMOVehicle* const veh, double time);
473 
476  double getRoutingSpeed() const;
477 
478 
481 
501  bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false, const bool forceCheck = false) const;
502 
504  bool validateDepartSpeed(SUMOVehicle& v) const;
505 
525  MSLane* getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos) const;
526 
527 
538  MSLane* getDepartLane(MSVehicle& veh) const;
539 
540 
546  }
547 
548 
552  inline void setLastFailedInsertionTime(SUMOTime time) const {
554  }
556 
557 
559  void changeLanes(SUMOTime t) const;
560 
561 
563  const MSEdge* getInternalFollowingEdge(const MSEdge* followerAfterInternal) const;
564 
565 
567  double getInternalFollowingLengthTo(const MSEdge* followerAfterInternal) const;
568 
570  const MSEdge* getNormalBefore() const;
571 
573  const MSEdge* getNormalSuccessor() const;
574 
576  inline bool prohibits(const SUMOVehicle* const vehicle) const {
577  if (vehicle == nullptr) {
578  return false;
579  }
580  const SUMOVehicleClass svc = vehicle->getVClass();
581  return (myCombinedPermissions & svc) != svc;
582  }
583 
589  inline bool restricts(const SUMOVehicle* const /* vehicle */) const {
590  return false;
591  }
592 
595  return myCombinedPermissions;
596  }
597 
601  double getWidth() const {
602  return myWidth;
603  }
604 
606  const std::vector<double> getSubLaneSides() const {
607  return mySublaneSides;
608  }
609 
610  void rebuildAllowedLanes();
611 
612  void rebuildAllowedTargets(const bool updateVehicles = true);
613 
614 
620  double getDistanceTo(const MSEdge* other, const bool doBoundaryEstimate = false) const;
621 
622 
624  static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
625 
626 
630  inline double getLength() const {
631  return myLength;
632  }
633 
634 
639  double getSpeedLimit() const;
640 
642  double getLengthGeometryFactor() const;
643 
647  void setMaxSpeed(double val) const;
648 
654  double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const;
655 
656 
657  virtual void addPerson(MSTransportable* p) const;
658 
659  virtual void removePerson(MSTransportable* p) const;
660 
662  virtual void addContainer(MSTransportable* container) const {
663  myContainers.insert(container);
664  }
665 
667  virtual void removeContainer(MSTransportable* container) const {
668  std::set<MSTransportable*>::iterator i = myContainers.find(container);
669  if (i != myContainers.end()) {
670  myContainers.erase(i);
671  }
672  }
673 
674  inline bool isRoundabout() const {
675  return myAmRoundabout;
676  }
677 
679  myAmRoundabout = true;
680  }
681 
682  void markDelayed() const {
683  myAmDelayed = true;
684  }
685 
686  // return whether there have been vehicles on this edge at least once
687  inline bool isDelayed() const {
688  return myAmDelayed || myBidiEdge == nullptr || myBidiEdge->myAmDelayed;
689  }
690 
691  bool hasLaneChanger() const {
692  return myLaneChanger != 0;
693  }
694 
696  bool canChangeToOpposite();
697 
699  const MSEdge* getOppositeEdge() const;
700 
702  double getMeanSpeed() const;
703 
705  double getMeanSpeedBike() const;
706 
708  bool hasMinorLink() const;
709 
711  bool isFringe() const {
712  return myAmFringe;
713  }
714 
716  virtual bool isSelected() const {
717  return false;
718  }
719 
721  virtual void lock() const {}
722 
724  virtual void unlock() const {};
725 
727  void addWaiting(SUMOVehicle* vehicle) const;
728 
730  void removeWaiting(const SUMOVehicle* vehicle) const;
731 
732  /* @brief returns a vehicle that is waiting for a for a person or a container at this edge at the given position
733  * @param[in] transportable The person or container that wants to ride
734  * @param[in] position The vehicle shall be positioned in the interval [position - t, position + t], where t is some tolerance
735  */
736  SUMOVehicle* getWaitingVehicle(MSTransportable* transportable, const double position) const;
737 
739  void updateMesoType();
740 
744  static bool dictionary(const std::string& id, MSEdge* edge);
745 
747  static MSEdge* dictionary(const std::string& id);
748 
750  static int dictSize();
751 
753  static const MSEdgeVector& getAllEdges();
754 
756  static void clear();
757 
759  static void insertIDs(std::vector<std::string>& into);
760 
761 
762 public:
765 
774  static void parseEdgesList(const std::string& desc, ConstMSEdgeVector& into,
775  const std::string& rid);
776 
777 
784  static void parseEdgesList(const std::vector<std::string>& desc, ConstMSEdgeVector& into,
785  const std::string& rid);
787 
788 
790  if (myReversedRoutingEdge == nullptr) {
792  }
793  return myReversedRoutingEdge;
794  }
795 
797  if (myRailwayRoutingEdge == nullptr) {
799  }
800  return myRailwayRoutingEdge;
801  }
802 
803 protected:
807  class by_id_sorter {
808  public:
810  explicit by_id_sorter() { }
811 
813  int operator()(const MSEdge* const e1, const MSEdge* const e2) const {
814  return e1->getNumericalID() < e2->getNumericalID();
815  }
816 
817  };
818 
823  public:
825  explicit transportable_by_position_sorter(SUMOTime timestep): myTime(timestep) { }
826 
828  int operator()(const MSTransportable* const c1, const MSTransportable* const c2) const;
829  private:
831  };
832 
833 
835  double getDepartPosBound(const MSVehicle& veh, bool upper = true) const;
836 
837 protected:
839  const int myNumericalID;
840 
842  std::shared_ptr<const std::vector<MSLane*> > myLanes;
843 
846 
849 
852 
855 
859  mutable std::set<int> myFailedInsertionMemory;
860 
862  std::vector<std::string> myCrossingEdges;
863 
866 
868 
871 
875 
877  mutable std::set<MSTransportable*> myPersons;
878 
880  mutable std::set<MSTransportable*> myContainers;
881 
884 
887 
890 
896 
899 
901  std::string myStreetName;
902 
904  std::string myEdgeType;
905 
907  const int myPriority;
908 
910  const double myDistance;
911 
913  double myWidth;
914 
916  double myLength;
917 
920 
923 
925  mutable bool myAmDelayed;
926 
929 
932 
934  std::vector<double> mySublaneSides;
935 
938 
940  typedef std::map< std::string, MSEdge* > DictType;
941 
945  static DictType myDict;
946 
952 
953 
955  mutable std::map<SUMOVehicleClass, MSEdgeVector> myClassesSuccessorMap;
956 
958  mutable std::map<SUMOVehicleClass, MSConstEdgePairVector> myClassesViaSuccessorMap;
959 
962 
964  mutable std::vector<SUMOVehicle*> myWaiting;
965 
966 #ifdef HAVE_FOX
968  mutable FXMutex myWaitingMutex;
969 
971  mutable FXMutex mySuccessorMutex;
972 #endif
973 
974 private:
975 
978 
982 
984  MSEdge(const MSEdge&);
985 
987  MSEdge& operator=(const MSEdge&) = delete;
988 
989  bool isSuperposable(const MSEdge* other);
990 
991  void addToAllowed(const SVCPermissions permissions, std::shared_ptr<const std::vector<MSLane*> > allowedLanes, AllowedLanesCont& laneCont) const;
992 };
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:31
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:807
by_id_sorter()
constructor
Definition: MSEdge.h:810
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition: MSEdge.h:813
Sorts transportables by their positions.
Definition: MSEdge.h:822
transportable_by_position_sorter(SUMOTime timestep)
constructor
Definition: MSEdge.h:825
int operator()(const MSTransportable *const c1, const MSTransportable *const c2) const
comparing operator
Definition: MSEdge.cpp:987
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:327
virtual void unlock() const
release exclusive access to the mesoscopic state
Definition: MSEdge.h:724
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:901
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:847
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
Definition: MSEdge.cpp:1180
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition: MSEdge.h:716
void addToAllowed(const SVCPermissions permissions, std::shared_ptr< const std::vector< MSLane * > > allowedLanes, AllowedLanesCont &laneCont) const
Definition: MSEdge.cpp:235
void changeLanes(SUMOTime t) const
Performs lane changing on this edge.
Definition: MSEdge.cpp:682
const int myPriority
the priority of the edge (used during network creation)
Definition: MSEdge.h:907
double getBruttoOccupancy() const
Definition: MSEdge.cpp:1274
bool isConnectedTo(const MSEdge &destination, SUMOVehicleClass vclass) const
Definition: MSEdge.h:231
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:894
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
Definition: MSEdge.h:353
double getFlow() const
return flow based on meanSpead
Definition: MSEdge.cpp:1264
const MSEdge * myOtherTazConnector
the other taz-connector if this edge isTazConnector, otherwise nullptr
Definition: MSEdge.h:898
Boundary myBoundary
The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start ...
Definition: MSEdge.h:961
double myWidth
Edge width [m].
Definition: MSEdge.h:913
AllowedLanesByTarget myAllowedTargets
From target edge to lanes allowed to be used to reach it.
Definition: MSEdge.h:889
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition: MSEdge.h:261
MSLane * getDepartLane(MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:488
SUMOTime myLastFailedInsertionTime
The time of last insertion failure.
Definition: MSEdge.h:854
void setOtherTazConnector(const MSEdge *edge)
Definition: MSEdge.h:283
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:667
int getPriority() const
Returns the priority of the edge.
Definition: MSEdge.h:313
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:853
bool canChangeToOpposite()
whether this edge allows changing to the opposite direction edge
Definition: MSEdge.cpp:1084
const MSEdge * getOtherTazConnector() const
Definition: MSEdge.h:287
const int myNumericalID
This edge's numerical id.
Definition: MSEdge.h:839
void setJunctions(MSJunction *from, MSJunction *to)
Definition: MSEdge.cpp:1073
double getMeanSpeedBike() const
get the mean speed of all bicycles on this edge
Definition: MSEdge.cpp:779
static MSEdgeVector myEdges
Static list of edges.
Definition: MSEdge.h:950
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition: MSEdge.h:594
AllowedLanesCont myAllowed
Associative container from vehicle class to allowed-lanes.
Definition: MSEdge.h:886
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:383
double myEmptyTraveltime
the traveltime on the empty edge (cached value for speedup)
Definition: MSEdge.h:919
void updateMesoType()
update meso segment parameters
Definition: MSEdge.cpp:186
bool myAmFringe
whether this edge is at the network fringe
Definition: MSEdge.h:931
static double getTravelTimeAggregated(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Definition: MSEdge.cpp:1283
MSJunction * myToJunction
Definition: MSEdge.h:874
void checkAndRegisterBiDirEdge(const std::string &bidiID="")
check and register the opposite superposable edge if any
Definition: MSEdge.cpp:1115
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:841
virtual ~MSEdge()
Destructor.
Definition: MSEdge.cpp:88
double getDepartPosBound(const MSVehicle &veh, bool upper=true) const
return upper bound for the depart position on this edge
Definition: MSEdge.cpp:444
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:301
const double myDistance
the kilometrage/mileage at the start of the edge
Definition: MSEdge.h:910
ReversedEdge< MSEdge, SUMOVehicle > * getReversedRoutingEdge() const
Definition: MSEdge.h:789
const MSEdge * myBidiEdge
the oppositing superposable edge
Definition: MSEdge.h:977
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:341
static double getTravelTimeStatic(const MSEdge *const edge, const SUMOVehicle *const veh, double time)
Returns the travel time for the given edge.
Definition: MSEdge.h:468
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal) const
Definition: MSEdge.cpp:690
std::string myEdgeType
the type of the edge (optionally used during network creation)
Definition: MSEdge.h:904
bool isWalkingArea() const
return whether this edge is walking area
Definition: MSEdge.h:275
bool isDelayed() const
Definition: MSEdge.h:687
const MSEdge * getOppositeEdge() const
Returns the opposite direction edge if on exists else a nullptr.
Definition: MSEdge.cpp:1092
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:871
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSEdge.cpp:926
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:998
bool isFringe() const
return whether this edge is at the fringe of the network
Definition: MSEdge.h:711
std::vector< SUMOVehicle * > myWaiting
List of waiting vehicles.
Definition: MSEdge.h:964
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
Definition: MSEdge.cpp:733
const std::set< MSTransportable * > & getPersons() const
Returns this edge's persons set.
Definition: MSEdge.h:192
bool isNormal() const
return whether this edge is an internal edge
Definition: MSEdge.h:251
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:589
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.cpp:948
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
Definition: MSEdge.cpp:961
bool isSuperposable(const MSEdge *other)
Definition: MSEdge.cpp:1140
bool validateDepartSpeed(SUMOVehicle &v) const
check whether the given departSpeed is valid for this edge
Definition: MSEdge.cpp:550
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:366
double getDistanceTo(const MSEdge *other, const bool doBoundaryEstimate=false) const
optimistic air distance heuristic for use in routing
Definition: MSEdge.cpp:894
const MSConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges with internal vias, restricted by vClass.
Definition: MSEdge.cpp:1043
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:845
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:166
double getOccupancy() const
return mean occupancy on this edges lanes or segments
Definition: MSEdge.cpp:1245
std::vector< MSTransportable * > getSortedContainers(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's containers sorted by pos.
Definition: MSEdge.cpp:979
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:848
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:880
void recalcCache()
Recalculates the cached values.
Definition: MSEdge.cpp:111
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:919
const MSJunction * getFromJunction() const
Definition: MSEdge.h:388
bool myAmDelayed
whether this edge had a vehicle with less than max speed on it
Definition: MSEdge.h:925
std::map< SUMOVehicleClass, MSEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:955
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:405
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:870
void rebuildAllowedTargets(const bool updateVehicles=true)
Definition: MSEdge.cpp:279
bool hasLaneChanger() const
Definition: MSEdge.h:691
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:250
double getLength() const
return the length of the edge
Definition: MSEdge.h:630
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:94
std::vector< std::string > myCrossingEdges
The crossed edges id for a crossing edge. On not crossing edges it is empty.
Definition: MSEdge.h:862
virtual void closeBuilding()
Definition: MSEdge.cpp:147
std::set< int > myFailedInsertionMemory
A cache for the rejected insertion attempts. Used to assure that no further insertion attempts are ma...
Definition: MSEdge.h:859
double getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:743
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:945
bool isTazConnector() const
Definition: MSEdge.h:279
MSEdge(const MSEdge &)
Invalidated copy constructor.
MSConstEdgePairVector myViaSuccessors
Definition: MSEdge.h:867
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
Definition: MSEdge.h:450
MSEdge & operator=(const MSEdge &)=delete
assignment operator.
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:662
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:865
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:877
bool isRoundabout() const
Definition: MSEdge.h:674
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:256
bool prohibits(const SUMOVehicle *const vehicle) const
Returns whether the vehicle (class) is not allowed on the edge.
Definition: MSEdge.h:576
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:347
double getWidth() const
Returns the edges's width (sum over all lanes)
Definition: MSEdge.h:601
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:798
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:294
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:408
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:570
static const Position getStopPosition(const SUMOVehicleParameter::Stop &stop)
return the coordinates of the center of the given stop
Definition: MSEdge.cpp:913
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition: MSEdge.cpp:1159
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:353
ReversedEdge< MSEdge, SUMOVehicle > * myReversedRoutingEdge
a reversed version for backward routing
Definition: MSEdge.h:980
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:814
std::vector< const SUMOVehicle * > getVehicles() const
return vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1203
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:863
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:931
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:398
MSJunction * myFromJunction
the junctions for this edge
Definition: MSEdge.h:873
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition: MSEdge.h:940
bool hasMinorLink() const
whether any lane has a minor link
Definition: MSEdge.cpp:1102
const std::vector< std::string > & getCrossingEdges() const
Gets the crossed edge ids.
Definition: MSEdge.h:335
std::map< SUMOVehicleClass, MSConstEdgePairVector > myClassesViaSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:958
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition: MSEdge.cpp:723
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1223
void markDelayed() const
Definition: MSEdge.h:682
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:307
RailEdge< MSEdge, SUMOVehicle > * getRailwayRoutingEdge() const
Definition: MSEdge.h:796
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:708
SUMOTime getLastFailedInsertionTime() const
Returns the last time a vehicle could not be inserted.
Definition: MSEdge.h:544
const MSJunction * getToJunction() const
Definition: MSEdge.h:392
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:246
bool allowsLaneChanging() const
Definition: MSEdge.cpp:213
void setMaxSpeed(double val) const
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
Definition: MSEdge.cpp:938
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:62
void buildLaneChanger()
Has to be called after all sucessors and predecessors have been set (after closeBuilding())
Definition: MSEdge.cpp:195
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge's sublanes.
Definition: MSEdge.h:606
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:808
virtual void lock() const
grant exclusive access to the mesoscopic state
Definition: MSEdge.h:721
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
Definition: MSEdge.cpp:1168
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition: MSEdge.h:270
std::vector< double > mySublaneSides
the right side for each sublane on this edge
Definition: MSEdge.h:934
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:1013
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:842
double getWaitingSeconds() const
return accumated waiting time for all vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1229
int myVaporizationRequests
Vaporizer counter.
Definition: MSEdge.h:851
int getNumPredecessors() const
Returns the number of edges this edge is connected to.
Definition: MSEdge.h:375
double myTimePenalty
flat penalty when computing traveltime
Definition: MSEdge.h:922
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:892
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass, double departPos) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:412
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:678
bool myAmRoundabout
whether this edge belongs to a roundabout
Definition: MSEdge.h:928
double getDistance() const
Returns the kilometrage/mileage at the start of the edge.
Definition: MSEdge.h:319
void setLastFailedInsertionTime(SUMOTime time) const
Sets the last time a vehicle could not be inserted.
Definition: MSEdge.h:552
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.cpp:953
RailEdge< MSEdge, SUMOVehicle > * myRailwayRoutingEdge
Definition: MSEdge.h:981
double myLength
the length of the edge (cached value for speedup)
Definition: MSEdge.h:916
The base class for an intersection.
Definition: MSJunction.h:58
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:45
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:171
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
Definition: MSNet.cpp:154
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
Base class for objects which have an id.
Definition: Named.h:53
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
An upper class for objects with additional parameters.
Definition: Parameterised.h:39
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
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:58
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.