SUMO - Simulation of Urban MObility
MSVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
15 // Representation of a vehicle in the micro simulation
16 /****************************************************************************/
17 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
18 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
19 /****************************************************************************/
20 //
21 // This file is part of SUMO.
22 // SUMO is free software: you can redistribute it and/or modify
23 // it under the terms of the GNU General Public License as published by
24 // the Free Software Foundation, either version 3 of the License, or
25 // (at your option) any later version.
26 //
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 
54 // ===========================================================================
55 // class declarations
56 // ===========================================================================
57 class SUMOSAXAttributes;
58 class MSMoveReminder;
59 class MSLaneChanger;
60 class MSVehicleTransfer;
62 class MSStoppingPlace;
63 class MSChargingStation;
64 class MSPerson;
65 class MSDevice;
67 class OutputDevice;
68 class Position;
70 class MSContainer;
71 class MSJunction;
72 
73 // ===========================================================================
74 // class definitions
75 // ===========================================================================
80 class MSVehicle : public MSBaseVehicle {
81 public:
82 
84  friend class MSLaneChanger;
85 
89  class State {
91  friend class MSVehicle;
92  friend class MSLaneChanger;
93 
94  public:
97 
99  State(const State& state);
100 
102  State& operator=(const State& state);
103 
105  bool operator!=(const State& state);
106 
108  SUMOReal pos() const;
109 
111  SUMOReal speed() const {
112  return mySpeed;
113  };
114 
115  private:
117  SUMOReal myPos;
118 
121 
122  };
123 
124 
129  friend class MSVehicle;
130 
131  typedef std::list<std::pair<SUMOTime, SUMOTime> > waitingIntervalList;
132 
133  public:
136 
139 
142 
144  bool operator!=(const WaitingTimeCollector& wt) const;
145 
148 
149  // return the waiting time within the last memory millisecs
150  SUMOTime cumulatedWaitingTime(SUMOTime memory = -1) const;
151 
152  // process time passing for dt millisecs
153  void passTime(SUMOTime dt, bool waiting);
154 
155  // maximal memory time stored
157  return myMemorySize;
158  }
159 
160  // maximal memory time stored
161  const waitingIntervalList& getWaitingIntervals() const {
162  return myWaitingIntervals;
163  }
164 
165  private:
168 
172  waitingIntervalList myWaitingIntervals;
173 
175  void appendWaitingTime(SUMOTime dt);
176  };
177 
178 
191  };
192 
200  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
201  const MSVehicleType* type, const SUMOReal speedFactor);
202 
204  virtual ~MSVehicle();
205 
206 
207 
209 
210 
220 
221 
222 
224 
225 
229  bool hasArrived() const;
230 
239  bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0);
240 
241 
247  bool willPass(const MSEdge* const edge) const;
248 
249  unsigned int getRoutePosition() const;
250  void resetRoutePosition(unsigned int index);
251 
260 
261 
269  static inline SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos) {
270  return predPos - predLength - pos;
271  }
272 
273 
274 
276 
277 
295  void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
297 
298 
316  void planMove(const SUMOTime t, const MSVehicle* pred, const SUMOReal lengthsInFront);
317 
318 
331  bool executeMove();
332 
333 
335 
336 
341  return myState.myPos;
342  }
343 
344 
348  SUMOReal getSpeed() const {
349  return myState.mySpeed;
350  }
351 
352 
357  return myAcceleration;
358  }
360 
361 
362 
364 
365 
369  SUMOReal getSlope() const;
370 
371 
379  Position getPosition(const SUMOReal offset = 0) const;
380 
381 
385  MSLane* getLane() const {
386  return myLane;
387  }
388 
389 
393  inline bool isOnRoad() const {
394  return myAmOnNet;
395  }
396 
397 
404  const MSEdge* getRerouteOrigin() const;
405 
406 
414  return myWaitingTime;
415  }
416 
417 
425  }
426 
427 
435  return STEPS2TIME(myWaitingTime);
436  }
437 
438 
446  }
447 
448 
452  SUMOReal getAngle() const {
453  return myAngle;
454  }
456 
458  SUMOReal computeAngle() const;
459 
461  void setAngle(SUMOReal angle);
462 
464  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
465  if (veh1->myState.myPos < veh2->myState.myPos) {
466  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
467  }
468  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
469  }
470 
471 
474  bool congested() const {
475  return myState.mySpeed < SUMOReal(60) / SUMOReal(3.6);
476  }
477 
478 
490 
497  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
498 
499 
500 
509  MSMoveReminder::Notification notification);
510 
515  void setTentativeLaneAndPosition(MSLane* lane, const SUMOReal pos);
516 
521  void enterLaneAtLaneChange(MSLane* enteredLane);
522 
523 
525  void leaveLane(const MSMoveReminder::Notification reason);
526 
527 
530 
531  const std::vector<MSLane*>& getFurtherLanes() const {
532  return myFurtherLanes;
533  }
534 
537 
541  struct LaneQ {
557  std::vector<MSLane*> bestContinuations;
558  };
559 
563  const std::vector<LaneQ>& getBestLanes() const;
564 
582  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
583 
584 
589  const std::vector<MSLane*>& getBestLanesContinuation() const;
590 
595  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
596 
598  int getBestLaneOffset() const;
599 
601  void adaptBestLanesOccupation(int laneIndex, SUMOReal density);
602 
604 
606  bool fixPosition();
607 
608 
617  void replaceVehicleType(MSVehicleType* type);
618 
619 
627  inline const MSCFModel& getCarFollowModel() const {
628  return myType->getCarFollowModel();
629  }
630 
631 
637  return myCFVariables;
638  }
639 
640 
642 
643 
647  struct Stop {
651  const MSLane* lane;
667  bool triggered;
671  bool parking;
673  bool reached;
675  std::set<std::string> awaitedPersons;
677  std::set<std::string> awaitedContainers;
682 
683  };
684 
685 
692  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0);
693 
694 
698  bool hasStops() const {
699  return !myStops.empty();
700  }
701 
705  bool isStopped() const;
706 
710  bool isParking() const;
711 
712 
716  bool isStoppedTriggered() const;
717 
720  bool isStoppedInRange(SUMOReal pos) const;
722 
723  bool knowsEdgeTest(MSEdge& edge) const;
724  unsigned int getLaneIndex() const;
725 
735  SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge) const;
736 
737 
745  SUMOReal processNextStop(SUMOReal currentVelocity);
746 
754  std::pair<const MSVehicle* const, SUMOReal> getLeader(SUMOReal dist = 0) const;
755 
762  SUMOReal getTimeGap() const;
763 
764 
766 
767 
771  SUMOReal getCO2Emissions() const;
772 
773 
777  SUMOReal getCOEmissions() const;
778 
779 
783  SUMOReal getHCEmissions() const;
784 
785 
789  SUMOReal getNOxEmissions() const;
790 
791 
795  SUMOReal getPMxEmissions() const;
796 
797 
802 
803 
808 
809 
815 
816 
817 
819 
820 
824  void addPerson(MSTransportable* person);
825 
827 
828 
832  void addContainer(MSTransportable* container);
833 
835  const std::vector<MSTransportable*>& getPersons() const;
836 
838  const std::vector<MSTransportable*>& getContainers() const;
839 
843  unsigned int getPersonNumber() const;
844 
848  unsigned int getContainerNumber() const;
849 
852 
856  enum Signalling {
887  };
888 
889 
895  LC_NEVER = 0, // lcModel shall never trigger changes at this level
896  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
897  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
898  };
899 
900 
903  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
904  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
905  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
906  LCP_OPPORTUNISTIC = 3 // change if not blocked
907  };
908 
909 
913  void switchOnSignal(int signal) {
914  mySignals |= signal;
915  }
916 
917 
921  void switchOffSignal(int signal) {
922  mySignals &= ~signal;
923  }
924 
925 
929  int getSignals() const {
930  return mySignals;
931  }
932 
933 
938  bool signalSet(int which) const {
939  return (mySignals & which) != 0;
940  }
942 
943 
945  bool unsafeLinkAhead(const MSLane* lane) const;
946 
947 
948 #ifndef NO_TRACI
949 
957 
970  bool addTraciStop(MSLane* const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until,
971  const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg);
972 
984  bool addTraciBusOrContainerStop(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking,
985  const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string& errorMsg);
986 
991  Stop& getNextStop();
992 
997  bool resumeFromStopping();
998 
999 
1012  class Influencer {
1013  public:
1015  Influencer();
1016 
1017 
1019  ~Influencer();
1020 
1021 
1025  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, SUMOReal> >& speedTimeLine);
1026 
1027 
1031  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, unsigned int> >& laneTimeLine);
1032 
1033 
1045  SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax);
1046 
1054  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const unsigned int currentLaneIndex, int state);
1055 
1056 
1062  SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1063 
1067  void setConsiderSafeVelocity(bool value);
1068 
1069 
1073  void setConsiderMaxAcceleration(bool value);
1074 
1075 
1079  void setConsiderMaxDeceleration(bool value);
1080 
1081 
1085  void setRespectJunctionPriority(bool value);
1086 
1087 
1091  inline bool getRespectJunctionPriority() const {
1092  return myRespectJunctionPriority;
1093  }
1094 
1095 
1099  void setEmergencyBrakeRedLight(bool value);
1100 
1101 
1105  inline bool getEmergencyBrakeRedLight() const {
1106  return myEmergencyBrakeRedLight;
1107  }
1108 
1109 
1113  void setLaneChangeMode(int value);
1114 
1115 
1119  inline SUMOReal getOriginalSpeed() const {
1120  return myOriginalSpeed;
1121  }
1122 
1123  void setVTDControlled(MSLane* l, SUMOReal pos, SUMOReal angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1124 
1126  return myLastVTDAccess;
1127  }
1128 
1129  void postProcessVTD(MSVehicle* v);
1130 
1132  SUMOReal implicitSpeedVTD(const MSVehicle* veh, SUMOReal oldSpeed);
1133 
1135  SUMOReal implicitDeltaPosVTD(const MSVehicle* veh);
1136 
1137  bool isVTDControlled() const;
1138 
1139  bool isVTDAffected(SUMOTime t) const;
1140 
1141  private:
1143  std::vector<std::pair<SUMOTime, SUMOReal> > mySpeedTimeLine;
1144 
1146  std::vector<std::pair<SUMOTime, unsigned int> > myLaneTimeLine;
1147 
1150 
1153 
1156 
1159 
1162 
1165 
1168 
1175 
1177 
1178  LaneChangeMode myStrategicLC;
1187  TraciLaneChangePriority myTraciLaneChangePriority;
1189 
1190  };
1191 
1192 
1199 
1200  bool hasInfluencer() const {
1201  return myInfluencer != 0;
1202  }
1203 
1205  int influenceChangeDecision(int state);
1206 
1208  SUMOReal getSafeFollowSpeed(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1209  const SUMOReal seen, const MSLane* const lane, SUMOReal distToCrossing) const;
1210 
1212  static int nextLinkPriority(const std::vector<MSLane*>& conts);
1213 
1214 #endif
1215 
1217 
1218 
1220  void saveState(OutputDevice& out);
1221 
1224  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1226 
1227 protected:
1228 
1229  SUMOReal getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1230 
1233 
1249  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1251 
1252 
1253 
1254  void setBlinkerInformation();
1255 
1258  void setEmergencyBlueLight(SUMOTime currentTime);
1259 
1261  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1262 
1265  const ConstMSEdgeVector getStopEdges() const;
1266 
1267 
1271 
1274 
1277 
1279 
1282 
1283  std::vector<std::vector<LaneQ> > myBestLanes;
1284  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1285  static std::vector<MSLane*> myEmptyLaneVector;
1286  static std::vector<MSTransportable*> myEmptyTransportableVector;
1287 
1289  std::list<Stop> myStops;
1290 
1293 
1296 
1299 
1301  std::vector<MSLane*> myFurtherLanes;
1302 
1305 
1308 
1311 
1314 
1316 
1319 
1321 
1322 protected:
1336 
1337  DriveProcessItem(MSLink* link, SUMOReal vPass, SUMOReal vWait, bool setRequest,
1338  SUMOTime arrivalTime, SUMOReal arrivalSpeed,
1339  SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking,
1340  SUMOReal distance,
1341  SUMOReal leaveSpeed = -1.) :
1342  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1343  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1344  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1345  myDistance(distance),
1346  accelV(leaveSpeed), hadVehicle(false), availableSpace(-1.) {
1347  assert(vWait >= 0);
1348  assert(vPass >= 0);
1349  };
1350 
1353  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1354  myArrivalTime(0), myArrivalSpeed(0),
1355  myArrivalTimeBraking(0), myArrivalSpeedBraking(0),
1356  myDistance(distance),
1357  accelV(-1), hadVehicle(false), availableSpace(-1.) {
1358  assert(vWait >= 0);
1359  };
1360 
1361 
1362  inline void adaptLeaveSpeed(const SUMOReal v) {
1363  if (accelV < 0) {
1364  accelV = v;
1365  } else {
1366  accelV = MIN2(accelV, v);
1367  }
1368  }
1369  inline SUMOReal getLeaveSpeed() const {
1370  return accelV < 0 ? myVLinkPass : accelV;
1371  }
1372  };
1373 
1374  typedef std::vector< DriveProcessItem > DriveItemVector;
1375 
1377  DriveItemVector myLFLinkLanes;
1378 
1379  void planMoveInternal(const SUMOTime t, const MSVehicle* pred, DriveItemVector& lfLinks) const;
1380  void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const;
1381 
1383  inline SUMOReal estimateLeaveSpeed(const MSLink* const link, const SUMOReal vLinkPass) const {
1384  // estimate leave speed for passing time computation
1385  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1386  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1387  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1389  }
1390 
1391  /* @brief estimate speed while accelerating for the given distance
1392  * @param[in] dist The distance during which accelerating takes place
1393  * @param[in] v The initial speed
1394  * @param[in] accel The acceleration
1395  * XXX affected by ticket #860 (the formula is invalid for the current position update rule)
1396  */
1397  inline SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const {
1398  // dist=v*t + 0.5*accel*t^2, solve for t and multiply with accel, then add v
1399  return MIN2(getVehicleType().getMaxSpeed(),
1400  (SUMOReal)sqrt(2 * dist * accel + v * v));
1401  }
1402 
1403 
1404  /* @brief adapt safe velocity in accordance to a moving obstacle:
1405  * - a leader vehicle
1406  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1407  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1408  * @param[in] seen the distance to the end of the current lane
1409  * @param[in] lastLink the lastLink index
1410  * @param[in] lane The current Lane the vehicle is on
1411  * @param[in,out] the safe velocity for driving
1412  * @param[in,out] the safe velocity for arriving at the next link
1413  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1414  */
1415  void adaptToLeader(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1416  const SUMOReal seen, DriveProcessItem* const lastLink,
1417  const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass,
1418  SUMOReal distToCrossing = -1) const;
1419 
1420 
1421 
1422 private:
1423  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1424  * @note member is initialized on first access */
1426 
1429 
1430 #ifndef NO_TRACI
1433 #endif
1434 
1435 private:
1437  MSVehicle();
1438 
1440  MSVehicle(const MSVehicle&);
1441 
1443  MSVehicle& operator=(const MSVehicle&);
1444 
1446 
1447 };
1448 
1449 
1450 #endif
1451 
1452 /****************************************************************************/
1453 
void resetRoutePosition(unsigned int index)
Definition: MSVehicle.cpp:632
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:938
void setAngle(SUMOReal angle)
Set a custom vehicle angle in rad.
Definition: MSVehicle.cpp:763
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1281
const MSVehicleType * myType
This Vehicle&#39;s type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:2623
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:1882
static int nextLinkPriority(const std::vector< MSLane * > &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:2307
std::list< std::pair< SUMOTime, SUMOTime > > waitingIntervalList
Definition: MSVehicle.h:131
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
long long int SUMOTime
Definition: SUMOTime.h:43
SUMOReal speed() const
Speed of this state.
Definition: MSVehicle.h:111
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
Definition: MSVehicle.h:679
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1425
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1280
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:894
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1278
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1307
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1185
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1283
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:627
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1301
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1273
Stop & getNextStop()
Definition: MSVehicle.cpp:2820
A lane area vehicles can halt at.
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
Definition: MSVehicle.h:1377
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:128
bool resumeFromStopping()
Definition: MSVehicle.cpp:2783
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1310
bool hasInfluencer() const
Definition: MSVehicle.h:1200
SUMOTime myLastVTDAccess
Definition: MSVehicle.h:1174
SUMOReal getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
Definition: MSVehicle.h:553
void setBlinkerInformation()
Definition: MSVehicle.cpp:2575
void addContainer(MSTransportable *container)
Adds a container.
Definition: MSVehicle.cpp:2522
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1369
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
Definition: MSVehicle.cpp:2646
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1298
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:2835
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:413
bool congested() const
Definition: MSVehicle.h:474
The front lights are on (no visualisation)
Definition: MSVehicle.h:868
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:856
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:718
The base class for an intersection.
Definition: MSJunction.h:64
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:565
The car-following model abstraction.
Definition: MSCFModel.h:59
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1158
State(SUMOReal pos, SUMOReal speed)
Constructor.
Definition: MSVehicle.cpp:133
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:872
Notification
Definition of a vehicle state.
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1292
SUMOReal currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:547
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
Definition: MSVehicle.cpp:572
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:1012
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:2464
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1164
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:673
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:113
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:874
vehicle doesn&#39;t want to change
Definition: MSVehicle.h:184
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2562
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:902
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1383
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1270
SUMOReal mySpeed
the stored speed
Definition: MSVehicle.h:120
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:647
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:2452
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:1389
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
SUMOTime myMemorySize
the maximal memory to store
Definition: MSVehicle.h:167
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2414
SUMOReal getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:340
DriveProcessItem(MSLink *link, SUMOReal vPass, SUMOReal vWait, bool setRequest, SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking, SUMOReal distance, SUMOReal leaveSpeed=-1.)
Definition: MSVehicle.h:1337
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1315
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:957
A storage for edge travel times and efforts.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:698
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:545
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:1914
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:667
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:2025
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1428
const MSCFModel & getCarFollowModel() const
Returns the vehicle type&#39;s car following model definition (const version)
Right blinker lights are switched on.
Definition: MSVehicle.h:860
MSChargingStation * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:657
SUMOReal nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:551
SUMOReal getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:2488
SUMOTime getMemorySize() const
Definition: MSVehicle.h:156
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
Definition: MSVehicle.cpp:1948
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:121
static std::vector< MSTransportable * > myEmptyTransportableVector
Definition: MSVehicle.h:1286
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:55
A road/street connecting two junctions.
Definition: MSEdge.h:80
MSLane * lane
The described lane.
Definition: MSVehicle.h:543
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:1690
Left blinker lights are switched on.
Definition: MSVehicle.h:862
unsigned int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:2568
SUMOReal computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:769
DriveProcessItem(SUMOReal vWait, SUMOReal distance)
constructor if the link shall not be passed
Definition: MSVehicle.h:1352
The wipers are on.
Definition: MSVehicle.h:876
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:663
vehicle want&#39;s to change to right lane
Definition: MSVehicle.h:188
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:655
Stores the waiting intervals over the previous seconds (memory is to be specified in ms...
Definition: MSVehicle.h:128
Encapsulated SAX-Attributes.
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:182
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle&#39;s current lane and their successors...
Definition: MSVehicle.cpp:2340
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:620
SUMOReal myAngle
the angle (
Definition: MSVehicle.h:1318
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:2043
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Definition: MSVehicle.h:681
Position myCachedPosition
Definition: MSVehicle.h:1320
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:651
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
Definition: MSVehicle.h:269
SUMOReal myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1149
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
Definition: MSVehicle.cpp:805
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1289
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:65
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:933
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
Definition: MSVehicle.cpp:951
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1161
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
void adaptLeaveSpeed(const SUMOReal v)
Definition: MSVehicle.h:1362
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1276
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:1091
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
Definition: MSVehicle.h:1313
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:864
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:1432
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1284
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
Definition: MSVehicle.cpp:2552
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:2397
SUMOReal getSafeFollowSpeed(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, const MSLane *const lane, SUMOReal distToCrossing) const
compute safe speed for following the given leader
Definition: MSVehicle.cpp:1368
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:1672
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:663
T MIN2(T a, T b)
Definition: StdDefs.h:69
The brake lights are on.
Definition: MSVehicle.h:866
SUMOReal getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:444
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
Definition: MSVehicle.h:1397
A blue emergency light is on.
Definition: MSVehicle.h:882
A structure representing the best lanes for continuing the route.
Definition: MSVehicle.h:541
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:2872
Everything is switched off.
Definition: MSVehicle.h:858
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:551
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
Definition: MSVehicle.h:677
Something on a lane to be noticed about vehicle movement.
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1269
One of the left doors is opened.
Definition: MSVehicle.h:878
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1183
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:939
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1181
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:2037
bool knowsEdgeTest(MSEdge &edge) const
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:555
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:2494
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
Definition: MSVehicle.cpp:2542
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:2858
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:1090
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.h:1119
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle&#39;s car following model variables.
Definition: MSVehicle.h:636
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2470
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1167
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:653
ConstMSEdgeVector myVTDRoute
Definition: MSVehicle.h:1173
void leaveLane(const MSMoveReminder::Notification reason)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
Definition: MSVehicle.cpp:1982
SUMOReal getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:178
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:2476
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2458
Abstract in-vehicle device.
Definition: MSDevice.h:69
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:2323
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:2611
vehicle want&#39;s to change to left lane
Definition: MSVehicle.h:186
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:531
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:2826
void setTentativeLaneAndPosition(MSLane *lane, const SUMOReal pos)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
Definition: MSVehicle.cpp:2638
Structure representing possible vehicle parameter.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1105
SUMOTime getAccumulatedWaitingTime(SUMOTime t=MSGlobals::gWaitingTimeMemory) const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:423
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1143
SUMOReal getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:707
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:669
bool fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:2386
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1125
SUMOReal occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:549
SUMOReal getAcceleration() const
Returns the vehicle&#39;s acceleration in m/s.
Definition: MSVehicle.h:356
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1304
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
Definition: MSVehicle.h:557
Definition of vehicle stop (position and duration)
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
Definition: MSVehicle.h:675
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2482
void adaptToLeader(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass, SUMOReal distToCrossing=-1) const
Definition: MSVehicle.cpp:1352
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
Definition: MSBaseVehicle.h:93
SUMOTime until
The time at which the vehicle may continue its journey.
Definition: MSVehicle.h:665
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
Definition: MSVehicle.cpp:1072
friend class MSVehicle
vehicle sets states directly
Definition: MSVehicle.h:91
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:649
const waitingIntervalList & getWaitingIntervals() const
Definition: MSVehicle.h:161
bool addTraciBusOrContainerStop(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string &errorMsg)
Definition: MSVehicle.cpp:2733
SUMOReal getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:348
SUMOReal myPos
the stored position
Definition: MSVehicle.h:113
SUMOReal getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:434
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:945
waitingIntervalList myWaitingIntervals
Definition: MSVehicle.h:172
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:102
std::vector< DriveProcessItem > DriveItemVector
Definition: MSVehicle.h:1374
std::vector< std::pair< SUMOTime, unsigned int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1146
void planMove(const SUMOTime t, const MSVehicle *pred, const SUMOReal lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
Definition: MSVehicle.cpp:1082
SUMOReal endPos
The stopping position end.
Definition: MSVehicle.h:661
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:748
vehicle want&#39;s to keep the current lane
Definition: MSVehicle.h:190
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:929
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:213
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:921
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:913
void addPerson(MSTransportable *person)
Adds a passenger.
Definition: MSVehicle.cpp:2500
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1285
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:2378
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:464
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
Definition: MSVehicle.cpp:161
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:481
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:353
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:393
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1152
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:385
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:2844
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
Definition: MSVehicle.cpp:1850
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2442
bool addTraciStop(MSLane *const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
Definition: MSVehicle.cpp:2700
SUMOReal startPos
The stopping position start.
Definition: MSVehicle.h:659
A red emergency light is on.
Definition: MSVehicle.h:884
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:653
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:641
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle&#39;s entering of a new lane.
Definition: MSVehicle.cpp:687
unsigned int getRoutePosition() const
Definition: MSVehicle.cpp:626
One of the right doors is opened.
Definition: MSVehicle.h:880
Interface for lane-change models.
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2368
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1155
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1295
The fog lights are on (no visualisation)
Definition: MSVehicle.h:870
bool parking
whether the vehicle is removed from the net while stopping
Definition: MSVehicle.h:671
SUMOReal getAngle() const
Returns the vehicle&#39;s direction in degrees.
Definition: MSVehicle.h:452
A yellow emergency light is on.
Definition: MSVehicle.h:886
unsigned int getLaneIndex() const
Definition: MSVehicle.cpp:2631