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 
371  void setApproachingForAllLinks(const SUMOTime t);
372 
373 
386  bool executeMove();
387 
394  double getDeltaPos(double accel);
395 
396 
398 
399 
403  double getPositionOnLane() const {
404  return myState.myPos;
405  }
406 
410  double getLastStepDist() const {
411  return myState.lastCoveredDist();
412  }
413 
417  double getPositionOnLane(const MSLane* lane) const;
418 
427  double getBackPositionOnLane(const MSLane* lane) const;
428 
432  double getBackPositionOnLane() const {
434  }
435 
440  double getLateralPositionOnLane() const {
441  return myState.myPosLat;
442  }
443 
448  double getRightSideOnLane() const;
449 
453  double lateralDistanceToLane(const int offset) const;
454 
456  double getLateralOverlap() const;
457  double getLateralOverlap(double posLat) const;
458 
464  double getRightSideOnEdge(const MSLane* lane = 0) const;
465 
471  double getCenterOnEdge(const MSLane* lane = 0) const;
472 
478  double getLatOffset(const MSLane* lane) const;
479 
483  double getSpeed() const {
484  return myState.mySpeed;
485  }
486 
487 
491  double getPreviousSpeed() const {
492  return myState.myPreviousSpeed;
493  }
494 
495 
500  double getAcceleration() const {
501  return myAcceleration;
502  }
503 
504 
510  return myType->getActionStepLength();
511  }
512 
517  double getActionStepLengthSecs() const {
519  }
520 
521 
526  return myLastActionTime;
527  }
528 
530 
531 
532 
534 
535 
539  double getSlope() const;
540 
541 
549  Position getPosition(const double offset = 0) const;
550 
551 
559  Position getPositionAlongBestLanes(double offset) const;
560 
561 
565  MSLane* getLane() const {
566  return myLane;
567  }
568 
569 
574  double
576  if (myLane != 0) {
577  return myLane->getVehicleMaxSpeed(this);
578  } else {
579  return myType->getMaxSpeed();
580  }
581  }
582 
583 
587  inline bool isOnRoad() const {
588  return myAmOnNet;
589  }
590 
591 
595  inline bool isActive() const {
596  return myActionStep;
597  }
598 
602  inline bool isActionStep(SUMOTime t) const {
603  return (t - myLastActionTime) % getActionStepLength() == 0;
604 // return t%getActionStepLength() == 0; // synchronized actions for all vehicles with identical actionsteplengths
605  }
606 
607 
611  bool isFrontOnLane(const MSLane* lane) const;
612 
613 
620  const MSEdge* getRerouteOrigin() const;
621 
622 
630  return myWaitingTime;
631  }
632 
643  return TIME2STEPS(myTimeLoss);
644  }
645 
646 
653  }
654 
661  double getWaitingSeconds() const {
662  return STEPS2TIME(myWaitingTime);
663  }
664 
665 
673  }
674 
677  double getTimeLossSeconds() const {
678  return myTimeLoss;
679  }
680 
681 
685  double getAngle() const {
686  return myAngle;
687  }
688 
689 
694  return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed());
695  }
697 
699  double computeAngle() const;
700 
702  void setAngle(double angle, bool straightenFurther = false);
703 
705  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
706  if (veh1->myState.myPos < veh2->myState.myPos) {
707  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
708  }
709  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
710  }
711 
712 
715  bool congested() const {
716  return myState.mySpeed < double(60) / double(3.6);
717  }
718 
719 
731  void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
732 
739  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
740 
741 
742 
751  void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat,
752  MSMoveReminder::Notification notification);
753 
758  void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0);
759 
764  void enterLaneAtLaneChange(MSLane* enteredLane);
765 
766 
768  void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0);
769 
776  void updateDriveItems();
777 
781  const std::pair<double, LinkDirection>& getNextTurn() {
782  return myNextTurn;
783  }
784 
785 
788 
789  const std::vector<MSLane*>& getFurtherLanes() const {
790  return myFurtherLanes;
791  }
792 
793  const std::vector<double>& getFurtherLanesPosLat() const {
794  return myFurtherLanesPosLat;
795  }
796 
797 
799  bool onFurtherEdge(const MSEdge* edge) const;
800 
803 
804  //
808  struct LaneQ {
812  double length;
816  double occupation;
823  /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change
824  * The 'length' attribute is the sum of these lane lengths
825  * (There may be alternative sequences that have equal length)
826  * It is the 'best' in the strategic sense of reducing required lane-changes
827  */
828  std::vector<MSLane*> bestContinuations;
829  };
830 
834  const std::vector<LaneQ>& getBestLanes() const;
835 
853  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
854 
855 
859  const std::vector<MSLane*>& getBestLanesContinuation() const;
860 
861 
865  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
866 
867  /* @brief returns the current signed offset from the lane that is most
868  * suited for continuing the current route (in the strategic sense of reducing lane-changes)
869  * - 0 if the vehicle is one it's best lane
870  * - negative if the vehicle should change to the right
871  * - positive if the vehicle should change to the left
872  */
873  int getBestLaneOffset() const;
874 
876  void adaptBestLanesOccupation(int laneIndex, double density);
877 
879 
881  void fixPosition();
882 
883 
891  inline const MSCFModel& getCarFollowModel() const {
892  return myType->getCarFollowModel();
893  }
894 
900  inline std::shared_ptr<MSSimpleDriverState> getDriverState() const {
901  return myDriverState;
902  }
903 
904 
910  return myCFVariables;
911  }
912 
914 
915 
919  class Stop {
920  public:
921  Stop(const SUMOVehicleParameter::Stop& par) : pars(par) {}
925  const MSLane* lane;
939  bool triggered;
943  bool reached;
953  bool collision;
954 
956  void write(OutputDevice& dev) const;
957 
959  double getEndPos(const SUMOVehicle& veh) const;
960 
962  std::string getDescription() const;
963  private:
965  Stop& operator=(const Stop& src);
966 
967  };
968 
969 
976  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false,
977  MSRouteIterator* searchStart = 0);
978 
981  bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
982 
985  void createDriverState();
986 
990 
994  bool hasStops() const {
995  return !myStops.empty();
996  }
997 
1000  inline bool hasDriverState() const {
1001  return (myDriverState != nullptr);
1002  }
1003 
1007  bool isStopped() const;
1008 
1011 
1014  bool willStop() const;
1015 
1017  bool isStoppedOnLane() const;
1018 
1020  bool keepStopping(bool afterProcessing = false) const;
1021 
1025  SUMOTime collisionStopTime() const;
1026 
1030  bool isParking() const;
1031 
1035  bool isRemoteControlled() const;
1036 
1040  bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const;
1041 
1043  double nextStopDist() const {
1044  return myStopDist;
1045  }
1046 
1050  bool isStoppedTriggered() const;
1051 
1054  bool isStoppedInRange(double pos) const;
1056 
1057  int getLaneIndex() const;
1058 
1068  double getDistanceToPosition(double destPos, const MSEdge* destEdge) const;
1069 
1070 
1078  double processNextStop(double currentVelocity);
1079 
1087  std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const;
1088 
1095  double getTimeGapOnLane() const;
1096 
1097 
1099 
1100 
1104  double getCO2Emissions() const;
1105 
1106 
1110  double getCOEmissions() const;
1111 
1112 
1116  double getHCEmissions() const;
1117 
1118 
1122  double getNOxEmissions() const;
1123 
1124 
1128  double getPMxEmissions() const;
1129 
1130 
1134  double getFuelConsumption() const;
1135 
1136 
1140  double getElectricityConsumption() const;
1141 
1142 
1146  double getHarmonoise_NoiseEmissions() const;
1148 
1149 
1150 
1152 
1153 
1157  void addPerson(MSTransportable* person);
1158 
1160 
1161 
1165  void addContainer(MSTransportable* container);
1166 
1169 
1173  enum Signalling {
1204  };
1205 
1206 
1212  LC_NEVER = 0, // lcModel shall never trigger changes at this level
1213  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
1214  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
1215  };
1216 
1217 
1220  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
1221  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
1222  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
1223  LCP_OPPORTUNISTIC = 3 // change if not blocked
1224  };
1225 
1226 
1230  void switchOnSignal(int signal) {
1231  mySignals |= signal;
1232  }
1233 
1234 
1238  void switchOffSignal(int signal) {
1239  mySignals &= ~signal;
1240  }
1241 
1242 
1246  int getSignals() const {
1247  return mySignals;
1248  }
1249 
1250 
1255  bool signalSet(int which) const {
1256  return (mySignals & which) != 0;
1257  }
1259 
1260 
1262  bool unsafeLinkAhead(const MSLane* lane) const;
1263 
1265  bool passingMinor() const;
1266 
1267 
1268 
1276  double getSpeedWithoutTraciInfluence() const;
1277 
1282  bool rerouteParkingArea(const std::string& parkingAreaID, std::string& errorMsg);
1283 
1296  bool addTraciStop(MSLane* const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until,
1297  const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg);
1298 
1310  bool addTraciStopAtStoppingPlace(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking,
1311  const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string& errorMsg);
1312 
1317  Stop& getNextStop();
1318 
1323  std::list<Stop> getMyStops();
1324 
1329  bool resumeFromStopping();
1330 
1331 
1333  double updateFurtherLanes(std::vector<MSLane*>& furtherLanes,
1334  std::vector<double>& furtherLanesPosLat,
1335  const std::vector<MSLane*>& passedLanes);
1336 
1339 
1342 
1355  class Influencer {
1356  private:
1359  GapControlState();
1360  void activate(double tauOriginal, double tauTarget, double additionalGap, double duration, double changeRate, double maxDecel);
1361  void deactivate();
1363  double tauOriginal;
1365  double tauCurrent;
1367  double tauTarget;
1376  double changeRate;
1378  double maxDecel;
1380  bool active;
1388  double timeHeadwayIncrement, spaceHeadwayIncrement;
1389  };
1390  public:
1392  Influencer();
1393 
1394 
1396  ~Influencer();
1397 
1398 
1402  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, double> >& speedTimeLine);
1403 
1406  void activateGapController(double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel);
1407 
1410  void deactivateGapController();
1411 
1415  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, int> >& laneTimeLine);
1416 
1420  void setSublaneChange(double latDist);
1421 
1423  int getSpeedMode() const;
1424 
1426  int getLaneChangeMode() const;
1427 
1429  int getRoutingMode() const {
1430  return myRoutingMode;
1431  }
1432  SUMOTime getLaneTimeLineDuration();
1433 
1434  SUMOTime getLaneTimeLineEnd();
1435 
1447  double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax);
1448 
1461  double gapControlSpeed(SUMOTime currentTime, const SUMOVehicle* veh, double speed, double vSafe, double vMin, double vMax);
1462 
1470  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state);
1471 
1472 
1478  double changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1479 
1483  inline bool getRespectJunctionPriority() const {
1484  return myRespectJunctionPriority;
1485  }
1486 
1487 
1491  inline bool getEmergencyBrakeRedLight() const {
1492  return myEmergencyBrakeRedLight;
1493  }
1494 
1495 
1497  bool considerSafeVelocity() const {
1498  return myConsiderSafeVelocity;
1499  }
1500 
1504  void setSpeedMode(int speedMode);
1505 
1509  void setLaneChangeMode(int value);
1510 
1514  void setRoutingMode(int value) {
1515  myRoutingMode = value;
1516  }
1517 
1521  double getOriginalSpeed() const;
1522 
1523  void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1524 
1526  return myLastRemoteAccess;
1527  }
1528 
1529  void postProcessRemoteControl(MSVehicle* v);
1530 
1532  double implicitSpeedRemote(const MSVehicle* veh, double oldSpeed);
1533 
1535  double implicitDeltaPosRemote(const MSVehicle* veh);
1536 
1537  bool isRemoteControlled() const;
1538 
1539  bool isRemoteAffected(SUMOTime t) const;
1540 
1541  void setSignals(int signals) {
1542  myTraCISignals = signals;
1543  }
1544 
1545  int getSignals() const {
1546  return myTraCISignals;
1547  }
1548 
1549  double getLatDist() const {
1550  return myLatDist;
1551  }
1552 
1553  void resetLatDist() {
1554  myLatDist = 0.;
1555  }
1556 
1557  bool ignoreOverlap() const {
1558  return myTraciLaneChangePriority == LCP_ALWAYS;
1559  }
1560 
1561  SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterTT() const;
1562 
1563  private:
1565  std::vector<std::pair<SUMOTime, double> > mySpeedTimeLine;
1566 
1568  std::vector<std::pair<SUMOTime, int> > myLaneTimeLine;
1569 
1571  std::shared_ptr<GapControlState> myGapControlState;
1572 
1575 
1577  double myLatDist;
1578 
1581 
1584 
1587 
1590 
1593 
1596 
1599  double myRemotePos;
1605 
1607 
1608  LaneChangeMode myStrategicLC;
1619  TraciLaneChangePriority myTraciLaneChangePriority;
1621 
1622  // @brief the signals set via TraCI
1624 
1627 
1628  };
1629 
1630 
1637 
1638  const Influencer* getInfluencer() const;
1639 
1640  bool hasInfluencer() const {
1641  return myInfluencer != 0;
1642  }
1643 
1645  int influenceChangeDecision(int state);
1646 
1648  void setRemoteState(Position xyPos);
1649 
1651  double basePos(const MSEdge* edge) const;
1652 
1654  double getSafeFollowSpeed(const std::pair<const MSVehicle*, double> leaderInfo,
1655  const double seen, const MSLane* const lane, double distToCrossing) const;
1656 
1658  static int nextLinkPriority(const std::vector<MSLane*>& conts);
1659 
1661  bool isLeader(const MSLink* link, const MSVehicle* veh) const;
1662 
1664 
1665 
1667  void saveState(OutputDevice& out);
1668 
1671  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1673 
1674 protected:
1675 
1676  double getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1677 
1680 
1696  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1698 
1699 
1707  void processLinkAproaches(double& vSafe, double& vSafeMin, double& vSafeMinDist);
1708 
1709 
1718  void processLaneAdvances(std::vector<MSLane*>& passedLanes, bool& moved, std::string& emergencyReason);
1719 
1720 
1728  double processTraCISpeedControl(double vSafe, double vNext);
1729 
1730 
1737  void removePassedDriveItems();
1738 
1741  void updateWaitingTime(double vNext);
1742 
1745  void updateTimeLoss(double vNext);
1746 
1748  bool canReverse() const;
1749 
1752  void setBrakingSignals(double vNext) ;
1753 
1756  void setBlinkerInformation();
1757 
1760  void setEmergencyBlueLight(SUMOTime currentTime);
1761 
1763  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1764 
1767  const ConstMSEdgeVector getStopEdges() const;
1768 
1770  double getBrakeGap() const;
1771 
1773  Position validatePosition(Position result, double offset = 0) const;
1774 
1776  virtual void drawOutsideNetwork(bool /*add*/) {};
1777 
1781 
1783  double myTimeLoss;
1784 
1787 
1789 // std::shared_ptr<MSDriverState> myDriverState;
1790  std::shared_ptr<MSSimpleDriverState> myDriverState;
1791 
1797 
1798 
1799 
1802 
1804 
1807 
1808  /* @brief Complex data structure for keeping and updating LaneQ:
1809  * Each element of the outer vector corresponds to an upcoming edge on the vehicles route
1810  * The first element corresponds to the current edge and is returned in getBestLanes()
1811  * The other elements are only used as a temporary structure in updateBestLanes();
1812  */
1813  std::vector<std::vector<LaneQ> > myBestLanes;
1814 
1815  /* @brief iterator to speed up retrieval of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation()
1816  * This is updated in updateOccupancyAndCurrentBestLane()
1817  */
1818  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1819 
1820  static std::vector<MSLane*> myEmptyLaneVector;
1821 
1823  std::list<Stop> myStops;
1824 
1827 
1830  std::pair<double, LinkDirection> myNextTurn;
1831 
1833  std::vector<MSLane*> myFurtherLanes;
1835  std::vector<double> myFurtherLanesPosLat;
1836 
1839 
1842 
1845 
1848 
1850 
1852  double myAngle;
1853 
1855  double myStopDist;
1856 
1859 
1861 
1866 
1867 protected:
1868 
1874  double myVLinkPass;
1875  double myVLinkWait;
1881  double myDistance;
1882  double accelV;
1885 
1886  DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest,
1887  SUMOTime arrivalTime, double arrivalSpeed,
1888  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1889  double distance,
1890  double leaveSpeed = -1.) :
1891  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1892  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1893  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1894  myDistance(distance),
1895  accelV(leaveSpeed), hadStoppedVehicle(false), availableSpace(0) {
1896  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1897  assert(vPass >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1898  };
1899 
1900 
1902  DriveProcessItem(double vWait, double distance, double _availableSpace = 0) :
1903  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1904  myArrivalTime(0), myArrivalSpeed(0),
1905  myArrivalTimeBraking(0), myArrivalSpeedBraking(0),
1906  myDistance(distance),
1907  accelV(-1), hadStoppedVehicle(false), availableSpace(_availableSpace) {
1908  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1909  };
1910 
1911 
1912  inline void adaptLeaveSpeed(const double v) {
1913  if (accelV < 0) {
1914  accelV = v;
1915  } else {
1916  accelV = MIN2(accelV, v);
1917  }
1918  }
1919  inline double getLeaveSpeed() const {
1920  return accelV < 0 ? myVLinkPass : accelV;
1921  }
1922  };
1923 
1925  // TODO: Consider making LFLinkLanes a std::deque for efficient front removal (needs refactoring in checkRewindLinkLanes()...)
1926  typedef std::vector< DriveProcessItem > DriveItemVector;
1927 
1929  DriveItemVector myLFLinkLanes;
1930 
1932  DriveItemVector myLFLinkLanesPrev;
1933 
1939  DriveItemVector::iterator myNextDriveItem;
1940 
1942  void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist, std::pair<double, LinkDirection>& myNextTurn) const;
1943 
1945  void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const;
1946 
1948  void removeApproachingInformation(DriveItemVector& lfLinks) const;
1949 
1950 
1952  inline double estimateLeaveSpeed(const MSLink* const link, const double vLinkPass) const {
1953  // estimate leave speed for passing time computation
1954  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1955  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1956  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1958  }
1959 
1960 
1961  /* @brief adapt safe velocity in accordance to a moving obstacle:
1962  * - a leader vehicle
1963  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1964  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1965  * @param[in] seen the distance to the end of the current lane
1966  * @param[in] lastLink the lastLink index
1967  * @param[in] lane The current Lane the vehicle is on
1968  * @param[in,out] the safe velocity for driving
1969  * @param[in,out] the safe velocity for arriving at the next link
1970  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1971  */
1972  void adaptToLeader(const std::pair<const MSVehicle*, double> leaderInfo,
1973  const double seen, DriveProcessItem* const lastLink,
1974  const MSLane* const lane, double& v, double& vLinkPass,
1975  double distToCrossing = -1) const;
1976 
1977  /* @brief adapt safe velocity in accordance to multiple vehicles ahead:
1978  * @param[in] ahead The leader information according to the current lateral-resolution
1979  * @param[in] latOffset the lateral offset for locating the ego vehicle on the given lane
1980  * @param[in] seen the distance to the end of the current lane
1981  * @param[in] lastLink the lastLink index
1982  * @param[in] lane The current Lane the vehicle is on
1983  * @param[in,out] the safe velocity for driving
1984  * @param[in,out] the safe velocity for arriving at the next link
1985  */
1986  void adaptToLeaders(const MSLeaderInfo& ahead,
1987  double latOffset,
1988  const double seen, DriveProcessItem* const lastLink,
1989  const MSLane* const lane, double& v, double& vLinkPass) const;
1990 
1992  void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen,
1993  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest,
1994  bool isShadowLink = false) const;
1995 
1997  void checkLinkLeaderCurrentAndParallel(const MSLink* link, const MSLane* lane, double seen,
1998  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const;
1999 
2000 
2001  // @brief return the lane on which the back of this vehicle resides
2002  const MSLane* getBackLane() const;
2003 
2004  // @brief get the position of the back bumper;
2005  const Position getBackPosition() const;
2006 
2014  void updateState(double vNext);
2015 
2016 
2018  bool keepClear(const MSLink* link) const;
2019 
2021  bool ignoreRed(const MSLink* link, bool canBrake) const;
2022 
2023 private:
2024  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
2025  * @note member is initialized on first access */
2027 
2030 
2033 
2034 private:
2036  MSVehicle();
2037 
2039  MSVehicle(const MSVehicle&);
2040 
2042  MSVehicle& operator=(const MSVehicle&);
2043 
2045 
2046 };
2047 
2048 
2049 #endif
2050 
2051 /****************************************************************************/
2052 
double myPos
the stored position
Definition: MSVehicle.h:136
int getRoutePosition() const
Definition: MSVehicle.cpp:1027
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:1483
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:2480
double myLatDist
The requested lateral change.
Definition: MSVehicle.h:1577
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
SUMOTime myJunctionConflictEntryTime
Definition: MSVehicle.h:1865
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:2431
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1806
Drive process items represent bounds on the safe velocity corresponding to the upcoming links...
Definition: MSVehicle.h:1872
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
double computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:1269
DriveItemVector myLFLinkLanesPrev
planned speeds from the previous step for un-registering from junctions after the new container is fi...
Definition: MSVehicle.h:1932
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:4811
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:671
int getSignals() const
Definition: MSVehicle.h:1545
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:492
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:4799
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:4098
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignore
Definition: MSVehicle.cpp:5555
std::list< std::pair< SUMOTime, SUMOTime > > waitingIntervalList
Definition: MSVehicle.h:167
double myAngle
the angle in radians (
Definition: MSVehicle.h:1852
double maxDecel
Maximal deceleration to be applied due to the adapted headway.
Definition: MSVehicle.h:1378
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:909
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
Definition: MSVehicle.cpp:5531
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:4817
double getPreviousSpeed() const
Returns the vehicle&#39;s speed before the previous time step.
Definition: MSVehicle.h:491
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:685
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:2026
PositionVector getBoundingPoly() const
get bounding polygon
Definition: MSVehicle.cpp:5178
static int nextLinkPriority(const std::vector< MSLane *> &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:4635
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:629
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1805
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:1211
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:4197
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1803
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1841
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:661
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1615
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1813
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1833
Position getVelocityVector() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:693
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1786
double myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1574
Stop & getNextStop()
Definition: MSVehicle.cpp:5478
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:1500
DriveItemVector myLFLinkLanes
container for the planned speeds in the current step
Definition: MSVehicle.h:1929
bool resumeFromStopping()
Definition: MSVehicle.cpp:5427
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1844
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:565
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
Definition: MSVehicle.h:820
double myTimeLoss
the time loss in seconds due to driving with less than maximum speed
Definition: MSVehicle.h:1783
void setBlinkerInformation()
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:4852
SUMOTime myLastActionTime
Action offset (actions are taken at time myActionOffset + N*getActionStepLength()) Initialized to 0...
Definition: MSVehicle.h:1796
void addContainer(MSTransportable *container)
Adds a container.
Definition: MSVehicle.cpp:4840
SUMOTime getMemorySize() const
Definition: MSVehicle.h:192
SUMOTime remainingStopDuration() const
Returns the remaining stop duration for a stopped vehicle or 0.
Definition: MSVehicle.cpp:1612
SUMOTime myJunctionEntryTimeNeverYield
Definition: MSVehicle.h:1864
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:4740
const SUMOVehicleParameter::Stop pars
The stop parameter.
Definition: MSVehicle.h:935
int myRoutingMode
routing mode (see TraCIConstants.h)
Definition: MSVehicle.h:1626
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:937
The front lights are on (no visualisation)
Definition: MSVehicle.h:1185
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:1173
void updateTimeLoss(double vNext)
Updates the vehicle&#39;s time loss.
Definition: MSVehicle.cpp:3192
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
Definition: MSVehicle.cpp:5214
std::list< Stop > getMyStops()
Definition: MSVehicle.cpp:5483
The base class for an intersection.
Definition: MSJunction.h:61
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:1908
The car-following model abstraction.
Definition: MSCFModel.h:57
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
Definition: MSVehicle.h:931
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:927
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:403
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:939
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1586
double myPosLat
the stored lateral position
Definition: MSVehicle.h:142
int getBestLaneOffset() const
Definition: MSVehicle.cpp:4697
bool canReverse() const
whether the vehicle is a train that can reverse its direction at the current point in its route ...
Definition: MSVehicle.cpp:3204
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:943
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:1189
Notification
Definition of a vehicle state.
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:1355
double lateralDistanceToLane(const int offset) const
Get the minimal lateral distance required to move fully onto the lane at given offset.
Definition: MSVehicle.cpp:5045
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:5347
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1592
bool gapAttained
Whether the desired gap was attained during the current activity phase (induces the remaining duratio...
Definition: MSVehicle.h:1382
double getLeaveSpeed() const
Definition: MSVehicle.h:1919
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:136
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:1191
vehicle doesn&#39;t want to change
Definition: MSVehicle.h:220
void createDriverState()
Create a DriverState for the vehicle.
Definition: MSVehicle.cpp:5735
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:1219
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist, std::pair< double, LinkDirection > &myNextTurn) const
Definition: MSVehicle.cpp:1960
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
SUMOTime getLastActionTime() const
Returns the time of the vehicle&#39;s last action point.
Definition: MSVehicle.h:525
double tauCurrent
Current, interpolated value for the desired time headway.
Definition: MSVehicle.h:1365
PositionVector getBoundingBox() const
get bounding rectangle
Definition: MSVehicle.cpp:5165
bool isStoppedOnLane() const
Definition: MSVehicle.cpp:1596
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1126
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
Definition: MSVehicle.cpp:1338
bool checkActionStep(const SUMOTime t)
Returns whether the vehicle is supposed to take action in the current simulation step Updates myActio...
Definition: MSVehicle.cpp:1875
double getRightSideOnLane() const
Get the vehicle&#39;s lateral position on the lane:
Definition: MSVehicle.cpp:4931
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:4707
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1780
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:3368
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:2633
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:72
SUMOTime myMemorySize
the maximal memory to store
Definition: MSVehicle.h:203
Container for state and parameters of the gap control.
Definition: MSVehicle.h:1358
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1246
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:52
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1849
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:949
double addGapCurrent
Current, interpolated value for the desired space headway.
Definition: MSVehicle.h:1369
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:818
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:812
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
Definition: MSVehicle.cpp:5224
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:5537
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:948
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:4147
double tauOriginal
Original value for the desired headway (will be reset after duration has expired) ...
Definition: MSVehicle.h:1363
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:1159
double getBrakeGap() const
get distance for coming to a stop (used for rerouting checks)
Definition: MSVehicle.cpp:1857
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:2532
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:941
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4307
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
Definition: MSVehicle.cpp:1640
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:2029
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:3790
int getLaneIndex() const
Definition: MSVehicle.cpp:4914
double getBackPositionOnLane() const
Get the vehicle&#39;s position relative to its current lane.
Definition: MSVehicle.h:432
bool isLeader(const MSLink *link, const MSVehicle *veh) const
whether the given vehicle must be followed at the given junction
Definition: MSVehicle.cpp:5607
Right blinker lights are switched on.
Definition: MSVehicle.h:1177
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation...
Definition: MSVehicle.h:575
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
Definition: MSVehicle.cpp:1847
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:957
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:1591
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1568
std::vector< double > myFurtherLanesPosLat
lateral positions on further lanes
Definition: MSVehicle.h:1835
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1255
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1491
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:148
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:48
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:4723
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:587
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:4257
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:4975
bool hasDriverState() const
Whether this vehicle is equipped with a MSDriverState.
Definition: MSVehicle.h:1000
MSLane * lane
The described lane.
Definition: MSVehicle.h:810
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:891
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:4781
SUMOTime getAccumulatedWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:651
Left blinker lights are switched on.
Definition: MSVehicle.h:1179
double getActionStepLengthSecs() const
Returns the vehicle&#39;s action step length in secs, i.e. the interval between two action points...
Definition: MSVehicle.h:517
The wipers are on.
Definition: MSVehicle.h:1193
void setAngle(double angle, bool straightenFurther=false)
Set a custom vehicle angle in rad, optionally updates furtherLanePosLat.
Definition: MSVehicle.cpp:1255
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:1221
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:3558
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it&#39;s primary lane ...
Definition: MSVehicle.cpp:5095
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:3630
SUMOTime lastUpdate
Time of the last update of the gap control.
Definition: MSVehicle.h:1386
Representation of a vehicle.
Definition: SUMOVehicle.h:60
SUMOTime myLastRemoteAccess
Definition: MSVehicle.h:1604
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:1858
void adaptLeaveSpeed(const double v)
Definition: MSVehicle.h:1912
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:509
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:923
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:677
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:4325
int getRoutingMode() const
return the current routing mode
Definition: MSVehicle.h:1429
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:4668
Position myCachedPosition
Definition: MSVehicle.h:1860
bool active
Whether the gap control is active.
Definition: MSVehicle.h:1380
double getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:3796
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:4943
double currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:814
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:781
std::shared_ptr< GapControlState > myGapControlState
The gap control state.
Definition: MSVehicle.h:1571
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:789
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1823
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:58
bool collision
Whether this stop was triggered by a collision.
Definition: MSVehicle.h:953
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1589
#define STEPS2TIME(x)
Definition: SUMOTime.h:58
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1801
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
Definition: MSVehicle.h:1847
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1181
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:994
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:2032
void resetRoutePosition(int index)
Definition: MSVehicle.cpp:1033
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1818
double getDeltaPos(double accel)
calculates the distance covered in the next integration step given an acceleration and assuming the c...
Definition: MSVehicle.cpp:2656
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
Definition: MSVehicle.cpp:5543
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:4823
bool considerSafeVelocity() const
Returns whether safe velocities shall be considered.
Definition: MSVehicle.h:1497
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:1884
double timeHeadwayIncrement
cache storage for the headway increments of the current operation
Definition: MSVehicle.h:1388
SUMOTime getActionStepLength() const
Returns this type&#39;s default action step length.
The brake lights are on.
Definition: MSVehicle.h:1183
A blue emergency light is on.
Definition: MSVehicle.h:1199
A structure representing the best lanes for continuing the current route starting at &#39;lane&#39;...
Definition: MSVehicle.h:808
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:5712
Everything is switched off.
Definition: MSVehicle.h:1175
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:934
double myStopDist
distance to the next stop or -1 if there is none
Definition: MSVehicle.h:1855
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:1634
bool hasInfluencer() const
Definition: MSVehicle.h:1640
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
Definition: MSVehicle.cpp:1621
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:1863
double myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1826
void fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:4715
bool myActionStep
The flag myActionStep indicates whether the current time step is an action point for the vehicle...
Definition: MSVehicle.h:1793
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:1776
One of the left doors is opened.
Definition: MSVehicle.h:1195
double changeRate
Rate by which the current time and space headways are changed towards the target value. (A rate of one corresponds to reaching the target value within one second)
Definition: MSVehicle.h:1376
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1613
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1611
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:925
void setApproachingForAllLinks(const SUMOTime t)
Register junction approaches for all link items in the current plan.
Definition: MSVehicle.cpp:4018
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:822
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:5687
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:1886
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:3241
double getLateralPositionOnLane() const
Get the vehicle&#39;s lateral position on the lane.
Definition: MSVehicle.h:440
void setRoutingMode(int value)
Sets routing behavior.
Definition: MSVehicle.h:1514
void setBrakingSignals(double vNext)
sets the braking lights on/off
Definition: MSVehicle.cpp:3161
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1595
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:4787
void removePassedDriveItems()
Erase passed drive items from myLFLinkLanes (and unregister approaching information for corresponding...
Definition: MSVehicle.cpp:2953
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
Definition: MSVehicle.h:1776
int numExpectedContainer
The number of still expected containers.
Definition: MSVehicle.h:947
const std::vector< double > & getFurtherLanesPosLat() const
Definition: MSVehicle.h:793
Abstract in-vehicle / in-person device.
Definition: MSDevice.h:63
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:4651
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:4900
double remainingDuration
Remaining duration for keeping the target headway.
Definition: MSVehicle.h:1373
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:5299
vehicle want&#39;s to change to left lane
Definition: MSVehicle.h:222
int numExpectedPerson
The number of still expected persons.
Definition: MSVehicle.h:945
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:5488
Structure representing possible vehicle parameter.
DriveItemVector::iterator myNextDriveItem
iterator pointing to the next item in myLFLinkLanes
Definition: MSVehicle.h:1939
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
Definition: MSVehicle.h:1617
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:816
std::pair< double, LinkDirection > myNextTurn
the upcoming turn for the vehicle
Definition: MSVehicle.h:1830
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
Definition: MSVehicle.cpp:1601
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:5100
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1646
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:4921
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:595
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:2678
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1565
MSVehicleType * myType
This vehicle&#39;s type.
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:1064
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
runs heuristic for keeping the intersection clear in case of downstream jamming
Definition: MSVehicle.cpp:3819
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1838
double addGapTarget
Target value for the desired space headway.
Definition: MSVehicle.h:1371
ConstMSEdgeVector myRemoteRoute
Definition: MSVehicle.h:1603
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:828
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:933
std::shared_ptr< MSSimpleDriverState > myDriverState
This vehicle&#39;s driver state.
Definition: MSVehicle.h:1790
Definition of vehicle stop (position and duration)
void setRemoteState(Position xyPos)
sets position outside the road network
Definition: MSVehicle.cpp:5525
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:2516
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:500
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:929
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1242
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:4805
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.
double tauTarget
Target value for the desired time headway.
Definition: MSVehicle.h:1367
void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
Definition: MSVehicle.cpp:4065
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:1889
DriveProcessItem(double vWait, double distance, double _availableSpace=0)
constructor if the link shall not be passed
Definition: MSVehicle.h:1902
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
Definition: MSVehicle.cpp:186
Stop(const SUMOVehicleParameter::Stop &par)
Definition: MSVehicle.h:921
const MSLane * getBackLane() const
Definition: MSVehicle.cpp:3620
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:2925
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:4770
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:1926
void updateWaitingTime(double vNext)
Updates the vehicle&#39;s waiting time counters (accumulated and consecutive)
Definition: MSVehicle.cpp:3180
void setSignals(int signals)
Definition: MSVehicle.h:1541
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:1042
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
Definition: MSCFModel.cpp:700
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:410
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:1238
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:56
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1230
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:1115
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
Definition: MSVehicle.cpp:5591
void addPerson(MSTransportable *person)
Adds a passenger.
Definition: MSVehicle.cpp:4829
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1820
std::shared_ptr< MSSimpleDriverState > getDriverState() const
Returns the vehicle driver&#39;s state.
Definition: MSVehicle.h:900
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:705
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle. ...
Definition: MSVehicle.h:602
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
Definition: MSVehicle.cpp:5112
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:1054
double getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:4793
const MSVehicle * prevLeader
The last recognized leader.
Definition: MSVehicle.h:1384
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:912
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1585
bool ignoreOverlap() const
Definition: MSVehicle.h:1557
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:1021
MSParkingArea * getNextParkingArea()
get the current parking area stop
Definition: MSVehicle.cpp:1571
const Position getBackPosition() const
Definition: MSVehicle.cpp:1314
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:4937
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:4319
SUMOTime getTimeLoss() const
Returns the SUMOTime lost (speed was lesser maximum speed)
Definition: MSVehicle.h:642
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1627
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:483
State(double pos, double speed, double posLat, double backPos)
Constructor.
Definition: MSVehicle.cpp:158
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1580
double estimateLeaveSpeed(const MSLink *const link, const double vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1952
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:5512
double getLatDist() const
Definition: MSVehicle.h:1549
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1525
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Definition: MSVehicle.h:951
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:1201
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
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:1093
SUMOTime myJunctionEntryTime
time at which the current junction was entered
Definition: MSVehicle.h:1863
One of the right doors is opened.
Definition: MSVehicle.h:1197
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:1583
The fog lights are on (no visualisation)
Definition: MSVehicle.h:1187
double nextStopDist() const
return the distance to the next stop or doubleMax if there is none.
Definition: MSVehicle.h:1043
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:5503
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:919
A yellow emergency light is on.
Definition: MSVehicle.h:1203
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:3007
bool congested() const
Definition: MSVehicle.h:715