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 /****************************************************************************/
21 // Representation of a lane in the micro simulation
22 /****************************************************************************/
23 #ifndef MSLane_h
24 #define MSLane_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #include <config.h>
31 
32 #include <memory>
33 #include <vector>
34 #include <map>
35 #include <deque>
36 #include <cassert>
37 #include <utils/common/Named.h>
43 #include "MSLinkCont.h"
44 #include "MSLeaderInfo.h"
45 #include "MSMoveReminder.h"
46 #include <libsumo/Helper.h>
47 
49 #ifdef HAVE_FOX
51 #endif
52 
53 
54 // ===========================================================================
55 // class declarations
56 // ===========================================================================
57 class MSEdge;
58 class MSVehicle;
59 class MSLaneChanger;
60 class MSLink;
61 class MSVehicleTransfer;
62 class MSVehicleControl;
63 class OutputDevice;
65 
66 // ===========================================================================
67 // type definitions
68 // ===========================================================================
70 typedef std::map<const MSLane*, std::pair<double, double> > LaneCoverageInfo; // also declared in libsumo/Helper.h!
71 
72 // ===========================================================================
73 // class definitions
74 // ===========================================================================
82 class MSLane : public Named, public Parameterised {
83 public:
85  friend class MSLaneChanger;
86  friend class MSLaneChangerSublane;
87 
88  friend class MSQueueExport;
89  friend class AnyVehicleIterator;
90 
92  typedef std::vector<MSVehicle*> VehCont;
93 
96  struct VehPosition : public std::binary_function < const MSVehicle*, double, bool > {
98  bool operator()(const MSVehicle* cmp, double pos) const;
99  };
100 
101  // TODO: Better documentation
110  public:
112  const MSLane* lane,
113  int i1,
114  int i2,
115  int i3,
116  const int i1End,
117  const int i2End,
118  const int i3End,
119  bool downstream = true) :
120  myLane(lane),
121  myI1(i1),
122  myI2(i2),
123  myI3(i3),
124  myI1End(i1End),
125  myI2End(i2End),
126  myI3End(i3End),
127  myDownstream(downstream),
128  myDirection(downstream ? 1 : -1) {
129  }
130 
131  bool operator== (AnyVehicleIterator const& other) const {
132  return (myI1 == other.myI1
133  && myI2 == other.myI2
134  && myI3 == other.myI3
135  && myI1End == other.myI1End
136  && myI2End == other.myI2End
137  && myI3End == other.myI3End);
138  }
139 
140  bool operator!= (AnyVehicleIterator const& other) const {
141  return !(*this == other);
142  }
143 
145  return **this;
146  }
147 
148  const MSVehicle* operator*();
149 
151 
152  private:
153  bool nextIsMyVehicles() const;
154 
156  const MSLane* myLane;
158  int myI1;
160  int myI2;
162  int myI3;
164  int myI1End;
166  int myI2End;
168  int myI3End;
173 
174  };
175 
176 
177 public:
186  };
187 
202  MSLane(const std::string& id, double maxSpeed, double length, MSEdge* const edge,
203  int numericalID, const PositionVector& shape, double width,
204  SVCPermissions permissions, int index, bool isRampAccel,
205  const std::string& type);
206 
207 
209  virtual ~MSLane();
210 
212  void setRNGIndex(const int rngIndex) {
213  myRNGIndex = rngIndex;
214  }
215 
217  int getRNGIndex() const {
218  return myRNGIndex;
219  }
220 
222  std::mt19937* getRNG() const {
223  return &myRNGs[myRNGIndex];
224  }
225 
227  static int getNumRNGs() {
228  return (int)myRNGs.size();
229  }
230 
233 
241  void addLink(MSLink* link);
242 
247  void addNeigh(const std::string& id);
249 
250 
251 
254 
261  virtual void addMoveReminder(MSMoveReminder* rem);
262 
263 
267  inline const std::vector< MSMoveReminder* >& getMoveReminders() const {
268  return myMoveReminders;
269  }
271 
272 
273 
276 
292  bool insertVehicle(MSVehicle& v);
293 
294 
313  bool isInsertionSuccess(MSVehicle* vehicle, double speed, double pos, double posLat,
314  bool recheckNextLanes,
315  MSMoveReminder::Notification notification);
316 
317  // XXX: Documentation?
318  bool checkFailure(const MSVehicle* aVehicle, double& speed, double& dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const;
319 
323  bool lastInsertion(MSVehicle& veh, double mspeed, double posLat, bool patchSpeed);
324 
332  bool freeInsertion(MSVehicle& veh, double speed, double posLat,
334 
335 
345  void forceVehicleInsertion(MSVehicle* veh, double pos, MSMoveReminder::Notification notification, double posLat = 0);
347 
348 
349 
353 
360  virtual double setPartialOccupation(MSVehicle* v);
361 
365  virtual void resetPartialOccupation(MSVehicle* v);
366 
369  virtual void setManeuverReservation(MSVehicle* v);
370 
374  virtual void resetManeuverReservation(MSVehicle* v);
375 
386  const MSLeaderInfo getLastVehicleInformation(const MSVehicle* ego, double latOffset, double minPos = 0, bool allowCached = true) const;
387 
389  const MSLeaderInfo getFirstVehicleInformation(const MSVehicle* ego, double latOffset, bool onlyFrontOnLane, double maxPos = std::numeric_limits<double>::max(), bool allowCached = true) const;
390 
392 
395 
400  int getVehicleNumber() const {
401  return (int)myVehicles.size();
402  }
403 
409  return (int)myVehicles.size() + (int)myPartialVehicles.size();
410  }
411 
417  return (int)myPartialVehicles.size();
418  }
419 
420 
427  virtual const VehCont& getVehiclesSecure() const {
428  return myVehicles;
429  }
430 
431 
434  return AnyVehicleIterator(this, 0, 0, 0,
435  (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(), true);
436  }
437 
440  return AnyVehicleIterator(this, (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(),
441  (int)myVehicles.size(), (int)myPartialVehicles.size(), (int)myTmpVehicles.size(), true);
442  }
443 
446  return AnyVehicleIterator(this, (int)myVehicles.size() - 1, (int)myPartialVehicles.size() - 1, (int)myTmpVehicles.size() - 1,
447  -1, -1, -1, false);
448  }
449 
452  return AnyVehicleIterator(this, -1, -1, -1, -1, -1, -1, false);
453  }
454 
457  virtual void releaseVehicles() const { }
459 
460 
461 
464 
465 
469  inline int getNumericalID() const {
470  return myNumericalID;
471  }
472 
473 
477  inline const PositionVector& getShape() const {
478  return myShape;
479  }
480 
482  inline double getLengthGeometryFactor() const {
483  return myLengthGeometryFactor;
484  }
485 
487  inline bool isAccelLane() const {
488  return myIsRampAccel;
489  }
490 
492  const std::string& getLaneType() const {
493  return myLaneType;
494  }
495 
496  /* @brief fit the given lane position to a visibly suitable geometry position
497  * (lane length might differ from geometry length) */
498  inline double interpolateLanePosToGeometryPos(double lanePos) const {
499  return lanePos * myLengthGeometryFactor;
500  }
501 
502  /* @brief fit the given lane position to a visibly suitable geometry position
503  * and return the coordinates */
504  inline const Position geometryPositionAtOffset(double offset, double lateralOffset = 0) const {
505  return myShape.positionAtOffset(interpolateLanePosToGeometryPos(offset), lateralOffset);
506  }
507 
508  /* @brief fit the given geometry position to a valid lane position
509  * (lane length might differ from geometry length) */
510  inline double interpolateGeometryPosToLanePos(double geometryPos) const {
511  return geometryPos / myLengthGeometryFactor;
512  }
513 
518  inline double getVehicleMaxSpeed(const SUMOTrafficObject* const veh) const {
519  if (myRestrictions != nullptr) {
520  std::map<SUMOVehicleClass, double>::const_iterator r = myRestrictions->find(veh->getVClass());
521  if (r != myRestrictions->end()) {
522  return MIN2(veh->getMaxSpeed(), r->second * veh->getChosenSpeedFactor());
523  }
524  }
525  return MIN2(veh->getMaxSpeed(), myMaxSpeed * veh->getChosenSpeedFactor());
526  }
527 
528 
532  inline double getSpeedLimit() const {
533  return myMaxSpeed;
534  }
535 
536 
540  inline double getLength() const {
541  return myLength;
542  }
543 
544 
549  return myPermissions;
550  }
551 
552 
556  double getWidth() const {
557  return myWidth;
558  }
559 
563  int getIndex() const {
564  return myIndex;
565  }
567 
569  int getCrossingIndex() const;
570 
571 
574 
582  virtual void planMovements(const SUMOTime t);
583 
589  virtual void setJunctionApproaches(const SUMOTime t) const;
590 
599  void updateLeaderInfo(const MSVehicle* veh, VehCont::reverse_iterator& vehPart, VehCont::reverse_iterator& vehRes, MSLeaderInfo& ahead) const;
600 
611  virtual void executeMovements(const SUMOTime t);
612 
614  virtual void integrateNewVehicles();
615 
617  void updateLengthSum();
619 
620 
622  inline bool needsCollisionCheck() const {
623  return myNeedsCollisionCheck;
624  }
625 
627  inline void requireCollisionCheck() {
628  myNeedsCollisionCheck = true;
629  }
630 
632  virtual void detectCollisions(SUMOTime timestep, const std::string& stage);
633 
634 
637  virtual bool appropriate(const MSVehicle* veh);
638 
639 
641  const MSLinkCont& getLinkCont() const;
642 
644  MSLink* getLinkTo(const MSLane*) const;
645 
647  MSLink* getEntryLink() const;
648 
649 
651  bool empty() const {
652  assert(myVehBuffer.size() == 0);
653  return myVehicles.empty();
654  }
655 
659  void setMaxSpeed(double val);
660 
664  void setLength(double val);
665 
669  MSEdge& getEdge() const {
670  return *myEdge;
671  }
672 
673 
677  const MSEdge* getNextNormal() const;
678 
679 
685  const MSLane* getFirstInternalInConnection(double& offset) const;
686 
687 
690 
701  static bool dictionary(const std::string& id, MSLane* lane);
702 
703 
710  static MSLane* dictionary(const std::string& id);
711 
712 
714  static void clear();
715 
716 
720  static int dictSize() {
721  return (int)myDict.size();
722  }
723 
724 
728  static void insertIDs(std::vector<std::string>& into);
729 
730 
735  template<class RTREE>
736  static void fill(RTREE& into);
737 
738 
740  static void initRNGs(const OptionsCont& oc);
742 
743 
744 
745  // XXX: succLink does not exist... Documentation?
750  static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle& veh,
751  int nRouteSuccs,
752  const MSLane& succLinkSource,
753  const std::vector<MSLane*>& conts);
754 
755 
758  bool isLinkEnd(MSLinkCont::const_iterator& i) const;
759 
762  bool isLinkEnd(MSLinkCont::iterator& i);
763 
766  bool isEmpty() const;
767 
769  bool isInternal() const;
770 
772  MSVehicle* getLastFullVehicle() const;
773 
776 
778  MSVehicle* getLastAnyVehicle() const;
779 
781  MSVehicle* getFirstAnyVehicle() const;
782 
783  /* @brief remove the vehicle from this lane
784  * @param[notify] whether moveReminders of the vehicle shall be triggered
785  */
786  virtual MSVehicle* removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify = true);
787 
788  void leftByLaneChange(MSVehicle* v);
790 
794  MSLane* getParallelLane(int offset, bool includeOpposite = true) const;
795 
796 
801  void setPermissions(SVCPermissions permissions, long long transientID);
802  void resetPermissions(long long transientID);
803 
804 
805  inline bool allowsVehicleClass(SUMOVehicleClass vclass) const {
806  return (myPermissions & vclass) == vclass;
807  }
808 
809  void addIncomingLane(MSLane* lane, MSLink* viaLink);
810 
811 
814  double length;
816  };
817 
818  const std::vector<IncomingLaneInfo>& getIncomingLanes() const {
819  return myIncomingLanes;
820  }
821 
822 
823  void addApproachingLane(MSLane* lane, bool warnMultiCon);
824  bool isApproachedFrom(MSEdge* const edge);
825  bool isApproachedFrom(MSEdge* const edge, MSLane* const lane);
826 
828  double getStopOffset(const MSVehicle* veh) const;
829 
831  const std::map<SVCPermissions, double>& getStopOffsets() const {
832  return myStopOffsets;
833  };
834 
836  void setStopOffsets(std::map<SVCPermissions, double> stopOffsets) {
837  myStopOffsets = stopOffsets;
838  };
839 
841  MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle* ego, double backOffset,
842  bool allSublanes, double searchDist = -1, bool ignoreMinorLinks = false) const;
843 
845  double getMissingRearGap(const MSVehicle* leader, double backOffset, double leaderSpeed) const;
846 
859  std::pair<MSVehicle* const, double> getLeader(const MSVehicle* veh, const double vehPos, const std::vector<MSLane*>& bestLaneConts, double dist = -1, bool checkTmpVehicles = false) const;
860 
883  std::pair<MSVehicle* const, double> getLeaderOnConsecutive(double dist, double seen,
884  double speed, const MSVehicle& veh, const std::vector<MSLane*>& bestLaneConts) const;
885 
887  void getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle* ego,
888  const std::vector<MSLane*>& bestLaneConts, MSLeaderDistanceInfo& result) const;
889 
907  std::pair<MSVehicle* const, double> getCriticalLeader(double dist, double seen, double speed, const MSVehicle& veh) const;
908 
909  /* @brief return the partial vehicle closest behind ego or 0
910  * if no such vehicle exists */
911  MSVehicle* getPartialBehind(const MSVehicle* ego) const;
912 
915 
927  std::set<MSVehicle*> getSurroundingVehicles(double startPos, double downstreamDist, double upstreamDist, std::shared_ptr<LaneCoverageInfo> checkedLanes) const;
928 
931  std::set<MSVehicle*> getVehiclesInRange(const double a, const double b) const;
932 
933 
935  std::vector<const MSJunction*> getUpcomingJunctions(double pos, double range, const std::vector<MSLane*>& contLanes) const;
937  std::vector<const MSLink*> getUpcomingLinks(double pos, double range, const std::vector<MSLane*>& contLanes) const;
938 
943 
947  const MSLane* getNormalPredecessorLane() const;
948 
951  MSLane* getLogicalPredecessorLane(const MSEdge& fromEdge) const;
952 
953 
960 
961 
968 
971 
973  const std::vector<std::pair<const MSLane*, const MSEdge*> > getOutgoingViaLanes() const;
974 
976 
977 
981  double getMeanSpeed() const;
982 
986  double getWaitingSeconds() const;
987 
988 
992  double getBruttoOccupancy() const;
993 
994 
998  double getNettoOccupancy() const;
999 
1000 
1004  inline double getBruttoVehLenSum() const {
1005  return myBruttoVehicleLengthSum;
1006  }
1007 
1008 
1012  double getCO2Emissions() const;
1013 
1014 
1018  double getCOEmissions() const;
1019 
1020 
1024  double getPMxEmissions() const;
1025 
1026 
1030  double getNOxEmissions() const;
1031 
1032 
1036  double getHCEmissions() const;
1037 
1038 
1042  double getFuelConsumption() const;
1043 
1044 
1048  double getElectricityConsumption() const;
1049 
1050 
1054  double getHarmonoise_NoiseEmissions() const;
1056 
1057  void setRightSideOnEdge(double value, int rightmostSublane) {
1058  myRightSideOnEdge = value;
1059  myRightmostSublane = rightmostSublane;
1060  }
1061 
1063  void initRestrictions();
1064 
1065  void checkBufferType();
1066 
1067  double getRightSideOnEdge() const {
1068  return myRightSideOnEdge;
1069  }
1070 
1071  int getRightmostSublane() const {
1072  return myRightmostSublane;
1073  }
1074 
1075  double getCenterOnEdge() const {
1076  return myRightSideOnEdge + 0.5 * myWidth;
1077  }
1078 
1080  void sortPartialVehicles();
1081 
1083  void sortManeuverReservations();
1084 
1086  MSLane* getOpposite() const;
1087 
1089  double getOppositePos(double pos) const;
1090 
1091  /* @brief find leader for a vehicle depending on the relative driving direction
1092  * @param[in] ego The ego vehicle
1093  * @param[in] dist The look-ahead distance when looking at consecutive lanes
1094  * @param[in] oppositeDir Whether the lane has the opposite driving direction of ego
1095  * @return the leader vehicle and it's gap to ego
1096  */
1097  std::pair<MSVehicle* const, double> getOppositeLeader(const MSVehicle* ego, double dist, bool oppositeDir) const;
1098 
1099  /* @brief find follower for a vehicle that is located on the opposite of this lane
1100  * @param[in] ego The ego vehicle
1101  * @return the follower vehicle and it's gap to ego
1102  */
1103  std::pair<MSVehicle* const, double> getOppositeFollower(const MSVehicle* ego) const;
1104 
1105 
1113  std::pair<MSVehicle* const, double> getFollower(const MSVehicle* ego, double egoPos, double dist, bool ignoreMinorLinks) const;
1114 
1115 
1117  void addParking(MSVehicle* veh);
1118 
1120  virtual void removeParking(MSVehicle* veh);
1121 
1123  const std::set<const MSVehicle*>& getParkingVehicles() const {
1124  return myParkingVehicles;
1125  }
1126 
1128  virtual bool isSelected() const {
1129  return false;
1130  }
1131 
1133  MSLane* getBidiLane() const;
1134 
1136  bool mustCheckJunctionCollisions() const;
1137 
1138 #ifdef HAVE_FOX
1139  FXWorkerThread::Task* getPlanMoveTask(const SUMOTime time) {
1140  mySimulationTask.init(&MSLane::planMovements, time);
1141  return &mySimulationTask;
1142  }
1143 
1144  FXWorkerThread::Task* getExecuteMoveTask(const SUMOTime time) {
1145  mySimulationTask.init(&MSLane::executeMovements, time);
1146  return &mySimulationTask;
1147  }
1148 
1149  FXWorkerThread::Task* getLaneChangeTask(const SUMOTime time) {
1150  mySimulationTask.init(&MSLane::changeLanes, time);
1151  return &mySimulationTask;
1152  }
1153 #endif
1154 
1155  void changeLanes(const SUMOTime time);
1156 
1159 
1167  void saveState(OutputDevice& out);
1168 
1180  void loadState(const std::vector<std::string>& vehIDs, MSVehicleControl& vc);
1182 
1183 
1191  void visit(const LaneStoringVisitor& cont) const {
1192  cont.add(this);
1193  }
1194 
1195  static void initCollisionOptions(const OptionsCont& oc);
1196 
1197  static bool teleportOnCollision() {
1199  }
1200 
1202  return myCollisionAction;
1203  }
1204 
1205  static const long CHANGE_PERMISSIONS_PERMANENT = 0;
1206  static const long CHANGE_PERMISSIONS_GUI = 1;
1207 
1208 protected:
1210  virtual void swapAfterLaneChange(SUMOTime t);
1211 
1223  virtual void incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat,
1224  const MSLane::VehCont::iterator& at,
1226 
1228  void detectPedestrianJunctionCollision(const MSVehicle* collider, const PositionVector& colliderBoundary, const MSLane* foeLane,
1229  SUMOTime timestep, const std::string& stage);
1230 
1232  bool detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim,
1233  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1234  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toTeleport) const;
1235 
1237  void handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim,
1238  double gap, double latGap,
1239  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1240  std::set<const MSVehicle*, ComparatorNumericalIdLess>& toTeleport) const;
1241 
1243  double getMaximumBrakeDist() const;
1244 
1245  /* @brief determine depart speed and whether it may be patched
1246  * @param[in] veh The departing vehicle
1247  * @param[out] whether the speed may be patched to account for safety
1248  * @return the depart speed
1249  */
1250  double getDepartSpeed(const MSVehicle& veh, bool& patchSpeed);
1251 
1252  /* @brief determine the lateral depart position
1253  * @param[in] veh The departing vehicle
1254  * @return the lateral depart position
1255  */
1256  double getDepartPosLat(const MSVehicle& veh);
1257 
1260  double safeInsertionSpeed(const MSVehicle* veh, double seen, const MSLeaderInfo& leaders, double speed);
1261 
1263  bool checkForPedestrians(const MSVehicle* aVehicle, double& speed, double& dist, double pos, bool patchSpeed) const;
1264 
1267 
1270 
1272  int myIndex;
1273 
1286 
1298 
1302 
1306 
1314 
1315  /* @brief list of vehicles that are parking near this lane
1316  * (not necessarily on the road but having reached their stop on this lane)
1317  * */
1318  std::set<const MSVehicle*> myParkingVehicles;
1319 
1321  double myLength;
1322 
1324  const double myWidth;
1325 
1329  std::map<SVCPermissions, double> myStopOffsets;
1330 
1332  MSEdge* const myEdge;
1333 
1335  double myMaxSpeed;
1336 
1339 
1342 
1344  const std::map<SUMOVehicleClass, double>* myRestrictions;
1345 
1347  std::vector<IncomingLaneInfo> myIncomingLanes;
1348 
1351 
1354 
1357 
1360 
1363 
1366 
1369 
1373 
1375  std::map<MSEdge*, std::vector<MSLane*> > myApproachingLanes;
1376 
1381 
1386 
1389 
1391  const bool myIsRampAccel;
1392 
1394  const std::string myLaneType;
1395 
1400 
1403 
1404  // @brief the ids of neighboring lanes
1405  std::vector<std::string> myNeighs;
1406 
1407  // @brief transient changes in permissions
1408  std::map<long long, SVCPermissions> myPermissionChanges;
1409 
1410  // @brief index of the associated thread-rng
1412 
1414  typedef std::map< std::string, MSLane* > DictType;
1415 
1418 
1419  static std::vector<std::mt19937> myRNGs;
1420 
1421 private:
1423  std::vector< MSMoveReminder* > myMoveReminders;
1424 
1430 
1436  public:
1438  explicit vehicle_position_sorter(const MSLane* lane) :
1439  myLane(lane) {
1440  }
1441 
1442 
1448  int operator()(MSVehicle* v1, MSVehicle* v2) const;
1449 
1450  const MSLane* myLane;
1451 
1452  };
1453 
1459  public:
1461  explicit vehicle_natural_position_sorter(const MSLane* lane) :
1462  myLane(lane) {
1463  }
1464 
1465 
1471  int operator()(MSVehicle* v1, MSVehicle* v2) const;
1472 
1473  const MSLane* myLane;
1474 
1475  };
1476 
1482  public:
1484  explicit by_connections_to_sorter(const MSEdge* const e);
1485 
1487  int operator()(const MSEdge* const e1, const MSEdge* const e2) const;
1488 
1489  private:
1490  by_connections_to_sorter& operator=(const by_connections_to_sorter&); // just to avoid a compiler warning
1491  private:
1492  const MSEdge* const myEdge;
1493  double myLaneDir;
1494  };
1495 
1496 
1497 
1503  public:
1505  explicit incoming_lane_priority_sorter(const MSLane* targetLane);
1506 
1508  int operator()(const IncomingLaneInfo& lane1, const IncomingLaneInfo& lane2) const;
1509 
1510  private:
1511  incoming_lane_priority_sorter& operator=(const incoming_lane_priority_sorter&); // just to avoid a compiler warning
1512  private:
1513  const MSLane* const myLane;
1514  double myLaneDir;
1515  };
1516 
1517 
1523  public:
1525  explicit outgoing_lane_priority_sorter(const MSLane* sourceLane);
1526 
1528  int operator()(const MSLink* link1, const MSLink* link2) const;
1529 
1530  private:
1531  outgoing_lane_priority_sorter& operator=(const outgoing_lane_priority_sorter&); // just to avoid a compiler warning
1532  private:
1533  const MSLane* const myLane;
1534  double myLaneDir;
1535  };
1536 
1540  class edge_finder {
1541  public:
1543  bool operator()(const IncomingLaneInfo& ili) const {
1544  return &(ili.lane->getEdge()) == myEdge;
1545  }
1546  private:
1547  edge_finder& operator=(const edge_finder&); // just to avoid a compiler warning
1548  private:
1549  const MSEdge* const myEdge;
1550  };
1551 
1552 #ifdef HAVE_FOX
1553  typedef void(MSLane::*Operation)(const SUMOTime);
1555 
1560  class SimulationTask : public FXWorkerThread::Task {
1561  public:
1562  SimulationTask(MSLane& l, const SUMOTime time)
1563  : myLane(l), myTime(time) {}
1564  void init(Operation operation, const SUMOTime time) {
1565  myOperation = operation;
1566  myTime = time;
1567  }
1568  void run(FXWorkerThread* /*context*/) {
1569  try {
1570  (myLane.*(myOperation))(myTime);
1571  } catch (ProcessError& e) {
1572  WRITE_ERROR(e.what());
1573  }
1574  }
1575  private:
1576  Operation myOperation = nullptr;
1577  MSLane& myLane;
1578  SUMOTime myTime;
1579  private:
1581  SimulationTask& operator=(const SimulationTask&) = delete;
1582  };
1583 
1584  SimulationTask mySimulationTask;
1586  mutable FXMutex myLeaderInfoMutex;
1588  mutable FXMutex myFollowerInfoMutex;
1590  mutable FXMutex myPartialOccupatorMutex;
1591 #endif
1592 private:
1594  MSLane(const MSLane&);
1595 
1597  MSLane& operator=(const MSLane&);
1598 
1599 
1600 };
1601 
1602 
1603 #endif
1604 
1605 /****************************************************************************/
1606 
MSLane::myMoveReminders
std::vector< MSMoveReminder * > myMoveReminders
This lane's move reminder.
Definition: MSLane.h:1423
MSLane::releaseVehicles
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:457
MSLane::outgoing_lane_priority_sorter::myLane
const MSLane *const myLane
Definition: MSLane.h:1533
MSLane::getWaitingSeconds
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
Definition: MSLane.cpp:2707
MSLane::AnyVehicleIterator::myI3End
int myI3End
end index for myTmpVehicles
Definition: MSLane.h:168
MSLane::myDict
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSLane.h:1417
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
MSLane::getVehiclesSecure
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:427
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1866
MSLane::myRNGIndex
int myRNGIndex
Definition: MSLane.h:1411
MSLane::getCOEmissions
double getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2748
MSLane::getDepartPosLat
double getDepartPosLat(const MSVehicle &veh)
Definition: MSLane.cpp:514
MSLane::dictSize
static int dictSize()
Returns the number of stored lanes.
Definition: MSLane.h:720
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:73
MSLane::getIncomingLinkState
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
Definition: MSLane.cpp:2630
MSLane::myIncomingLanes
std::vector< IncomingLaneInfo > myIncomingLanes
All direct predecessor lanes.
Definition: MSLane.h:1347
MSLane::teleportOnCollision
static bool teleportOnCollision()
Definition: MSLane.h:1197
MSLane::outgoing_lane_priority_sorter::operator()
int operator()(const MSLink *link1, const MSLink *link2) const
comparing operator
Definition: MSLane.cpp:2990
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:178
MSLane::myFollowerInfo
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
Definition: MSLane.h:1380
MSLane::incoming_lane_priority_sorter::operator()
int operator()(const IncomingLaneInfo &lane1, const IncomingLaneInfo &lane2) const
comparing operator
Definition: MSLane.cpp:2912
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
Named
Base class for objects which have an id.
Definition: Named.h:56
MSLane::isLinkEnd
bool isLinkEnd(MSLinkCont::const_iterator &i) const
Definition: MSLane.cpp:1994
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:2252
MSLane::getRightmostSublane
int getRightmostSublane() const
Definition: MSLane.h:1071
MSLane::sortPartialVehicles
void sortPartialVehicles()
sorts myPartialVehicles
Definition: MSLane.cpp:1967
MSLaneChanger
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:47
MSLeaderDistanceInfo
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:132
MSLane::getLastAnyVehicle
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
Definition: MSLane.cpp:2033
MSLane::resetPartialOccupation
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:284
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSLane::anyVehiclesUpstreamBegin
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction
Definition: MSLane.h:445
MSLane::myNeighs
std::vector< std::string > myNeighs
Definition: MSLane.h:1405
MSLane::setJunctionApproaches
virtual void setJunctionApproaches(const SUMOTime t) const
Register junction approaches for all vehicles after velocities have been planned.
Definition: MSLane.cpp:1213
MSLane::myNumericalID
int myNumericalID
Unique numerical ID (set on reading by netload)
Definition: MSLane.h:1266
MSLane::myRNGs
static std::vector< std::mt19937 > myRNGs
Definition: MSLane.h:1419
MSLane::getCanonicalSuccessorLane
MSLane * getCanonicalSuccessorLane() const
Definition: MSLane.cpp:2609
MSLane::myLaneType
const std::string myLaneType
the type of this lane
Definition: MSLane.h:1394
MSLane::AnyVehicleIterator::operator!=
bool operator!=(AnyVehicleIterator const &other) const
Definition: MSLane.h:140
MSLane::sortManeuverReservations
void sortManeuverReservations()
sorts myManeuverReservations
Definition: MSLane.cpp:1975
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:3372
MSLane::myNettoVehicleLengthSumToRemove
double myNettoVehicleLengthSumToRemove
The length of all vehicles that have left this lane in the current step (this lane,...
Definition: MSLane.h:1368
MSLane::AnyVehicleIterator::myDirection
int myDirection
index delta
Definition: MSLane.h:172
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:1221
MSLane::getPartialVehicleNumber
int getPartialVehicleNumber() const
Returns the number of vehicles partially on this lane (for which this lane is not responsible)
Definition: MSLane.h:416
MSLane::myCollisionMinGapFactor
static double myCollisionMinGapFactor
Definition: MSLane.h:1429
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:1062
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:487
MSLane::getOppositeFollower
std::pair< MSVehicle *const, double > getOppositeFollower(const MSVehicle *ego) const
Definition: MSLane.cpp:3581
MSLane::myManeuverReservations
VehCont myManeuverReservations
The vehicles which registered maneuvering into the lane within their current action step....
Definition: MSLane.h:1313
MSLane::isEmpty
bool isEmpty() const
Definition: MSLane.cpp:2005
MSLane::getRightSideOnEdge
double getRightSideOnEdge() const
Definition: MSLane.h:1067
MSLane::succLinkSec
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
Definition: MSLane.cpp:2061
MSLane::getPermissions
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:548
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSLane::VehCont
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:92
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:111
MSLane::initRestrictions
void initRestrictions()
initialized vClass-specific speed limits
Definition: MSLane.cpp:223
MSLane::vehicle_natural_position_sorter::myLane
const MSLane * myLane
Definition: MSLane.h:1473
MSLane::requireCollisionCheck
void requireCollisionCheck()
require another collision check due to relevant changes in the simulation
Definition: MSLane.h:627
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:479
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:2820
MSLane::myCollisionAction
static CollisionAction myCollisionAction
the action to take on collisions
Definition: MSLane.h:1426
MSLane::getHCEmissions
double getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2784
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:1173
NamedRTree.h
MSLane::myShape
PositionVector myShape
The shape of the lane.
Definition: MSLane.h:1269
MSLane::AnyVehicleIterator::operator*
const MSVehicle * operator*()
Definition: MSLane.cpp:126
MSLane::getLastFullVehicle
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
Definition: MSLane.cpp:2015
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:1024
MSLaneChangerSublane
Performs lane changing of vehicles.
Definition: MSLaneChangerSublane.h:42
MSLane::getCollisionAction
static CollisionAction getCollisionAction()
Definition: MSLane.h:1201
PositionVector
A list of positions.
Definition: PositionVector.h:45
MSLane::myLeaderInfo
MSLeaderInfo myLeaderInfo
leaders on all sublanes as seen by approaching vehicles (cached)
Definition: MSLane.h:1378
MSLane::myLinks
MSLinkCont myLinks
Definition: MSLane.h:1372
MSLane::getBidiLane
MSLane * getBidiLane() const
retrieve bidirectional lane or nullptr
Definition: MSLane.cpp:3706
MSLane::setMaxSpeed
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
Definition: MSLane.cpp:2155
MSLane::getBruttoOccupancy
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:2677
MSLane::AnyVehicleIterator::operator++
AnyVehicleIterator & operator++()
Definition: MSLane.cpp:109
MSVehicleTransfer
Definition: MSVehicleTransfer.h:63
MSLane::AnyVehicleIterator::operator->
const MSVehicle * operator->()
Definition: MSLane.h:144
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:3470
MSLane::getRNGIndex
int getRNGIndex() const
returns the associated RNG index
Definition: MSLane.h:217
FXSynchQue.h
MSLane::addLink
void addLink(MSLink *link)
Delayed initialization.
Definition: MSLane.cpp:239
MSLane::vehicle_position_sorter
Sorts vehicles by their position (descending)
Definition: MSLane.h:1435
MSLane::myRightSideOnEdge
double myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
Definition: MSLane.h:1397
MSLane::getLengthGeometryFactor
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSLane.h:482
LaneStoringVisitor
Definition: Helper.h:52
MSLane::getIncomingLanes
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition: MSLane.h:818
MSLane::myWidth
const double myWidth
Lane width [m].
Definition: MSLane.h:1324
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:66
MSLane::getPartialBehind
MSVehicle * getPartialBehind(const MSVehicle *ego) const
Definition: MSLane.cpp:3349
MSLane::myCanonicalSuccessorLane
MSLane * myCanonicalSuccessorLane
Main successor lane,.
Definition: MSLane.h:1356
MSLane::getVehicleNumber
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
Definition: MSLane.h:400
MSLane::myBruttoVehicleLengthSumToRemove
double myBruttoVehicleLengthSumToRemove
The length of all vehicles that have left this lane in the current step (this lane,...
Definition: MSLane.h:1365
MSLane::myBruttoVehicleLengthSum
double myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
Definition: MSLane.h:1359
MSLane::needsCollisionCheck
bool needsCollisionCheck() const
short-circut collision check if nothing changed since the last check
Definition: MSLane.h:622
MSLane::myNettoVehicleLengthSum
double myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
Definition: MSLane.h:1362
SUMOTrafficObject::getChosenSpeedFactor
virtual double getChosenSpeedFactor() const =0
MSLeaderInfo
Definition: MSLeaderInfo.h:49
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:1004
MSLane::COLLISION_ACTION_NONE
Definition: MSLane.h:182
MSLane::vehicle_natural_position_sorter::vehicle_natural_position_sorter
vehicle_natural_position_sorter(const MSLane *lane)
Constructor.
Definition: MSLane.h:1461
MSLane::AnyVehicleIterator::myI2
int myI2
index for myPartialVehicles
Definition: MSLane.h:160
MSLane::insertIDs
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
Definition: MSLane.cpp:1898
MSLane::addParking
void addParking(MSVehicle *veh)
add parking vehicle. This should only used during state loading
Definition: MSLane.cpp:3025
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1137
SUMOVehicle.h
MSLane::detectCollisionBetween
bool detectCollisionBetween(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toTeleport) const
detect whether there is a collision between the two vehicles
Definition: MSLane.cpp:1518
MSMoveReminder.h
MSLane::getCO2Emissions
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2736
MSLane::incoming_lane_priority_sorter::myLane
const MSLane *const myLane
Definition: MSLane.h:1513
MSLane::edge_finder::operator()
bool operator()(const IncomingLaneInfo &ili) const
Definition: MSLane.h:1543
MSLane::myFollowerInfoTime
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
Definition: MSLane.h:1385
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:1118
MSLane::by_connections_to_sorter::myEdge
const MSEdge *const myEdge
Definition: MSLane.h:1492
MSLane::getParkingVehicles
const std::set< const MSVehicle * > & getParkingVehicles() const
retrieve the parking vehicles (see GUIParkingArea)
Definition: MSLane.h:1123
MSLane::executeMovements
virtual void executeMovements(const SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:1714
MSLane::by_connections_to_sorter::by_connections_to_sorter
by_connections_to_sorter(const MSEdge *const e)
constructor
Definition: MSLane.cpp:2866
MSLane::swapAfterLaneChange
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:2169
MSLane::getElectricityConsumption
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2808
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:649
MSLane::COLLISION_ACTION_WARN
Definition: MSLane.h:183
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:3630
MSLane::interpolateGeometryPosToLanePos
double interpolateGeometryPosToLanePos(double geometryPos) const
Definition: MSLane.h:510
MSLane::AnyVehicleIterator::myLane
const MSLane * myLane
the lane that is being iterated
Definition: MSLane.h:156
MSLane::myStopOffsets
std::map< SVCPermissions, double > myStopOffsets
Definition: MSLane.h:1329
MSLane::myLengthGeometryFactor
const double myLengthGeometryFactor
precomputed myShape.length / myLength
Definition: MSLane.h:1388
MSLane::VehPosition
Definition: MSLane.h:96
MSLane::CHANGE_PERMISSIONS_PERMANENT
static const long CHANGE_PERMISSIONS_PERMANENT
Definition: MSLane.h:1205
MSLane::myLeaderInfoTime
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
Definition: MSLane.h:1383
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
MSLane::initRNGs
static void initRNGs(const OptionsCont &oc)
initialize rngs
Definition: MSLane.cpp:3692
MSLane::edge_finder::edge_finder
edge_finder(MSEdge *e)
Definition: MSLane.h:1542
MSLane::getVehicleNumberWithPartials
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
Definition: MSLane.h:408
MSLane::getMoveReminders
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
Definition: MSLane.h:267
MSLane::getStopOffset
double getStopOffset(const MSVehicle *veh) const
Returns vehicle class specific stopOffset for the vehicle.
Definition: MSLane.cpp:3064
MSLane::myIsRampAccel
const bool myIsRampAccel
whether this lane is an acceleration lane
Definition: MSLane.h:1391
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:2470
MSLane::getLaneType
const std::string & getLaneType() const
return the type of this lane
Definition: MSLane.h:492
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:2279
MSLane::changeLanes
void changeLanes(const SUMOTime time)
Definition: MSLane.cpp:1832
MSLane::IncomingLaneInfo
Definition: MSLane.h:812
MSLane::addMoveReminder
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
Definition: MSLane.cpp:257
Parameterised.h
Named.h
MSLane::AnyVehicleIterator::myI1
int myI1
index for myVehicles
Definition: MSLane.h:158
MSLane::leftByLaneChange
void leftByLaneChange(MSVehicle *v)
Definition: MSLane.cpp:2652
MSLane::isSelected
virtual bool isSelected() const
whether this lane is selected in the GUI
Definition: MSLane.h:1128
MSLane::myLogicalPredecessorLane
MSLane * myLogicalPredecessorLane
Definition: MSLane.h:1350
MSLane::COLLISION_ACTION_REMOVE
Definition: MSLane.h:185
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:248
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:3439
MSLane::insertVehicle
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:538
SUMOVehicleClass.h
MSLane::IncomingLaneInfo::length
double length
Definition: MSLane.h:814
MSLane::getNOxEmissions
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2772
MSLane::interpolateLanePosToGeometryPos
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:498
MSLane::appropriate
virtual bool appropriate(const MSVehicle *veh)
Definition: MSLane.cpp:1922
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:540
MSLane::vehicle_position_sorter::vehicle_position_sorter
vehicle_position_sorter(const MSLane *lane)
Constructor.
Definition: MSLane.h:1438
MSLane::setRNGIndex
void setRNGIndex(const int rngIndex)
sets the associated RNG index
Definition: MSLane.h:212
MSLane::CHANGE_PERMISSIONS_GUI
static const long CHANGE_PERMISSIONS_GUI
Definition: MSLane.h:1206
MSLane::getOppositePos
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
Definition: MSLane.cpp:3527
MSLane::clear
static void clear()
Clears the dictionary.
Definition: MSLane.cpp:1889
MSLane::empty
bool empty() const
Returns true if there is not a single vehicle on the lane.
Definition: MSLane.h:651
ProcessError
Definition: UtilExceptions.h:39
MSLane::vehicle_position_sorter::myLane
const MSLane * myLane
Definition: MSLane.h:1450
MSLane::getOppositeLeader
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir) const
Definition: MSLane.cpp:3558
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:3259
MSLane::myOriginalPermissions
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
Definition: MSLane.h:1341
Helper.h
MSLane::getMeanSpeed
double getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2720
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
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:391
MSLane::outgoing_lane_priority_sorter
Sorts lanes (their origin link) by the priority of their noninternal target edges or,...
Definition: MSLane.h:1522
MSLane::by_connections_to_sorter
Sorts edges by their angle relative to the given edge (straight comes first)
Definition: MSLane.h:1481
MSLane::addApproachingLane
void addApproachingLane(MSLane *lane, bool warnMultiCon)
Definition: MSLane.cpp:2214
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:1838
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:3657
MSLane::removeVehicle
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2180
MSLane::checkBufferType
void checkBufferType()
Definition: MSLane.cpp:231
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
FXWorkerThread.h
MSLane::myNeedsCollisionCheck
bool myNeedsCollisionCheck
whether a collision check is currently needed
Definition: MSLane.h:1402
MSLane::getNumRNGs
static int getNumRNGs()
return the number of RNGs
Definition: MSLane.h:227
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:3387
MSLane::vehicle_position_sorter::operator()
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
Definition: MSLane.cpp:2843
MSLane::AnyVehicleIterator::nextIsMyVehicles
bool nextIsMyVehicles() const
Definition: MSLane.cpp:142
MSLane::resetManeuverReservation
virtual void resetManeuverReservation(MSVehicle *v)
Unregisters a vehicle, which previously registered for maneuvering into this lane.
Definition: MSLane.cpp:317
MSLane::getCanonicalPredecessorLane
MSLane * getCanonicalPredecessorLane() const
Definition: MSLane.cpp:2589
MSLane::vehicle_natural_position_sorter::operator()
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
Definition: MSLane.cpp:2855
MSMoveReminder::NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
Definition: MSMoveReminder.h:93
MSLane::getNettoOccupancy
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)
Definition: MSLane.cpp:2692
MSLane::getLinkCont
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:2110
MSLane::AnyVehicleIterator::myI1End
int myI1End
end index for myVehicles
Definition: MSLane.h:164
MSLane::getNumericalID
int getNumericalID() const
Returns this lane's numerical id.
Definition: MSLane.h:469
MSLane::setManeuverReservation
virtual void setManeuverReservation(MSVehicle *v)
Registers the lane change intentions (towards this lane) for the given vehicle.
Definition: MSLane.cpp:306
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:3459
MSLane::anyVehiclesEnd
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction
Definition: MSLane.h:439
MSLane::visit
void visit(const LaneStoringVisitor &cont) const
Callback for visiting the lane when traversing an RTree.
Definition: MSLane.h:1191
MSLane::AnyVehicleIterator::myI3
int myI3
index for myTmpVehicles
Definition: MSLane.h:162
FXSynchQue
Definition: FXSynchQue.h:41
MSLane::detectCollisions
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:1271
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:3049
MSLane::updateLengthSum
void updateLengthSum()
updated current vehicle length sum (delayed to avoid lane-order-dependency)
Definition: MSLane.cpp:1818
MSLane::allowsVehicleClass
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: MSLane.h:805
MSLane::getPMxEmissions
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2760
MSLane::isApproachedFrom
bool isApproachedFrom(MSEdge *const edge)
Definition: MSLane.cpp:2228
MSLane::vehicle_natural_position_sorter
Definition: MSLane.h:1458
MSLane::getOpposite
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
Definition: MSLane.cpp:3518
MSLane::getLogicalPredecessorLane
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:2543
MSLane::myCheckJunctionCollisions
static bool myCheckJunctionCollisions
Definition: MSLane.h:1427
MSLane::~MSLane
virtual ~MSLane()
Destructor.
Definition: MSLane.cpp:215
MSLane::getMaximumBrakeDist
double getMaximumBrakeDist() const
compute maximum braking distance on this lane
Definition: MSLane.cpp:2268
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
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:1848
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:335
MSLane::getCenterOnEdge
double getCenterOnEdge() const
Definition: MSLane.h:1075
MSLane::myRestrictions
const std::map< SUMOVehicleClass, double > * myRestrictions
The vClass speed restrictions for this lane.
Definition: MSLane.h:1344
MSLane::addIncomingLane
void addIncomingLane(MSLane *lane, MSLink *viaLink)
Definition: MSLane.cpp:2204
MSLane::myEdge
MSEdge *const myEdge
The lane's edge, for routing only.
Definition: MSLane.h:1332
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:3078
MSLane::myRightmostSublane
int myRightmostSublane
the index of the rightmost sublane of this lane on myEdge
Definition: MSLane.h:1399
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:477
MSLane::myIndex
int myIndex
The lane index.
Definition: MSLane.h:1272
MSLane::DictType
std::map< std::string, MSLane * > DictType
definition of the static dictionary type
Definition: MSLane.h:1414
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:1375
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 *, ComparatorNumericalIdLess > &toTeleport) const
take action upon collision
Definition: MSLane.cpp:1589
MSLane::saveState
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
Definition: MSLane.cpp:3036
MSLane::mustCheckJunctionCollisions
bool mustCheckJunctionCollisions() const
whether this lane must check for junction collisions
Definition: MSLane.cpp:3719
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:620
MSLane::AnyVehicleIterator::myDownstream
bool myDownstream
iteration direction
Definition: MSLane.h:170
MSLane::AnyVehicleIterator::operator==
bool operator==(AnyVehicleIterator const &other) const
Definition: MSLane.h:131
MSLane::setRightSideOnEdge
void setRightSideOnEdge(double value, int rightmostSublane)
Definition: MSLane.h:1057
MSLane::incoming_lane_priority_sorter::incoming_lane_priority_sorter
incoming_lane_priority_sorter(const MSLane *targetLane)
constructor
Definition: MSLane.cpp:2907
MSLane::getStopOffsets
const std::map< SVCPermissions, double > & getStopOffsets() const
Returns vehicle class specific stopOffsets.
Definition: MSLane.h:831
MSLane::integrateNewVehicles
virtual void integrateNewVehicles()
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:1940
MSLane::myPermissions
SVCPermissions myPermissions
The vClass permissions for this lane.
Definition: MSLane.h:1338
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:1033
MSLane::myLength
double myLength
Lane length [m].
Definition: MSLane.h:1321
MSLane::IncomingLaneInfo::lane
MSLane * lane
Definition: MSLane.h:813
MSLane::anyVehiclesUpstreamEnd
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction
Definition: MSLane.h:451
MSLane::getLinkTo
MSLink * getLinkTo(const MSLane *) const
returns the link to the given lane or 0, if it is not connected
Definition: MSLane.cpp:2117
MSLane::setLength
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
Definition: MSLane.cpp:2162
MSLane::edge_finder
Definition: MSLane.h:1540
LaneCoverageInfo
std::map< const MSLane *, std::pair< double, double > > LaneCoverageInfo
Coverage info.
Definition: MSLane.h:64
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:1305
MSLane::fill
static void fill(RTREE &into)
Fills the given RTree with lane instances.
Definition: MSLane.cpp:1906
MSLane::CollisionAction
CollisionAction
Definition: MSLane.h:181
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:2198
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:1297
MSLane::outgoing_lane_priority_sorter::myLaneDir
double myLaneDir
Definition: MSLane.h:1534
MSLane::removeParking
virtual void removeParking(MSVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
Definition: MSLane.cpp:3031
MSLane::by_connections_to_sorter::operator()
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Definition: MSLane.cpp:2873
FXSynchQue::size
size_t size() const
Definition: FXSynchQue.h:158
MSLane::getWidth
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:556
MSLane::myParkingVehicles
std::set< const MSVehicle * > myParkingVehicles
Definition: MSLane.h:1318
MSLane::AnyVehicleIterator::myI2End
int myI2End
end index for myPartialVehicles
Definition: MSLane.h:166
MSLane::AnyVehicleIterator
friend class AnyVehicleIterator
Definition: MSLane.h:89
config.h
MSLane::getFirstAnyVehicle
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
Definition: MSLane.cpp:2047
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:71
MSLane::isInternal
bool isInternal() const
Definition: MSLane.cpp:2010
MSLane::incoming_lane_priority_sorter::operator=
incoming_lane_priority_sorter & operator=(const incoming_lane_priority_sorter &)
MSLane::COLLISION_ACTION_TELEPORT
Definition: MSLane.h:184
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:504
MSLane::getRNG
std::mt19937 * getRNG() const
return the associated RNG
Definition: MSLane.h:222
MSLane::IncomingLaneInfo::viaLink
MSLink * viaLink
Definition: MSLane.h:815
MSLane::VehPosition::operator()
bool operator()(const MSVehicle *cmp, double pos) const
compares vehicle position to the detector position
Definition: MSLane.cpp:2837
MSLane::myCanonicalPredecessorLane
MSLane * myCanonicalPredecessorLane
Similar to LogicalPredecessorLane,.
Definition: MSLane.h:1353
MSLane::getOutgoingViaLanes
const std::vector< std::pair< const MSLane *, const MSEdge * > > getOutgoingViaLanes() const
get the list of outgoing lanes
Definition: MSLane.cpp:2641
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:2568
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:518
MSLane::setStopOffsets
void setStopOffsets(std::map< SVCPermissions, double > stopOffsets)
Set vehicle class specific stopOffsets.
Definition: MSLane.h:836
MSQueueExport
Export the queueing length in front of a junction (very experimental!)
Definition: MSQueueExport.h:49
MSLane::myPermissionChanges
std::map< long long, SVCPermissions > myPermissionChanges
Definition: MSLane.h:1408
MSLane::getSpeedLimit
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:532
FXWorkerThread::Task
Abstract superclass of a task to be run with an index to keep track of pending tasks.
Definition: FXWorkerThread.h:55
MSLane::getFuelConsumption
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2796
MSLane::setPartialOccupation
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:267
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:1484
MSLane::getCrossingIndex
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1
Definition: MSLane.cpp:2666
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:2024
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
MSLane::outgoing_lane_priority_sorter::outgoing_lane_priority_sorter
outgoing_lane_priority_sorter(const MSLane *sourceLane)
constructor
Definition: MSLane.cpp:2985
MSLane::incoming_lane_priority_sorter
Sorts lanes (IncomingLaneInfos) by their priority or, if this doesn't apply, wrt. the angle differenc...
Definition: MSLane.h:1502
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
PositionVector.h
MSLane::by_connections_to_sorter::myLaneDir
double myLaneDir
Definition: MSLane.h:1493
MSLane::edge_finder::myEdge
const MSEdge *const myEdge
Definition: MSLane.h:1549
MSLane::AnyVehicleIterator
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane,...
Definition: MSLane.h:109
MSLane::getIndex
int getIndex() const
Returns the lane's index.
Definition: MSLane.h:563
MSLane::addNeigh
void addNeigh(const std::string &id)
Adds a neighbor to this lane.
Definition: MSLane.cpp:245
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:356
MSLane::myVehicles
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
Definition: MSLane.h:1285
MSLane::myMaxSpeed
double myMaxSpeed
Lane-wide speedlimit [m/s].
Definition: MSLane.h:1335
LaneStoringVisitor::add
void add(const MSLane *const l) const
Adds the given object to the container.
Definition: Helper.cpp:62
MSLane::resetPermissions
void resetPermissions(long long transientID)
Definition: MSLane.cpp:3642
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:2344
MSLane::enteredByLaneChange
void enteredByLaneChange(MSVehicle *v)
Definition: MSLane.cpp:2659
FXWorkerThread
A thread repeatingly calculating incoming tasks.
Definition: FXWorkerThread.h:48
MSLane::incoming_lane_priority_sorter::myLaneDir
double myLaneDir
Definition: MSLane.h:1514
MSLane::myCollisionStopTime
static SUMOTime myCollisionStopTime
Definition: MSLane.h:1428
MSLane::myTmpVehicles
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
Definition: MSLane.h:1301
MSLane::getEntryLink
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
Definition: MSLane.cpp:2138
MSLane::anyVehiclesBegin
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction
Definition: MSLane.h:433
MSLane::initCollisionOptions
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:3610
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
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:3539