Eclipse 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-2019 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 
50 #ifdef HAVE_FOX
52 #endif
53 
54 
55 // ===========================================================================
56 // class declarations
57 // ===========================================================================
58 class MSEdge;
59 class MSVehicle;
60 class MSLaneChanger;
61 class MSLink;
62 class MSVehicleTransfer;
63 class MSVehicleControl;
64 class OutputDevice;
66 
67 // ===========================================================================
68 // type definitions
69 // ===========================================================================
71 typedef std::map<const MSLane*, std::pair<double, double> > LaneCoverageInfo; // also declared in libsumo/Helper.h!
72 
73 // ===========================================================================
74 // class definitions
75 // ===========================================================================
83 class MSLane : public Named, public Parameterised {
84 public:
86  friend class MSLaneChanger;
87  friend class MSLaneChangerSublane;
88 
89  friend class MSQueueExport;
90  friend class AnyVehicleIterator;
91 
93  typedef std::vector<MSVehicle*> VehCont;
94 
97  struct VehPosition : public std::binary_function < const MSVehicle*, double, bool > {
99  bool operator()(const MSVehicle* cmp, double pos) const;
100  };
101 
102  // TODO: Better documentation
111  public:
113  const MSLane* lane,
114  int i1,
115  int i2,
116  int i3,
117  const int i1End,
118  const int i2End,
119  const int i3End,
120  bool downstream = true) :
121  myLane(lane),
122  myI1(i1),
123  myI2(i2),
124  myI3(i3),
125  myI1End(i1End),
126  myI2End(i2End),
127  myI3End(i3End),
128  myDownstream(downstream),
129  myDirection(downstream ? 1 : -1) {
130  }
131 
132  bool operator== (AnyVehicleIterator const& other) const {
133  return (myI1 == other.myI1
134  && myI2 == other.myI2
135  && myI3 == other.myI3
136  && myI1End == other.myI1End
137  && myI2End == other.myI2End
138  && myI3End == other.myI3End);
139  }
140 
141  bool operator!= (AnyVehicleIterator const& other) const {
142  return !(*this == other);
143  }
144 
146  return **this;
147  }
148 
149  const MSVehicle* operator*();
150 
152 
153  private:
154  bool nextIsMyVehicles() const;
155 
157  const MSLane* myLane;
159  int myI1;
161  int myI2;
163  int myI3;
165  int myI1End;
167  int myI2End;
169  int myI3End;
174 
175  };
176 
177 
178 public:
187  };
188 
203  MSLane(const std::string& id, double maxSpeed, double length, MSEdge* const edge,
204  int numericalID, const PositionVector& shape, double width,
205  SVCPermissions permissions, int index, bool isRampAccel,
206  const std::string& type);
207 
208 
210  virtual ~MSLane();
211 
213  void setRNGIndex(const int rngIndex) {
214  myRNGIndex = rngIndex;
215  }
216 
218  int getRNGIndex() const {
219  return myRNGIndex;
220  }
221 
223  std::mt19937* getRNG() const {
224  return &myRNGs[myRNGIndex];
225  }
226 
228  static int getNumRNGs() {
229  return (int)myRNGs.size();
230  }
231 
234 
242  void addLink(MSLink* link);
243 
248  void addNeigh(const std::string& id);
250 
251 
252 
255 
262  virtual void addMoveReminder(MSMoveReminder* rem);
263 
264 
268  inline const std::vector< MSMoveReminder* >& getMoveReminders() const {
269  return myMoveReminders;
270  }
272 
273 
274 
277 
293  bool insertVehicle(MSVehicle& v);
294 
295 
314  bool isInsertionSuccess(MSVehicle* vehicle, double speed, double pos, double posLat,
315  bool recheckNextLanes,
316  MSMoveReminder::Notification notification);
317 
318  // XXX: Documentation?
319  bool checkFailure(const MSVehicle* aVehicle, double& speed, double& dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const;
320 
324  bool lastInsertion(MSVehicle& veh, double mspeed, double posLat, bool patchSpeed);
325 
333  bool freeInsertion(MSVehicle& veh, double speed, double posLat,
335 
336 
346  void forceVehicleInsertion(MSVehicle* veh, double pos, MSMoveReminder::Notification notification, double posLat = 0);
348 
349 
350 
354 
361  virtual double setPartialOccupation(MSVehicle* v);
362 
366  virtual void resetPartialOccupation(MSVehicle* v);
367 
370  virtual void setManeuverReservation(MSVehicle* v);
371 
375  virtual void resetManeuverReservation(MSVehicle* v);
376 
387  const MSLeaderInfo getLastVehicleInformation(const MSVehicle* ego, double latOffset, double minPos = 0, bool allowCached = true) const;
388 
390  const MSLeaderInfo getFirstVehicleInformation(const MSVehicle* ego, double latOffset, bool onlyFrontOnLane, double maxPos = std::numeric_limits<double>::max(), bool allowCached = true) const;
391 
393 
396 
401  int getVehicleNumber() const {
402  return (int)myVehicles.size();
403  }
404 
410  return (int)myVehicles.size() + (int)myPartialVehicles.size();
411  }
412 
418  return (int)myPartialVehicles.size();
419  }
420 
421 
428  virtual const VehCont& getVehiclesSecure() const {
429  return myVehicles;
430  }
431 
432 
435  return AnyVehicleIterator(this, 0, 0, 0,
436  (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(), true);
437  }
438 
441  return AnyVehicleIterator(this, (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(),
442  (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(), true);
443  }
444 
447  return AnyVehicleIterator(this, (int)myVehicles.size() - 1, (int)myPartialVehicles.size() - 1, (int)myTmpVehicles.size() - 1,
448  -1, -1, -1, false);
449  }
450 
453  return AnyVehicleIterator(this, -1, -1, -1, -1, -1, -1, false);
454  }
455 
458  virtual void releaseVehicles() const { }
460 
461 
462 
465 
466 
470  inline int getNumericalID() const {
471  return myNumericalID;
472  }
473 
474 
478  inline const PositionVector& getShape() const {
479  return myShape;
480  }
481 
483  inline double getLengthGeometryFactor() const {
484  return myLengthGeometryFactor;
485  }
486 
488  inline bool isAccelLane() const {
489  return myIsRampAccel;
490  }
491 
493  const std::string& getLaneType() const {
494  return myLaneType;
495  }
496 
497  /* @brief fit the given lane position to a visibly suitable geometry position
498  * (lane length might differ from geometry length) */
499  inline double interpolateLanePosToGeometryPos(double lanePos) const {
500  return lanePos * myLengthGeometryFactor;
501  }
502 
503  /* @brief fit the given lane position to a visibly suitable geometry position
504  * and return the coordinates */
505  inline const Position geometryPositionAtOffset(double offset, double lateralOffset = 0) const {
506  return myShape.positionAtOffset(interpolateLanePosToGeometryPos(offset), lateralOffset);
507  }
508 
509  /* @brief fit the given geometry position to a valid lane position
510  * (lane length might differ from geometry length) */
511  inline double interpolateGeometryPosToLanePos(double geometryPos) const {
512  return geometryPos / myLengthGeometryFactor;
513  }
514 
519  inline double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const {
520  if (myRestrictions != 0) {
521  std::map<SUMOVehicleClass, double>::const_iterator r = myRestrictions->find(veh->getVClass());
522  if (r != myRestrictions->end()) {
523  return MIN2(veh->getMaxSpeed(), r->second * veh->getChosenSpeedFactor());
524  }
525  }
526  return MIN2(veh->getMaxSpeed(), myMaxSpeed * veh->getChosenSpeedFactor());
527  }
528 
529 
533  inline double getSpeedLimit() const {
534  return myMaxSpeed;
535  }
536 
537 
541  inline double getLength() const {
542  return myLength;
543  }
544 
545 
550  return myPermissions;
551  }
552 
553 
557  double getWidth() const {
558  return myWidth;
559  }
560 
564  int getIndex() const {
565  return myIndex;
566  }
568 
570  int getCrossingIndex() const;
571 
572 
575 
583  virtual void planMovements(const SUMOTime t);
584 
590  virtual void setJunctionApproaches(const SUMOTime t) const;
591 
600  void updateLeaderInfo(const MSVehicle* veh, VehCont::reverse_iterator& vehPart, VehCont::reverse_iterator& vehRes, MSLeaderInfo& ahead) const;
601 
612  virtual void executeMovements(const SUMOTime t);
613 
615  virtual void integrateNewVehicles();
616 
618  void updateLengthSum();
620 
621 
623  inline bool needsCollisionCheck() const {
624  return myNeedsCollisionCheck;
625  }
626 
628  inline void requireCollisionCheck() {
629  myNeedsCollisionCheck = true;
630  }
631 
633  virtual void detectCollisions(SUMOTime timestep, const std::string& stage);
634 
635 
638  virtual bool appropriate(const MSVehicle* veh);
639 
640 
642  const MSLinkCont& getLinkCont() const;
643 
645  MSLink* getLinkTo(const MSLane*) const;
646 
648  MSLink* getEntryLink() const;
649 
650 
652  bool empty() const {
653  assert(myVehBuffer.size() == 0);
654  return myVehicles.empty();
655  }
656 
660  void setMaxSpeed(double val);
661 
665  void setLength(double val);
666 
670  MSEdge& getEdge() const {
671  return *myEdge;
672  }
673 
674 
678  const MSEdge* getNextNormal() const;
679 
680 
686  const MSLane* getFirstInternalInConnection(double& offset) const;
687 
688 
691 
702  static bool dictionary(const std::string& id, MSLane* lane);
703 
704 
711  static MSLane* dictionary(const std::string& id);
712 
713 
715  static void clear();
716 
717 
721  static int dictSize() {
722  return (int)myDict.size();
723  }
724 
725 
729  static void insertIDs(std::vector<std::string>& into);
730 
731 
736  template<class RTREE>
737  static void fill(RTREE& into);
738 
739 
741  static void initRNGs(const OptionsCont& oc);
743 
744 
745 
746  // XXX: succLink does not exist... Documentation?
751  static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle& veh,
752  int nRouteSuccs,
753  const MSLane& succLinkSource,
754  const std::vector<MSLane*>& conts);
755 
756 
759  bool isLinkEnd(MSLinkCont::const_iterator& i) const;
760 
763  bool isLinkEnd(MSLinkCont::iterator& i);
764 
767  bool isEmpty() const;
768 
770  bool isInternal() const;
771 
773  MSVehicle* getLastFullVehicle() const;
774 
777 
779  MSVehicle* getLastAnyVehicle() const;
780 
782  MSVehicle* getFirstAnyVehicle() const;
783 
784  /* @brief remove the vehicle from this lane
785  * @param[notify] whether moveReminders of the vehicle shall be triggered
786  */
787  virtual MSVehicle* removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify = true);
788 
789  void leftByLaneChange(MSVehicle* v);
791 
795  MSLane* getParallelLane(int offset, bool includeOpposite = true) const;
796 
797 
802  void setPermissions(SVCPermissions permissions, long long transientID);
803  void resetPermissions(long long transientID);
804 
805 
806  inline bool allowsVehicleClass(SUMOVehicleClass vclass) const {
807  return (myPermissions & vclass) == vclass;
808  }
809 
810  void addIncomingLane(MSLane* lane, MSLink* viaLink);
811 
812 
815  double length;
817  };
818 
819  const std::vector<IncomingLaneInfo>& getIncomingLanes() const {
820  return myIncomingLanes;
821  }
822 
823 
824  void addApproachingLane(MSLane* lane, bool warnMultiCon);
825  bool isApproachedFrom(MSEdge* const edge);
826  bool isApproachedFrom(MSEdge* const edge, MSLane* const lane);
827 
829  double getStopOffset(const MSVehicle* veh) const;
830 
832  const std::map<SVCPermissions, double>& getStopOffsets() const {
833  return myStopOffsets;
834  };
835 
837  void setStopOffsets(std::map<SVCPermissions, double> stopOffsets) {
838  myStopOffsets = stopOffsets;
839  };
840 
842  MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle* ego, double backOffset,
843  bool allSublanes, double searchDist = -1, bool ignoreMinorLinks = false) const;
844 
846  double getMissingRearGap(const MSVehicle* leader, double backOffset, double leaderSpeed) const;
847 
860  std::pair<MSVehicle* const, double> getLeader(const MSVehicle* veh, const double vehPos, const std::vector<MSLane*>& bestLaneConts, double dist = -1, bool checkTmpVehicles = false) const;
861 
884  std::pair<MSVehicle* const, double> getLeaderOnConsecutive(double dist, double seen,
885  double speed, const MSVehicle& veh, const std::vector<MSLane*>& bestLaneConts) const;
886 
888  void getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle* ego,
889  const std::vector<MSLane*>& bestLaneConts, MSLeaderDistanceInfo& result) const;
890 
908  std::pair<MSVehicle* const, double> getCriticalLeader(double dist, double seen, double speed, const MSVehicle& veh) const;
909 
910  /* @brief return the partial vehicle closest behind ego or 0
911  * if no such vehicle exists */
912  MSVehicle* getPartialBehind(const MSVehicle* ego) const;
913 
916 
928  std::set<MSVehicle*> getSurroundingVehicles(double startPos, double downstreamDist, double upstreamDist, std::shared_ptr<LaneCoverageInfo> checkedLanes) const;
929 
932  std::set<MSVehicle*> getVehiclesInRange(const double a, const double b) const;
933 
934 
936  std::vector<const MSJunction*> getUpcomingJunctions(double pos, double range, const std::vector<MSLane*>& contLanes) const;
938  std::vector<const MSLink*> getUpcomingLinks(double pos, double range, const std::vector<MSLane*>& contLanes) const;
939 
944 
948  const MSLane* getNormalPredecessorLane() const;
949 
952  MSLane* getLogicalPredecessorLane(const MSEdge& fromEdge) const;
953 
954 
961 
962 
969 
972 
974  const std::vector<std::pair<const MSLane*, const MSEdge*> > getOutgoingViaLanes() const;
975 
977 
978 
982  double getMeanSpeed() const;
983 
987  double getWaitingSeconds() const;
988 
989 
993  double getBruttoOccupancy() const;
994 
995 
999  double getNettoOccupancy() const;
1000 
1001 
1005  inline double getBruttoVehLenSum() const {
1006  return myBruttoVehicleLengthSum;
1007  }
1008 
1009 
1013  double getCO2Emissions() const;
1014 
1015 
1019  double getCOEmissions() const;
1020 
1021 
1025  double getPMxEmissions() const;
1026 
1027 
1031  double getNOxEmissions() const;
1032 
1033 
1037  double getHCEmissions() const;
1038 
1039 
1043  double getFuelConsumption() const;
1044 
1045 
1049  double getElectricityConsumption() const;
1050 
1051 
1055  double getHarmonoise_NoiseEmissions() const;
1057 
1058  void setRightSideOnEdge(double value, int rightmostSublane) {
1059  myRightSideOnEdge = value;
1060  myRightmostSublane = rightmostSublane;
1061  }
1062 
1064  void initRestrictions();
1065 
1066  void checkBufferType();
1067 
1068  double getRightSideOnEdge() const {
1069  return myRightSideOnEdge;
1070  }
1071 
1072  int getRightmostSublane() const {
1073  return myRightmostSublane;
1074  }
1075 
1076  double getCenterOnEdge() const {
1077  return myRightSideOnEdge + 0.5 * myWidth;
1078  }
1079 
1081  void sortPartialVehicles();
1082 
1084  void sortManeuverReservations();
1085 
1087  MSLane* getOpposite() const;
1088 
1090  double getOppositePos(double pos) const;
1091 
1092  /* @brief find leader for a vehicle depending on the relative driving direction
1093  * @param[in] ego The ego vehicle
1094  * @param[in] dist The look-ahead distance when looking at consecutive lanes
1095  * @param[in] oppositeDir Whether the lane has the opposite driving direction of ego
1096  * @return the leader vehicle and it's gap to ego
1097  */
1098  std::pair<MSVehicle* const, double> getOppositeLeader(const MSVehicle* ego, double dist, bool oppositeDir) const;
1099 
1100  /* @brief find follower for a vehicle that is located on the opposite of this lane
1101  * @param[in] ego The ego vehicle
1102  * @return the follower vehicle and it's gap to ego
1103  */
1104  std::pair<MSVehicle* const, double> getOppositeFollower(const MSVehicle* ego) const;
1105 
1106 
1114  std::pair<MSVehicle* const, double> getFollower(const MSVehicle* ego, double egoPos, double dist, bool ignoreMinorLinks) const;
1115 
1116 
1118  void addParking(MSVehicle* veh);
1119 
1121  virtual void removeParking(MSVehicle* veh);
1122 
1124  const std::set<const MSVehicle*>& getParkingVehicles() const {
1125  return myParkingVehicles;
1126  }
1127 
1129  virtual bool isSelected() const {
1130  return false;
1131  }
1132 
1134  MSLane* getBidiLane() const;
1135 
1137  bool mustCheckJunctionCollisions() const;
1138 
1139 #ifdef HAVE_FOX
1140  FXWorkerThread::Task* getPlanMoveTask(const SUMOTime time) {
1141  mySimulationTask.init(&MSLane::planMovements, time);
1142  return &mySimulationTask;
1143  }
1144 
1145  FXWorkerThread::Task* getExecuteMoveTask(const SUMOTime time) {
1146  mySimulationTask.init(&MSLane::executeMovements, time);
1147  return &mySimulationTask;
1148  }
1149 
1150  FXWorkerThread::Task* getLaneChangeTask(const SUMOTime time) {
1151  mySimulationTask.init(&MSLane::changeLanes, time);
1152  return &mySimulationTask;
1153  }
1154 #endif
1155 
1156  void changeLanes(const SUMOTime time);
1157 
1160 
1168  void saveState(OutputDevice& out);
1169 
1181  void loadState(const std::vector<std::string>& vehIDs, MSVehicleControl& vc);
1183 
1184 
1192  void visit(const LaneStoringVisitor& cont) const {
1193  cont.add(this);
1194  }
1195 
1196  static void initCollisionOptions(const OptionsCont& oc);
1197 
1198  static bool teleportOnCollision() {
1200  }
1201 
1203  return myCollisionAction;
1204  }
1205 
1206  static const long CHANGE_PERMISSIONS_PERMANENT = 0;
1207  static const long CHANGE_PERMISSIONS_GUI = 1;
1208 
1209 protected:
1211  virtual void swapAfterLaneChange(SUMOTime t);
1212 
1224  virtual void incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat,
1225  const MSLane::VehCont::iterator& at,
1227 
1229  void detectPedestrianJunctionCollision(const MSVehicle* collider, const PositionVector& colliderBoundary, const MSLane* foeLane,
1230  SUMOTime timestep, const std::string& stage);
1231 
1233  bool detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim,
1234  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1235  std::set<const MSVehicle*>& toTeleport) const;
1236 
1238  void handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim,
1239  double gap, double latGap,
1240  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1241  std::set<const MSVehicle*>& toTeleport) const;
1242 
1244  double getMaximumBrakeDist() const;
1245 
1246  /* @brief determine depart speed and whether it may be patched
1247  * @param[in] veh The departing vehicle
1248  * @param[out] whether the speed may be patched to account for safety
1249  * @return the depart speed
1250  */
1251  double getDepartSpeed(const MSVehicle& veh, bool& patchSpeed);
1252 
1253  /* @brief determine the lateral depart position
1254  * @param[in] veh The departing vehicle
1255  * @return the lateral depart position
1256  */
1257  double getDepartPosLat(const MSVehicle& veh);
1258 
1261  double safeInsertionSpeed(const MSVehicle* veh, double seen, const MSLeaderInfo& leaders, double speed);
1262 
1264  bool checkForPedestrians(const MSVehicle* aVehicle, double& speed, double& dist, double pos, bool patchSpeed) const;
1265 
1268 
1271 
1273  int myIndex;
1274 
1287 
1299 
1303 
1307 
1315 
1316  /* @brief list of vehicles that are parking near this lane
1317  * (not necessarily on the road but having reached their stop on this lane)
1318  * */
1319  std::set<const MSVehicle*> myParkingVehicles;
1320 
1322  double myLength;
1323 
1325  const double myWidth;
1326 
1330  std::map<SVCPermissions, double> myStopOffsets;
1331 
1333  MSEdge* const myEdge;
1334 
1336  double myMaxSpeed;
1337 
1340 
1343 
1345  const std::map<SUMOVehicleClass, double>* myRestrictions;
1346 
1348  std::vector<IncomingLaneInfo> myIncomingLanes;
1349 
1352 
1355 
1358 
1361 
1364 
1367 
1370 
1374 
1376  std::map<MSEdge*, std::vector<MSLane*> > myApproachingLanes;
1377 
1382 
1387 
1390 
1392  const bool myIsRampAccel;
1393 
1395  const std::string myLaneType;
1396 
1401 
1404 
1405  // @brief the ids of neighboring lanes
1406  std::vector<std::string> myNeighs;
1407 
1408  // @brief transient changes in permissions
1409  std::map<long long, SVCPermissions> myPermissionChanges;
1410 
1411  // @brief index of the associated thread-rng
1413 
1415  typedef std::map< std::string, MSLane* > DictType;
1416 
1419 
1420  static std::vector<std::mt19937> myRNGs;
1421 
1422 private:
1424  std::vector< MSMoveReminder* > myMoveReminders;
1425 
1431 
1437  public:
1439  explicit vehicle_position_sorter(const MSLane* lane) :
1440  myLane(lane) {
1441  }
1442 
1443 
1449  int operator()(MSVehicle* v1, MSVehicle* v2) const;
1450 
1451  const MSLane* myLane;
1452 
1453  };
1454 
1460  public:
1462  explicit vehicle_natural_position_sorter(const MSLane* lane) :
1463  myLane(lane) {
1464  }
1465 
1466 
1472  int operator()(MSVehicle* v1, MSVehicle* v2) const;
1473 
1474  const MSLane* myLane;
1475 
1476  };
1477 
1483  public:
1485  explicit by_connections_to_sorter(const MSEdge* const e);
1486 
1488  int operator()(const MSEdge* const e1, const MSEdge* const e2) const;
1489 
1490  private:
1491  by_connections_to_sorter& operator=(const by_connections_to_sorter&); // just to avoid a compiler warning
1492  private:
1493  const MSEdge* const myEdge;
1494  double myLaneDir;
1495  };
1496 
1497 
1498 
1504  public:
1506  explicit incoming_lane_priority_sorter(const MSLane* targetLane);
1507 
1509  int operator()(const IncomingLaneInfo& lane1, const IncomingLaneInfo& lane2) const;
1510 
1511  private:
1512  incoming_lane_priority_sorter& operator=(const incoming_lane_priority_sorter&); // just to avoid a compiler warning
1513  private:
1514  const MSLane* const myLane;
1515  double myLaneDir;
1516  };
1517 
1518 
1524  public:
1526  explicit outgoing_lane_priority_sorter(const MSLane* sourceLane);
1527 
1529  int operator()(const MSLink* link1, const MSLink* link2) const;
1530 
1531  private:
1532  outgoing_lane_priority_sorter& operator=(const outgoing_lane_priority_sorter&); // just to avoid a compiler warning
1533  private:
1534  const MSLane* const myLane;
1535  double myLaneDir;
1536  };
1537 
1541  class edge_finder {
1542  public:
1544  bool operator()(const IncomingLaneInfo& ili) const {
1545  return &(ili.lane->getEdge()) == myEdge;
1546  }
1547  private:
1548  edge_finder& operator=(const edge_finder&); // just to avoid a compiler warning
1549  private:
1550  const MSEdge* const myEdge;
1551  };
1552 
1553 #ifdef HAVE_FOX
1554  typedef void(MSLane::*Operation)(const SUMOTime);
1556 
1561  class SimulationTask : public FXWorkerThread::Task {
1562  public:
1563  SimulationTask(MSLane& l, const SUMOTime time)
1564  : myLane(l), myTime(time) {}
1565  void init(Operation operation, const SUMOTime time) {
1566  myOperation = operation;
1567  myTime = time;
1568  }
1569  void run(FXWorkerThread* /*context*/) {
1570  try {
1571  (myLane.*(myOperation))(myTime);
1572  } catch (ProcessError& e) {
1573  WRITE_ERROR(e.what());
1574  }
1575  }
1576  private:
1577  Operation myOperation;
1578  MSLane& myLane;
1579  SUMOTime myTime;
1580  private:
1582  SimulationTask& operator=(const SimulationTask&) = delete;
1583  };
1584 
1585  SimulationTask mySimulationTask;
1587  mutable FXMutex myLeaderInfoMutex;
1589  mutable FXMutex myFollowerInfoMutex;
1590 #endif
1591 private:
1593  MSLane(const MSLane&);
1594 
1596  MSLane& operator=(const MSLane&);
1597 
1598 
1599 };
1600 
1601 
1602 #endif
1603 
1604 /****************************************************************************/
1605 
MSLane::myMoveReminders
std::vector< MSMoveReminder * > myMoveReminders
This lane's move reminder.
Definition: MSLane.h:1424
MSLane::releaseVehicles
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:458
MSLane::outgoing_lane_priority_sorter::myLane
const MSLane *const myLane
Definition: MSLane.h:1534
MSLane::getWaitingSeconds
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
Definition: MSLane.cpp:2696
MSLane::AnyVehicleIterator::myI3End
int myI3End
end index for myTmpVehicles
Definition: MSLane.h:169
MSLane::myDict
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSLane.h:1418
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
MSLane::getVehiclesSecure
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:428
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1855
MSLane::myRNGIndex
int myRNGIndex
Definition: MSLane.h:1412
MSLane::getCOEmissions
double getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2737
MSLane::getDepartPosLat
double getDepartPosLat(const MSVehicle &veh)
Definition: MSLane.cpp:509
MSLane::dictSize
static int dictSize()
Returns the number of stored lanes.
Definition: MSLane.h:721
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:74
MSLane::getIncomingLinkState
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
Definition: MSLane.cpp:2619
MSLane::myIncomingLanes
std::vector< IncomingLaneInfo > myIncomingLanes
All direct predecessor lanes.
Definition: MSLane.h:1348
MSLane::teleportOnCollision
static bool teleportOnCollision()
Definition: MSLane.h:1198
MSLane::outgoing_lane_priority_sorter::operator()
int operator()(const MSLink *link1, const MSLink *link2) const
comparing operator
Definition: MSLane.cpp:2971
MSLane::MSLane
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, const std::string &type)
Constructor.
Definition: MSLane.cpp:179
MSLane::myFollowerInfo
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
Definition: MSLane.h:1381
MSLane::incoming_lane_priority_sorter::operator()
int operator()(const IncomingLaneInfo &lane1, const IncomingLaneInfo &lane2) const
comparing operator
Definition: MSLane.cpp:2893
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
Named
Base class for objects which have an id.
Definition: Named.h:57
MSLane::isLinkEnd
bool isLinkEnd(MSLinkCont::const_iterator &i) const
Definition: MSLane.cpp:1983
MSLane::getMissingRearGap
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:2241
MSLane::getRightmostSublane
int getRightmostSublane() const
Definition: MSLane.h:1072
MSLane::sortPartialVehicles
void sortPartialVehicles()
sorts myPartialVehicles
Definition: MSLane.cpp:1956
MSLaneChanger
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:48
MSLeaderDistanceInfo
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:133
MSLane::getLastAnyVehicle
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
Definition: MSLane.cpp:2022
MSLane::resetPartialOccupation
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:282
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSLane::anyVehiclesUpstreamBegin
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction
Definition: MSLane.h:446
MSLane::myNeighs
std::vector< std::string > myNeighs
Definition: MSLane.h:1406
MSLane::setJunctionApproaches
virtual void setJunctionApproaches(const SUMOTime t) const
Register junction approaches for all vehicles after velocities have been planned.
Definition: MSLane.cpp:1202
MSLane::myNumericalID
int myNumericalID
Unique numerical ID (set on reading by netload)
Definition: MSLane.h:1267
MSLane::myRNGs
static std::vector< std::mt19937 > myRNGs
Definition: MSLane.h:1420
MSLane::getCanonicalSuccessorLane
MSLane * getCanonicalSuccessorLane() const
Definition: MSLane.cpp:2598
MSLane::myLaneType
const std::string myLaneType
the type of this lane
Definition: MSLane.h:1395
MSLane::AnyVehicleIterator::operator!=
bool operator!=(AnyVehicleIterator const &other) const
Definition: MSLane.h:141
MSLane::sortManeuverReservations
void sortManeuverReservations()
sorts myManeuverReservations
Definition: MSLane.cpp:1964
MSLane::by_connections_to_sorter::operator=
by_connections_to_sorter & operator=(const by_connections_to_sorter &)
MSLeaderInfo.h
MSLane::getPartialBeyond
MSLeaderInfo getPartialBeyond() const
get all vehicles that are inlapping from consecutive edges
Definition: MSLane.cpp:3353
MSLane::myNettoVehicleLengthSumToRemove
double myNettoVehicleLengthSumToRemove
The length of all vehicles that have left this lane in the current step (this lane,...
Definition: MSLane.h:1369
MSLane::AnyVehicleIterator::myDirection
int myDirection
index delta
Definition: MSLane.h:173
MSLane::updateLeaderInfo
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:1210
MSLane::getPartialVehicleNumber
int getPartialVehicleNumber() const
Returns the number of vehicles partially on this lane (for which this lane is not responsible)
Definition: MSLane.h:417
MSLane::myCollisionMinGapFactor
static double myCollisionMinGapFactor
Definition: MSLane.h:1430
MSLane::getLastVehicleInformation
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:1051
MSLane::operator=
MSLane & operator=(const MSLane &)
invalidated assignment operator
MSLane::isAccelLane
bool isAccelLane() const
return whether this lane is an acceleration lane
Definition: MSLane.h:488
MSLane::getOppositeFollower
std::pair< MSVehicle *const, double > getOppositeFollower(const MSVehicle *ego) const
Definition: MSLane.cpp:3562
MSLane::myManeuverReservations
VehCont myManeuverReservations
The vehicles which registered maneuvering into the lane within their current action step....
Definition: MSLane.h:1314
MSLane::isEmpty
bool isEmpty() const
Definition: MSLane.cpp:1994
MSLane::getRightSideOnEdge
double getRightSideOnEdge() const
Definition: MSLane.h:1068
MSLane::succLinkSec
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
Definition: MSLane.cpp:2050
MSLane::getPermissions
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:549
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:61
MSLane::VehCont
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:93
MSLane::AnyVehicleIterator::AnyVehicleIterator
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:112
MSLane::initRestrictions
void initRestrictions()
initialized vClass-specific speed limits
Definition: MSLane.cpp:224
MSLane::vehicle_natural_position_sorter::myLane
const MSLane * myLane
Definition: MSLane.h:1474
MSLane::requireCollisionCheck
void requireCollisionCheck()
require another collision check due to relevant changes in the simulation
Definition: MSLane.h:628
SUMOTrafficObject::getVClass
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle's access class.
MSLane::getDepartSpeed
double getDepartSpeed(const MSVehicle &veh, bool &patchSpeed)
Definition: MSLane.cpp:474
MSLane::edge_finder::operator=
edge_finder & operator=(const edge_finder &)
MSLane::getHarmonoise_NoiseEmissions
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:2809
MSLane::myCollisionAction
static CollisionAction myCollisionAction
the action to take on collisions
Definition: MSLane.h:1427
MSLane::getHCEmissions
double getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2773
MSLane::planMovements
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:1162
NamedRTree.h
MSLane::myShape
PositionVector myShape
The shape of the lane.
Definition: MSLane.h:1270
MSLane::AnyVehicleIterator::operator*
const MSVehicle * operator*()
Definition: MSLane.cpp:127
MSLane::getLastFullVehicle
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
Definition: MSLane.cpp:2004
MSLane::forceVehicleInsertion
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
Definition: MSLane.cpp:1013
MSLaneChangerSublane
Performs lane changing of vehicles.
Definition: MSLaneChangerSublane.h:43
MSLane::getCollisionAction
static CollisionAction getCollisionAction()
Definition: MSLane.h:1202
PositionVector
A list of positions.
Definition: PositionVector.h:46
MSLane::myLeaderInfo
MSLeaderInfo myLeaderInfo
leaders on all sublanes as seen by approaching vehicles (cached)
Definition: MSLane.h:1379
MSLane::myLinks
MSLinkCont myLinks
Definition: MSLane.h:1373
MSLane::getBidiLane
MSLane * getBidiLane() const
retrieve bidirectional lane or nullptr
Definition: MSLane.cpp:3684
MSLane::setMaxSpeed
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
Definition: MSLane.cpp:2144
MSLane::getBruttoOccupancy
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:2666
MSLane::AnyVehicleIterator::operator++
AnyVehicleIterator & operator++()
Definition: MSLane.cpp:110
MSVehicleTransfer
Definition: MSVehicleTransfer.h:64
MSLane::AnyVehicleIterator::operator->
const MSVehicle * operator->()
Definition: MSLane.h:145
MSLane::getUpcomingLinks
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:3451
MSLane::getRNGIndex
int getRNGIndex() const
returns the associated RNG index
Definition: MSLane.h:218
FXSynchQue.h
MSLane::addLink
void addLink(MSLink *link)
Delayed initialization.
Definition: MSLane.cpp:240
MSLane::vehicle_position_sorter
Sorts vehicles by their position (descending)
Definition: MSLane.h:1436
MSLane::myRightSideOnEdge
double myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
Definition: MSLane.h:1398
MSLane::getLengthGeometryFactor
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSLane.h:483
LaneStoringVisitor
Definition: Helper.h:53
MSLane::getIncomingLanes
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition: MSLane.h:819
MSLane::myWidth
const double myWidth
Lane width [m].
Definition: MSLane.h:1325
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:64
MSLane::getPartialBehind
MSVehicle * getPartialBehind(const MSVehicle *ego) const
Definition: MSLane.cpp:3330
MSLane::myCanonicalSuccessorLane
MSLane * myCanonicalSuccessorLane
Main successor lane,.
Definition: MSLane.h:1357
MSLane::getVehicleNumber
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
Definition: MSLane.h:401
MSLane::myBruttoVehicleLengthSumToRemove
double myBruttoVehicleLengthSumToRemove
The length of all vehicles that have left this lane in the current step (this lane,...
Definition: MSLane.h:1366
MSLane::myBruttoVehicleLengthSum
double myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
Definition: MSLane.h:1360
MSLane::needsCollisionCheck
bool needsCollisionCheck() const
short-circut collision check if nothing changed since the last check
Definition: MSLane.h:623
MSLane::myNettoVehicleLengthSum
double myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
Definition: MSLane.h:1363
SUMOTrafficObject::getChosenSpeedFactor
virtual double getChosenSpeedFactor() const =0
MSLeaderInfo
Definition: MSLeaderInfo.h:50
MSLane::getBruttoVehLenSum
double getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
Definition: MSLane.h:1005
MSLane::COLLISION_ACTION_NONE
Definition: MSLane.h:183
MSLane::vehicle_natural_position_sorter::vehicle_natural_position_sorter
vehicle_natural_position_sorter(const MSLane *lane)
Constructor.
Definition: MSLane.h:1462
MSLane::AnyVehicleIterator::myI2
int myI2
index for myPartialVehicles
Definition: MSLane.h:161
MSLane::insertIDs
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
Definition: MSLane.cpp:1887
MSLane::addParking
void addParking(MSVehicle *veh)
add parking vehicle. This should only used during state loading
Definition: MSLane.cpp:3006
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1132
SUMOVehicle.h
MSMoveReminder.h
MSLane::getCO2Emissions
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2725
MSLane::incoming_lane_priority_sorter::myLane
const MSLane *const myLane
Definition: MSLane.h:1514
MSLane::edge_finder::operator()
bool operator()(const IncomingLaneInfo &ili) const
Definition: MSLane.h:1544
MSLane::myFollowerInfoTime
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
Definition: MSLane.h:1386
MSLane::getFirstVehicleInformation
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:1107
MSLane::by_connections_to_sorter::myEdge
const MSEdge *const myEdge
Definition: MSLane.h:1493
MSLane::getParkingVehicles
const std::set< const MSVehicle * > & getParkingVehicles() const
retrieve the parking vehicles (see GUIParkingArea)
Definition: MSLane.h:1124
MSLane::executeMovements
virtual void executeMovements(const SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:1703
MSLane::by_connections_to_sorter::by_connections_to_sorter
by_connections_to_sorter(const MSEdge *const e)
constructor
Definition: MSLane.cpp:2847
MSLane::swapAfterLaneChange
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:2158
MSLane::getElectricityConsumption
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2797
MSLane::isInsertionSuccess
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:638
MSLane::COLLISION_ACTION_WARN
Definition: MSLane.h:184
MSLane::setPermissions
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:3611
MSLane::interpolateGeometryPosToLanePos
double interpolateGeometryPosToLanePos(double geometryPos) const
Definition: MSLane.h:511
MSLane::AnyVehicleIterator::myLane
const MSLane * myLane
the lane that is being iterated
Definition: MSLane.h:157
MSLane::myStopOffsets
std::map< SVCPermissions, double > myStopOffsets
Definition: MSLane.h:1330
MSLane::myLengthGeometryFactor
const double myLengthGeometryFactor
precomputed myShape.length / myLength
Definition: MSLane.h:1389
MSLane::VehPosition
Definition: MSLane.h:97
MSLane::CHANGE_PERMISSIONS_PERMANENT
static const long CHANGE_PERMISSIONS_PERMANENT
Definition: MSLane.h:1206
MSLane::myLeaderInfoTime
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
Definition: MSLane.h:1384
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
MSLane::initRNGs
static void initRNGs(const OptionsCont &oc)
initialize rngs
Definition: MSLane.cpp:3672
MSLane::handleCollisionBetween
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:1578
MSLane::edge_finder::edge_finder
edge_finder(MSEdge *e)
Definition: MSLane.h:1543
MSLane::getVehicleNumberWithPartials
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
Definition: MSLane.h:409
MSLane::getMoveReminders
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
Definition: MSLane.h:268
MSLane::getStopOffset
double getStopOffset(const MSVehicle *veh) const
Returns vehicle class specific stopOffset for the vehicle.
Definition: MSLane.cpp:3045
MSLane::myIsRampAccel
const bool myIsRampAccel
whether this lane is an acceleration lane
Definition: MSLane.h:1392
MSLane::getCriticalLeader
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:2459
MSLane::getLaneType
const std::string & getLaneType() const
return the type of this lane
Definition: MSLane.h:493
MSLane::getLeader
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:2268
MSLane::changeLanes
void changeLanes(const SUMOTime time)
Definition: MSLane.cpp:1821
MSLane::IncomingLaneInfo
Definition: MSLane.h:813
MSLane::addMoveReminder
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
Definition: MSLane.cpp:258
Parameterised.h
Named.h
MSLane::AnyVehicleIterator::myI1
int myI1
index for myVehicles
Definition: MSLane.h:159
MSLane::leftByLaneChange
void leftByLaneChange(MSVehicle *v)
Definition: MSLane.cpp:2641
MSLane::isSelected
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition: MSLane.h:1129
MSLane::detectCollisionBetween
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:1507
MSLane::myLogicalPredecessorLane
MSLane * myLogicalPredecessorLane
Definition: MSLane.h:1351
MSLane::COLLISION_ACTION_REMOVE
Definition: MSLane.h:186
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:246
MSLane::getVehiclesInRange
std::set< MSVehicle * > getVehiclesInRange(const double a, const double b) const
Returns all vehicles on the lane overlapping with the interval [a,b].
Definition: MSLane.cpp:3420
MSLane::insertVehicle
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:533
SUMOVehicleClass.h
MSLane::IncomingLaneInfo::length
double length
Definition: MSLane.h:815
MSLane::getNOxEmissions
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2761
MSLane::interpolateLanePosToGeometryPos
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:499
MSLane::appropriate
virtual bool appropriate(const MSVehicle *veh)
Definition: MSLane.cpp:1911
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:541
MSLane::vehicle_position_sorter::vehicle_position_sorter
vehicle_position_sorter(const MSLane *lane)
Constructor.
Definition: MSLane.h:1439
MSLane::setRNGIndex
void setRNGIndex(const int rngIndex)
sets the associated RNG index
Definition: MSLane.h:213
MSLane::CHANGE_PERMISSIONS_GUI
static const long CHANGE_PERMISSIONS_GUI
Definition: MSLane.h:1207
MSLane::getOppositePos
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
Definition: MSLane.cpp:3508
MSLane::clear
static void clear()
Clears the dictionary.
Definition: MSLane.cpp:1878
MSLane::empty
bool empty() const
Returns true if there is not a single vehicle on the lane.
Definition: MSLane.h:652
ProcessError
Definition: UtilExceptions.h:40
MSLane::vehicle_position_sorter::myLane
const MSLane * myLane
Definition: MSLane.h:1451
MSLane::getOppositeLeader
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir) const
Definition: MSLane.cpp:3539
MSLane::getLeadersOnConsecutive
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:3240
MSLane::myOriginalPermissions
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
Definition: MSLane.h:1342
Helper.h
MSLane::getMeanSpeed
double getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2709
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
MSLane::freeInsertion
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:386
MSLane::outgoing_lane_priority_sorter
Sorts lanes (their origin link) by the priority of their noninternal target edges or,...
Definition: MSLane.h:1523
MSLane::by_connections_to_sorter
Sorts edges by their angle relative to the given edge (straight comes first)
Definition: MSLane.h:1482
MSLane::addApproachingLane
void addApproachingLane(MSLane *lane, bool warnMultiCon)
Definition: MSLane.cpp:2203
MSLane::getNextNormal
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
Definition: MSLane.cpp:1827
MSLane::checkForPedestrians
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:3638
MSLane::removeVehicle
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2169
MSLane::checkBufferType
void checkBufferType()
Definition: MSLane.cpp:232
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
FXWorkerThread.h
MSLane::myNeedsCollisionCheck
bool myNeedsCollisionCheck
whether a collision check is currently needed
Definition: MSLane.h:1403
MSLane::getNumRNGs
static int getNumRNGs()
return the number of RNGs
Definition: MSLane.h:228
MSLane::getSurroundingVehicles
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:3368
MSLane::vehicle_position_sorter::operator()
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
Definition: MSLane.cpp:2832
MSLane::AnyVehicleIterator::nextIsMyVehicles
bool nextIsMyVehicles() const
Definition: MSLane.cpp:143
MSLane::resetManeuverReservation
virtual void resetManeuverReservation(MSVehicle *v)
Unregisters a vehicle, which previously registered for maneuvering into this lane.
Definition: MSLane.cpp:312
MSLane::getCanonicalPredecessorLane
MSLane * getCanonicalPredecessorLane() const
Definition: MSLane.cpp:2578
MSLane::vehicle_natural_position_sorter::operator()
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
Definition: MSLane.cpp:2837
MSMoveReminder::NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
Definition: MSMoveReminder.h:91
MSLane::getNettoOccupancy
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)
Definition: MSLane.cpp:2681
MSLane::getLinkCont
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:2099
MSLane::AnyVehicleIterator::myI1End
int myI1End
end index for myVehicles
Definition: MSLane.h:165
MSLane::getNumericalID
int getNumericalID() const
Returns this lane's numerical id.
Definition: MSLane.h:470
MSLane::setManeuverReservation
virtual void setManeuverReservation(MSVehicle *v)
Registers the lane change intentions (towards this lane) for the given vehicle.
Definition: MSLane.cpp:301
MSLane::getUpcomingJunctions
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:3440
MSLane::anyVehiclesEnd
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction
Definition: MSLane.h:440
MSLane::visit
void visit(const LaneStoringVisitor &cont) const
Callback for visiting the lane when traversing an RTree.
Definition: MSLane.h:1192
MSLane::AnyVehicleIterator::myI3
int myI3
index for myTmpVehicles
Definition: MSLane.h:163
FXSynchQue
Definition: FXSynchQue.h:34
MSLane::detectCollisions
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:1260
MSLane::loadState
void loadState(const std::vector< std::string > &vehIDs, MSVehicleControl &vc)
Loads the state of this segment with the given parameters.
Definition: MSLane.cpp:3030
MSLane::updateLengthSum
void updateLengthSum()
updated current vehicle length sum (delayed to avoid lane-order-dependency)
Definition: MSLane.cpp:1807
MSLane::allowsVehicleClass
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: MSLane.h:806
MSLane::getPMxEmissions
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2749
MSLane::isApproachedFrom
bool isApproachedFrom(MSEdge *const edge)
Definition: MSLane.cpp:2217
MSLane::vehicle_natural_position_sorter
Definition: MSLane.h:1459
MSLane::getOpposite
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
Definition: MSLane.cpp:3499
MSLane::getLogicalPredecessorLane
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:2532
MSLane::myCheckJunctionCollisions
static bool myCheckJunctionCollisions
Definition: MSLane.h:1428
MSLane::~MSLane
virtual ~MSLane()
Destructor.
Definition: MSLane.cpp:216
MSLane::getMaximumBrakeDist
double getMaximumBrakeDist() const
compute maximum braking distance on this lane
Definition: MSLane.cpp:2257
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:670
MSLane::getFirstInternalInConnection
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:1837
MSLane::incorporateVehicle
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:330
MSLane::getCenterOnEdge
double getCenterOnEdge() const
Definition: MSLane.h:1076
MSLane::myRestrictions
const std::map< SUMOVehicleClass, double > * myRestrictions
The vClass speed restrictions for this lane.
Definition: MSLane.h:1345
MSLane::addIncomingLane
void addIncomingLane(MSLane *lane, MSLink *viaLink)
Definition: MSLane.cpp:2193
MSLane::myEdge
MSEdge *const myEdge
The lane's edge, for routing only.
Definition: MSLane.h:1333
MSLane::outgoing_lane_priority_sorter::operator=
outgoing_lane_priority_sorter & operator=(const outgoing_lane_priority_sorter &)
MSLane::getFollowersOnConsecutive
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:3059
MSLane::myRightmostSublane
int myRightmostSublane
the index of the rightmost sublane of this lane on myEdge
Definition: MSLane.h:1400
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:478
MSLane::myIndex
int myIndex
The lane index.
Definition: MSLane.h:1273
MSLane::DictType
std::map< std::string, MSLane * > DictType
definition of the static dictionary type
Definition: MSLane.h:1415
MSLane::myApproachingLanes
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
All direct internal and direct (disregarding internal predecessors) non-internal predecessor lanes of...
Definition: MSLane.h:1376
MSLane::saveState
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
Definition: MSLane.cpp:3017
MSLane::mustCheckJunctionCollisions
bool mustCheckJunctionCollisions() const
whether this lane must check for junction collisions
Definition: MSLane.cpp:3696
MSLane::checkFailure
bool checkFailure(const MSVehicle *aVehicle, double &speed, double &dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const
Definition: MSLane.cpp:609
MSLane::AnyVehicleIterator::myDownstream
bool myDownstream
iteration direction
Definition: MSLane.h:171
MSLane::AnyVehicleIterator::operator==
bool operator==(AnyVehicleIterator const &other) const
Definition: MSLane.h:132
MSLane::setRightSideOnEdge
void setRightSideOnEdge(double value, int rightmostSublane)
Definition: MSLane.h:1058
MSLane::incoming_lane_priority_sorter::incoming_lane_priority_sorter
incoming_lane_priority_sorter(const MSLane *targetLane)
constructor
Definition: MSLane.cpp:2888
MSLane::getStopOffsets
const std::map< SVCPermissions, double > & getStopOffsets() const
Returns vehicle class specific stopOffsets.
Definition: MSLane.h:832
MSLane::integrateNewVehicles
virtual void integrateNewVehicles()
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:1929
MSLane::myPermissions
SVCPermissions myPermissions
The vClass permissions for this lane.
Definition: MSLane.h:1339
MSLane::safeInsertionSpeed
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:1022
MSLane::myLength
double myLength
Lane length [m].
Definition: MSLane.h:1322
MSLane::IncomingLaneInfo::lane
MSLane * lane
Definition: MSLane.h:814
MSLane::anyVehiclesUpstreamEnd
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction
Definition: MSLane.h:452
MSLane::getLinkTo
MSLink * getLinkTo(const MSLane *) const
returns the link to the given lane or 0, if it is not connected
Definition: MSLane.cpp:2106
MSLane::setLength
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
Definition: MSLane.cpp:2151
MSLane::edge_finder
Definition: MSLane.h:1541
LaneCoverageInfo
std::map< const MSLane *, std::pair< double, double > > LaneCoverageInfo
Coverage info.
Definition: MSLane.h:65
MSLane::myVehBuffer
FXSynchQue< MSVehicle *, std::vector< MSVehicle * > > myVehBuffer
Buffer for vehicles that moved from their previous lane onto this one. Integrated after all vehicles ...
Definition: MSLane.h:1306
MSLane::fill
static void fill(RTREE &into)
Fills the given RTree with lane instances.
Definition: MSLane.cpp:1895
MSLane::CollisionAction
CollisionAction
Definition: MSLane.h:182
MSLane::getParallelLane
MSLane * getParallelLane(int offset, bool includeOpposite=true) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
Definition: MSLane.cpp:2187
MSLane::myPartialVehicles
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
Definition: MSLane.h:1298
MSLane::outgoing_lane_priority_sorter::myLaneDir
double myLaneDir
Definition: MSLane.h:1535
MSLane::removeParking
virtual void removeParking(MSVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
Definition: MSLane.cpp:3012
MSLane::by_connections_to_sorter::operator()
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition: MSLane.cpp:2854
FXSynchQue::size
size_t size() const
Definition: FXSynchQue.h:134
MSLane::getWidth
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:557
MSLane::myParkingVehicles
std::set< const MSVehicle * > myParkingVehicles
Definition: MSLane.h:1319
MSLane::AnyVehicleIterator::myI2End
int myI2End
end index for myPartialVehicles
Definition: MSLane.h:167
MSLane::AnyVehicleIterator
friend class AnyVehicleIterator
Definition: MSLane.h:90
config.h
MSLane::getFirstAnyVehicle
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
Definition: MSLane.cpp:2036
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:72
MSLane::isInternal
bool isInternal() const
Definition: MSLane.cpp:1999
MSLane::incoming_lane_priority_sorter::operator=
incoming_lane_priority_sorter & operator=(const incoming_lane_priority_sorter &)
MSLane::COLLISION_ACTION_TELEPORT
Definition: MSLane.h:185
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
MSLane::getRNG
std::mt19937 * getRNG() const
return the associated RNG
Definition: MSLane.h:223
MSLane::IncomingLaneInfo::viaLink
MSLink * viaLink
Definition: MSLane.h:816
MSLane::VehPosition::operator()
bool operator()(const MSVehicle *cmp, double pos) const
compares vehicle position to the detector position
Definition: MSLane.cpp:2826
MSLane::myCanonicalPredecessorLane
MSLane * myCanonicalPredecessorLane
Similar to LogicalPredecessorLane,.
Definition: MSLane.h:1354
MSLane::getOutgoingViaLanes
const std::vector< std::pair< const MSLane *, const MSEdge * > > getOutgoingViaLanes() const
get the list of outgoing lanes
Definition: MSLane.cpp:2630
MSLane::getNormalPredecessorLane
const MSLane * getNormalPredecessorLane() const
get normal lane leading to this internal lane, for normal lanes, the lane itself is returned
Definition: MSLane.cpp:2557
MSLane::getVehicleMaxSpeed
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:519
MSLane::setStopOffsets
void setStopOffsets(std::map< SVCPermissions, double > stopOffsets)
Set vehicle class specific stopOffsets.
Definition: MSLane.h:837
MSQueueExport
Export the queueing length in front of a junction (very experimental!)
Definition: MSQueueExport.h:50
MSLane::myPermissionChanges
std::map< long long, SVCPermissions > myPermissionChanges
Definition: MSLane.h:1409
MSLane::getSpeedLimit
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:533
FXWorkerThread::Task
Abstract superclass of a task to be run with an index to keep track of pending tasks.
Definition: FXWorkerThread.h:56
MSLane::getFuelConsumption
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2785
MSLane::setPartialOccupation
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:268
MSLane::detectPedestrianJunctionCollision
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:1473
MSLane::getCrossingIndex
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1
Definition: MSLane.cpp:2655
SUMOTrafficObject::getMaxSpeed
virtual double getMaxSpeed() const =0
Returns the vehicle's maximum speed.
MSLane::getFirstFullVehicle
MSVehicle * getFirstFullVehicle() const
returns the first vehicle for which this lane is responsible or 0
Definition: MSLane.cpp:2013
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
MSLane::outgoing_lane_priority_sorter::outgoing_lane_priority_sorter
outgoing_lane_priority_sorter(const MSLane *sourceLane)
constructor
Definition: MSLane.cpp:2966
MSLane::incoming_lane_priority_sorter
Sorts lanes (IncomingLaneInfos) by their priority or, if this doesn't apply, wrt. the angle differenc...
Definition: MSLane.h:1503
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
PositionVector.h
MSLane::by_connections_to_sorter::myLaneDir
double myLaneDir
Definition: MSLane.h:1494
MSLane::edge_finder::myEdge
const MSEdge *const myEdge
Definition: MSLane.h:1550
MSLane::AnyVehicleIterator
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane,...
Definition: MSLane.h:110
MSLane::getIndex
int getIndex() const
Returns the lane's index.
Definition: MSLane.h:564
MSLane::addNeigh
void addNeigh(const std::string &id)
Adds a neighbor to this lane.
Definition: MSLane.cpp:246
MSLane::lastInsertion
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:351
MSLane::myVehicles
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
Definition: MSLane.h:1286
MSLane::myMaxSpeed
double myMaxSpeed
Lane-wide speedlimit [m/s].
Definition: MSLane.h:1336
LaneStoringVisitor::add
void add(const MSLane *const l) const
Adds the given object to the container.
Definition: Helper.cpp:63
MSLane::resetPermissions
void resetPermissions(long long transientID)
Definition: MSLane.cpp:3623
MSLane::getLeaderOnConsecutive
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:2333
MSLane::enteredByLaneChange
void enteredByLaneChange(MSVehicle *v)
Definition: MSLane.cpp:2648
FXWorkerThread
A thread repeatingly calculating incoming tasks.
Definition: FXWorkerThread.h:49
MSLane::incoming_lane_priority_sorter::myLaneDir
double myLaneDir
Definition: MSLane.h:1515
MSLane::myCollisionStopTime
static SUMOTime myCollisionStopTime
Definition: MSLane.h:1429
MSLane::myTmpVehicles
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
Definition: MSLane.h:1302
MSLane::getEntryLink
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
Definition: MSLane.cpp:2127
MSLane::anyVehiclesBegin
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction
Definition: MSLane.h:434
MSLane::initCollisionOptions
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:3591
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
MSLane::getFollower
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:3520