SUMO - Simulation of Urban MObility
MSLane.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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
22 // Representation of a lane in the micro simulation
23 /****************************************************************************/
24 #ifndef MSLane_h
25 #define MSLane_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #include <config.h>
32 
33 #include <memory>
34 #include <vector>
35 #include <map>
36 #include <deque>
37 #include <cassert>
38 #include <utils/common/Named.h>
44 #include "MSLinkCont.h"
45 #include "MSLeaderInfo.h"
46 #include "MSMoveReminder.h"
47 #include <libsumo/Helper.h>
48 
49 
50 // ===========================================================================
51 // class declarations
52 // ===========================================================================
53 class MSEdge;
54 class MSVehicle;
55 class MSLaneChanger;
56 class MSLink;
57 class MSVehicleTransfer;
58 class MSVehicleControl;
59 class OutputDevice;
61 
62 // ===========================================================================
63 // type definitions
64 // ===========================================================================
66 typedef std::map<const MSLane*, std::pair<double, double> > LaneCoverageInfo; // also declared in libsumo/Helper.h!
67 
68 // ===========================================================================
69 // class definitions
70 // ===========================================================================
78 class MSLane : public Named, public Parameterised {
79 public:
81  friend class MSLaneChanger;
82  friend class MSLaneChangerSublane;
83 
84  friend class MSXMLRawOut;
85 
86  friend class MSQueueExport;
87  friend class AnyVehicleIterator;
88 
90  typedef std::vector<MSVehicle*> VehCont;
91 
94  struct VehPosition : public std::binary_function < const MSVehicle*, double, bool > {
96  bool operator()(const MSVehicle* cmp, double pos) const;
97  };
98 
99  // TODO: Better documentation
108  public:
110  const MSLane* lane,
111  int i1,
112  int i2,
113  int i3,
114  const int i1End,
115  const int i2End,
116  const int i3End,
117  bool downstream = true) :
118  myLane(lane),
119  myI1(i1),
120  myI2(i2),
121  myI3(i3),
122  myI1End(i1End),
123  myI2End(i2End),
124  myI3End(i3End),
125  myDownstream(downstream),
126  myDirection(downstream ? 1 : -1) {
127  }
128 
129  bool operator== (AnyVehicleIterator const& other) const {
130  return (myI1 == other.myI1
131  && myI2 == other.myI2
132  && myI3 == other.myI3
133  && myI1End == other.myI1End
134  && myI2End == other.myI2End
135  && myI3End == other.myI3End);
136  }
137 
138  bool operator!= (AnyVehicleIterator const& other) const {
139  return !(*this == other);
140  }
141 
143  return **this;
144  }
145 
146  const MSVehicle* operator*();
147 
148  AnyVehicleIterator& operator++();
149 
150  private:
151  bool nextIsMyVehicles() const;
152 
154  const MSLane* myLane;
156  int myI1;
158  int myI2;
160  int myI3;
162  int myI1End;
164  int myI2End;
166  int myI3End;
171 
172  };
173 
174 
175 public:
184  };
185 
200  MSLane(const std::string& id, double maxSpeed, double length, MSEdge* const edge,
201  int numericalID, const PositionVector& shape, double width,
202  SVCPermissions permissions, int index, bool isRampAccel);
203 
204 
206  virtual ~MSLane();
207 
208 
209 
212 
220  void addLink(MSLink* link);
221 
226  void addNeigh(const std::string& id);
228 
229 
230 
233 
240  virtual void addMoveReminder(MSMoveReminder* rem);
241 
242 
246  inline const std::vector< MSMoveReminder* >& getMoveReminders() const {
247  return myMoveReminders;
248  }
250 
251 
252 
255 
271  bool insertVehicle(MSVehicle& v);
272 
273 
292  bool isInsertionSuccess(MSVehicle* vehicle, double speed, double pos, double posLat,
293  bool recheckNextLanes,
294  MSMoveReminder::Notification notification);
295 
296  // XXX: Documentation?
297  bool checkFailure(const MSVehicle* aVehicle, double& speed, double& dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const;
298 
302  bool lastInsertion(MSVehicle& veh, double mspeed, double posLat, bool patchSpeed);
303 
311  bool freeInsertion(MSVehicle& veh, double speed, double posLat,
313 
314 
324  void forceVehicleInsertion(MSVehicle* veh, double pos, MSMoveReminder::Notification notification, double posLat = 0);
326 
327 
328 
332 
339  virtual double setPartialOccupation(MSVehicle* v);
340 
344  virtual void resetPartialOccupation(MSVehicle* v);
345 
348  virtual void setManeuverReservation(MSVehicle* v);
349 
353  virtual void resetManeuverReservation(MSVehicle* v);
354 
365  const MSLeaderInfo& getLastVehicleInformation(const MSVehicle* ego, double latOffset, double minPos = 0, bool allowCached = true) const;
366 
368  const MSLeaderInfo& getFirstVehicleInformation(const MSVehicle* ego, double latOffset, bool onlyFrontOnLane, double maxPos = std::numeric_limits<double>::max(), bool allowCached = true) const;
369 
371 
374 
379  int getVehicleNumber() const {
380  return (int)myVehicles.size();
381  }
382 
388  return (int)myVehicles.size() + (int)myPartialVehicles.size();
389  }
390 
396  return (int)myPartialVehicles.size();
397  }
398 
399 
406  virtual const VehCont& getVehiclesSecure() const {
407  return myVehicles;
408  }
409 
410 
413  return AnyVehicleIterator(this, 0, 0, 0,
414  (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(), true);
415  }
416 
419  return AnyVehicleIterator(this, (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(),
420  (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(), true);
421  }
422 
425  return AnyVehicleIterator(this, (int)myVehicles.size() - 1, (int)myPartialVehicles.size() - 1, (int)myTmpVehicles.size() - 1,
426  -1, -1, -1, false);
427  }
428 
431  return AnyVehicleIterator(this, -1, -1, -1, -1, -1, -1, false);
432  }
433 
436  virtual void releaseVehicles() const { }
438 
439 
440 
443 
444 
448  inline int getNumericalID() const {
449  return myNumericalID;
450  }
451 
452 
456  inline const PositionVector& getShape() const {
457  return myShape;
458  }
459 
461  inline double getLengthGeometryFactor() const {
462  return myLengthGeometryFactor;
463  }
464 
466  inline bool isAccelLane() const {
467  return myIsRampAccel;
468  }
469 
470  /* @brief fit the given lane position to a visibly suitable geometry position
471  * (lane length might differ from geometry length) */
472  inline double interpolateLanePosToGeometryPos(double lanePos) const {
473  return lanePos * myLengthGeometryFactor;
474  }
475 
476  /* @brief fit the given lane position to a visibly suitable geometry position
477  * and return the coordinates */
478  inline const Position geometryPositionAtOffset(double offset, double lateralOffset = 0) const {
479  return myShape.positionAtOffset(interpolateLanePosToGeometryPos(offset), lateralOffset);
480  }
481 
482  /* @brief fit the given geomtry position to a valid lane position
483  * (lane length might differ from geometry length) */
484  inline double interpolateGeometryPosToLanePos(double geometryPos) const {
485  return geometryPos / myLengthGeometryFactor;
486  }
487 
492  inline double getVehicleMaxSpeed(const SUMOVehicle* const veh) const {
493  if (myRestrictions != 0) {
494  std::map<SUMOVehicleClass, double>::const_iterator r = myRestrictions->find(veh->getVClass());
495  if (r != myRestrictions->end()) {
496  return MIN2(veh->getMaxSpeed(), r->second * veh->getChosenSpeedFactor());
497  }
498  }
499  return MIN2(veh->getMaxSpeed(), myMaxSpeed * veh->getChosenSpeedFactor());
500  }
501 
502 
506  inline double getSpeedLimit() const {
507  return myMaxSpeed;
508  }
509 
510 
514  inline double getLength() const {
515  return myLength;
516  }
517 
518 
523  return myPermissions;
524  }
525 
526 
530  double getWidth() const {
531  return myWidth;
532  }
533 
537  int getIndex() const {
538  return myIndex;
539  }
541 
543  int getCrossingIndex() const;
544 
545 
548 
556  virtual void planMovements(const SUMOTime t);
557 
563  virtual void setJunctionApproaches(const SUMOTime t);
564 
573  void updateLeaderInfo(const MSVehicle* veh, VehCont::reverse_iterator& vehPart, VehCont::reverse_iterator& vehRes, MSLeaderInfo& ahead) const;
574 
585  virtual bool executeMovements(SUMOTime t, std::vector<MSLane*>& lanesWithVehiclesToIntegrate);
586 
588  virtual bool integrateNewVehicle(SUMOTime t);
590 
591 
593  inline bool needsCollisionCheck() const {
594  return myNeedsCollisionCheck;
595  }
596 
598  inline void requireCollisionCheck() {
599  myNeedsCollisionCheck = true;
600  }
601 
603  virtual void detectCollisions(SUMOTime timestep, const std::string& stage);
604 
605 
608  virtual bool appropriate(const MSVehicle* veh);
609 
610 
612  const MSLinkCont& getLinkCont() const;
613 
615  MSLink* getLinkTo(const MSLane*) const;
616 
618  MSLink* getEntryLink() const;
619 
620 
622  bool empty() const {
623  assert(myVehBuffer.size() == 0);
624  return myVehicles.empty();
625  }
626 
630  void setMaxSpeed(double val);
631 
635  void setLength(double val);
636 
640  MSEdge& getEdge() const {
641  return *myEdge;
642  }
643 
644 
648  const MSEdge* getNextNormal() const;
649 
650 
656  const MSLane* getFirstInternalInConnection(double& offset) const;
657 
658 
661 
672  static bool dictionary(const std::string& id, MSLane* lane);
673 
674 
681  static MSLane* dictionary(const std::string& id);
682 
683 
685  static void clear();
686 
687 
691  static int dictSize() {
692  return (int)myDict.size();
693  }
694 
695 
699  static void insertIDs(std::vector<std::string>& into);
700 
701 
706  template<class RTREE>
707  static void fill(RTREE& into);
709 
710 
711 
712  // XXX: succLink does not exist... Documentation?
717  static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle& veh,
718  int nRouteSuccs,
719  const MSLane& succLinkSource,
720  const std::vector<MSLane*>& conts);
721 
722 
725  bool isLinkEnd(MSLinkCont::const_iterator& i) const;
726 
729  bool isLinkEnd(MSLinkCont::iterator& i);
730 
733  bool isEmpty() const;
734 
736  bool isInternal() const;
737 
739  MSVehicle* getLastFullVehicle() const;
740 
743 
745  MSVehicle* getLastAnyVehicle() const;
746 
748  MSVehicle* getFirstAnyVehicle() const;
749 
750  /* @brief remove the vehicle from this lane
751  * @param[notify] whether moveReminders of the vehicle shall be triggered
752  */
753  virtual MSVehicle* removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify = true);
754 
755  void leftByLaneChange(MSVehicle* v);
757 
761  MSLane* getParallelLane(int offset) const;
762 
763 
768  void setPermissions(SVCPermissions permissions, long long transientID);
769  void resetPermissions(long long transientID);
770 
771 
772  inline bool allowsVehicleClass(SUMOVehicleClass vclass) const {
773  return (myPermissions & vclass) == vclass;
774  }
775 
776  void addIncomingLane(MSLane* lane, MSLink* viaLink);
777 
778 
781  double length;
783  };
784 
785  const std::vector<IncomingLaneInfo>& getIncomingLanes() const {
786  return myIncomingLanes;
787  }
788 
789 
790  void addApproachingLane(MSLane* lane, bool warnMultiCon);
791  bool isApproachedFrom(MSEdge* const edge);
792  bool isApproachedFrom(MSEdge* const edge, MSLane* const lane);
793 
795  double getStopOffset(const MSVehicle* veh) const;
796 
798  const std::map<SVCPermissions, double>& getStopOffsets() const {
799  return myStopOffsets;
800  };
801 
803  void setStopOffsets(std::map<SVCPermissions, double> stopOffsets) {
804  myStopOffsets = stopOffsets;
805  };
806 
808  MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle* ego, double backOffset,
809  bool allSublanes, double searchDist = -1, bool ignoreMinorLinks = false) const;
810 
812  double getMissingRearGap(const MSVehicle* leader, double backOffset, double leaderSpeed) const;
813 
826  std::pair<MSVehicle* const, double> getLeader(const MSVehicle* veh, const double vehPos, const std::vector<MSLane*>& bestLaneConts, double dist = -1, bool checkTmpVehicles = false) const;
827 
850  std::pair<MSVehicle* const, double> getLeaderOnConsecutive(double dist, double seen,
851  double speed, const MSVehicle& veh, const std::vector<MSLane*>& bestLaneConts) const;
852 
854  void getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle* ego,
855  const std::vector<MSLane*>& bestLaneConts, MSLeaderDistanceInfo& result) const;
856 
874  std::pair<MSVehicle* const, double> getCriticalLeader(double dist, double seen, double speed, const MSVehicle& veh) const;
875 
876  /* @brief return the partial vehicle closest behind ego or 0
877  * if no such vehicle exists */
878  MSVehicle* getPartialBehind(const MSVehicle* ego) const;
879 
882 
894  std::set<MSVehicle*> getSurroundingVehicles(double startPos, double downstreamDist, double upstreamDist, std::shared_ptr<LaneCoverageInfo> checkedLanes) const;
895 
898  std::set<MSVehicle*> getVehiclesInRange(double a, double b) const;
899 
900 
902  std::vector<const MSJunction*> getUpcomingJunctions(double pos, double range, const std::vector<MSLane*>& contLanes) const;
904  std::vector<const MSLink*> getUpcomingLinks(double pos, double range, const std::vector<MSLane*>& contLanes) const;
905 
910 
913  MSLane* getLogicalPredecessorLane(const MSEdge& fromEdge) const;
914 
915 
922 
923 
930 
933 
935  const std::vector<std::pair<const MSLane*, const MSEdge*> > getOutgoingViaLanes() const;
936 
938 
939 
943  double getMeanSpeed() const;
944 
948  double getWaitingSeconds() const;
949 
950 
954  double getBruttoOccupancy() const;
955 
956 
960  double getNettoOccupancy() const;
961 
962 
966  inline double getBruttoVehLenSum() const {
968  }
969 
970 
974  double getCO2Emissions() const;
975 
976 
980  double getCOEmissions() const;
981 
982 
986  double getPMxEmissions() const;
987 
988 
992  double getNOxEmissions() const;
993 
994 
998  double getHCEmissions() const;
999 
1000 
1004  double getFuelConsumption() const;
1005 
1006 
1010  double getElectricityConsumption() const;
1011 
1012 
1016  double getHarmonoise_NoiseEmissions() const;
1018 
1019  void setRightSideOnEdge(double value, int rightmostSublane) {
1020  myRightSideOnEdge = value;
1021  myRightmostSublane = rightmostSublane;
1022  }
1023 
1025  void initRestrictions();
1026 
1027  double getRightSideOnEdge() const {
1028  return myRightSideOnEdge;
1029  }
1030 
1031  int getRightmostSublane() const {
1032  return myRightmostSublane;
1033  }
1034 
1035  double getCenterOnEdge() const {
1036  return myRightSideOnEdge + 0.5 * myWidth;
1037  }
1038 
1040  void sortPartialVehicles();
1041 
1043  void sortManeuverReservations();
1044 
1046  MSLane* getOpposite() const;
1047 
1049  double getOppositePos(double pos) const;
1050 
1051  /* @brief find leader for a vehicle depending on the relative driving direction
1052  * @param[in] ego The ego vehicle
1053  * @param[in] dist The look-ahead distance when looking at consecutive lanes
1054  * @param[in] oppositeDir Whether the lane has the opposite driving direction of ego
1055  * @return the leader vehicle and it's gap to ego
1056  */
1057  std::pair<MSVehicle* const, double> getOppositeLeader(const MSVehicle* ego, double dist, bool oppositeDir) const;
1058 
1059  /* @brief find follower for a vehicle that is located on the opposite of this lane
1060  * @param[in] ego The ego vehicle
1061  * @return the follower vehicle and it's gap to ego
1062  */
1063  std::pair<MSVehicle* const, double> getOppositeFollower(const MSVehicle* ego) const;
1064 
1065 
1073  std::pair<MSVehicle* const, double> getFollower(const MSVehicle* ego, double egoPos, double dist, bool ignoreMinorLinks) const;
1074 
1075 
1077  void addParking(MSVehicle* veh);
1078 
1080  virtual void removeParking(MSVehicle* veh);
1081 
1083  const std::set<const MSVehicle*>& getParkingVehicles() const {
1084  return myParkingVehicles;
1085  }
1086 
1088  virtual bool isSelected() const {
1089  return false;
1090  }
1091 
1094 
1102  void saveState(OutputDevice& out);
1103 
1115  void loadState(std::vector<std::string>& vehIDs, MSVehicleControl& vc);
1117 
1118 
1126  void visit(const LaneStoringVisitor& cont) const {
1127  cont.add(this);
1128  }
1129 
1130  static void initCollisionOptions(const OptionsCont& oc);
1131 
1132  static bool teleportOnCollision() {
1134  }
1135 
1137  return myCollisionAction;
1138  }
1139 
1140  static const long CHANGE_PERMISSIONS_PERMANENT = 0;
1141  static const long CHANGE_PERMISSIONS_GUI = 1;
1142 
1143 protected:
1145  virtual void swapAfterLaneChange(SUMOTime t);
1146 
1158  virtual void incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat,
1159  const MSLane::VehCont::iterator& at,
1161 
1163  void detectPedestrianJunctionCollision(const MSVehicle* collider, const PositionVector& colliderBoundary, const MSLane* foeLane,
1164  SUMOTime timestep, const std::string& stage);
1165 
1167  bool detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim,
1168  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1169  std::set<const MSVehicle*>& toTeleport) const;
1170 
1172  void handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim,
1173  double gap, double latGap,
1174  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1175  std::set<const MSVehicle*>& toTeleport) const;
1176 
1178  double getMaximumBrakeDist() const;
1179 
1180  /* @brief determine depart speed and whether it may be patched
1181  * @param[in] veh The departing vehicle
1182  * @param[out] whether the speed may be patched to account for safety
1183  * @return the depart speed
1184  */
1185  double getDepartSpeed(const MSVehicle& veh, bool& patchSpeed);
1186 
1187  /* @brief determine the lateral depart position
1188  * @param[in] veh The departing vehicle
1189  * @return the lateral depart position
1190  */
1191  double getDepartPosLat(const MSVehicle& veh);
1192 
1195  double safeInsertionSpeed(const MSVehicle* veh, double seen, const MSLeaderInfo& leaders, double speed);
1196 
1198  bool checkForPedestrians(const MSVehicle* aVehicle, double& speed, double& dist, double pos, bool patchSpeed) const;
1199 
1202 
1205 
1207  int myIndex;
1208 
1220  VehCont myVehicles;
1221 
1233 
1236  VehCont myTmpVehicles;
1237 
1240  VehCont myVehBuffer;
1241 
1249 
1250  /* @brief list of vehicles that are parking near this lane
1251  * (not necessarily on the road but having reached their stop on this lane)
1252  * */
1253  std::set<const MSVehicle*> myParkingVehicles;
1254 
1256  double myLength;
1257 
1259  const double myWidth;
1260 
1264  std::map<SVCPermissions, double> myStopOffsets;
1265 
1267  MSEdge* const myEdge;
1268 
1270  double myMaxSpeed;
1271 
1274 
1277 
1279  const std::map<SUMOVehicleClass, double>* myRestrictions;
1280 
1282  std::vector<IncomingLaneInfo> myIncomingLanes;
1283 
1286 
1289 
1292 
1295 
1298 
1302 
1304  std::map<MSEdge*, std::vector<MSLane*> > myApproachingLanes;
1305 
1310 
1312 
1317 
1320 
1322  const bool myIsRampAccel;
1323 
1328 
1331 
1332  // @brief the ids of neighboring lanes
1333  std::vector<std::string> myNeighs;
1334 
1335  // @brief transient changes in permissions
1336  std::map<long long, SVCPermissions> myPermissionChanges;
1337 
1339  typedef std::map< std::string, MSLane* > DictType;
1340 
1342  static DictType myDict;
1343 
1344 private:
1346  std::vector< MSMoveReminder* > myMoveReminders;
1347 
1353 
1359  public:
1361  explicit vehicle_position_sorter(const MSLane* lane) :
1362  myLane(lane) {
1363  }
1364 
1365 
1371  int operator()(MSVehicle* v1, MSVehicle* v2) const;
1372 
1373  const MSLane* myLane;
1374 
1375  };
1376 
1382  public:
1384  explicit vehicle_natural_position_sorter(const MSLane* lane) :
1385  myLane(lane) {
1386  }
1387 
1388 
1394  int operator()(MSVehicle* v1, MSVehicle* v2) const;
1395 
1396  const MSLane* myLane;
1397 
1398  };
1399 
1405  public:
1407  explicit by_connections_to_sorter(const MSEdge* const e);
1408 
1410  int operator()(const MSEdge* const e1, const MSEdge* const e2) const;
1411 
1412  private:
1413  by_connections_to_sorter& operator=(const by_connections_to_sorter&); // just to avoid a compiler warning
1414  private:
1415  const MSEdge* const myEdge;
1416  double myLaneDir;
1417  };
1418 
1419 
1420 
1426  public:
1428  explicit incoming_lane_priority_sorter(const MSLane* targetLane);
1429 
1431  int operator()(const IncomingLaneInfo& lane1, const IncomingLaneInfo& lane2) const;
1432 
1433  private:
1434  incoming_lane_priority_sorter& operator=(const incoming_lane_priority_sorter&); // just to avoid a compiler warning
1435  private:
1436  const MSLane* const myLane;
1437  double myLaneDir;
1438  };
1439 
1440 
1446  public:
1448  explicit outgoing_lane_priority_sorter(const MSLane* sourceLane);
1449 
1451  int operator()(const MSLink* link1, const MSLink* link2) const;
1452 
1453  private:
1454  outgoing_lane_priority_sorter& operator=(const outgoing_lane_priority_sorter&); // just to avoid a compiler warning
1455  private:
1456  const MSLane* const myLane;
1457  double myLaneDir;
1458  };
1459 
1463  class edge_finder {
1464  public:
1465  edge_finder(MSEdge* e) : myEdge(e) {}
1466  bool operator()(const IncomingLaneInfo& ili) const {
1467  return &(ili.lane->getEdge()) == myEdge;
1468  }
1469  private:
1470  edge_finder& operator=(const edge_finder&); // just to avoid a compiler warning
1471  private:
1472  const MSEdge* const myEdge;
1473  };
1474 
1475 private:
1477  MSLane(const MSLane&);
1478 
1480  MSLane& operator=(const MSLane&);
1481 
1482 
1483 };
1484 
1485 
1486 #endif
1487 
1488 /****************************************************************************/
1489 
void detectPedestrianJunctionCollision(const MSVehicle *collider, const PositionVector &colliderBoundary, const MSLane *foeLane, SUMOTime timestep, const std::string &stage)
detect whether a vehicle collids with pedestrians on the junction
Definition: MSLane.cpp:1370
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition: MSLane.h:785
std::pair< MSVehicle *const, double > getFollower(const MSVehicle *ego, double egoPos, double dist, bool ignoreMinorLinks) const
Find follower vehicle for the given ego vehicle (which may be on the opposite direction lane) ...
Definition: MSLane.cpp:3380
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:2531
void loadState(std::vector< std::string > &vehIDs, MSVehicleControl &vc)
Loads the state of this segment with the given parameters.
Definition: MSLane.cpp:2893
SVCPermissions myPermissions
The vClass permissions for this lane.
Definition: MSLane.h:1273
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:2407
VehCont myVehicles
The lane&#39;s vehicles. This container holds all vehicles that have their front (longitudinally) and the...
Definition: MSLane.h:1220
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:492
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:129
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2626
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:640
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
long long int SUMOTime
Definition: SUMOTime.h:36
MSVehicle * getFirstFullVehicle() const
returns the first vehicle for which this lane is responsible or 0
Definition: MSLane.cpp:1889
bool detectCollisionBetween(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *> &toTeleport) const
detect whether there is a collision between the two vehicles
Definition: MSLane.cpp:1403
MSLane(const std::string &id, double maxSpeed, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, int index, bool isRampAccel)
Constructor.
Definition: MSLane.cpp:171
void sortManeuverReservations()
sorts myManeuverReservations
Definition: MSLane.cpp:1840
const MSEdge * getNextNormal() const
Returns the lane&#39;s follower if it is an internal lane, the edge of the lane otherwise.
Definition: MSLane.cpp:1702
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
Definition: MSLane.cpp:1762
std::set< MSVehicle * > getSurroundingVehicles(double startPos, double downstreamDist, double upstreamDist, std::shared_ptr< LaneCoverageInfo > checkedLanes) const
Returns all vehicles closer than downstreamDist along the along the road network starting on the give...
Definition: MSLane.cpp:3212
void updateLeaderInfo(const MSVehicle *veh, VehCont::reverse_iterator &vehPart, VehCont::reverse_iterator &vehRes, MSLeaderInfo &ahead) const
This updates the MSLeaderInfo argument with respect to the given MSVehicle. All leader-vehicles on th...
Definition: MSLane.cpp:1153
Sorts lanes (IncomingLaneInfos) by their priority or, if this doesn&#39;t apply, wrt. the angle differenc...
Definition: MSLane.h:1425
virtual void removeParking(MSVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
Definition: MSLane.cpp:2877
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir) const
Definition: MSLane.cpp:3399
std::map< const MSLane *, std::pair< double, double > > LaneCoverageInfo
Coverage info.
Definition: MSLane.h:60
static bool teleportOnCollision()
Definition: MSLane.h:1132
static const long CHANGE_PERMISSIONS_GUI
Definition: MSLane.h:1141
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
bool checkFailure(const MSVehicle *aVehicle, double &speed, double &dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const
Definition: MSLane.cpp:577
int myI2
index for myPartialVehicles
Definition: MSLane.h:158
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2650
bool isInsertionSuccess(MSVehicle *vehicle, double speed, double pos, double posLat, bool recheckNextLanes, MSMoveReminder::Notification notification)
Tries to insert the given vehicle with the given state (speed and pos)
Definition: MSLane.cpp:606
static void fill(RTREE &into)
Fills the given RTree with lane instances.
Definition: MSLane.cpp:1770
double getMaximumBrakeDist() const
compute maximum braking distance on this lane
Definition: MSLane.cpp:2133
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
Definition: MSLane.cpp:2020
std::vector< IncomingLaneInfo > myIncomingLanes
All direct predecessor lanes.
Definition: MSLane.h:1282
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
int myI2End
end index for myPartialVehicles
Definition: MSLane.h:164
std::vector< const MSJunction * > getUpcomingJunctions(double pos, double range, const std::vector< MSLane *> &contLanes) const
Returns all upcoming junctions within given range along the given (non-internal) continuation lanes m...
Definition: MSLane.cpp:3300
void addLink(MSLink *link)
Delayed initialization.
Definition: MSLane.cpp:216
MSLane * myCanonicalPredecessorLane
Similar to LogicalPredecessorLane,.
Definition: MSLane.h:1288
int myIndex
The lane index.
Definition: MSLane.h:1207
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:1804
static double myCollisionMinGapFactor
Definition: MSLane.h:1352
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
Definition: MSLane.h:1314
bool needsCollisionCheck() const
short-circut collision check if nothing changed since the last check
Definition: MSLane.h:593
bool operator()(const MSVehicle *cmp, double pos) const
compares vehicle position to the detector position
Definition: MSLane.cpp:2691
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane...
Definition: MSLane.h:107
static SUMOTime myCollisionStopTime
Definition: MSLane.h:1351
Notification
Definition of a vehicle state.
virtual void resetManeuverReservation(MSVehicle *v)
Unregisters a vehicle, which previously registered for maneuvering into this lane.
Definition: MSLane.cpp:288
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2045
double myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
Definition: MSLane.h:1294
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
Definition: MSLane.cpp:1912
const MSEdge *const myEdge
Definition: MSLane.h:1415
std::map< long long, SVCPermissions > myPermissionChanges
Definition: MSLane.h:1336
void addIncomingLane(MSLane *lane, MSLink *viaLink)
Definition: MSLane.cpp:2069
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2614
void visit(const LaneStoringVisitor &cont) const
Callback for visiting the lane when traversing an RTree.
Definition: MSLane.h:1126
std::set< MSVehicle * > getVehiclesInRange(double a, double b) const
Returns all vehicles on the lane overlapping with the interval [a,b].
Definition: MSLane.cpp:3264
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:514
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:406
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:456
bool isLinkEnd(MSLinkCont::const_iterator &i) const
Definition: MSLane.cpp:1859
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:3451
Realises dumping the complete network state.
Definition: MSXMLRawOut.h:55
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
Definition: MSLane.cpp:234
MSLink * getLinkTo(const MSLane *) const
returns the link to the given lane or 0, if it is not connected
Definition: MSLane.cpp:1982
void leftByLaneChange(MSVehicle *v)
Definition: MSLane.cpp:2506
MSLane * getCanonicalPredecessorLane() const
Definition: MSLane.cpp:2443
void addNeigh(const std::string &id)
Adds a neighbor to this lane.
Definition: MSLane.cpp:222
const std::vector< MSMoveReminder *> & getMoveReminders() const
Return the list of this lane&#39;s move reminders.
Definition: MSLane.h:246
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:244
VehCont myPartialVehicles
The lane&#39;s partial vehicles. This container holds all vehicles that are partially on this lane but wh...
Definition: MSLane.h:1232
static bool myCheckJunctionCollisions
Definition: MSLane.h:1350
virtual void setManeuverReservation(MSVehicle *v)
Registers the lane change intentions (towards this lane) for the given vehicle.
Definition: MSLane.cpp:277
double getWidth() const
Returns the lane&#39;s width.
Definition: MSLane.h:530
int myI1End
end index for myVehicles
Definition: MSLane.h:162
int myDirection
index delta
Definition: MSLane.h:170
PositionVector myShape
The shape of the lane.
Definition: MSLane.h:1204
int myI3
index for myTmpVehicles
Definition: MSLane.h:160
MSLane * getCanonicalSuccessorLane() const
Definition: MSLane.cpp:2463
std::set< const MSVehicle * > myParkingVehicles
Definition: MSLane.h:1253
void getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle *ego, const std::vector< MSLane *> &bestLaneConts, MSLeaderDistanceInfo &result) const
Returns the immediate leaders and the distance to them (as getLeaderOnConsecutive but for the sublane...
Definition: MSLane.cpp:3084
bool myDownstream
iteration direction
Definition: MSLane.h:168
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
Definition: MSLane.h:387
void requireCollisionCheck()
require another collision check due to relevant changes in the simulation
Definition: MSLane.h:598
Performs lane changing of vehicles.
std::vector< std::string > myNeighs
Definition: MSLane.h:1333
static CollisionAction myCollisionAction
the action to take on collisions
Definition: MSLane.h:1349
int getNumericalID() const
Returns this lane&#39;s numerical id.
Definition: MSLane.h:448
std::map< std::string, MSLane *> DictType
definition of the static dictionary type
Definition: MSLane.h:1339
static CollisionAction getCollisionAction()
Definition: MSLane.h:1136
int getPartialVehicleNumber() const
Returns the number of vehicles partially on this lane (for which this lane is not responsible) ...
Definition: MSLane.h:395
MSLinkCont myLinks
Definition: MSLane.h:1301
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:1203
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSLane.h:1342
Sorts lanes (their origin link) by the priority of their noninternal target edges or...
Definition: MSLane.h:1445
bool isInternal() const
Definition: MSLane.cpp:1875
void addApproachingLane(MSLane *lane, bool warnMultiCon)
Definition: MSLane.cpp:2079
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:48
A road/street connecting two junctions.
Definition: MSEdge.h:75
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:501
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle&#39;s access class.
double getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
Definition: MSLane.h:966
double myLength
Lane length [m].
Definition: MSLane.h:1256
int getIndex() const
Returns the lane&#39;s index.
Definition: MSLane.h:537
void resetPermissions(long long transientID)
Definition: MSLane.cpp:3483
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
Definition: MSLane.h:1236
void setPermissions(SVCPermissions permissions, long long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
Definition: MSLane.cpp:3471
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
Definition: MSLane.cpp:2003
static int dictSize()
Returns the number of stored lanes.
Definition: MSLane.h:691
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1 ...
Definition: MSLane.cpp:2520
Export the queueing length in front of a junction (very experimental!)
Definition: MSQueueExport.h:50
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:258
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2590
const bool myIsRampAccel
whether this lane is an acceleration lane
Definition: MSLane.h:1322
const MSEdge *const myEdge
Definition: MSLane.h:1472
Representation of a vehicle.
Definition: SUMOVehicle.h:60
friend class AnyVehicleIterator
Definition: MSLane.h:87
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
Definition: MSLane.cpp:2027
double interpolateGeometryPosToLanePos(double geometryPos) const
Definition: MSLane.h:484
Sorts vehicles by their position (descending)
Definition: MSLane.h:1358
double myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
Definition: MSLane.h:1325
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
double getCenterOnEdge() const
Definition: MSLane.h:1035
bool lastInsertion(MSVehicle &veh, double mspeed, double posLat, bool patchSpeed)
inserts vehicle as close as possible to the last vehicle on this lane (or at the end of the lane if t...
Definition: MSLane.cpp:327
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
Definition: MSLane.h:1276
A list of positions.
void enteredByLaneChange(MSVehicle *v)
Definition: MSLane.cpp:2513
virtual void setJunctionApproaches(const SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. ...
Definition: MSLane.cpp:1146
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, double latOffset, double minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
Definition: MSLane.cpp:1002
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
Definition: MSLane.h:379
const std::map< SUMOVehicleClass, double > * myRestrictions
The vClass speed restrictions for this lane.
Definition: MSLane.h:1279
bool isEmpty() const
Definition: MSLane.cpp:1870
bool checkForPedestrians(const MSVehicle *aVehicle, double &speed, double &dist, double pos, bool patchSpeed) const
check whether pedestrians on this lane interfere with vehicle insertion
Definition: MSLane.cpp:3498
std::pair< MSVehicle *const, double > getOppositeFollower(const MSVehicle *ego) const
Definition: MSLane.cpp:3422
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:522
double safeInsertionSpeed(const MSVehicle *veh, double seen, const MSLeaderInfo &leaders, double speed)
return the maximum safe speed for insertion behind leaders (a negative value indicates that safe inse...
Definition: MSLane.cpp:973
double getSpeedLimit() const
Returns the lane&#39;s maximum allowed speed.
Definition: MSLane.h:506
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Sorts edges by their angle relative to the given edge (straight comes first)
Definition: MSLane.h:1404
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
Definition: MSLane.cpp:964
void setStopOffsets(std::map< SVCPermissions, double > stopOffsets)
Set vehicle class specific stopOffsets.
Definition: MSLane.h:803
void add(const MSLane *const l) const
Adds the given object to the container.
Definition: Helper.cpp:61
T MIN2(T a, T b)
Definition: StdDefs.h:70
MSVehicle * getPartialBehind(const MSVehicle *ego) const
Definition: MSLane.cpp:3174
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition: MSLane.h:1088
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction ...
Definition: MSLane.h:418
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction ...
Definition: MSLane.h:412
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
Definition: MSLane.cpp:2484
virtual bool executeMovements(SUMOTime t, std::vector< MSLane *> &lanesWithVehiclesToIntegrate)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:1593
std::pair< MSVehicle *const, double > getLeader(const MSVehicle *veh, const double vehPos, const std::vector< MSLane *> &bestLaneConts, double dist=-1, bool checkTmpVehicles=false) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
Definition: MSLane.cpp:2143
CollisionAction
Definition: MSLane.h:179
int myRightmostSublane
the index of the rightmost sublane of this lane on myEdge
Definition: MSLane.h:1327
MSLane * myLogicalPredecessorLane
Definition: MSLane.h:1285
Something on a lane to be noticed about vehicle movement.
const std::vector< std::pair< const MSLane *, const MSEdge * > > getOutgoingViaLanes() const
get the list of outgoing lanes
Definition: MSLane.cpp:2495
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
Definition: MSLane.cpp:3359
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction ...
Definition: MSLane.h:424
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:2034
An upper class for objects with additional parameters.
Definition: Parameterised.h:44
double getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2638
virtual double getChosenSpeedFactor() const =0
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
All direct internal and direct (disregarding internal predecessors) non-internal predecessor lanes of...
Definition: MSLane.h:1304
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:90
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane *> &conts)
Definition: MSLane.cpp:1926
const std::map< SVCPermissions, double > & getStopOffsets() const
Returns vehicle class specific stopOffsets.
Definition: MSLane.h:798
Base class for objects which have an id.
Definition: Named.h:58
std::map< SVCPermissions, double > myStopOffsets
Definition: MSLane.h:1264
int myNumericalID
Unique numerical ID (set on reading by netload)
Definition: MSLane.h:1201
std::vector< MSMoveReminder *> myMoveReminders
This lane&#39;s move reminder.
Definition: MSLane.h:1346
VehCont myManeuverReservations
The vehicles which registered maneuvering into the lane within their current action step...
Definition: MSLane.h:1248
virtual double getMaxSpeed() const =0
Returns the vehicle&#39;s maximum speed.
double getRightSideOnEdge() const
Definition: MSLane.h:1027
MSLeaderInfo getPartialBeyond() const
get all vehicles that are inlapping from consecutive edges
Definition: MSLane.cpp:3197
void initRestrictions()
initialized vClass-specific speed limits
Definition: MSLane.cpp:208
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSLane.h:461
AnyVehicleIterator(const MSLane *lane, int i1, int i2, int i3, const int i1End, const int i2End, const int i3End, bool downstream=true)
Definition: MSLane.h:109
int getRightmostSublane() const
Definition: MSLane.h:1031
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
Definition: MSLane.cpp:1880
void sortPartialVehicles()
sorts myPartialVehicles
Definition: MSLane.cpp:1832
bool freeInsertion(MSVehicle &veh, double speed, double posLat, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Tries to insert the given vehicle on any place.
Definition: MSLane.cpp:362
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2662
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1730
The vehicle has departed (was inserted into the network)
double getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2602
std::pair< MSVehicle *const, double > getLeaderOnConsecutive(double dist, double seen, double speed, const MSVehicle &veh, const std::vector< MSLane *> &bestLaneConts) const
Returns the immediate leader and the distance to him.
Definition: MSLane.cpp:2208
int myI1
index for myVehicles
Definition: MSLane.h:156
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
Definition: MSLane.cpp:3368
bool operator()(const IncomingLaneInfo &ili) const
Definition: MSLane.h:1466
static void clear()
Clears the dictionary.
Definition: MSLane.cpp:1753
const MSLane * getFirstInternalInConnection(double &offset) const
Returns 0 if the lane is not internal. Otherwise the first part of the connection (sequence of intern...
Definition: MSLane.cpp:1712
int myI3End
end index for myTmpVehicles
Definition: MSLane.h:166
MSEdge *const myEdge
The lane&#39;s edge, for routing only.
Definition: MSLane.h:1267
const MSVehicle * operator->()
Definition: MSLane.h:142
const MSLane * myLane
the lane that is being iterated
Definition: MSLane.h:154
A storage for options typed value containers)
Definition: OptionsCont.h:92
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:472
void handleCollisionBetween(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, double gap, double latGap, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *> &toTeleport) const
take action upon collision
Definition: MSLane.cpp:1469
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
Definition: MSLane.cpp:1898
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:478
bool isApproachedFrom(MSEdge *const edge)
Definition: MSLane.cpp:2093
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:2674
double getStopOffset(const MSVehicle *veh) const
Returns vehicle class specific stopOffset for the vehicle.
Definition: MSLane.cpp:2908
std::pair< MSVehicle *const, double > getCriticalLeader(double dist, double seen, double speed, const MSVehicle &veh) const
Returns the most dangerous leader and the distance to him.
Definition: MSLane.cpp:2334
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
Definition: MSLane.h:430
const MSLeaderInfo & getFirstVehicleInformation(const MSVehicle *ego, double latOffset, bool onlyFrontOnLane, double maxPos=std::numeric_limits< double >::max(), bool allowCached=true) const
analogue to getLastVehicleInformation but in the upstream direction
Definition: MSLane.cpp:1055
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: MSLane.h:772
MSLane & operator=(const MSLane &)
invalidated assignment operator
const std::set< const MSVehicle * > & getParkingVehicles() const
retrieve the parking vehicles (see GUIParkingArea)
Definition: MSLane.h:1083
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
Definition: MSLane.cpp:2882
MSLeaderInfo myLeaderInfo
leaders on all sublanes as seen by approaching vehicles (cached)
Definition: MSLane.h:1307
MSLane * myCanonicalSuccessorLane
Main successor lane,.
Definition: MSLane.h:1291
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
double myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
Definition: MSLane.h:1297
double getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2574
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
Definition: MSLane.h:1309
virtual ~MSLane()
Destructor.
Definition: MSLane.cpp:200
void addParking(MSVehicle *veh)
add parking vehicle. This should only used during state loading
Definition: MSLane.cpp:2871
The class responsible for building and deletion of vehicles.
double getMissingRearGap(const MSVehicle *leader, double backOffset, double leaderSpeed) const
return by how much further the leader must be inserted to avoid rear end collisions ...
Definition: MSLane.cpp:2117
const double myLengthGeometryFactor
precomputed myShape.length / myLength
Definition: MSLane.h:1319
MSLeaderInfo myLeaderInfoTmp
Definition: MSLane.h:1311
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:1975
VehCont myVehBuffer
Buffer for vehicles that moved from their previous lane onto this one. Integrated after all vehicles ...
Definition: MSLane.h:1240
double getDepartPosLat(const MSVehicle &veh)
Definition: MSLane.cpp:477
static const long CHANGE_PERMISSIONS_PERMANENT
Definition: MSLane.h:1140
MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle *ego, double backOffset, bool allSublanes, double searchDist=-1, bool ignoreMinorLinks=false) const
return the sublane followers with the largest missing rear gap among all predecessor lanes (within di...
Definition: MSLane.cpp:2922
bool empty() const
Returns true if there is not a single vehicle on the lane.
Definition: MSLane.h:622
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
Definition: MSLane.h:1316
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:436
double myMaxSpeed
Lane-wide speedlimit [m/s].
Definition: MSLane.h:1270
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
Definition: MSLane.cpp:2546
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
std::vector< const MSLink * > getUpcomingLinks(double pos, double range, const std::vector< MSLane *> &contLanes) const
Returns all upcoming junctions within given range along the given (non-internal) continuation lanes m...
Definition: MSLane.cpp:3311
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
Definition: MSLane.cpp:2561
bool myNeedsCollisionCheck
whether a collision check is currently needed
Definition: MSLane.h:1330
const double myWidth
Lane width [m].
Definition: MSLane.h:1259
edge_finder(MSEdge *e)
Definition: MSLane.h:1465
void setRightSideOnEdge(double value, int rightmostSublane)
Definition: MSLane.h:1019
bool isAccelLane() const
return whether this lane is an acceleration lane
Definition: MSLane.h:466
virtual void incorporateVehicle(MSVehicle *veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: MSLane.cpp:306
virtual bool appropriate(const MSVehicle *veh)
Definition: MSLane.cpp:1786
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
Definition: MSLane.cpp:1107
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
Definition: MSLane.cpp:2063
vehicle_position_sorter(const MSLane *lane)
Constructor.
Definition: MSLane.h:1361
vehicle_natural_position_sorter(const MSLane *lane)
Constructor.
Definition: MSLane.h:1384
double getDepartSpeed(const MSVehicle &veh, bool &patchSpeed)
Definition: MSLane.cpp:450