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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
26 // Representation of a vehicle in the micro simulation
27 /****************************************************************************/
28 #ifndef MSVehicle_h
29 #define MSVehicle_h
30 
31 
32 // ===========================================================================
33 // included modules
34 // ===========================================================================
35 #ifdef _MSC_VER
36 #include <windows_config.h>
37 #else
38 #include <config.h>
39 #endif
40 
41 #include <list>
42 #include <deque>
43 #include <map>
44 #include <set>
45 #include <string>
46 #include <vector>
47 #include "MSGlobals.h"
48 #include "MSVehicleType.h"
49 #include "MSBaseVehicle.h"
50 #include "MSLink.h"
51 #include "MSLane.h"
52 
53 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light! Refs. #2577
54 
55 // ===========================================================================
56 // class declarations
57 // ===========================================================================
58 class SUMOSAXAttributes;
59 class MSMoveReminder;
60 class MSLaneChanger;
61 class MSVehicleTransfer;
63 class MSStoppingPlace;
64 class MSChargingStation;
65 class MSParkingArea;
66 class MSPerson;
67 class MSDevice;
69 class OutputDevice;
70 class Position;
72 class MSContainer;
73 class MSJunction;
74 class MSLeaderInfo;
75 
76 // ===========================================================================
77 // class definitions
78 // ===========================================================================
83 class MSVehicle : public MSBaseVehicle {
84 public:
85 
87  friend class MSLaneChanger;
88  friend class MSLaneChangerSublane;
89 
93  class State {
95  friend class MSVehicle;
96  friend class MSLaneChanger;
97  friend class MSLaneChangerSublane;
98 
99  public:
101  State(double pos, double speed, double posLat, double backPos);
102 
104  State(const State& state);
105 
107  State& operator=(const State& state);
108 
110  bool operator!=(const State& state);
111 
113  double pos() const {
114  return myPos;
115  }
116 
118  double speed() const {
119  return mySpeed;
120  };
121 
123  double posLat() const {
124  return myPosLat;
125  }
126 
128  double backPos() const {
129  return myBackPos;
130  }
131 
133  double lastCoveredDist() const {
134  return myLastCoveredDist;
135  }
136 
137 
138  private:
140  double myPos;
141 
143  double mySpeed;
144 
146  double myPosLat;
147 
149  // if the vehicle occupies multiple lanes, this is the position relative
150  // to the lane occupied by its back
151  double myBackPos;
152 
155 
161 
162  };
163 
164 
169  friend class MSVehicle;
170 
171  typedef std::list<std::pair<SUMOTime, SUMOTime> > waitingIntervalList;
172 
173  public:
176 
179 
182 
184  bool operator!=(const WaitingTimeCollector& wt) const;
185 
188 
189  // return the waiting time within the last memory millisecs
190  SUMOTime cumulatedWaitingTime(SUMOTime memory = -1) const;
191 
192  // process time passing for dt millisecs
193  void passTime(SUMOTime dt, bool waiting);
194 
195  // maximal memory time stored
197  return myMemorySize;
198  }
199 
200  // maximal memory time stored
201  const waitingIntervalList& getWaitingIntervals() const {
202  return myWaitingIntervals;
203  }
204 
205  private:
208 
212  waitingIntervalList myWaitingIntervals;
213 
215  void appendWaitingTime(SUMOTime dt);
216  };
217 
218 
231  };
232 
240  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
241  MSVehicleType* type, const double speedFactor);
242 
244  virtual ~MSVehicle();
245 
246 
248 
249 
259 
260 
261 
263 
264 
268  bool hasArrived() const;
269 
279  bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true);
280 
281 
287  bool willPass(const MSEdge* const edge) const;
288 
289  int getRoutePosition() const;
290  void resetRoutePosition(int index);
291 
300 
301 
303 
304 
322  void workOnMoveReminders(double oldPos, double newPos, double newSpeed);
324 
325 
331  bool checkActionStep(const SUMOTime t);
332 
338  void resetActionOffset(const SUMOTime timeUntilNextAction = 0);
339 
340 
350  void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength);
351 
352 
370  void planMove(const SUMOTime t, const MSLeaderInfo& ahead, const double lengthsInFront);
371 
372 
385  bool executeMove();
386 
393  double getDeltaPos(double accel);
394 
395 
397 
398 
402  double getPositionOnLane() const {
403  return myState.myPos;
404  }
405 
409  double getLastStepDist() const {
410  return myState.lastCoveredDist();
411  }
412 
416  double getPositionOnLane(const MSLane* lane) const;
417 
426  double getBackPositionOnLane(const MSLane* lane) const;
427 
431  double getBackPositionOnLane() const {
433  }
434 
439  double getLateralPositionOnLane() const {
440  return myState.myPosLat;
441  }
442 
447  double getRightSideOnLane() const;
448 
452  double lateralDistanceToLane(const int offset) const;
453 
455  double getLateralOverlap() const;
456  double getLateralOverlap(double posLat) const;
457 
463  double getRightSideOnEdge(const MSLane* lane = 0) const;
464 
470  double getCenterOnEdge(const MSLane* lane = 0) const;
471 
477  double getLatOffset(const MSLane* lane) const;
478 
482  double getSpeed() const {
483  return myState.mySpeed;
484  }
485 
486 
490  double getPreviousSpeed() const {
491  return myState.myPreviousSpeed;
492  }
493 
494 
499  double getAcceleration() const {
500  return myAcceleration;
501  }
502 
503 
509  return myType->getActionStepLength();
510  }
511 
516  double getActionStepLengthSecs() const {
518  }
519 
520 
525  return myLastActionTime;
526  }
527 
529 
530 
531 
533 
534 
538  double getSlope() const;
539 
540 
548  Position getPosition(const double offset = 0) const;
549 
550 
558  Position getPositionAlongBestLanes(double offset) const;
559 
560 
564  MSLane* getLane() const {
565  return myLane;
566  }
567 
568 
573  double
575  if (myLane != 0) {
576  return myLane->getVehicleMaxSpeed(this);
577  } else {
578  return myType->getMaxSpeed();
579  }
580  }
581 
582 
586  inline bool isOnRoad() const {
587  return myAmOnNet;
588  }
589 
590 
594  inline bool isActive() const {
595  return myActionStep;
596  }
597 
601  inline bool isActionStep(SUMOTime t) const {
602  return (t - myLastActionTime) % getActionStepLength() == 0;
603 // return t%getActionStepLength() == 0; // synchronized actions for all vehicles with identical actionsteplengths
604  }
605 
606 
610  bool isFrontOnLane(const MSLane* lane) const;
611 
612 
619  const MSEdge* getRerouteOrigin() const;
620 
621 
629  return myWaitingTime;
630  }
631 
642  return TIME2STEPS(myTimeLoss);
643  }
644 
645 
652  }
653 
660  double getWaitingSeconds() const {
661  return STEPS2TIME(myWaitingTime);
662  }
663 
664 
672  }
673 
676  double getTimeLossSeconds() const {
677  return myTimeLoss;
678  }
679 
680 
684  double getAngle() const {
685  return myAngle;
686  }
687 
688 
693  return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed());
694  }
696 
698  double computeAngle() const;
699 
701  void setAngle(double angle, bool straightenFurther = false);
702 
704  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
705  if (veh1->myState.myPos < veh2->myState.myPos) {
706  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
707  }
708  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
709  }
710 
711 
714  bool congested() const {
715  return myState.mySpeed < double(60) / double(3.6);
716  }
717 
718 
730  void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
731 
738  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
739 
740 
741 
750  void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat,
751  MSMoveReminder::Notification notification);
752 
757  void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0);
758 
763  void enterLaneAtLaneChange(MSLane* enteredLane);
764 
765 
767  void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0);
768 
775  void updateDriveItems();
776 
779 
780  const std::vector<MSLane*>& getFurtherLanes() const {
781  return myFurtherLanes;
782  }
783 
784  const std::vector<double>& getFurtherLanesPosLat() const {
785  return myFurtherLanesPosLat;
786  }
787 
788 
790  bool onFurtherEdge(const MSEdge* edge) const;
791 
794 
795  //
799  struct LaneQ {
803  double length;
807  double occupation;
814  /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change
815  * The 'length' attribute is the sum of these lane lengths
816  * (There may be alternative sequences that have equal length)
817  * It is the 'best' in the strategic sense of reducing required lane-changes
818  */
819  std::vector<MSLane*> bestContinuations;
820  };
821 
825  const std::vector<LaneQ>& getBestLanes() const;
826 
844  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
845 
846 
850  const std::vector<MSLane*>& getBestLanesContinuation() const;
851 
852 
856  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
857 
858  /* @brief returns the current signed offset from the lane that is most
859  * suited for continuing the current route (in the strategic sense of reducing lane-changes)
860  * - 0 if the vehicle is one it's best lane
861  * - negative if the vehicle should change to the right
862  * - positive if the vehicle should change to the left
863  */
864  int getBestLaneOffset() const;
865 
867  void adaptBestLanesOccupation(int laneIndex, double density);
868 
870 
872  void fixPosition();
873 
874 
882  inline const MSCFModel& getCarFollowModel() const {
883  return myType->getCarFollowModel();
884  }
885 
886 
892  return myCFVariables;
893  }
894 
896 
897 
901  class Stop {
902  public:
903  Stop(const SUMOVehicleParameter::Stop& par) : pars(par) {}
907  const MSLane* lane;
921  bool triggered;
925  bool reached;
935  bool collision;
936 
938  void write(OutputDevice& dev) const;
939 
941  double getEndPos(const SUMOVehicle& veh) const;
942 
944  std::string getDescription() const;
945  private:
947  Stop& operator=(const Stop& src);
948 
949  };
950 
951 
958  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false,
959  MSRouteIterator* searchStart = 0);
960 
963  bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
964 
965 
969 
973  bool hasStops() const {
974  return !myStops.empty();
975  }
976 
980  bool isStopped() const;
981 
983  bool isStoppedOnLane() const;
984 
986  bool keepStopping(bool afterProcessing = false) const;
987 
991  SUMOTime collisionStopTime() const;
992 
996  bool isParking() const;
997 
1001  bool isRemoteControlled() const;
1002 
1006  bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const;
1007 
1009  double nextStopDist() const {
1010  return myStopDist;
1011  }
1012 
1016  bool isStoppedTriggered() const;
1017 
1020  bool isStoppedInRange(double pos) const;
1022 
1023  int getLaneIndex() const;
1024 
1034  double getDistanceToPosition(double destPos, const MSEdge* destEdge) const;
1035 
1036 
1044  double processNextStop(double currentVelocity);
1045 
1053  std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const;
1054 
1061  double getTimeGapOnLane() const;
1062 
1063 
1065 
1066 
1070  double getCO2Emissions() const;
1071 
1072 
1076  double getCOEmissions() const;
1077 
1078 
1082  double getHCEmissions() const;
1083 
1084 
1088  double getNOxEmissions() const;
1089 
1090 
1094  double getPMxEmissions() const;
1095 
1096 
1100  double getFuelConsumption() const;
1101 
1102 
1106  double getElectricityConsumption() const;
1107 
1108 
1112  double getHarmonoise_NoiseEmissions() const;
1114 
1115 
1116 
1118 
1119 
1123  void addPerson(MSTransportable* person);
1124 
1126 
1127 
1131  void addContainer(MSTransportable* container);
1132 
1135 
1137  const std::vector<MSTransportable*>& getPersons() const;
1138 
1140  const std::vector<MSTransportable*>& getContainers() const;
1141 
1145  int getPersonNumber() const;
1146 
1150  int getContainerNumber() const;
1151 
1154 
1158  enum Signalling {
1189  };
1190 
1191 
1197  LC_NEVER = 0, // lcModel shall never trigger changes at this level
1198  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
1199  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
1200  };
1201 
1202 
1205  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
1206  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
1207  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
1208  LCP_OPPORTUNISTIC = 3 // change if not blocked
1209  };
1210 
1211 
1215  void switchOnSignal(int signal) {
1216  mySignals |= signal;
1217  }
1218 
1219 
1223  void switchOffSignal(int signal) {
1224  mySignals &= ~signal;
1225  }
1226 
1227 
1231  int getSignals() const {
1232  return mySignals;
1233  }
1234 
1235 
1240  bool signalSet(int which) const {
1241  return (mySignals & which) != 0;
1242  }
1244 
1245 
1247  bool unsafeLinkAhead(const MSLane* lane) const;
1248 
1250  bool passingMinor() const;
1251 
1252 
1253 
1254 #ifndef NO_TRACI
1255 
1262  double getSpeedWithoutTraciInfluence() const;
1263 
1276  bool addTraciStop(MSLane* const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until,
1277  const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg);
1278 
1290  bool addTraciStopAtStoppingPlace(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking,
1291  const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string& errorMsg);
1292 
1297  Stop& getNextStop();
1298 
1303  bool resumeFromStopping();
1304 
1305 
1307  double updateFurtherLanes(std::vector<MSLane*>& furtherLanes,
1308  std::vector<double>& furtherLanesPosLat,
1309  const std::vector<MSLane*>& passedLanes);
1310 
1313 
1316 
1329  class Influencer {
1330  public:
1332  Influencer();
1333 
1334 
1336  ~Influencer();
1337 
1338 
1342  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, double> >& speedTimeLine);
1343 
1344 
1348  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, int> >& laneTimeLine);
1349 
1353  void setSublaneChange(double latDist);
1354 
1356  int getSpeedMode() const;
1357 
1359  int getLanechangeMode() const;
1360 
1362  int getRoutingMode() const {
1363  return myRoutingMode;
1364  }
1365 
1377  double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax);
1378 
1386  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state);
1387 
1388 
1394  double changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1395 
1399  inline bool getRespectJunctionPriority() const {
1400  return myRespectJunctionPriority;
1401  }
1402 
1403 
1407  inline bool getEmergencyBrakeRedLight() const {
1408  return myEmergencyBrakeRedLight;
1409  }
1410 
1414  void setSpeedMode(int speedMode);
1415 
1419  void setLaneChangeMode(int value);
1420 
1424  void setRoutingMode(int value) {
1425  myRoutingMode = value;
1426  }
1427 
1431  double getOriginalSpeed() const;
1432 
1433  void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1434 
1436  return myLastRemoteAccess;
1437  }
1438 
1439  void postProcessRemoteControl(MSVehicle* v);
1440 
1442  double implicitSpeedRemote(const MSVehicle* veh, double oldSpeed);
1443 
1445  double implicitDeltaPosRemote(const MSVehicle* veh);
1446 
1447  bool isRemoteControlled() const;
1448 
1449  bool isRemoteAffected(SUMOTime t) const;
1450 
1451  void setSignals(int signals) {
1452  myTraCISignals = signals;
1453  }
1454 
1455  int getSignals() const {
1456  return myTraCISignals;
1457  }
1458 
1459  double getLatDist() const {
1460  return myLatDist;
1461  }
1462 
1463  void resetLatDist() {
1464  myLatDist = 0.;
1465  }
1466 
1467  SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterTT() const;
1468 
1469  private:
1471  std::vector<std::pair<SUMOTime, double> > mySpeedTimeLine;
1472 
1474  std::vector<std::pair<SUMOTime, int> > myLaneTimeLine;
1475 
1478 
1480  double myLatDist;
1481 
1484 
1487 
1490 
1493 
1496 
1499 
1502  double myRemotePos;
1508 
1510 
1511  LaneChangeMode myStrategicLC;
1522  TraciLaneChangePriority myTraciLaneChangePriority;
1524 
1525  // @brief the signals set via TraCI
1527 
1530 
1531  };
1532 
1533 
1540 
1541  const Influencer* getInfluencer() const;
1542 
1543  bool hasInfluencer() const {
1544  return myInfluencer != 0;
1545  }
1546 
1548  int influenceChangeDecision(int state);
1549 
1551  void setRemoteState(Position xyPos);
1552 
1553 #endif
1554 
1556  double getSafeFollowSpeed(const std::pair<const MSVehicle*, double> leaderInfo,
1557  const double seen, const MSLane* const lane, double distToCrossing) const;
1558 
1560  static int nextLinkPriority(const std::vector<MSLane*>& conts);
1561 
1563 
1564 
1566  void saveState(OutputDevice& out);
1567 
1570  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1572 
1573 protected:
1574 
1575  double getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1576 
1579 
1595  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1597 
1598 
1606  void processLinkAproaches(double& vSafe, double& vSafeMin, double& vSafeMinDist);
1607 
1608 
1617  void processLaneAdvances(std::vector<MSLane*>& passedLanes, bool& moved, std::string& emergencyReason);
1618 
1619 
1626  void processTraCISpeedControl(double vSafe, double& vNext);
1627 
1628 
1635  void removePassedDriveItems();
1636 
1639  void updateWaitingTime(double vNext);
1640 
1643  void updateTimeLoss(double vNext);
1644 
1645 
1648  void setBrakingSignals(double vNext) ;
1649 
1652  void setBlinkerInformation();
1653 
1656  void setEmergencyBlueLight(SUMOTime currentTime);
1657 
1659  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1660 
1663  const ConstMSEdgeVector getStopEdges() const;
1664 
1666  Position validatePosition(Position result, double offset = 0) const;
1667 
1669  virtual void drawOutsideNetwork(bool /*add*/) {};
1670 
1674 
1676  double myTimeLoss;
1677 
1680 
1686 
1687 
1688 
1691 
1693 
1696 
1697  /* @brief Complex data structure for keeping and updating LaneQ:
1698  * Each element of the outer vector corresponds to an upcoming edge on the vehicles route
1699  * The first element corresponds to the current edge and is returned in getBestLanes()
1700  * The other elements are only used as a temporary structure in updateBestLanes();
1701  */
1702  std::vector<std::vector<LaneQ> > myBestLanes;
1703 
1704  /* @brief iterator to speed up retrival of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation()
1705  * This is updated in updateOccupancyAndCurrentBestLane()
1706  */
1707  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1708 
1709  static std::vector<MSLane*> myEmptyLaneVector;
1710  static std::vector<MSTransportable*> myEmptyTransportableVector;
1711 
1713  std::list<Stop> myStops;
1714 
1717 
1720 
1723 
1725  std::vector<MSLane*> myFurtherLanes;
1727  std::vector<double> myFurtherLanesPosLat;
1728 
1731 
1734 
1737 
1740 
1742 
1744  double myAngle;
1745 
1747  double myStopDist;
1748 
1751 
1753 
1754 protected:
1755 
1761  double myVLinkPass;
1762  double myVLinkWait;
1768  double myDistance;
1769  double accelV;
1772 
1773  DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest,
1774  SUMOTime arrivalTime, double arrivalSpeed,
1775  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1776  double distance,
1777  double leaveSpeed = -1.) :
1778  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1779  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1780  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1781  myDistance(distance),
1782  accelV(leaveSpeed), hadVehicle(false), availableSpace(0) {
1783  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1784  assert(vPass >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1785  };
1786 
1787 
1789  DriveProcessItem(double vWait, double distance, double _availableSpace = 0) :
1790  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1791  myArrivalTime(0), myArrivalSpeed(0),
1792  myArrivalTimeBraking(0), myArrivalSpeedBraking(0),
1793  myDistance(distance),
1794  accelV(-1), hadVehicle(false), availableSpace(_availableSpace) {
1795  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1796  };
1797 
1798 
1799  inline void adaptLeaveSpeed(const double v) {
1800  if (accelV < 0) {
1801  accelV = v;
1802  } else {
1803  accelV = MIN2(accelV, v);
1804  }
1805  }
1806  inline double getLeaveSpeed() const {
1807  return accelV < 0 ? myVLinkPass : accelV;
1808  }
1809  };
1810 
1812  // TODO: Consider making LFLinkLanes a std::deque for efficient front removal (needs refactoring in checkRewindLinkLanes()...)
1813  typedef std::vector< DriveProcessItem > DriveItemVector;
1814  DriveItemVector myLFLinkLanes;
1820  DriveItemVector::iterator myNextDriveItem;
1821 
1823  void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist) const;
1824 
1826  void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const;
1827 
1829  void removeApproachingInformation(DriveItemVector& lfLinks) const;
1830 
1831 
1833  inline double estimateLeaveSpeed(const MSLink* const link, const double vLinkPass) const {
1834  // estimate leave speed for passing time computation
1835  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1836  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1837  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1839  }
1840 
1841 
1842  /* @brief adapt safe velocity in accordance to a moving obstacle:
1843  * - a leader vehicle
1844  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1845  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1846  * @param[in] seen the distance to the end of the current lane
1847  * @param[in] lastLink the lastLink index
1848  * @param[in] lane The current Lane the vehicle is on
1849  * @param[in,out] the safe velocity for driving
1850  * @param[in,out] the safe velocity for arriving at the next link
1851  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1852  */
1853  void adaptToLeader(const std::pair<const MSVehicle*, double> leaderInfo,
1854  const double seen, DriveProcessItem* const lastLink,
1855  const MSLane* const lane, double& v, double& vLinkPass,
1856  double distToCrossing = -1) const;
1857 
1858  /* @brief adapt safe velocity in accordance to multiple vehicles ahead:
1859  * @param[in] ahead The leader information according to the current lateral-resolution
1860  * @param[in] latOffset the lateral offset for locating the ego vehicle on the given lane
1861  * @param[in] seen the distance to the end of the current lane
1862  * @param[in] lastLink the lastLink index
1863  * @param[in] lane The current Lane the vehicle is on
1864  * @param[in,out] the safe velocity for driving
1865  * @param[in,out] the safe velocity for arriving at the next link
1866  */
1867  void adaptToLeaders(const MSLeaderInfo& ahead,
1868  double latOffset,
1869  const double seen, DriveProcessItem* const lastLink,
1870  const MSLane* const lane, double& v, double& vLinkPass) const;
1871 
1873  void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen,
1874  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest,
1875  bool isShadowLink = false) const;
1876 
1877 
1878  // @brief return the lane on which the back of this vehicle resides
1879  const MSLane* getBackLane() const;
1880 
1881  // @brief get the position of the back bumper;
1882  const Position getBackPosition() const;
1883 
1891  void updateState(double vNext);
1892 
1893 
1895  bool keepClear(const MSLink* link) const;
1896 
1898  bool ignoreRed(const MSLink* link, bool canBrake) const;
1899 
1900 private:
1901  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1902  * @note member is initialized on first access */
1904 
1907 
1908 #ifndef NO_TRACI
1911 #endif
1912 
1913 private:
1915  MSVehicle();
1916 
1918  MSVehicle(const MSVehicle&);
1919 
1921  MSVehicle& operator=(const MSVehicle&);
1922 
1924 
1925 };
1926 
1927 
1928 #endif
1929 
1930 /****************************************************************************/
1931 
double myPos
the stored position
Definition: MSVehicle.h:140
int getRoutePosition() const
Definition: MSVehicle.cpp:802
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:1399
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:2123
double myLatDist
The requested lateral change.
Definition: MSVehicle.h:1480
A lane area vehicles can halt at.
Definition: MSParkingArea.h:65
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:2078
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1695
Drive process items represent bounds on the safe velocity corresponding to the upcoming links...
Definition: MSVehicle.h:1759
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
double computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:1038
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:4168
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:670
int getSignals() const
Definition: MSVehicle.h:1455
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:475
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:4156
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:3478
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignore
Definition: MSVehicle.cpp:4880
std::list< std::pair< SUMOTime, SUMOTime > > waitingIntervalList
Definition: MSVehicle.h:171
double myAngle
the angle in radians (
Definition: MSVehicle.h:1744
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle&#39;s car following model variables.
Definition: MSVehicle.h:891
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
Definition: MSVehicle.cpp:4856
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:4174
double getPreviousSpeed() const
Returns the vehicle&#39;s speed before the previous time step.
Definition: MSVehicle.h:490
double backPos() const
back Position of this state
Definition: MSVehicle.h:128
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:684
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1903
PositionVector getBoundingPoly() const
get bounding polygon
Definition: MSVehicle.cpp:4578
static int nextLinkPriority(const std::vector< MSLane *> &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:3993
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:628
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1694
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:1196
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:3566
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1692
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1733
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:660
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1518
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1702
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1725
Position getVelocityVector() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:692
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1679
double myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1477
Stop & getNextStop()
Definition: MSVehicle.cpp:4806
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:1247
DriveItemVector myLFLinkLanes
Definition: MSVehicle.h:1814
bool resumeFromStopping()
Definition: MSVehicle.cpp:4755
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1736
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:564
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
Definition: MSVehicle.h:811
double myTimeLoss
the time loss in seconds due to driving with less than maximum speed
Definition: MSVehicle.h:1676
void setBlinkerInformation()
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:4260
SUMOTime myLastActionTime
Action offset (actions are taken at time myActionOffset + N*getActionStepLength()) Initialized to 0...
Definition: MSVehicle.h:1685
void addContainer(MSTransportable *container)
Adds a container.
Definition: MSVehicle.cpp:4201
SUMOTime getMemorySize() const
Definition: MSVehicle.h:196
int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:4247
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:4098
const SUMOVehicleParameter::Stop pars
The stop parameter.
Definition: MSVehicle.h:917
int myRoutingMode
routing mode (see TraCIConstants.h)
Definition: MSVehicle.h:1529
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:919
The front lights are on (no visualisation)
Definition: MSVehicle.h:1170
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:1158
void updateTimeLoss(double vNext)
Updates the vehicle&#39;s time loss.
Definition: MSVehicle.cpp:2707
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
Definition: MSVehicle.cpp:4614
The base class for an intersection.
Definition: MSJunction.h:64
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:1637
The car-following model abstraction.
Definition: MSCFModel.h:59
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
Definition: MSVehicle.h:913
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:909
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:402
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:921
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1489
double myPosLat
the stored lateral position
Definition: MSVehicle.h:146
int getBestLaneOffset() const
Definition: MSVehicle.cpp:4055
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:925
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:1174
Notification
Definition of a vehicle state.
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1716
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:1329
double lateralDistanceToLane(const int offset) const
Get the minimal lateral distance required to move fully onto the lane at given offset.
Definition: MSVehicle.cpp:4445
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:4675
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1495
double getLeaveSpeed() const
Definition: MSVehicle.h:1806
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:133
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:1176
vehicle doesn&#39;t want to change
Definition: MSVehicle.h:224
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:1204
SUMOTime DELTA_T
Definition: SUMOTime.cpp:39
SUMOTime getLastActionTime() const
Returns the time of the vehicle&#39;s last action point.
Definition: MSVehicle.h:524
PositionVector getBoundingBox() const
get bounding rectangle
Definition: MSVehicle.cpp:4565
bool isStoppedOnLane() const
Definition: MSVehicle.cpp:1337
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:901
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
Definition: MSVehicle.cpp:1103
bool checkActionStep(const SUMOTime t)
Returns whether the vehicle is supposed to take action in the current simulation step Updates myActio...
Definition: MSVehicle.cpp:1604
double getRightSideOnLane() const
Get the vehicle&#39;s lateral position on the lane:
Definition: MSVehicle.cpp:4331
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:4065
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1673
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:2819
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:2225
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
SUMOTime myMemorySize
the maximal memory to store
Definition: MSVehicle.h:207
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1231
double lastCoveredDist() const
previous Speed of this state
Definition: MSVehicle.h:133
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
double myLastCoveredDist
Definition: MSVehicle.h:160
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:55
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1741
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:931
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:809
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:803
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:4862
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:723
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:3516
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:933
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist) const
Definition: MSVehicle.cpp:1706
The car-following model and parameter.
Definition: MSVehicleType.h:72
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:2159
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:923
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:3674
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
Definition: MSVehicle.cpp:1370
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1906
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:3202
int getLaneIndex() const
Definition: MSVehicle.cpp:4314
double getBackPositionOnLane() const
Get the vehicle&#39;s position relative to its current lane.
Definition: MSVehicle.h:431
Right blinker lights are switched on.
Definition: MSVehicle.h:1162
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation...
Definition: MSVehicle.h:574
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
Definition: MSVehicle.cpp:1594
double getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:203
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1474
std::vector< double > myFurtherLanesPosLat
lateral positions on further lanes
Definition: MSVehicle.h:1727
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1240
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1407
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:145
static std::vector< MSTransportable * > myEmptyTransportableVector
Definition: MSVehicle.h:1710
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:54
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:4081
A road/street connecting two junctions.
Definition: MSEdge.h:80
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:586
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:3624
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:4375
MSLane * lane
The described lane.
Definition: MSVehicle.h:801
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:882
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:4138
SUMOTime getAccumulatedWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:650
Left blinker lights are switched on.
Definition: MSVehicle.h:1164
double getActionStepLengthSecs() const
Returns the vehicle&#39;s action step length in secs, i.e. the interval between two action points...
Definition: MSVehicle.h:516
The wipers are on.
Definition: MSVehicle.h:1178
void setAngle(double angle, bool straightenFurther=false)
Set a custom vehicle angle in rad, optionally updates furtherLanePosLat.
Definition: MSVehicle.cpp:1024
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:995
vehicle want&#39;s to change to right lane
Definition: MSVehicle.h:228
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:3000
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it&#39;s primary lane ...
Definition: MSVehicle.cpp:4495
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:3054
Representation of a vehicle.
Definition: SUMOVehicle.h:66
SUMOTime myLastRemoteAccess
Definition: MSVehicle.h:1507
Stores the waiting intervals over the previous seconds (memory is to be specified in ms...
Definition: MSVehicle.h:168
Encapsulated SAX-Attributes.
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
Definition: MSVehicle.h:1750
void adaptLeaveSpeed(const double v)
Definition: MSVehicle.h:1799
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:222
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
SUMOTime getActionStepLength() const
Returns the vehicle&#39;s action step length in millisecs, i.e. the interval between two action points...
Definition: MSVehicle.h:508
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:905
double posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
Definition: MSVehicle.h:123
A list of positions.
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:676
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:3692
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
Definition: MSVehicle.cpp:732
int getRoutingMode() const
return the current routing mode
Definition: MSVehicle.h:1362
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:4026
Position myCachedPosition
Definition: MSVehicle.h:1752
double getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:3208
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:4343
double currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:805
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:780
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1713
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:64
bool collision
Whether this stop was triggered by a collision.
Definition: MSVehicle.h:935
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1492
#define STEPS2TIME(x)
Definition: SUMOTime.h:64
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1690
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
Definition: MSVehicle.h:1739
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1166
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:973
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:1910
void resetRoutePosition(int index)
Definition: MSVehicle.cpp:808
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1707
void 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:2449
double getDeltaPos(double accel)
calculates the distance covered in the next integration step given an acceleration and assuming the c...
Definition: MSVehicle.cpp:2248
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
Definition: MSVehicle.cpp:4868
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:4180
T MIN2(T a, T b)
Definition: StdDefs.h:67
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:1613
SUMOTime getActionStepLength() const
Returns this type&#39;s default action step length.
The brake lights are on.
Definition: MSVehicle.h:1168
A blue emergency light is on.
Definition: MSVehicle.h:1184
A structure representing the best lanes for continuing the current route starting at &#39;lane&#39;...
Definition: MSVehicle.h:799
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:4958
Everything is switched off.
Definition: MSVehicle.h:1160
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:709
double myStopDist
distance to the next stop or -1 if there is none
Definition: MSVehicle.h:1747
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:1364
bool hasInfluencer() const
Definition: MSVehicle.h:1543
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
Definition: MSVehicle.cpp:1352
Something on a lane to be noticed about vehicle movement.
double myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1722
void fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:4073
bool myActionStep
The flag myActionStep indicates whether the current time step is an action point for the vehicle...
Definition: MSVehicle.h:1682
double myPreviousSpeed
the speed at the begin of the previous time step
Definition: MSVehicle.h:154
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1669
One of the left doors is opened.
Definition: MSVehicle.h:1180
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1516
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1514
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:907
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:813
const waitingIntervalList & getWaitingIntervals() const
Definition: MSVehicle.h:201
Container that holds the vehicles driving state (position+speed).
Definition: MSVehicle.h:93
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:4933
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:1773
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:2719
double getLateralPositionOnLane() const
Get the vehicle&#39;s lateral position on the lane.
Definition: MSVehicle.h:439
void setRoutingMode(int value)
Sets routing behavior.
Definition: MSVehicle.h:1424
void setBrakingSignals(double vNext)
sets the braking lights on/off
Definition: MSVehicle.cpp:2676
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1498
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:4144
void removePassedDriveItems()
Erase passed drive items from myLFLinkLanes (and unregister approaching information for corresponding...
Definition: MSVehicle.cpp:2462
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
Definition: MSVehicle.h:1669
int numExpectedContainer
The number of still expected containers.
Definition: MSVehicle.h:929
const std::vector< double > & getFurtherLanesPosLat() const
Definition: MSVehicle.h:784
Abstract in-vehicle device.
Definition: MSDevice.h:70
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:4009
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:4302
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:4626
vehicle want&#39;s to change to left lane
Definition: MSVehicle.h:226
int numExpectedPerson
The number of still expected persons.
Definition: MSVehicle.h:927
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:4812
Structure representing possible vehicle parameter.
DriveItemVector::iterator myNextDriveItem
iterator pointing to the next item in myLFLinkLanes
Definition: MSVehicle.h:1820
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
Definition: MSVehicle.h:1520
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:807
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
Definition: MSVehicle.cpp:1342
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:4500
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1376
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:4321
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:594
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:2270
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1471
MSVehicleType * myType
This vehicle&#39;s type.
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:839
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:3229
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1730
ConstMSEdgeVector myRemoteRoute
Definition: MSVehicle.h:1506
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:819
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:915
Definition of vehicle stop (position and duration)
void setRemoteState(Position xyPos)
sets position outside the road network
Definition: MSVehicle.cpp:4849
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:499
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:911
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1011
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:4162
friend class MSVehicle
vehicle sets states directly
Definition: MSVehicle.h:95
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:3445
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:1618
int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:4253
DriveProcessItem(double vWait, double distance, double _availableSpace=0)
constructor if the link shall not be passed
Definition: MSVehicle.h:1789
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
Definition: MSVehicle.cpp:183
Stop(const SUMOVehicleParameter::Stop &par)
Definition: MSVehicle.h:903
const MSLane * getBackLane() const
Definition: MSVehicle.cpp:3044
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:4127
waitingIntervalList myWaitingIntervals
Definition: MSVehicle.h:212
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:115
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during planMove() and executeMove.
Definition: MSVehicle.h:1813
void updateWaitingTime(double vNext)
Updates the vehicle&#39;s waiting time counters (accumulated and consecutive)
Definition: MSVehicle.cpp:2695
void setSignals(int signals)
Definition: MSVehicle.h:1451
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:817
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
Definition: MSCFModel.cpp:653
vehicle want&#39;s to keep the current lane
Definition: MSVehicle.h:230
double getLastStepDist() const
Get the distance the vehicle covered in the previous timestep.
Definition: MSVehicle.h:409
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
double speed() const
Speed of this state.
Definition: MSVehicle.h:118
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:1223
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:62
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1215
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:890
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
Definition: MSVehicle.cpp:4916
void addPerson(MSTransportable *person)
Adds a passenger.
Definition: MSVehicle.cpp:4186
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1709
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:704
long long int SUMOTime
Definition: TraCIDefs.h:51
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle. ...
Definition: MSVehicle.h:601
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
Definition: MSVehicle.cpp:4512
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:829
double getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:4150
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:685
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
Definition: MSVehicle.cpp:4227
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1332
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
Definition: MSVehicle.cpp:4237
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:796
MSParkingArea * getNextParkingArea()
get the current parking area stop
Definition: MSVehicle.cpp:1318
const Position getBackPosition() const
Definition: MSVehicle.cpp:1079
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:4337
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:3686
SUMOTime getTimeLoss() const
Returns the SUMOTime lost (speed was lesser maximum speed)
Definition: MSVehicle.h:641
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1358
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:482
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:1483
double estimateLeaveSpeed(const MSLink *const link, const double vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1833
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:4836
double getLatDist() const
Definition: MSVehicle.h:1459
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1435
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Definition: MSVehicle.h:933
A red emergency light is on.
Definition: MSVehicle.h:1186
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
double myBackPos
the stored back position
Definition: MSVehicle.h:151
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle&#39;s entering of a new lane.
Definition: MSVehicle.cpp:868
One of the right doors is opened.
Definition: MSVehicle.h:1182
Interface for lane-change models.
double mySpeed
the stored speed (should be >=0 at any time)
Definition: MSVehicle.h:143
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1486
void removeTransportable(MSTransportable *t)
removes a person or container
Definition: MSVehicle.cpp:4217
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1719
The fog lights are on (no visualisation)
Definition: MSVehicle.h:1172
double nextStopDist() const
return the distance to the next stop or doubleMax if there is none.
Definition: MSVehicle.h:1009
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:4827
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:901
A yellow emergency light is on.
Definition: MSVehicle.h:1188
double pos() const
Position of this state.
Definition: MSVehicle.h:113
void updateDriveItems()
Check whether the drive items (myLFLinkLanes) are up to date, and update them if required.
Definition: MSVehicle.cpp:2516
bool congested() const
Definition: MSVehicle.h:714