SUMO - Simulation of Urban MObility
MSVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
24 // Representation of a vehicle in the micro simulation
25 /****************************************************************************/
26 #ifndef MSVehicle_h
27 #define MSVehicle_h
28 
29 
30 // ===========================================================================
31 // included modules
32 // ===========================================================================
33 #include <config.h>
34 
35 #include <list>
36 #include <deque>
37 #include <map>
38 #include <set>
39 #include <string>
40 #include <vector>
41 #include <memory>
42 #include "MSGlobals.h"
43 #include "MSVehicleType.h"
44 #include "MSBaseVehicle.h"
45 #include "MSLink.h"
46 #include "MSLane.h"
47 
48 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light! Refs. #2577
49 
50 // ===========================================================================
51 // class declarations
52 // ===========================================================================
53 class SUMOSAXAttributes;
54 class MSMoveReminder;
55 class MSLaneChanger;
56 class MSVehicleTransfer;
58 class MSStoppingPlace;
59 class MSChargingStation;
60 class MSParkingArea;
61 class MSPerson;
62 class MSDevice;
64 class OutputDevice;
65 class Position;
66 class MSContainer;
67 class MSJunction;
68 class MSLeaderInfo;
69 //class MSDriverState;
71 
72 // ===========================================================================
73 // class definitions
74 // ===========================================================================
79 class MSVehicle : public MSBaseVehicle {
80 public:
81 
83  friend class MSLaneChanger;
84  friend class MSLaneChangerSublane;
85 
89  class State {
91  friend class MSVehicle;
92  friend class MSLaneChanger;
93  friend class MSLaneChangerSublane;
94 
95  public:
97  State(double pos, double speed, double posLat, double backPos);
98 
100  State(const State& state);
101 
103  State& operator=(const State& state);
104 
106  bool operator!=(const State& state);
107 
109  double pos() const {
110  return myPos;
111  }
112 
114  double speed() const {
115  return mySpeed;
116  };
117 
119  double posLat() const {
120  return myPosLat;
121  }
122 
124  double backPos() const {
125  return myBackPos;
126  }
127 
129  double lastCoveredDist() const {
130  return myLastCoveredDist;
131  }
132 
133 
134  private:
136  double myPos;
137 
139  double mySpeed;
140 
142  double myPosLat;
143 
145  // if the vehicle occupies multiple lanes, this is the position relative
146  // to the lane occupied by its back
147  double myBackPos;
148 
151 
157 
158  };
159 
160 
165  friend class MSVehicle;
166 
167  typedef std::list<std::pair<SUMOTime, SUMOTime> > waitingIntervalList;
168 
169  public:
172 
175 
178 
180  bool operator!=(const WaitingTimeCollector& wt) const;
181 
184 
185  // return the waiting time within the last memory millisecs
186  SUMOTime cumulatedWaitingTime(SUMOTime memory = -1) const;
187 
188  // process time passing for dt millisecs
189  void passTime(SUMOTime dt, bool waiting);
190 
191  // maximal memory time stored
193  return myMemorySize;
194  }
195 
196  // maximal memory time stored
197  const waitingIntervalList& getWaitingIntervals() const {
198  return myWaitingIntervals;
199  }
200 
201  private:
204 
208  waitingIntervalList myWaitingIntervals;
209 
211  void appendWaitingTime(SUMOTime dt);
212  };
213 
214 
227  };
228 
236  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
237  MSVehicleType* type, const double speedFactor);
238 
240  virtual ~MSVehicle();
241 
242 
244 
245 
255 
256 
257 
259 
260 
264  bool hasArrived() const;
265 
276  bool replaceRoute(const MSRoute* route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true);
277 
278 
284  bool willPass(const MSEdge* const edge) const;
285 
286  int getRoutePosition() const;
287  void resetRoutePosition(int index);
288 
297 
298 
300 
301 
319  void workOnMoveReminders(double oldPos, double newPos, double newSpeed);
321 
322 
328  bool checkActionStep(const SUMOTime t);
329 
335  void resetActionOffset(const SUMOTime timeUntilNextAction = 0);
336 
337 
347  void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength);
348 
349 
367  void planMove(const SUMOTime t, const MSLeaderInfo& ahead, const double lengthsInFront);
368 
369 
382  bool executeMove();
383 
390  double getDeltaPos(double accel);
391 
392 
394 
395 
399  double getPositionOnLane() const {
400  return myState.myPos;
401  }
402 
406  double getLastStepDist() const {
407  return myState.lastCoveredDist();
408  }
409 
413  double getPositionOnLane(const MSLane* lane) const;
414 
423  double getBackPositionOnLane(const MSLane* lane) const;
424 
428  double getBackPositionOnLane() const {
430  }
431 
436  double getLateralPositionOnLane() const {
437  return myState.myPosLat;
438  }
439 
444  double getRightSideOnLane() const;
445 
449  double lateralDistanceToLane(const int offset) const;
450 
452  double getLateralOverlap() const;
453  double getLateralOverlap(double posLat) const;
454 
460  double getRightSideOnEdge(const MSLane* lane = 0) const;
461 
467  double getCenterOnEdge(const MSLane* lane = 0) const;
468 
474  double getLatOffset(const MSLane* lane) const;
475 
479  double getSpeed() const {
480  return myState.mySpeed;
481  }
482 
483 
487  double getPreviousSpeed() const {
488  return myState.myPreviousSpeed;
489  }
490 
491 
496  double getAcceleration() const {
497  return myAcceleration;
498  }
499 
500 
506  return myType->getActionStepLength();
507  }
508 
513  double getActionStepLengthSecs() const {
515  }
516 
517 
522  return myLastActionTime;
523  }
524 
526 
527 
528 
530 
531 
535  double getSlope() const;
536 
537 
545  Position getPosition(const double offset = 0) const;
546 
547 
555  Position getPositionAlongBestLanes(double offset) const;
556 
557 
561  MSLane* getLane() const {
562  return myLane;
563  }
564 
565 
570  double
572  if (myLane != 0) {
573  return myLane->getVehicleMaxSpeed(this);
574  } else {
575  return myType->getMaxSpeed();
576  }
577  }
578 
579 
583  inline bool isOnRoad() const {
584  return myAmOnNet;
585  }
586 
587 
591  inline bool isActive() const {
592  return myActionStep;
593  }
594 
598  inline bool isActionStep(SUMOTime t) const {
599  return (t - myLastActionTime) % getActionStepLength() == 0;
600 // return t%getActionStepLength() == 0; // synchronized actions for all vehicles with identical actionsteplengths
601  }
602 
603 
607  bool isFrontOnLane(const MSLane* lane) const;
608 
609 
616  const MSEdge* getRerouteOrigin() const;
617 
618 
626  return myWaitingTime;
627  }
628 
639  return TIME2STEPS(myTimeLoss);
640  }
641 
642 
649  }
650 
657  double getWaitingSeconds() const {
658  return STEPS2TIME(myWaitingTime);
659  }
660 
661 
669  }
670 
673  double getTimeLossSeconds() const {
674  return myTimeLoss;
675  }
676 
677 
681  double getAngle() const {
682  return myAngle;
683  }
684 
685 
690  return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed());
691  }
693 
695  double computeAngle() const;
696 
698  void setAngle(double angle, bool straightenFurther = false);
699 
701  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
702  if (veh1->myState.myPos < veh2->myState.myPos) {
703  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
704  }
705  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
706  }
707 
708 
711  bool congested() const {
712  return myState.mySpeed < double(60) / double(3.6);
713  }
714 
715 
727  void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
728 
735  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
736 
737 
738 
747  void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat,
748  MSMoveReminder::Notification notification);
749 
754  void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0);
755 
760  void enterLaneAtLaneChange(MSLane* enteredLane);
761 
762 
764  void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0);
765 
772  void updateDriveItems();
773 
777  const std::pair<double, LinkDirection>& getNextTurn() {
778  return myNextTurn;
779  }
780 
781 
784 
785  const std::vector<MSLane*>& getFurtherLanes() const {
786  return myFurtherLanes;
787  }
788 
789  const std::vector<double>& getFurtherLanesPosLat() const {
790  return myFurtherLanesPosLat;
791  }
792 
793 
795  bool onFurtherEdge(const MSEdge* edge) const;
796 
799 
800  //
804  struct LaneQ {
808  double length;
812  double occupation;
819  /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change
820  * The 'length' attribute is the sum of these lane lengths
821  * (There may be alternative sequences that have equal length)
822  * It is the 'best' in the strategic sense of reducing required lane-changes
823  */
824  std::vector<MSLane*> bestContinuations;
825  };
826 
830  const std::vector<LaneQ>& getBestLanes() const;
831 
849  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
850 
851 
855  const std::vector<MSLane*>& getBestLanesContinuation() const;
856 
857 
861  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
862 
863  /* @brief returns the current signed offset from the lane that is most
864  * suited for continuing the current route (in the strategic sense of reducing lane-changes)
865  * - 0 if the vehicle is one it's best lane
866  * - negative if the vehicle should change to the right
867  * - positive if the vehicle should change to the left
868  */
869  int getBestLaneOffset() const;
870 
872  void adaptBestLanesOccupation(int laneIndex, double density);
873 
875 
877  void fixPosition();
878 
879 
887  inline const MSCFModel& getCarFollowModel() const {
888  return myType->getCarFollowModel();
889  }
890 
896  inline std::shared_ptr<MSSimpleDriverState> getDriverState() const {
897  return myDriverState;
898  }
899 
900 
906  return myCFVariables;
907  }
908 
910 
911 
915  class Stop {
916  public:
917  Stop(const SUMOVehicleParameter::Stop& par) : pars(par) {}
921  const MSLane* lane;
935  bool triggered;
939  bool reached;
949  bool collision;
950 
952  void write(OutputDevice& dev) const;
953 
955  double getEndPos(const SUMOVehicle& veh) const;
956 
958  std::string getDescription() const;
959  private:
961  Stop& operator=(const Stop& src);
962 
963  };
964 
965 
972  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false,
973  MSRouteIterator* searchStart = 0);
974 
977  bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
978 
981  void createDriverState();
982 
986 
990  bool hasStops() const {
991  return !myStops.empty();
992  }
993 
996  inline bool hasDriverState() const {
997  return (myDriverState != nullptr);
998  }
999 
1003  bool isStopped() const;
1004 
1007 
1010  bool willStop() const;
1011 
1013  bool isStoppedOnLane() const;
1014 
1016  bool keepStopping(bool afterProcessing = false) const;
1017 
1021  SUMOTime collisionStopTime() const;
1022 
1026  bool isParking() const;
1027 
1031  bool isRemoteControlled() const;
1032 
1036  bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const;
1037 
1039  double nextStopDist() const {
1040  return myStopDist;
1041  }
1042 
1046  bool isStoppedTriggered() const;
1047 
1050  bool isStoppedInRange(double pos) const;
1052 
1053  int getLaneIndex() const;
1054 
1064  double getDistanceToPosition(double destPos, const MSEdge* destEdge) const;
1065 
1066 
1074  double processNextStop(double currentVelocity);
1075 
1083  std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const;
1084 
1091  double getTimeGapOnLane() const;
1092 
1093 
1095 
1096 
1100  double getCO2Emissions() const;
1101 
1102 
1106  double getCOEmissions() const;
1107 
1108 
1112  double getHCEmissions() const;
1113 
1114 
1118  double getNOxEmissions() const;
1119 
1120 
1124  double getPMxEmissions() const;
1125 
1126 
1130  double getFuelConsumption() const;
1131 
1132 
1136  double getElectricityConsumption() const;
1137 
1138 
1142  double getHarmonoise_NoiseEmissions() const;
1144 
1145 
1146 
1148 
1149 
1153  void addPerson(MSTransportable* person);
1154 
1156 
1157 
1161  void addContainer(MSTransportable* container);
1162 
1165 
1169  enum Signalling {
1200  };
1201 
1202 
1208  LC_NEVER = 0, // lcModel shall never trigger changes at this level
1209  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
1210  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
1211  };
1212 
1213 
1216  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
1217  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
1218  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
1219  LCP_OPPORTUNISTIC = 3 // change if not blocked
1220  };
1221 
1222 
1226  void switchOnSignal(int signal) {
1227  mySignals |= signal;
1228  }
1229 
1230 
1234  void switchOffSignal(int signal) {
1235  mySignals &= ~signal;
1236  }
1237 
1238 
1242  int getSignals() const {
1243  return mySignals;
1244  }
1245 
1246 
1251  bool signalSet(int which) const {
1252  return (mySignals & which) != 0;
1253  }
1255 
1256 
1258  bool unsafeLinkAhead(const MSLane* lane) const;
1259 
1261  bool passingMinor() const;
1262 
1263 
1264 
1272  double getSpeedWithoutTraciInfluence() const;
1273 
1278  bool rerouteParkingArea(const std::string& parkingAreaID, std::string& errorMsg);
1279 
1292  bool addTraciStop(MSLane* const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until,
1293  const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg);
1294 
1306  bool addTraciStopAtStoppingPlace(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking,
1307  const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string& errorMsg);
1308 
1313  Stop& getNextStop();
1314 
1319  std::list<Stop> getMyStops();
1320 
1325  bool resumeFromStopping();
1326 
1327 
1329  double updateFurtherLanes(std::vector<MSLane*>& furtherLanes,
1330  std::vector<double>& furtherLanesPosLat,
1331  const std::vector<MSLane*>& passedLanes);
1332 
1335 
1338 
1351  class Influencer {
1352  public:
1354  Influencer();
1355 
1356 
1358  ~Influencer();
1359 
1360 
1364  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, double> >& speedTimeLine);
1365 
1366 
1370  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, int> >& laneTimeLine);
1371 
1375  void setSublaneChange(double latDist);
1376 
1378  int getSpeedMode() const;
1379 
1381  int getLaneChangeMode() const;
1382 
1384  int getRoutingMode() const {
1385  return myRoutingMode;
1386  }
1387  SUMOTime getLaneTimeLineDuration();
1388 
1400  double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax);
1401 
1409  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state);
1410 
1411 
1417  double changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1418 
1422  inline bool getRespectJunctionPriority() const {
1423  return myRespectJunctionPriority;
1424  }
1425 
1426 
1430  inline bool getEmergencyBrakeRedLight() const {
1431  return myEmergencyBrakeRedLight;
1432  }
1433 
1434 
1436  bool considerSafeVelocity() const {
1437  return myConsiderSafeVelocity;
1438  }
1439 
1443  void setSpeedMode(int speedMode);
1444 
1448  void setLaneChangeMode(int value);
1449 
1453  void setRoutingMode(int value) {
1454  myRoutingMode = value;
1455  }
1456 
1460  double getOriginalSpeed() const;
1461 
1462  void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1463 
1465  return myLastRemoteAccess;
1466  }
1467 
1468  void postProcessRemoteControl(MSVehicle* v);
1469 
1471  double implicitSpeedRemote(const MSVehicle* veh, double oldSpeed);
1472 
1474  double implicitDeltaPosRemote(const MSVehicle* veh);
1475 
1476  bool isRemoteControlled() const;
1477 
1478  bool isRemoteAffected(SUMOTime t) const;
1479 
1480  void setSignals(int signals) {
1481  myTraCISignals = signals;
1482  }
1483 
1484  int getSignals() const {
1485  return myTraCISignals;
1486  }
1487 
1488  double getLatDist() const {
1489  return myLatDist;
1490  }
1491 
1492  void resetLatDist() {
1493  myLatDist = 0.;
1494  }
1495 
1496  SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterTT() const;
1497 
1498  private:
1500  std::vector<std::pair<SUMOTime, double> > mySpeedTimeLine;
1501 
1503  std::vector<std::pair<SUMOTime, int> > myLaneTimeLine;
1504 
1507 
1509  double myLatDist;
1510 
1513 
1516 
1519 
1522 
1525 
1528 
1531  double myRemotePos;
1537 
1539 
1540  LaneChangeMode myStrategicLC;
1551  TraciLaneChangePriority myTraciLaneChangePriority;
1553 
1554  // @brief the signals set via TraCI
1556 
1559 
1560  };
1561 
1562 
1569 
1570  const Influencer* getInfluencer() const;
1571 
1572  bool hasInfluencer() const {
1573  return myInfluencer != 0;
1574  }
1575 
1577  int influenceChangeDecision(int state);
1578 
1580  void setRemoteState(Position xyPos);
1581 
1583  double basePos(const MSEdge* edge) const;
1584 
1586  double getSafeFollowSpeed(const std::pair<const MSVehicle*, double> leaderInfo,
1587  const double seen, const MSLane* const lane, double distToCrossing) const;
1588 
1590  static int nextLinkPriority(const std::vector<MSLane*>& conts);
1591 
1593 
1594 
1596  void saveState(OutputDevice& out);
1597 
1600  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1602 
1603 protected:
1604 
1605  double getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1606 
1609 
1625  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1627 
1628 
1636  void processLinkAproaches(double& vSafe, double& vSafeMin, double& vSafeMinDist);
1637 
1638 
1647  void processLaneAdvances(std::vector<MSLane*>& passedLanes, bool& moved, std::string& emergencyReason);
1648 
1649 
1657  double processTraCISpeedControl(double vSafe, double vNext);
1658 
1659 
1666  void removePassedDriveItems();
1667 
1670  void updateWaitingTime(double vNext);
1671 
1674  void updateTimeLoss(double vNext);
1675 
1677  bool canReverse() const;
1678 
1681  void setBrakingSignals(double vNext) ;
1682 
1685  void setBlinkerInformation();
1686 
1689  void setEmergencyBlueLight(SUMOTime currentTime);
1690 
1692  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1693 
1696  const ConstMSEdgeVector getStopEdges() const;
1697 
1699  Position validatePosition(Position result, double offset = 0) const;
1700 
1702  virtual void drawOutsideNetwork(bool /*add*/) {};
1703 
1707 
1709  double myTimeLoss;
1710 
1713 
1715 // std::shared_ptr<MSDriverState> myDriverState;
1716  std::shared_ptr<MSSimpleDriverState> myDriverState;
1717 
1723 
1724 
1725 
1728 
1730 
1733 
1734  /* @brief Complex data structure for keeping and updating LaneQ:
1735  * Each element of the outer vector corresponds to an upcoming edge on the vehicles route
1736  * The first element corresponds to the current edge and is returned in getBestLanes()
1737  * The other elements are only used as a temporary structure in updateBestLanes();
1738  */
1739  std::vector<std::vector<LaneQ> > myBestLanes;
1740 
1741  /* @brief iterator to speed up retrieval of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation()
1742  * This is updated in updateOccupancyAndCurrentBestLane()
1743  */
1744  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1745 
1746  static std::vector<MSLane*> myEmptyLaneVector;
1747 
1749  std::list<Stop> myStops;
1750 
1753 
1756  std::pair<double, LinkDirection> myNextTurn;
1757 
1759  std::vector<MSLane*> myFurtherLanes;
1761  std::vector<double> myFurtherLanesPosLat;
1762 
1765 
1768 
1771 
1774 
1776 
1778  double myAngle;
1779 
1781  double myStopDist;
1782 
1785 
1787 
1788 protected:
1789 
1795  double myVLinkPass;
1796  double myVLinkWait;
1802  double myDistance;
1803  double accelV;
1806 
1807  DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest,
1808  SUMOTime arrivalTime, double arrivalSpeed,
1809  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1810  double distance,
1811  double leaveSpeed = -1.) :
1812  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1813  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1814  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1815  myDistance(distance),
1816  accelV(leaveSpeed), hadVehicle(false), availableSpace(0) {
1817  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1818  assert(vPass >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1819  };
1820 
1821 
1823  DriveProcessItem(double vWait, double distance, double _availableSpace = 0) :
1824  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1825  myArrivalTime(0), myArrivalSpeed(0),
1826  myArrivalTimeBraking(0), myArrivalSpeedBraking(0),
1827  myDistance(distance),
1828  accelV(-1), hadVehicle(false), availableSpace(_availableSpace) {
1829  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1830  };
1831 
1832 
1833  inline void adaptLeaveSpeed(const double v) {
1834  if (accelV < 0) {
1835  accelV = v;
1836  } else {
1837  accelV = MIN2(accelV, v);
1838  }
1839  }
1840  inline double getLeaveSpeed() const {
1841  return accelV < 0 ? myVLinkPass : accelV;
1842  }
1843  };
1844 
1846  // TODO: Consider making LFLinkLanes a std::deque for efficient front removal (needs refactoring in checkRewindLinkLanes()...)
1847  typedef std::vector< DriveProcessItem > DriveItemVector;
1848  DriveItemVector myLFLinkLanes;
1854  DriveItemVector::iterator myNextDriveItem;
1855 
1857  void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist, std::pair<double, LinkDirection>& myNextTurn) const;
1858 
1860  void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const;
1861 
1863  void setApproachingForAllLinks(DriveItemVector& lfLinks) const;
1864 
1866  void removeApproachingInformation(DriveItemVector& lfLinks) const;
1867 
1868 
1870  inline double estimateLeaveSpeed(const MSLink* const link, const double vLinkPass) const {
1871  // estimate leave speed for passing time computation
1872  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1873  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1874  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1876  }
1877 
1878 
1879  /* @brief adapt safe velocity in accordance to a moving obstacle:
1880  * - a leader vehicle
1881  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1882  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1883  * @param[in] seen the distance to the end of the current lane
1884  * @param[in] lastLink the lastLink index
1885  * @param[in] lane The current Lane the vehicle is on
1886  * @param[in,out] the safe velocity for driving
1887  * @param[in,out] the safe velocity for arriving at the next link
1888  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1889  */
1890  void adaptToLeader(const std::pair<const MSVehicle*, double> leaderInfo,
1891  const double seen, DriveProcessItem* const lastLink,
1892  const MSLane* const lane, double& v, double& vLinkPass,
1893  double distToCrossing = -1) const;
1894 
1895  /* @brief adapt safe velocity in accordance to multiple vehicles ahead:
1896  * @param[in] ahead The leader information according to the current lateral-resolution
1897  * @param[in] latOffset the lateral offset for locating the ego vehicle on the given lane
1898  * @param[in] seen the distance to the end of the current lane
1899  * @param[in] lastLink the lastLink index
1900  * @param[in] lane The current Lane the vehicle is on
1901  * @param[in,out] the safe velocity for driving
1902  * @param[in,out] the safe velocity for arriving at the next link
1903  */
1904  void adaptToLeaders(const MSLeaderInfo& ahead,
1905  double latOffset,
1906  const double seen, DriveProcessItem* const lastLink,
1907  const MSLane* const lane, double& v, double& vLinkPass) const;
1908 
1910  void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen,
1911  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest,
1912  bool isShadowLink = false) const;
1913 
1915  void checkLinkLeaderCurrentAndParallel(const MSLink* link, const MSLane* lane, double seen,
1916  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const;
1917 
1918 
1919  // @brief return the lane on which the back of this vehicle resides
1920  const MSLane* getBackLane() const;
1921 
1922  // @brief get the position of the back bumper;
1923  const Position getBackPosition() const;
1924 
1932  void updateState(double vNext);
1933 
1934 
1936  bool keepClear(const MSLink* link) const;
1937 
1939  bool ignoreRed(const MSLink* link, bool canBrake) const;
1940 
1941 private:
1942  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1943  * @note member is initialized on first access */
1945 
1948 
1951 
1952 private:
1954  MSVehicle();
1955 
1957  MSVehicle(const MSVehicle&);
1958 
1960  MSVehicle& operator=(const MSVehicle&);
1961 
1963 
1964 };
1965 
1966 
1967 #endif
1968 
1969 /****************************************************************************/
1970 
double myPos
the stored position
Definition: MSVehicle.h:136
int getRoutePosition() const
Definition: MSVehicle.cpp:833
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:1422
void adaptToLeader(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass, double distToCrossing=-1) const
Definition: MSVehicle.cpp:2305
double myLatDist
The requested lateral change.
Definition: MSVehicle.h:1509
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
void adaptToLeaders(const MSLeaderInfo &ahead, double latOffset, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass) const
Definition: MSVehicle.cpp:2256
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1732
Drive process items represent bounds on the safe velocity corresponding to the upcoming links...
Definition: MSVehicle.h:1793
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
double computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:1075
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:4523
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:667
int getSignals() const
Definition: MSVehicle.h:1484
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:485
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:4511
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:3819
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignore
Definition: MSVehicle.cpp:5264
std::list< std::pair< SUMOTime, SUMOTime > > waitingIntervalList
Definition: MSVehicle.h:167
double myAngle
the angle in radians (
Definition: MSVehicle.h:1778
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
long long int SUMOTime
Definition: SUMOTime.h:36
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle&#39;s car following model variables.
Definition: MSVehicle.h:905
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
Definition: MSVehicle.cpp:5240
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:4529
double getPreviousSpeed() const
Returns the vehicle&#39;s speed before the previous time step.
Definition: MSVehicle.h:487
double backPos() const
back Position of this state
Definition: MSVehicle.h:124
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:681
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1944
PositionVector getBoundingPoly() const
get bounding polygon
Definition: MSVehicle.cpp:4890
static int nextLinkPriority(const std::vector< MSLane *> &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:4347
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:625
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1731
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:1207
void enterLaneAtInsertion(MSLane *enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
Definition: MSVehicle.cpp:3918
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1729
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1767
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:657
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1547
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1739
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1759
Position getVelocityVector() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:689
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1712
double myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1506
Stop & getNextStop()
Definition: MSVehicle.cpp:5187
A lane area vehicles can halt at.
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
Definition: MSVehicle.cpp:1301
DriveItemVector myLFLinkLanes
Definition: MSVehicle.h:1848
bool resumeFromStopping()
Definition: MSVehicle.cpp:5136
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1770
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:561
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
Definition: MSVehicle.h:816
double myTimeLoss
the time loss in seconds due to driving with less than maximum speed
Definition: MSVehicle.h:1709
void setBlinkerInformation()
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:4564
SUMOTime myLastActionTime
Action offset (actions are taken at time myActionOffset + N*getActionStepLength()) Initialized to 0...
Definition: MSVehicle.h:1722
void addContainer(MSTransportable *container)
Adds a container.
Definition: MSVehicle.cpp:4552
SUMOTime getMemorySize() const
Definition: MSVehicle.h:192
SUMOTime remainingStopDuration() const
Returns the remaining stop duration for a stopped vehicle or 0.
Definition: MSVehicle.cpp:1413
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:4452
const SUMOVehicleParameter::Stop pars
The stop parameter.
Definition: MSVehicle.h:931
int myRoutingMode
routing mode (see TraCIConstants.h)
Definition: MSVehicle.h:1558
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:933
The front lights are on (no visualisation)
Definition: MSVehicle.h:1181
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:1169
void updateTimeLoss(double vNext)
Updates the vehicle&#39;s time loss.
Definition: MSVehicle.cpp:2973
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
Definition: MSVehicle.cpp:4926
std::list< Stop > getMyStops()
Definition: MSVehicle.cpp:5192
The base class for an intersection.
Definition: MSJunction.h:60
void planMove(const SUMOTime t, const MSLeaderInfo &ahead, const double lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
Definition: MSVehicle.cpp:1723
The car-following model abstraction.
Definition: MSCFModel.h:57
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
Definition: MSVehicle.h:927
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:923
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:399
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:935
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1518
double myPosLat
the stored lateral position
Definition: MSVehicle.h:142
int getBestLaneOffset() const
Definition: MSVehicle.cpp:4409
bool canReverse() const
whether the vehicle is a train that can reverse its direction at the current point in its route ...
Definition: MSVehicle.cpp:2985
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:939
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:1185
Notification
Definition of a vehicle state.
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:1351
double lateralDistanceToLane(const int offset) const
Get the minimal lateral distance required to move fully onto the lane at given offset.
Definition: MSVehicle.cpp:4757
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
Definition: MSVehicle.cpp:5056
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1524
double getLeaveSpeed() const
Definition: MSVehicle.h:1840
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:133
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:1187
vehicle doesn&#39;t want to change
Definition: MSVehicle.h:220
void createDriverState()
Create a DriverState for the vehicle.
Definition: MSVehicle.cpp:5365
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:1215
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist, std::pair< double, LinkDirection > &myNextTurn) const
Definition: MSVehicle.cpp:1793
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
SUMOTime getLastActionTime() const
Returns the time of the vehicle&#39;s last action point.
Definition: MSVehicle.h:521
PositionVector getBoundingBox() const
get bounding rectangle
Definition: MSVehicle.cpp:4877
bool isStoppedOnLane() const
Definition: MSVehicle.cpp:1397
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:932
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
Definition: MSVehicle.cpp:1144
bool checkActionStep(const SUMOTime t)
Returns whether the vehicle is supposed to take action in the current simulation step Updates myActio...
Definition: MSVehicle.cpp:1690
double getRightSideOnLane() const
Get the vehicle&#39;s lateral position on the lane:
Definition: MSVehicle.cpp:4643
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:4419
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1706
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:3132
double getSafeFollowSpeed(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, const MSLane *const lane, double distToCrossing) const
compute safe speed for following the given leader
Definition: MSVehicle.cpp:2443
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:72
SUMOTime myMemorySize
the maximal memory to store
Definition: MSVehicle.h:203
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1242
double lastCoveredDist() const
previous Speed of this state
Definition: MSVehicle.h:129
#define TIME2STEPS(x)
Definition: SUMOTime.h:60
double myLastCoveredDist
Definition: MSVehicle.h:156
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:50
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1775
A storage for edge travel times and efforts.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
Definition: MSVehicle.h:945
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:814
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:808
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
Definition: MSVehicle.cpp:4936
bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI within the lookBack time...
Definition: MSVehicle.cpp:5246
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:754
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:3868
Position getPositionAlongBestLanes(double offset) const
Return the (x,y)-position, which the vehicle would reach if it continued along its best continuation ...
Definition: MSVehicle.cpp:965
The car-following model and parameter.
Definition: MSVehicleType.h:66
void checkLinkLeader(const MSLink *link, const MSLane *lane, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass, double &vLinkWait, bool &setRequest, bool isShadowLink=false) const
checks for link leaders on the given link
Definition: MSVehicle.cpp:2357
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:937
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4028
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
Definition: MSVehicle.cpp:1440
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1947
Performs lane changing of vehicles.
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
Definition: MSVehicle.cpp:3528
int getLaneIndex() const
Definition: MSVehicle.cpp:4626
double getBackPositionOnLane() const
Get the vehicle&#39;s position relative to its current lane.
Definition: MSVehicle.h:428
Right blinker lights are switched on.
Definition: MSVehicle.h:1173
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation...
Definition: MSVehicle.h:571
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
Definition: MSVehicle.cpp:1668
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
Definition: MSVehicle.cpp:763
double getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:210
bool willStop() const
Returns whether the vehicle will stop on the current edge.
Definition: MSVehicle.cpp:1392
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1503
std::vector< double > myFurtherLanesPosLat
lateral positions on further lanes
Definition: MSVehicle.h:1761
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1251
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1430
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:145
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:48
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:4435
A road/street connecting two junctions.
Definition: MSEdge.h:75
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:583
void leaveLane(const MSMoveReminder::Notification reason, const MSLane *approachedLane=0)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
Definition: MSVehicle.cpp:3978
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
Definition: MSVehicle.cpp:4687
bool hasDriverState() const
Whether this vehicle is equipped with a MSDriverState.
Definition: MSVehicle.h:996
MSLane * lane
The described lane.
Definition: MSVehicle.h:806
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:887
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:4493
SUMOTime getAccumulatedWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:647
Left blinker lights are switched on.
Definition: MSVehicle.h:1175
double getActionStepLengthSecs() const
Returns the vehicle&#39;s action step length in secs, i.e. the interval between two action points...
Definition: MSVehicle.h:513
The wipers are on.
Definition: MSVehicle.h:1189
void setAngle(double angle, bool straightenFurther=false)
Set a custom vehicle angle in rad, optionally updates furtherLanePosLat.
Definition: MSVehicle.cpp:1061
const MSCFModel & getCarFollowModel() const
Returns the vehicle type&#39;s car following model definition (const version)
Position validatePosition(Position result, double offset=0) const
ensure that a vehicle-relative position is not invalid
Definition: MSVehicle.cpp:1027
vehicle want&#39;s to change to right lane
Definition: MSVehicle.h:224
void updateState(double vNext)
updates the vehicles state, given a next value for its speed. This value can be negative in case of t...
Definition: MSVehicle.cpp:3322
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it&#39;s primary lane ...
Definition: MSVehicle.cpp:4807
double updateFurtherLanes(std::vector< MSLane *> &furtherLanes, std::vector< double > &furtherLanesPosLat, const std::vector< MSLane *> &passedLanes)
update a vector of further lanes and return the new backPos
Definition: MSVehicle.cpp:3375
Representation of a vehicle.
Definition: SUMOVehicle.h:60
SUMOTime myLastRemoteAccess
Definition: MSVehicle.h:1536
Stores the waiting intervals over the previous seconds (memory is to be specified in ms...
Definition: MSVehicle.h:164
Encapsulated SAX-Attributes.
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
Definition: MSVehicle.h:1784
void adaptLeaveSpeed(const double v)
Definition: MSVehicle.h:1833
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:218
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
SUMOTime getActionStepLength() const
Returns the vehicle&#39;s action step length in millisecs, i.e. the interval between two action points...
Definition: MSVehicle.h:505
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:919
double posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
Definition: MSVehicle.h:119
A list of positions.
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:673
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:4046
int getRoutingMode() const
return the current routing mode
Definition: MSVehicle.h:1384
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:4380
Position myCachedPosition
Definition: MSVehicle.h:1786
double getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:3534
double getCenterOnEdge(const MSLane *lane=0) const
Get the vehicle&#39;s lateral position on the edge of the given lane (or its current edge if lane == 0) ...
Definition: MSVehicle.cpp:4655
double currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:810
const std::pair< double, LinkDirection > & getNextTurn()
Get the distance and direction of the next upcoming turn for the vehicle (within its look-ahead range...
Definition: MSVehicle.h:777
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:785
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1749
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:58
bool collision
Whether this stop was triggered by a collision.
Definition: MSVehicle.h:949
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1521
#define STEPS2TIME(x)
Definition: SUMOTime.h:58
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1727
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
Definition: MSVehicle.h:1773
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1177
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:990
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:1950
void resetRoutePosition(int index)
Definition: MSVehicle.cpp:839
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1744
double getDeltaPos(double accel)
calculates the distance covered in the next integration step given an acceleration and assuming the c...
Definition: MSVehicle.cpp:2466
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
Definition: MSVehicle.cpp:5252
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:4535
bool considerSafeVelocity() const
Returns whether safe velocities shall be considered.
Definition: MSVehicle.h:1436
T MIN2(T a, T b)
Definition: StdDefs.h:70
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:1699
SUMOTime getActionStepLength() const
Returns this type&#39;s default action step length.
The brake lights are on.
Definition: MSVehicle.h:1179
A blue emergency light is on.
Definition: MSVehicle.h:1195
A structure representing the best lanes for continuing the current route starting at &#39;lane&#39;...
Definition: MSVehicle.h:804
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:5342
Everything is switched off.
Definition: MSVehicle.h:1171
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:740
double myStopDist
distance to the next stop or -1 if there is none
Definition: MSVehicle.h:1781
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:1434
bool hasInfluencer() const
Definition: MSVehicle.h:1572
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
Definition: MSVehicle.cpp:1422
Something on a lane to be noticed about vehicle movement.
double basePos(const MSEdge *edge) const
departure position where the vehicle fits fully onto the edge (if possible)
Definition: MSVehicle.cpp:1678
double myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1752
void fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:4427
bool myActionStep
The flag myActionStep indicates whether the current time step is an action point for the vehicle...
Definition: MSVehicle.h:1719
double myPreviousSpeed
the speed at the begin of the previous time step
Definition: MSVehicle.h:150
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1702
One of the left doors is opened.
Definition: MSVehicle.h:1191
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1545
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1543
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:921
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:818
const waitingIntervalList & getWaitingIntervals() const
Definition: MSVehicle.h:197
Container that holds the vehicles driving state (position+speed).
Definition: MSVehicle.h:89
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:5317
DriveProcessItem(MSLink *link, double vPass, double vWait, bool setRequest, SUMOTime arrivalTime, double arrivalSpeed, SUMOTime arrivalTimeBraking, double arrivalSpeedBraking, double distance, double leaveSpeed=-1.)
Definition: MSVehicle.h:1807
void processLaneAdvances(std::vector< MSLane *> &passedLanes, bool &moved, std::string &emergencyReason)
This method checks if the vehicle has advanced over one or several lanes along its route and triggers...
Definition: MSVehicle.cpp:3022
double getLateralPositionOnLane() const
Get the vehicle&#39;s lateral position on the lane.
Definition: MSVehicle.h:436
void setRoutingMode(int value)
Sets routing behavior.
Definition: MSVehicle.h:1453
void setBrakingSignals(double vNext)
sets the braking lights on/off
Definition: MSVehicle.cpp:2942
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1527
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:4499
void removePassedDriveItems()
Erase passed drive items from myLFLinkLanes (and unregister approaching information for corresponding...
Definition: MSVehicle.cpp:2734
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
Definition: MSVehicle.h:1702
int numExpectedContainer
The number of still expected containers.
Definition: MSVehicle.h:943
const std::vector< double > & getFurtherLanesPosLat() const
Definition: MSVehicle.h:789
Abstract in-vehicle device.
Definition: MSDevice.h:65
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:4363
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:4612
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
Definition: MSVehicle.cpp:5008
vehicle want&#39;s to change to left lane
Definition: MSVehicle.h:222
int numExpectedPerson
The number of still expected persons.
Definition: MSVehicle.h:941
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:5197
Structure representing possible vehicle parameter.
DriveItemVector::iterator myNextDriveItem
iterator pointing to the next item in myLFLinkLanes
Definition: MSVehicle.h:1854
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
Definition: MSVehicle.h:1549
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:812
std::pair< double, LinkDirection > myNextTurn
the upcoming turn for the vehicle
Definition: MSVehicle.h:1756
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
Definition: MSVehicle.cpp:1402
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
void removeApproachingInformation(DriveItemVector &lfLinks) const
unregister approach from all upcoming links
Definition: MSVehicle.cpp:4812
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1446
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
Definition: MSVehicle.cpp:4633
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:591
void processLinkAproaches(double &vSafe, double &vSafeMin, double &vSafeMinDist)
This method iterates through the driveprocess items for the vehicle and adapts the given in/out param...
Definition: MSVehicle.cpp:2488
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1500
MSVehicleType * myType
This vehicle&#39;s type.
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:870
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
runs heuristic for keeping the intersection clear in case of downstream jamming
Definition: MSVehicle.cpp:3555
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1764
ConstMSEdgeVector myRemoteRoute
Definition: MSVehicle.h:1535
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:824
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:929
std::shared_ptr< MSSimpleDriverState > myDriverState
This vehicle&#39;s driver state.
Definition: MSVehicle.h:1716
Definition of vehicle stop (position and duration)
void setRemoteState(Position xyPos)
sets position outside the road network
Definition: MSVehicle.cpp:5234
void checkLinkLeaderCurrentAndParallel(const MSLink *link, const MSLane *lane, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass, double &vLinkWait, bool &setRequest) const
checks for link leaders of the current link as well as the parallel link (if there is one) ...
Definition: MSVehicle.cpp:2341
double getAcceleration() const
Returns the vehicle&#39;s acceleration in m/s (this is computed as the last step&#39;s mean acceleration in c...
Definition: MSVehicle.h:496
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:925
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1048
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:4517
friend class MSVehicle
vehicle sets states directly
Definition: MSVehicle.h:91
double getActionStepLengthSecs() const
Returns this type&#39;s default action step length in seconds.
void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
Definition: MSVehicle.cpp:3786
void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength)
Process an updated action step length value (only affects the vehicle&#39;s action offset, The actionStepLength is stored in the (singular) vtype)
Definition: MSVehicle.cpp:1704
DriveProcessItem(double vWait, double distance, double _availableSpace=0)
constructor if the link shall not be passed
Definition: MSVehicle.h:1823
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
Definition: MSVehicle.cpp:183
Stop(const SUMOVehicleParameter::Stop &par)
Definition: MSVehicle.h:917
const MSLane * getBackLane() const
Definition: MSVehicle.cpp:3365
double processTraCISpeedControl(double vSafe, double vNext)
Check for speed advices from the traci client and adjust the speed vNext in the current (euler) / aft...
Definition: MSVehicle.cpp:2706
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:4482
waitingIntervalList myWaitingIntervals
Definition: MSVehicle.h:208
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:109
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during planMove() and executeMove.
Definition: MSVehicle.h:1847
void updateWaitingTime(double vNext)
Updates the vehicle&#39;s waiting time counters (accumulated and consecutive)
Definition: MSVehicle.cpp:2961
void setSignals(int signals)
Definition: MSVehicle.h:1480
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:848
void setApproachingForAllLinks(DriveItemVector &lfLinks) const
registers computed approach information with all links
Definition: MSVehicle.cpp:3760
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
Definition: MSCFModel.cpp:695
vehicle want&#39;s to keep the current lane
Definition: MSVehicle.h:226
double getLastStepDist() const
Get the distance the vehicle covered in the previous timestep.
Definition: MSVehicle.h:406
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
double speed() const
Speed of this state.
Definition: MSVehicle.h:114
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:1234
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:56
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1226
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:921
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
Definition: MSVehicle.cpp:5300
void addPerson(MSTransportable *person)
Adds a passenger.
Definition: MSVehicle.cpp:4541
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1746
std::shared_ptr< MSSimpleDriverState > getDriverState() const
Returns the vehicle driver&#39;s state.
Definition: MSVehicle.h:896
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:701
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle. ...
Definition: MSVehicle.h:598
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
Definition: MSVehicle.cpp:4824
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:860
double getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:4505
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:718
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1386
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:827
MSParkingArea * getNextParkingArea()
get the current parking area stop
Definition: MSVehicle.cpp:1372
const Position getBackPosition() const
Definition: MSVehicle.cpp:1120
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle&#39;s lateral position on the edge of the given lane (or its current edge if lane == 0) ...
Definition: MSVehicle.cpp:4649
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:4040
SUMOTime getTimeLoss() const
Returns the SUMOTime lost (speed was lesser maximum speed)
Definition: MSVehicle.h:638
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1428
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:479
State(double pos, double speed, double posLat, double backPos)
Constructor.
Definition: MSVehicle.cpp:155
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1512
double estimateLeaveSpeed(const MSLink *const link, const double vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1870
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:5221
double getLatDist() const
Definition: MSVehicle.h:1488
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1464
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Definition: MSVehicle.h:947
Provides an interface to an error whose fluctuation is controlled via the driver&#39;s &#39;awareness&#39;...
A red emergency light is on.
Definition: MSVehicle.h:1197
Representation of a lane in the micro simulation.
Definition: MSLane.h:71
double myBackPos
the stored back position
Definition: MSVehicle.h:147
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle&#39;s entering of a new lane.
Definition: MSVehicle.cpp:899
One of the right doors is opened.
Definition: MSVehicle.h:1193
Interface for lane-change models.
double mySpeed
the stored speed (should be >=0 at any time)
Definition: MSVehicle.h:139
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1515
The fog lights are on (no visualisation)
Definition: MSVehicle.h:1183
double nextStopDist() const
return the distance to the next stop or doubleMax if there is none.
Definition: MSVehicle.h:1039
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:5212
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:915
A yellow emergency light is on.
Definition: MSVehicle.h:1199
double pos() const
Position of this state.
Definition: MSVehicle.h:109
void updateDriveItems()
Check whether the drive items (myLFLinkLanes) are up to date, and update them if required.
Definition: MSVehicle.cpp:2788
bool congested() const
Definition: MSVehicle.h:711