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-2015 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 "MSVehicleType.h"
48 #include "MSBaseVehicle.h"
49 #include "MSLink.h"
50 #include "MSLane.h"
51 
52 
53 // ===========================================================================
54 // class declarations
55 // ===========================================================================
56 class SUMOSAXAttributes;
57 class MSMoveReminder;
58 class MSLaneChanger;
59 class MSVehicleTransfer;
61 class MSStoppingPlace;
62 class MSChargingStation;
63 class MSPerson;
64 class MSDevice;
66 class OutputDevice;
67 class Position;
68 class MSDevice_Person;
69 class MSDevice_Container;
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 
137  };
138 
146  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
147  const MSVehicleType* type, const SUMOReal speedFactor);
148 
150  virtual ~MSVehicle();
151 
152 
153 
155 
156 
166 
167 
168 
170 
171 
175  bool hasArrived() const;
176 
185  bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0);
186 
187 
193  bool willPass(const MSEdge* const edge) const;
194 
195  unsigned int getRoutePosition() const;
196  void resetRoutePosition(unsigned int index);
197 
206 
207 
215  static inline SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos) {
216  return predPos - predLength - pos;
217  }
218 
219 
220 
222 
223 
241  void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
243 
244 
262  void planMove(const SUMOTime t, const MSVehicle* pred, const SUMOReal lengthsInFront);
263 
264 
277  bool executeMove();
278 
279 
281 
282 
287  return myState.myPos;
288  }
289 
290 
294  SUMOReal getSpeed() const {
295  return myState.mySpeed;
296  }
297 
298 
303  return myAcceleration;
304  }
306 
307 
308 
310 
311 
315  SUMOReal getSlope() const;
316 
317 
325  Position getPosition(const SUMOReal offset = 0) const;
326 
327 
331  MSLane* getLane() const {
332  return myLane;
333  }
334 
335 
339  inline bool isOnRoad() const {
340  return myAmOnNet;
341  }
342 
343 
350  const MSEdge* getRerouteOrigin() const;
351 
352 
360  return myWaitingTime;
361  }
362 
363 
371  return STEPS2TIME(myWaitingTime);
372  }
373 
374 
378  SUMOReal getAngle() const;
380 
381 
383  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
384  if (veh1->myState.myPos < veh2->myState.myPos) {
385  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
386  }
387  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
388  }
389 
390 
393  bool congested() const {
394  return myState.mySpeed < SUMOReal(60) / SUMOReal(3.6);
395  }
396 
397 
409 
416  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
417 
418 
419 
428  MSMoveReminder::Notification notification);
429 
434  void setTentativeLaneAndPosition(MSLane* lane, const SUMOReal pos);
435 
440  void enterLaneAtLaneChange(MSLane* enteredLane);
441 
442 
444  void leaveLane(const MSMoveReminder::Notification reason);
445 
446 
449 
450  const std::vector<MSLane*>& getFurtherLanes() const {
451  return myFurtherLanes;
452  }
453 
456 
460  struct LaneQ {
474  std::vector<MSLane*> bestContinuations;
475  };
476 
480  const std::vector<LaneQ>& getBestLanes() const;
481 
499  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
500 
501 
506  const std::vector<MSLane*>& getBestLanesContinuation() const;
507 
512  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
513 
515  int getBestLaneOffset() const;
516 
518  void adaptBestLanesOccupation(int laneIndex, SUMOReal density);
519 
521 
523  bool fixPosition();
524 
525 
534  void replaceVehicleType(MSVehicleType* type);
535 
536 
544  inline const MSCFModel& getCarFollowModel() const {
545  return myType->getCarFollowModel();
546  }
547 
548 
554  return myCFVariables;
555  }
556 
557 
559 
560 
564  struct Stop {
568  const MSLane* lane;
584  bool triggered;
588  bool parking;
590  bool reached;
592  std::set<std::string> awaitedPersons;
594  std::set<std::string> awaitedContainers;
599 
600  };
601 
602 
609  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0);
610 
611 
615  bool hasStops() const {
616  return !myStops.empty();
617  }
618 
622  bool isStopped() const;
623 
627  bool isParking() const;
628 
629 
633  bool isStoppedTriggered() const;
634 
637  bool isStoppedInRange(SUMOReal pos) const;
639 
640  bool knowsEdgeTest(MSEdge& edge) const;
641  unsigned int getLaneIndex() const;
642 
652  SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge) const;
653 
654 
662  SUMOReal processNextStop(SUMOReal currentVelocity);
663 
671  std::pair<const MSVehicle* const, SUMOReal> getLeader(SUMOReal dist = 0) const;
672 
679  SUMOReal getTimeGap() const;
680 
681 
683 
684 
688  SUMOReal getCO2Emissions() const;
689 
690 
694  SUMOReal getCOEmissions() const;
695 
696 
700  SUMOReal getHCEmissions() const;
701 
702 
706  SUMOReal getNOxEmissions() const;
707 
708 
712  SUMOReal getPMxEmissions() const;
713 
714 
719 
720 
726 
727 
728 
730 
731 
735  void addPerson(MSTransportable* person);
736 
738 
739 
743  void addContainer(MSTransportable* container);
744 
745 
749  unsigned int getPersonNumber() const;
750 
754  unsigned int getContainerNumber() const;
755 
758 
762  enum Signalling {
793  };
794 
795 
801  LC_NEVER = 0, // lcModel shall never trigger changes at this level
802  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
803  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
804  };
805 
806 
809  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
810  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
811  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
812  LCP_OPPORTUNISTIC = 3 // change if not blocked
813  };
814 
815 
819  void switchOnSignal(int signal) {
820  mySignals |= signal;
821  }
822 
823 
827  void switchOffSignal(int signal) {
828  mySignals &= ~signal;
829  }
830 
831 
835  int getSignals() const {
836  return mySignals;
837  }
838 
839 
844  bool signalSet(int which) const {
845  return (mySignals & which) != 0;
846  }
848 
849 
850 #ifndef NO_TRACI
851 
859 
872  bool addTraciStop(MSLane* const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until,
873  const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg);
874 
886  bool addTraciBusOrContainerStop(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking,
887  const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string& errorMsg);
888 
893  Stop& getNextStop();
894 
899  bool resumeFromStopping();
900 
901 
914  class Influencer {
915  public:
917  Influencer();
918 
919 
921  ~Influencer();
922 
923 
927  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, SUMOReal> >& speedTimeLine);
928 
929 
933  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, unsigned int> >& laneTimeLine);
934 
935 
947  SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax);
948 
956  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const unsigned int currentLaneIndex, int state);
957 
958 
964  SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const;
965 
969  void setConsiderSafeVelocity(bool value);
970 
971 
975  void setConsiderMaxAcceleration(bool value);
976 
977 
981  void setConsiderMaxDeceleration(bool value);
982 
983 
987  void setRespectJunctionPriority(bool value);
988 
989 
993  inline bool getRespectJunctionPriority() const {
994  return myRespectJunctionPriority;
995  }
996 
997 
1001  void setEmergencyBrakeRedLight(bool value);
1002 
1003 
1007  inline bool getEmergencyBrakeRedLight() const {
1008  return myEmergencyBrakeRedLight;
1009  }
1010 
1011 
1015  void setLaneChangeMode(int value);
1016 
1017 
1021  inline SUMOReal getOriginalSpeed() const {
1022  return myOriginalSpeed;
1023  }
1024 
1025  void setVTDControlled(bool c, MSLane* l, SUMOReal pos, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t) {
1026  myAmVTDControlled = c;
1027  myVTDLane = l;
1028  myVTDPos = pos;
1029  myVTDEdgeOffset = edgeOffset;
1030  myVTDRoute = route;
1031  myLastVTDAccess = t;
1032  }
1033 
1035  return myLastVTDAccess;
1036  }
1037 
1038  void postProcessVTD(MSVehicle* v);
1039 
1041  SUMOReal implicitSpeedVTD(const MSVehicle* veh, SUMOReal oldSpeed);
1042 
1044  SUMOReal implicitDeltaPosVTD(const MSVehicle* veh);
1045 
1046  inline bool isVTDControlled() const {
1047  return myAmVTDControlled;
1048  }
1049 
1050  inline bool isVTDAffected(SUMOTime t) const {
1051  return myAmVTDControlled && myLastVTDAccess >= t - TIME2STEPS(10);
1052  }
1053 
1054 
1055  private:
1057  std::vector<std::pair<SUMOTime, SUMOReal> > mySpeedTimeLine;
1058 
1060  std::vector<std::pair<SUMOTime, unsigned int> > myLaneTimeLine;
1061 
1064 
1067 
1070 
1073 
1076 
1079 
1082 
1089 
1091 
1092  LaneChangeMode myStrategicLC;
1101  TraciLaneChangePriority myTraciLaneChangePriority;
1103 
1104  };
1105 
1106 
1113 
1114  bool hasInfluencer() const {
1115  return myInfluencer != 0;
1116  }
1117 
1119  int influenceChangeDecision(int state);
1120 
1122  SUMOReal getSafeFollowSpeed(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1123  const SUMOReal seen, const MSLane* const lane, SUMOReal distToCrossing) const;
1124 
1125 #endif
1126 
1128 
1129 
1131  void saveState(OutputDevice& out);
1132 
1135  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1137 
1138 protected:
1139 
1140  SUMOReal getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1141 
1144 
1160  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1162 
1163 
1164 
1165  void setBlinkerInformation();
1166 
1169  void setEmergencyBlueLight(SUMOTime currentTime);
1170 
1172  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1173 
1176  const ConstMSEdgeVector getStopEdges() const;
1177 
1178 
1181 
1184 
1187 
1189 
1192 
1193  std::vector<std::vector<LaneQ> > myBestLanes;
1194  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1195  static std::vector<MSLane*> myEmptyLaneVector;
1196 
1198  std::list<Stop> myStops;
1199 
1202 
1205 
1208 
1210  std::vector<MSLane*> myFurtherLanes;
1211 
1214 
1217 
1220 
1223 
1225 
1227 
1228 protected:
1242 
1243  DriveProcessItem(MSLink* link, SUMOReal vPass, SUMOReal vWait, bool setRequest,
1244  SUMOTime arrivalTime, SUMOReal arrivalSpeed,
1245  SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking,
1246  SUMOReal distance,
1247  SUMOReal leaveSpeed = -1.) :
1248  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1249  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1250  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1251  myDistance(distance),
1252  accelV(leaveSpeed), hadVehicle(false), availableSpace(-1.) {
1253  assert(vWait >= 0);
1254  assert(vPass >= 0);
1255  };
1256 
1259  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1260  myArrivalTime(0), myArrivalSpeed(0),
1261  myArrivalTimeBraking(0), myArrivalSpeedBraking(0),
1262  myDistance(distance),
1263  accelV(-1), hadVehicle(false), availableSpace(-1.) {
1264  assert(vWait >= 0);
1265  };
1266 
1267 
1268  inline void adaptLeaveSpeed(const SUMOReal v) {
1269  if (accelV < 0) {
1270  accelV = v;
1271  } else {
1272  accelV = MIN2(accelV, v);
1273  }
1274  }
1275  inline SUMOReal getLeaveSpeed() const {
1276  return accelV < 0 ? myVLinkPass : accelV;
1277  }
1278  };
1279 
1280  typedef std::vector< DriveProcessItem > DriveItemVector;
1281 
1283  DriveItemVector myLFLinkLanes;
1284 
1285  void planMoveInternal(const SUMOTime t, const MSVehicle* pred, DriveItemVector& lfLinks) const;
1286  void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const;
1287 
1289  inline SUMOReal estimateLeaveSpeed(const MSLink* const link, const SUMOReal vLinkPass) const {
1290  // estimate leave speed for passing time computation
1291  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1292  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1293  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1295  }
1296 
1297  /* @brief estimate speed while accelerating for the given distance
1298  * @param[in] dist The distance during which accelerating takes place
1299  * @param[in] v The initial speed
1300  * @param[in] accel The acceleration
1301  * XXX affected by ticket #860 (the formula is invalid for the current position update rule)
1302  */
1303  inline SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const {
1304  // dist=v*t + 0.5*accel*t^2, solve for t and multiply with accel, then add v
1305  return MIN2(getVehicleType().getMaxSpeed(),
1306  (SUMOReal)sqrt(2 * dist * accel + v * v));
1307  }
1308 
1309 
1310  /* @brief adapt safe velocity in accordance to a moving obstacle:
1311  * - a leader vehicle
1312  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1313  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1314  * @param[in] seen the distance to the end of the current lane
1315  * @param[in] lastLink the lastLink index
1316  * @param[in] lane The current Lane the vehicle is on
1317  * @param[in,out] the safe velocity for driving
1318  * @param[in,out] the safe velocity for arriving at the next link
1319  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1320  */
1321  void adaptToLeader(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1322  const SUMOReal seen, DriveProcessItem* const lastLink,
1323  const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass,
1324  SUMOReal distToCrossing = -1) const;
1325 
1326 private:
1327  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1328  * @note member is initialized on first access */
1330 
1333 
1334 #ifndef NO_TRACI
1337 #endif
1338 
1339 private:
1341  MSVehicle();
1342 
1344  MSVehicle(const MSVehicle&);
1345 
1347  MSVehicle& operator=(const MSVehicle&);
1348 
1350 
1351 };
1352 
1353 
1354 #endif
1355 
1356 /****************************************************************************/
1357 
void resetRoutePosition(unsigned int index)
Definition: MSVehicle.cpp:531
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:844
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1191
const MSVehicleType * myType
This Vehicle&#39;s type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:2441
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:1768
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:596
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1329
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1190
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:800
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1188
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1216
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1099
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1193
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:544
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1210
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1183
Stop & getNextStop()
Definition: MSVehicle.cpp:2585
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:1283
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:134
bool resumeFromStopping()
Definition: MSVehicle.cpp:2548
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1219
bool hasInfluencer() const
Definition: MSVehicle.h:1114
SUMOTime myLastVTDAccess
Definition: MSVehicle.h:1088
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:470
void setBlinkerInformation()
Definition: MSVehicle.cpp:2393
void addContainer(MSTransportable *container)
Adds a container.
Definition: MSVehicle.cpp:2360
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1275
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1207
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:2600
bool isVTDControlled() const
Definition: MSVehicle.h:1046
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:359
bool congested() const
Definition: MSVehicle.h:393
The front lights are on (no visualisation)
Definition: MSVehicle.h:774
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:762
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:617
The base class for an intersection.
Definition: MSJunction.h:61
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:464
The car-following model abstraction.
Definition: MSCFModel.h:59
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1072
State(SUMOReal pos, SUMOReal speed)
Constructor.
Definition: MSVehicle.cpp:139
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:778
Notification
Definition of a vehicle state.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
Definition: MSVehicle.cpp:471
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:914
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:2308
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1078
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:590
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:119
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:780
vehicle doesn&#39;t want to change
Definition: MSVehicle.h:130
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2380
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:808
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1289
SUMOReal mySpeed
the stored speed
Definition: MSVehicle.h:120
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:564
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:2296
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:1283
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:79
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:2262
SUMOReal getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:286
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
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:1243
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1224
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:851
A storage for edge travel times and efforts.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:615
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:464
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:1800
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:584
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:1904
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1332
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:766
MSChargingStation * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:574
SUMOReal nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:468
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:1833
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:127
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:55
A road/street connecting two junctions.
Definition: MSEdge.h:81
MSLane * lane
The described lane.
Definition: MSVehicle.h:462
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:1577
Left blinker lights are switched on.
Definition: MSVehicle.h:768
unsigned int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:2386
DriveProcessItem(SUMOReal vWait, SUMOReal distance)
constructor if the link shall not be passed
Definition: MSVehicle.h:1258
The wipers are on.
Definition: MSVehicle.h:782
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:562
vehicle want&#39;s to change to right lane
Definition: MSVehicle.h:134
void setVTDControlled(bool c, MSLane *l, SUMOReal pos, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSVehicle.h:1025
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:572
Encapsulated SAX-Attributes.
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:128
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:2188
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:519
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:1922
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Definition: MSVehicle.h:598
Position myCachedPosition
Definition: MSVehicle.h:1226
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:568
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
Definition: MSVehicle.h:215
SUMOReal myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1063
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
Definition: MSVehicle.cpp:699
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1198
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:61
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:827
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
Definition: MSVehicle.cpp:845
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1075
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
void adaptLeaveSpeed(const SUMOReal v)
Definition: MSVehicle.h:1268
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1186
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:993
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
Definition: MSVehicle.h:1222
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:770
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:1336
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1194
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:2245
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:1262
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:1559
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:580
T MIN2(T a, T b)
Definition: StdDefs.h:73
The brake lights are on.
Definition: MSVehicle.h:772
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
Definition: MSVehicle.h:1303
A blue emergency light is on.
Definition: MSVehicle.h:788
A structure representing the best lanes for continuing the route.
Definition: MSVehicle.h:460
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:2637
Everything is switched off.
Definition: MSVehicle.h:764
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:450
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
Definition: MSVehicle.h:594
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:1180
One of the left doors is opened.
Definition: MSVehicle.h:784
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1097
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:833
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1095
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:1916
bool knowsEdgeTest(MSEdge &edge) const
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:472
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:2332
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:2623
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:984
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.h:1021
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle&#39;s car following model variables.
Definition: MSVehicle.h:553
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2314
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1081
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:552
ConstMSEdgeVector myVTDRoute
Definition: MSVehicle.h:1087
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:1861
SUMOReal getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:176
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:2320
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2302
Abstract in-vehicle device.
Definition: MSDevice.h:69
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:2171
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:2429
vehicle want&#39;s to change to left lane
Definition: MSVehicle.h:132
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:450
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:2591
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:2456
Structure representing possible vehicle parameter.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1007
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1057
SUMOReal getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:606
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:586
bool fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:2234
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1034
SUMOReal occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:466
SUMOReal getAcceleration() const
Returns the vehicle&#39;s acceleration in m/s.
Definition: MSVehicle.h:302
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1213
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
Definition: MSVehicle.h:474
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:592
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2326
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:1246
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:582
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
Definition: MSVehicle.cpp:966
friend class MSVehicle
vehicle sets states directly
Definition: MSVehicle.h:91
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:566
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:2498
SUMOReal getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:294
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:370
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:839
std::vector< DriveProcessItem > DriveItemVector
Definition: MSVehicle.h:1280
std::vector< std::pair< SUMOTime, unsigned int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1060
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:976
SUMOReal endPos
The stopping position end.
Definition: MSVehicle.h:578
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:647
vehicle want&#39;s to keep the current lane
Definition: MSVehicle.h:136
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:835
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:214
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:827
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:819
void addPerson(MSTransportable *person)
Adds a passenger.
Definition: MSVehicle.cpp:2338
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1195
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:2226
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:383
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:385
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:354
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:339
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1066
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:331
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:2609
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
Definition: MSVehicle.cpp:1737
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2286
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:2465
SUMOReal startPos
The stopping position start.
Definition: MSVehicle.h:576
A red emergency light is on.
Definition: MSVehicle.h:790
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:570
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
MSDevice_Container * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1204
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:540
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle&#39;s entering of a new lane.
Definition: MSVehicle.cpp:586
bool isVTDAffected(SUMOTime t) const
Definition: MSVehicle.h:1050
unsigned int getRoutePosition() const
Definition: MSVehicle.cpp:525
One of the right doors is opened.
Definition: MSVehicle.h:786
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1201
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2216
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1069
The fog lights are on (no visualisation)
Definition: MSVehicle.h:776
bool parking
whether the vehicle is removed from the net while stopping
Definition: MSVehicle.h:588
SUMOReal getAngle() const
Returns the vehicle&#39;s direction in degrees.
Definition: MSVehicle.cpp:663
A yellow emergency light is on.
Definition: MSVehicle.h:792
unsigned int getLaneIndex() const
Definition: MSVehicle.cpp:2449