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 MSBusStop;
62 class MSContainerStop;
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 
427  void enterLaneAtInsertion(MSLane* enteredLane, SUMOReal pos, SUMOReal speed,
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 
452 
456  struct LaneQ {
470  std::vector<MSLane*> bestContinuations;
471  };
472 
476  const std::vector<LaneQ>& getBestLanes() const;
477 
495  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
496 
497 
502  const std::vector<MSLane*>& getBestLanesContinuation() const;
503 
508  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
509 
511  int getBestLaneOffset() const;
512 
514  void adaptBestLanesOccupation(int laneIndex, SUMOReal density);
515 
517 
519  bool fixPosition();
520 
521 
530  void replaceVehicleType(MSVehicleType* type);
531 
532 
540  inline const MSCFModel& getCarFollowModel() const {
541  return myType->getCarFollowModel();
542  }
543 
544 
550  return myCFVariables;
551  }
552 
553 
555 
556 
560  struct Stop {
564  const MSLane* lane;
578  bool triggered;
582  bool parking;
584  bool reached;
586  std::set<std::string> awaitedPersons;
588  std::set<std::string> awaitedContainers;
593 
594  };
595 
596 
603  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0);
604 
605 
609  bool hasStops() const {
610  return !myStops.empty();
611  }
612 
616  bool isStopped() const;
617 
621  bool isParking() const;
622 
623 
627  bool isStoppedTriggered() const;
628 
631  bool isStoppedInRange(SUMOReal pos) const;
633 
634  bool knowsEdgeTest(MSEdge& edge) const;
635  unsigned int getLaneIndex() const;
636 
646  SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge);
647 
648 
656  SUMOReal processNextStop(SUMOReal currentVelocity);
657 
665  std::pair<const MSVehicle* const, SUMOReal> getLeader(SUMOReal dist = 0) const;
666 
673  SUMOReal getTimeGap() const;
674 
675 
677 
678 
682  SUMOReal getCO2Emissions() const;
683 
684 
688  SUMOReal getCOEmissions() const;
689 
690 
694  SUMOReal getHCEmissions() const;
695 
696 
700  SUMOReal getNOxEmissions() const;
701 
702 
706  SUMOReal getPMxEmissions() const;
707 
708 
713 
714 
720 
721 
722 
724 
725 
729  void addPerson(MSPerson* person);
730 
732 
733 
737  void addContainer(MSContainer* container);
738 
739 
743  unsigned int getPersonNumber() const;
744 
748  unsigned int getContainerNumber() const;
749 
752 
756  enum Signalling {
787  };
788 
789 
795  LC_NEVER = 0, // lcModel shall never trigger changes at this level
796  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
797  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
798  };
799 
800 
803  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
804  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
805  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
806  LCP_OPPORTUNISTIC = 3 // change if not blocked
807  };
808 
809 
813  void switchOnSignal(int signal) {
814  mySignals |= signal;
815  }
816 
817 
821  void switchOffSignal(int signal) {
822  mySignals &= ~signal;
823  }
824 
825 
829  int getSignals() const {
830  return mySignals;
831  }
832 
833 
838  bool signalSet(int which) const {
839  return (mySignals & which) != 0;
840  }
842 
843 
844 #ifndef NO_TRACI
845 
853 
865  bool addTraciStop(MSLane* lane, SUMOReal pos, SUMOReal radius, SUMOTime duration,
866  bool parking, bool triggered, bool containerTriggered, std::string& errorMsg);
867 
872  Stop& getNextStop();
873 
878  bool resumeFromStopping();
879 
880 
893  class Influencer {
894  public:
896  Influencer();
897 
898 
900  ~Influencer();
901 
902 
906  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, SUMOReal> >& speedTimeLine);
907 
908 
912  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, unsigned int> >& laneTimeLine);
913 
914 
926  SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax);
927 
935  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const unsigned int currentLaneIndex, int state);
936 
937 
943  SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const;
944 
948  void setConsiderSafeVelocity(bool value);
949 
950 
954  void setConsiderMaxAcceleration(bool value);
955 
956 
960  void setConsiderMaxDeceleration(bool value);
961 
962 
966  void setRespectJunctionPriority(bool value);
967 
968 
972  inline bool getRespectJunctionPriority() const {
974  }
975 
976 
980  void setEmergencyBrakeRedLight(bool value);
981 
982 
986  inline bool getEmergencyBrakeRedLight() const {
988  }
989 
990 
994  void setLaneChangeMode(int value);
995 
996 
1000  inline SUMOReal getOriginalSpeed() const {
1001  return myOriginalSpeed;
1002  }
1003 
1004  void setVTDControlled(bool c, MSLane* l, SUMOReal pos, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t) {
1005  myAmVTDControlled = c;
1006  myVTDLane = l;
1007  myVTDPos = pos;
1008  myVTDEdgeOffset = edgeOffset;
1009  myVTDRoute = route;
1010  myLastVTDAccess = t;
1011  }
1012 
1014  return myLastVTDAccess;
1015  }
1016 
1017  void postProcessVTD(MSVehicle* v);
1018 
1019  inline bool isVTDControlled() const {
1020  return myAmVTDControlled;
1021  }
1022 
1023  inline bool isVTDAffected(SUMOTime t) const {
1024  return myAmVTDControlled && myLastVTDAccess >= t - TIME2STEPS(10);
1025  }
1026 
1027 
1028  private:
1030  std::vector<std::pair<SUMOTime, SUMOReal> > mySpeedTimeLine;
1031 
1033  std::vector<std::pair<SUMOTime, unsigned int> > myLaneTimeLine;
1034 
1037 
1040 
1043 
1046 
1049 
1052 
1055 
1062 
1064 
1076 
1077  };
1078 
1079 
1086 
1087  bool hasInfluencer() const {
1088  return myInfluencer != 0;
1089  }
1090 
1092  int influenceChangeDecision(int state);
1093 
1095  SUMOReal getSafeFollowSpeed(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1096  const SUMOReal seen, const MSLane* const lane, SUMOReal distToCrossing) const;
1097 
1098 #endif
1099 
1101 
1102 
1104  void saveState(OutputDevice& out);
1105 
1108  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1110 
1111 protected:
1112 
1113  SUMOReal getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1114 
1117 
1133  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1135 
1136 
1137 
1138  void setBlinkerInformation();
1139 
1141  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1142 
1145  const ConstMSEdgeVector getStopEdges() const;
1146 
1147 
1150 
1153 
1156 
1158 
1161 
1162  std::vector<std::vector<LaneQ> > myBestLanes;
1163  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1164  static std::vector<MSLane*> myEmptyLaneVector;
1165 
1167  std::list<Stop> myStops;
1168 
1171 
1174 
1177 
1179  std::vector<MSLane*> myFurtherLanes;
1180 
1183 
1186 
1189 
1192 
1194 
1196 
1197 protected:
1211 
1212  DriveProcessItem(MSLink* link, SUMOReal vPass, SUMOReal vWait, bool setRequest,
1213  SUMOTime arrivalTime, SUMOReal arrivalSpeed,
1214  SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking,
1215  SUMOReal distance,
1216  SUMOReal leaveSpeed = -1.) :
1217  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1218  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1219  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1220  myDistance(distance),
1221  accelV(leaveSpeed), hadVehicle(false), availableSpace(-1.) {
1222  assert(vWait >= 0);
1223  assert(vPass >= 0);
1224  };
1225 
1228  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1229  myArrivalTime(0), myArrivalSpeed(0),
1230  myArrivalTimeBraking(0), myArrivalSpeedBraking(0),
1231  myDistance(distance),
1232  accelV(-1), hadVehicle(false), availableSpace(-1.) {
1233  assert(vWait >= 0);
1234  };
1235 
1236 
1237  inline void adaptLeaveSpeed(const SUMOReal v) {
1238  if (accelV < 0) {
1239  accelV = v;
1240  } else {
1241  accelV = MIN2(accelV, v);
1242  }
1243  }
1244  inline SUMOReal getLeaveSpeed() const {
1245  return accelV < 0 ? myVLinkPass : accelV;
1246  }
1247  };
1248 
1249  typedef std::vector< DriveProcessItem > DriveItemVector;
1250 
1252  DriveItemVector myLFLinkLanes;
1253 
1254  void planMoveInternal(const SUMOTime t, const MSVehicle* pred, DriveItemVector& lfLinks) const;
1255  void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const;
1256 
1258  inline SUMOReal estimateLeaveSpeed(const MSLink* const link, const SUMOReal vLinkPass) const {
1259  // estimate leave speed for passing time computation
1260  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1261  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1262  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1264  }
1265 
1266  /* @brief estimate speed while accelerating for the given distance
1267  * @param[in] dist The distance during which accelerating takes place
1268  * @param[in] v The initial speed
1269  * @param[in] accel The acceleration
1270  * XXX affected by ticket #860 (the formula is invalid for the current position update rule)
1271  */
1272  inline SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const {
1273  // dist=v*t + 0.5*accel*t^2, solve for t and multiply with accel, then add v
1274  return MIN2(getVehicleType().getMaxSpeed(),
1275  (SUMOReal)sqrt(2 * dist * accel + v * v));
1276  }
1277 
1278 
1279  /* @brief adapt safe velocity in accordance to a moving obstacle:
1280  * - a leader vehicle
1281  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1282  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1283  * @param[in] seen the distance to the end of the current lane
1284  * @param[in] lastLink the lastLink index
1285  * @param[in] lane The current Lane the vehicle is on
1286  * @param[in,out] the safe velocity for driving
1287  * @param[in,out] the safe velocity for arriving at the next link
1288  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1289  */
1290  void adaptToLeader(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1291  const SUMOReal seen, DriveProcessItem* const lastLink,
1292  const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass,
1293  SUMOReal distToCrossing = -1) const;
1294 
1295 #ifdef HAVE_INTERNAL_LANES
1296  mutable std::map<const MSJunction*, std::set<std::string> > myLinkLeaders;
1298 #endif
1299 
1300 private:
1301  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1302  * @note member is initialized on first access */
1304 
1307 
1308 #ifndef NO_TRACI
1311 #endif
1312 
1313 private:
1315  MSVehicle();
1316 
1318  MSVehicle(const MSVehicle&);
1319 
1321  MSVehicle& operator=(const MSVehicle&);
1322 
1324 
1325 };
1326 
1327 
1328 #endif
1329 
1330 /****************************************************************************/
1331 
void resetRoutePosition(unsigned int index)
Definition: MSVehicle.cpp:517
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:838
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1160
const MSVehicleType * myType
This Vehicle's type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:2408
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:1727
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
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:590
A lane area vehicles can halt at and load and unload containers.
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1303
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1159
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:794
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1157
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1185
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1072
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1162
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:540
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1179
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1152
Stop & getNextStop()
Definition: MSVehicle.cpp:2504
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
Definition: MSVehicle.h:1252
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:139
bool resumeFromStopping()
Definition: MSVehicle.cpp:2467
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1188
bool hasInfluencer() const
Definition: MSVehicle.h:1087
SUMOTime myLastVTDAccess
Definition: MSVehicle.h:1061
SUMOReal getLengthWithGap() const
Get vehicle'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:466
void setBlinkerInformation()
Definition: MSVehicle.cpp:2377
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1244
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1176
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:2519
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
Definition: MSVehicle.cpp:327
bool isVTDControlled() const
Definition: MSVehicle.h:1019
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:768
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:756
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:603
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:450
The car-following model abstraction.
Definition: MSCFModel.h:59
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1045
State(SUMOReal pos, SUMOReal speed)
Constructor.
Definition: MSVehicle.cpp:144
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:772
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:457
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:893
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:2292
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1051
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:584
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:124
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:774
vehicle doesn't want to change
Definition: MSVehicle.h:130
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2364
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:802
void postProcessVTD(MSVehicle *v)
Definition: MSVehicle.cpp:349
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1258
SUMOReal mySpeed
the stored speed
Definition: MSVehicle.h:120
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:560
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:2280
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:1250
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:2246
SUMOReal getPositionOnLane() const
Get the vehicle'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:1212
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1193
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:831
A storage for edge travel times and efforts.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:609
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:460
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge &currentEdge, const unsigned int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
Definition: MSVehicle.cpp:219
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:1759
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:578
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:1884
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1306
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
Right blinker lights are switched on.
Definition: MSVehicle.h:760
SUMOReal nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:464
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:1812
SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
Applies stored velocity information on the speed to use.
Definition: MSVehicle.cpp:186
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:132
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:458
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:1533
Left blinker lights are switched on.
Definition: MSVehicle.h:762
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
Definition: MSVehicle.cpp:333
unsigned int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:2370
DriveProcessItem(SUMOReal vWait, SUMOReal distance)
constructor if the link shall not be passed
Definition: MSVehicle.h:1227
The wipers are on.
Definition: MSVehicle.h:776
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:548
vehicle want'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:1004
Encapsulated SAX-Attributes.
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:180
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's current lane and their successors...
Definition: MSVehicle.cpp:2168
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
Definition: MSVehicle.h:1075
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:505
A lane area vehicles can halt at.
Definition: MSBusStop.h:64
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:1902
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Definition: MSVehicle.h:592
Position myCachedPosition
Definition: MSVehicle.h:1195
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:564
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:1036
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
Definition: MSVehicle.cpp:679
std::list< Stop > myStops
The vehicle's list of stops.
Definition: MSVehicle.h:1167
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:61
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:807
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
Definition: MSVehicle.cpp:825
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1048
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
void adaptLeaveSpeed(const SUMOReal v)
Definition: MSVehicle.h:1237
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1155
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:972
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
Definition: MSVehicle.h:1191
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:764
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:1310
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1163
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:1229
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:1515
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:574
MSVehicle()
invalidated default constructor
T MIN2(T a, T b)
Definition: StdDefs.h:68
The brake lights are on.
Definition: MSVehicle.h:766
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
Definition: MSVehicle.h:1272
A blue emergency light is on.
Definition: MSVehicle.h:782
A structure representing the best lanes for continuing the route.
Definition: MSVehicle.h:456
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:2556
Everything is switched off.
Definition: MSVehicle.h:758
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:436
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered, bool containerTriggered, std::string &errorMsg)
Definition: MSVehicle.cpp:2432
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
Definition: MSVehicle.h:588
Something on a lane to be noticed about vehicle movement.
SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
Definition: MSVehicle.cpp:301
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1149
One of the left doors is opened.
Definition: MSVehicle.h:778
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1070
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:813
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1068
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:1896
bool knowsEdgeTest(MSEdge &edge) const
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:468
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:2316
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:2542
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:964
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.h:1000
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
Definition: MSVehicle.h:549
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2298
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1054
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:538
Influencer()
Constructor.
Definition: MSVehicle.cpp:152
ConstMSEdgeVector myVTDRoute
Definition: MSVehicle.h:1060
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:1844
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:176
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:2304
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2286
Abstract in-vehicle device.
Definition: MSDevice.h:69
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:2151
vehicle want's to change to left lane
Definition: MSVehicle.h:132
~Influencer()
Destructor.
Definition: MSVehicle.cpp:169
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:173
MSVehicle & operator=(const MSVehicle &)
invalidated assignment operator
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:2510
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:2423
Structure representing possible vehicle parameter.
Definition of vehicle stop (position and duration)
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:986
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1030
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
Definition: MSVehicle.cpp:592
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:580
void setConsiderMaxDeceleration(bool value)
Sets whether the maximum deceleration shall be regarded.
Definition: MSVehicle.cpp:321
bool fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:2214
MSContainerStop * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:568
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1013
SUMOReal occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:462
SUMOReal getAcceleration() const
Returns the vehicle'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:1182
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
Definition: MSVehicle.h:470
void addContainer(MSContainer *container)
Adds a container.
Definition: MSVehicle.cpp:2344
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:586
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2310
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:1213
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:90
SUMOTime until
The time at which the vehicle may continue its journey.
Definition: MSVehicle.h:576
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
Definition: MSVehicle.cpp:309
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
Definition: MSVehicle.cpp:946
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:562
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge)
Definition: MSVehicle.cpp:2225
SUMOReal getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:294
int SUMOTime
Definition: SUMOTime.h:43
void setLaneChangeMode(int value)
Sets lane changing behavior.
Definition: MSVehicle.cpp:339
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
MSBusStop * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:566
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:819
std::vector< DriveProcessItem > DriveItemVector
Definition: MSVehicle.h:1249
std::vector< std::pair< SUMOTime, unsigned int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1033
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:956
SUMOReal endPos
The stopping position end.
Definition: MSVehicle.h:572
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:630
vehicle want's to keep the current lane
Definition: MSVehicle.h:136
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:829
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:218
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:821
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:813
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1164
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:2206
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:383
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:370
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle'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:1039
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:2528
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
Definition: MSVehicle.cpp:1696
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2270
void addPerson(MSPerson *person)
Adds a passenger.
Definition: MSVehicle.cpp:2322
SUMOReal startPos
The stopping position start.
Definition: MSVehicle.h:570
A red emergency light is on.
Definition: MSVehicle.h:784
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
MSDevice_Container * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1173
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
Definition: MSVehicle.cpp:526
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
Definition: MSVehicle.cpp:572
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
Definition: MSVehicle.h:1066
bool isVTDAffected(SUMOTime t) const
Definition: MSVehicle.h:1023
unsigned int getRoutePosition() const
Definition: MSVehicle.cpp:511
One of the right doors is opened.
Definition: MSVehicle.h:780
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1170
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2196
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1042
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
Definition: MSVehicle.cpp:315
The fog lights are on (no visualisation)
Definition: MSVehicle.h:770
bool parking
whether the vehicle is removed from the net while stopping
Definition: MSVehicle.h:582
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
Definition: MSVehicle.cpp:646
A yellow emergency light is on.
Definition: MSVehicle.h:786
unsigned int getLaneIndex() const
Definition: MSVehicle.cpp:2416