SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
18 // Copyright (C) 2001-2014 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 MSPerson;
63 class MSDevice;
65 class OutputDevice;
66 class Position;
67 class MSDevice_Person;
68 
69 
70 // ===========================================================================
71 // class definitions
72 // ===========================================================================
77 class MSVehicle : public MSBaseVehicle {
78 public:
79 
81  friend class MSLaneChanger;
82 
86  class State {
88  friend class MSVehicle;
89  friend class MSLaneChanger;
90 
91  public:
94 
96  State(const State& state);
97 
99  State& operator=(const State& state);
100 
102  bool operator!=(const State& state);
103 
105  SUMOReal pos() const;
106 
108  SUMOReal speed() const {
109  return mySpeed;
110  };
111 
112  private:
114  SUMOReal myPos;
115 
118 
119  };
120 
121 
134  };
135 
143  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
144  const MSVehicleType* type, SUMOReal speedFactor);
145 
147  virtual ~MSVehicle();
148 
149 
150 
152 
153 
163 
164 
165 
167 
168 
172  bool hasArrived() const;
173 
182  bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0);
183 
184 
190  bool willPass(const MSEdge* const edge) const;
191 
192  unsigned int getRoutePosition() const;
193  void resetRoutePosition(unsigned int index);
194 
203 
204 
212  static inline SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos) {
213  return predPos - predLength - pos;
214  }
215 
216 
217 
219 
220 
238  void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
240 
241 
259  void planMove(const SUMOTime t, const MSVehicle* pred, const SUMOReal lengthsInFront);
260 
261 
274  bool executeMove();
275 
276 
278 
279 
284  return myState.myPos;
285  }
286 
287 
291  SUMOReal getSpeed() const {
292  return myState.mySpeed;
293  }
294 
295 
300  return myAcceleration;
301  }
303 
304 
305 
307 
308 
312  SUMOReal getSlope() const;
313 
314 
322  Position getPosition(const SUMOReal offset = 0) const;
323 
324 
328  MSLane* getLane() const {
329  return myLane;
330  }
331 
332 
336  inline bool isOnRoad() const {
337  return myAmOnNet;
338  }
339 
340 
346  const MSEdge* getRerouteOrigin() const {
347 #ifdef HAVE_INTERNAL_LANES
348  if (myLane != 0) {
349  return myLane->getInternalFollower();
350  }
351 #endif
352  return *myCurrEdge;
353  }
354 
355 
363  return myWaitingTime;
364  }
365 
366 
374  return STEPS2TIME(myWaitingTime);
375  }
376 
377 
381  SUMOReal getAngle() const;
383 
384 
386  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
387  if (veh1->myState.myPos < veh2->myState.myPos) {
388  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
389  }
390  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
391  }
392 
393 
396  bool congested() const {
397  return myState.mySpeed < SUMOReal(60) / SUMOReal(3.6);
398  }
399 
400 
412 
419  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
420 
421 
422 
430  void enterLaneAtInsertion(MSLane* enteredLane, SUMOReal pos, SUMOReal speed,
431  MSMoveReminder::Notification notification);
432 
433 
438  void enterLaneAtLaneChange(MSLane* enteredLane);
439 
440 
442  void leaveLane(const MSMoveReminder::Notification reason);
443 
444 
447 
450 
454  struct LaneQ {
468  std::vector<MSLane*> bestContinuations;
469  };
470 
489  virtual const std::vector<LaneQ>& getBestLanes(bool forceRebuild = false, MSLane* startLane = 0) const;
490 
491 
496  const std::vector<MSLane*>& getBestLanesContinuation() const;
497 
502  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
503 
505  int getBestLaneOffset() const;
506 
508 
510  bool fixPosition();
511 
512 
521  void replaceVehicleType(MSVehicleType* type);
522 
523 
531  inline const MSCFModel& getCarFollowModel() const {
532  return myType->getCarFollowModel();
533  }
534 
535 
541  return myCFVariables;
542  }
543 
544 
546 
547 
551  struct Stop {
555  const MSLane* lane;
567  bool triggered;
569  bool parking;
571  bool reached;
573  std::set<std::string> awaitedPersons;
574  };
575 
576 
583  bool addStop(const SUMOVehicleParameter::Stop& stopPar, SUMOTime untilOffset = 0);
584 
585 
589  bool hasStops() const {
590  return !myStops.empty();
591  }
592 
596  bool isStopped() const;
597 
601  bool isParking() const;
602 
603 
607  bool isStoppedTriggered() const;
609 
610  bool knowsEdgeTest(MSEdge& edge) const;
611  unsigned int getLaneIndex() const;
612 
622  SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge);
623 
624 
631  SUMOReal processNextStop(SUMOReal currentVelocity);
632 
640  std::pair<const MSVehicle* const, SUMOReal> getLeader(SUMOReal dist = 0) const;
641 
648  SUMOReal getTimeGap() const;
649 
650 
652 
653 
657  SUMOReal getCO2Emissions() const;
658 
659 
663  SUMOReal getCOEmissions() const;
664 
665 
669  SUMOReal getHCEmissions() const;
670 
671 
675  SUMOReal getNOxEmissions() const;
676 
677 
681  SUMOReal getPMxEmissions() const;
682 
683 
688 
689 
695 
696 
697 
699 
700 
704  void addPerson(MSPerson* person);
705 
706 
710  unsigned int getPersonNumber() const;
711 
714 
718  enum Signalling {
749  };
750 
751 
757  LC_NEVER = 0, // lcModel shall never trigger changes at this level
758  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
759  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
760  };
761 
762 
765  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
766  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
767  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
768  LCP_OPPORTUNISTIC = 3 // change if not blocked
769  };
770 
771 
775  void switchOnSignal(int signal) {
776  mySignals |= signal;
777  }
778 
779 
783  void switchOffSignal(int signal) {
784  mySignals &= ~signal;
785  }
786 
787 
791  int getSignals() const {
792  return mySignals;
793  }
794 
795 
800  bool signalSet(int which) const {
801  return (mySignals & which) != 0;
802  }
804 
805 
806 #ifndef NO_TRACI
807 
815 
826  bool addTraciStop(MSLane* lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered);
827 
832  Stop& getNextStop();
833 
838  bool resumeFromStopping();
839 
840 
853  class Influencer {
854  public:
856  Influencer();
857 
858 
860  ~Influencer();
861 
862 
866  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, SUMOReal> >& speedTimeLine);
867 
868 
872  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, unsigned int> >& laneTimeLine);
873 
874 
886  SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax);
887 
895  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const unsigned int currentLaneIndex, int state);
896 
897 
903  SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const;
904 
908  void setConsiderSafeVelocity(bool value);
909 
910 
914  void setConsiderMaxAcceleration(bool value);
915 
916 
920  void setConsiderMaxDeceleration(bool value);
921 
922 
926  void setRespectJunctionPriority(bool value);
927 
928 
932  inline bool getRespectJunctionPriority() const {
934  }
935 
936 
940  void setEmergencyBrakeRedLight(bool value);
941 
942 
946  inline bool getEmergencyBrakeRedLight() const {
948  }
949 
950 
954  void setLaneChangeMode(int value);
955 
956 
960  inline SUMOReal getOriginalSpeed() const {
961  return myOriginalSpeed;
962  }
963 
964  void setVTDControlled(bool c, MSLane* l, SUMOReal pos, int edgeOffset, const MSEdgeVector& route) {
965  myAmVTDControlled = c;
966  myVTDLane = l;
967  myVTDPos = pos;
968  myVTDEdgeOffset = edgeOffset;
969  myVTDRoute = route;
970  }
971 
972  void postProcessVTD(MSVehicle* v);
973 
974  inline bool isVTDControlled() const {
975  return myAmVTDControlled;
976  }
977 
978  private:
980  std::vector<std::pair<SUMOTime, SUMOReal> > mySpeedTimeLine;
981 
983  std::vector<std::pair<SUMOTime, unsigned int> > myLaneTimeLine;
984 
987 
990 
993 
996 
999 
1002 
1005 
1011 
1013 
1025 
1026  };
1027 
1028 
1035 
1036  bool hasInfluencer() const {
1037  return myInfluencer != 0;
1038  }
1039 
1041  int influenceChangeDecision(int state);
1042 
1043 
1044 #endif
1045 
1047 
1048 
1050  void saveState(OutputDevice& out);
1051 
1054  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1056 
1057 protected:
1058 
1059  SUMOReal getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1060 
1063 
1079  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1081 
1082 
1083 
1084  void setBlinkerInformation();
1085 
1086 
1089 
1092 
1095 
1097 
1098  mutable const MSEdge* myLastBestLanesEdge;
1100 
1101  mutable std::vector<std::vector<LaneQ> > myBestLanes;
1102  mutable std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1103  static std::vector<MSLane*> myEmptyLaneVector;
1104 
1106  std::list<Stop> myStops;
1107 
1110 
1113 
1115  std::vector<MSLane*> myFurtherLanes;
1116 
1119 
1122 
1125 
1127 
1129 
1130 protected:
1144 
1145  DriveProcessItem(MSLink* link, SUMOReal vPass, SUMOReal vWait, bool setRequest,
1146  SUMOTime arrivalTime, SUMOReal arrivalSpeed,
1147  SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking,
1148  SUMOReal distance,
1149  SUMOReal leaveSpeed = -1.) :
1150  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1151  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1152  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1153  myDistance(distance),
1154  accelV(leaveSpeed), hadVehicle(false), availableSpace(-1.) {
1155  assert(vWait >= 0);
1156  assert(vPass >= 0);
1157  };
1158 
1161  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1164  myDistance(distance),
1165  accelV(-1), hadVehicle(false), availableSpace(-1.) {
1166  assert(vWait >= 0);
1167  };
1168 
1169 
1170  inline void adaptLeaveSpeed(const SUMOReal v) {
1171  if (accelV < 0) {
1172  accelV = v;
1173  } else {
1174  accelV = MIN2(accelV, v);
1175  }
1176  }
1177  inline SUMOReal getLeaveSpeed() const {
1178  return accelV < 0 ? myVLinkPass : accelV;
1179  }
1180  };
1181 
1182  typedef std::vector< DriveProcessItem > DriveItemVector;
1183 
1186 
1187  void planMoveInternal(const SUMOTime t, const MSVehicle* pred, DriveItemVector& lfLinks) const;
1188  void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const;
1189 
1191  inline SUMOReal estimateLeaveSpeed(const MSLink* const link, const SUMOReal vLinkPass) const {
1192  // estimate leave speed for passing time computation
1193  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1194  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1195  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1197  }
1198 
1199  /* @brief estimate speed while accelerating for the given distance
1200  * @param[in] dist The distance during which accelerating takes place
1201  * @param[in] v The initial speed
1202  * @param[in] accel The acceleration
1203  */
1204  inline SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const {
1205  // dist=v*t + 0.5*accel*t^2, solve for t and multiply with accel, then add v
1206  return MIN2(getVehicleType().getMaxSpeed(),
1207  (SUMOReal)sqrt(2 * dist * accel + v * v));
1208  }
1209 
1210 
1211  /* @brief estimate speed while accelerating for the given distance
1212  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1213  * @param[in] seen the distance to the end of the current lane
1214  * @param[in] lastLink the lastLink index
1215  * @param[in] lane The current Lane the vehicle is on
1216  * @param[in,out] the safe velocity for driving
1217  * @param[in,out] the safe velocity for arriving at the next link
1218  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1219  */
1220  void adaptToLeader(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1221  const SUMOReal seen, DriveProcessItem* const lastLink,
1222  const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass,
1223  SUMOReal distToCrossing = -1) const;
1224 
1225 #ifdef HAVE_INTERNAL_LANES
1226  mutable std::set<std::string> myLinkLeaders;
1228 #endif
1229 
1230 private:
1231  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1232  * @note member is initialized on first access */
1234 
1237 
1238 #ifndef NO_TRACI
1241 #endif
1242 
1243 private:
1245  MSVehicle();
1246 
1248  MSVehicle(const MSVehicle&);
1249 
1251  MSVehicle& operator=(const MSVehicle&);
1252 
1254 
1255 };
1256 
1257 
1258 #endif
1259 
1260 /****************************************************************************/
1261 
void resetRoutePosition(unsigned int index)
Definition: MSVehicle.cpp:526
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:800
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1099
virtual const std::vector< LaneQ > & getBestLanes(bool forceRebuild=false, MSLane *startLane=0) const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:1752
const MSVehicleType * myType
This Vehicle's type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:2232
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:1593
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
SUMOReal speed() const
Speed of this state.
Definition: MSVehicle.h:108
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1233
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1098
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:756
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1096
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1121
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1021
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
Definition: MSLane.cpp:818
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1101
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:531
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1115
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1091
Stop & getNextStop()
Definition: MSVehicle.cpp:2287
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
Definition: MSVehicle.h:1185
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:136
bool resumeFromStopping()
Definition: MSVehicle.cpp:2276
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1124
bool hasInfluencer() const
Definition: MSVehicle.h:1036
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:464
void setBlinkerInformation()
Definition: MSVehicle.cpp:2201
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1177
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1112
MSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:59
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:2302
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
Definition: MSVehicle.cpp:323
bool isVTDControlled() const
Definition: MSVehicle.h:974
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:362
bool congested() const
Definition: MSVehicle.h:396
The front lights are on (no visualisation)
Definition: MSVehicle.h:730
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:718
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:612
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:459
The car-following model abstraction.
Definition: MSCFModel.h:58
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:995
State(SUMOReal pos, SUMOReal speed)
Constructor.
Definition: MSVehicle.cpp:141
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:734
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:465
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:853
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:2141
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1001
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:571
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:121
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:736
vehicle doesn't want to change
Definition: MSVehicle.h:127
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2194
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:764
void postProcessVTD(MSVehicle *v)
Definition: MSVehicle.cpp:345
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1191
SUMOReal mySpeed
the stored speed
Definition: MSVehicle.h:117
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:551
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:2129
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:1134
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:2095
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:283
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:1145
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:57
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1126
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:769
A storage for edge travel times and efforts.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:589
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:458
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge &currentEdge, const unsigned int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
Definition: MSVehicle.cpp:215
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:1625
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.h:346
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:567
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:1740
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1236
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
Right blinker lights are switched on.
Definition: MSVehicle.h:722
SUMOReal nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:462
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:1677
SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
Applies stored velocity information on the speed to use.
Definition: MSVehicle.cpp:182
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:129
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:54
A road/street connecting two junctions.
Definition: MSEdge.h:73
MSLane * lane
The described lane.
Definition: MSVehicle.h:456
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:1400
Left blinker lights are switched on.
Definition: MSVehicle.h:724
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
Definition: MSVehicle.cpp:329
DriveProcessItem(SUMOReal vWait, SUMOReal distance)
constructor if the link shall not be passed
Definition: MSVehicle.h:1160
The wipers are on.
Definition: MSVehicle.h:738
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:557
vehicle want's to change to right lane
Definition: MSVehicle.h:131
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered)
Definition: MSVehicle.cpp:2248
Encapsulated SAX-Attributes.
std::vector< const MSEdge * > MSEdgeVector
Definition: MSPerson.h:53
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:176
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:125
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:2025
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:1024
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:514
A lane area vehicles can halt at.
Definition: MSBusStop.h:63
Position myCachedPosition
Definition: MSVehicle.h:1128
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:555
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
Definition: MSVehicle.h:212
SUMOReal myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:986
std::list< Stop > myStops
The vehicle's list of stops.
Definition: MSVehicle.h:1106
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:751
void setVTDControlled(bool c, MSLane *l, SUMOReal pos, int edgeOffset, const MSEdgeVector &route)
Definition: MSVehicle.h:964
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:998
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
void adaptLeaveSpeed(const SUMOReal v)
Definition: MSVehicle.h:1170
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1094
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:932
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:726
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:1240
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1102
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:1382
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:563
MSVehicle()
invalidated default constructor
T MIN2(T a, T b)
Definition: StdDefs.h:65
The brake lights are on.
Definition: MSVehicle.h:728
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
Definition: MSVehicle.h:1204
A blue emergency light is on.
Definition: MSVehicle.h:744
A structure representing the best lanes for continuing the route.
Definition: MSVehicle.h:454
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:2339
Everything is switched off.
Definition: MSVehicle.h:720
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:446
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:297
bool addStop(const SUMOVehicleParameter::Stop &stopPar, SUMOTime untilOffset=0)
Adds a stop.
Definition: MSVehicle.cpp:669
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1088
One of the left doors is opened.
Definition: MSVehicle.h:740
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1019
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:757
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1017
bool knowsEdgeTest(MSEdge &edge) const
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:466
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:2165
Container that holds the vehicles driving state (position+speed).
Definition: MSVehicle.h:86
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:2325
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:869
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.h:960
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
Definition: MSVehicle.h:540
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2147
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1004
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:547
Influencer()
Constructor.
Definition: MSVehicle.cpp:149
MSEdgeVector myVTDRoute
Definition: MSVehicle.h:1010
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:1709
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:157
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:2153
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2135
Abstract in-vehicle device.
Definition: MSDevice.h:68
vehicle want's to change to left lane
Definition: MSVehicle.h:129
~Influencer()
Destructor.
Definition: MSVehicle.cpp:165
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:169
MSVehicle & operator=(const MSVehicle &)
invalidated assignment operator
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:2293
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:946
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:980
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
Definition: MSVehicle.cpp:601
void setConsiderMaxDeceleration(bool value)
Sets whether the maximum deceleration shall be regarded.
Definition: MSVehicle.cpp:317
bool fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:2063
SUMOReal occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:460
SUMOReal getAcceleration() const
Returns the vehicle's acceleration in m/s.
Definition: MSVehicle.h:299
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1118
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
Definition: MSVehicle.h:468
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:573
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2159
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:1106
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:94
SUMOTime until
The time at which the vehicle may continue its journey.
Definition: MSVehicle.h:565
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
Definition: MSVehicle.cpp:305
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:553
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge)
Definition: MSVehicle.cpp:2074
SUMOReal getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:291
int SUMOTime
Definition: SUMOTime.h:43
void setLaneChangeMode(int value)
Sets lane changing behavior.
Definition: MSVehicle.cpp:335
SUMOReal myPos
the stored position
Definition: MSVehicle.h:110
SUMOReal getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:373
MSBusStop * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:557
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:763
std::vector< DriveProcessItem > DriveItemVector
Definition: MSVehicle.h:1182
std::vector< std::pair< SUMOTime, unsigned int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:983
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:861
SUMOReal endPos
The stopping position end.
Definition: MSVehicle.h:561
vehicle want's to keep the current lane
Definition: MSVehicle.h:133
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:791
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
#define SUMOReal
Definition: config.h:215
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:783
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:775
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1103
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:386
MSRouteIterator myCurrEdge
Iterator to current route-edge.
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:366
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:336
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:989
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:328
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:2311
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
Definition: MSVehicle.cpp:1562
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2119
void addPerson(MSPerson *person)
Adds a passenger.
Definition: MSVehicle.cpp:2171
SUMOReal startPos
The stopping position start.
Definition: MSVehicle.h:559
A red emergency light is on.
Definition: MSVehicle.h:746
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
Definition: MSVehicle.cpp:535
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
Definition: MSVehicle.cpp:581
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
Definition: MSVehicle.h:1015
unsigned int getRoutePosition() const
Definition: MSVehicle.cpp:520
One of the right doors is opened.
Definition: MSVehicle.h:742
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1109
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2053
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:992
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
Definition: MSVehicle.cpp:311
The fog lights are on (no visualisation)
Definition: MSVehicle.h:732
bool parking
whether the vehicle is removed from the net while stopping
Definition: MSVehicle.h:569
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
Definition: MSVehicle.cpp:639
A yellow emergency light is on.
Definition: MSVehicle.h:748
unsigned int getLaneIndex() const
Definition: MSVehicle.cpp:2240