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.dlr.de/
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 class MSJunction;
69 
70 
71 // ===========================================================================
72 // class definitions
73 // ===========================================================================
78 class MSVehicle : public MSBaseVehicle {
79 public:
80 
82  friend class MSLaneChanger;
83 
87  class State {
89  friend class MSVehicle;
90  friend class MSLaneChanger;
91 
92  public:
95 
97  State(const State& state);
98 
100  State& operator=(const State& state);
101 
103  bool operator!=(const State& state);
104 
106  SUMOReal pos() const;
107 
109  SUMOReal speed() const {
110  return mySpeed;
111  };
112 
113  private:
115  SUMOReal myPos;
116 
119 
120  };
121 
122 
135  };
136 
144  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
145  const MSVehicleType* type, const SUMOReal speedFactor);
146 
148  virtual ~MSVehicle();
149 
150 
151 
153 
154 
164 
165 
166 
168 
169 
173  bool hasArrived() const;
174 
183  bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0);
184 
185 
191  bool willPass(const MSEdge* const edge) const;
192 
193  unsigned int getRoutePosition() const;
194  void resetRoutePosition(unsigned int index);
195 
204 
205 
213  static inline SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos) {
214  return predPos - predLength - pos;
215  }
216 
217 
218 
220 
221 
239  void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed);
241 
242 
260  void planMove(const SUMOTime t, const MSVehicle* pred, const SUMOReal lengthsInFront);
261 
262 
275  bool executeMove();
276 
277 
279 
280 
285  return myState.myPos;
286  }
287 
288 
292  SUMOReal getSpeed() const {
293  return myState.mySpeed;
294  }
295 
296 
301  return myAcceleration;
302  }
304 
305 
306 
308 
309 
313  SUMOReal getSlope() const;
314 
315 
323  Position getPosition(const SUMOReal offset = 0) const;
324 
325 
329  MSLane* getLane() const {
330  return myLane;
331  }
332 
333 
337  inline bool isOnRoad() const {
338  return myAmOnNet;
339  }
340 
341 
348  const MSEdge* getRerouteOrigin() const;
349 
350 
358  return myWaitingTime;
359  }
360 
361 
369  return STEPS2TIME(myWaitingTime);
370  }
371 
372 
376  SUMOReal getAngle() const;
378 
379 
381  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
382  if (veh1->myState.myPos < veh2->myState.myPos) {
383  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
384  }
385  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
386  }
387 
388 
391  bool congested() const {
392  return myState.mySpeed < SUMOReal(60) / SUMOReal(3.6);
393  }
394 
395 
407 
414  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
415 
416 
417 
425  void enterLaneAtInsertion(MSLane* enteredLane, SUMOReal pos, SUMOReal speed,
426  MSMoveReminder::Notification notification);
427 
432  void setTentativeLaneAndPosition(MSLane* lane, const SUMOReal pos);
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 
474  const std::vector<LaneQ>& getBestLanes() const;
475 
493  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
494 
495 
500  const std::vector<MSLane*>& getBestLanesContinuation() const;
501 
506  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
507 
509  int getBestLaneOffset() const;
510 
512  void adaptBestLanesOccupation(int laneIndex, SUMOReal density);
513 
515 
517  bool fixPosition();
518 
519 
528  void replaceVehicleType(MSVehicleType* type);
529 
530 
538  inline const MSCFModel& getCarFollowModel() const {
539  return myType->getCarFollowModel();
540  }
541 
542 
548  return myCFVariables;
549  }
550 
551 
553 
554 
558  struct Stop {
562  const MSLane* lane;
574  bool triggered;
576  bool parking;
578  bool reached;
580  std::set<std::string> awaitedPersons;
581  };
582 
583 
590  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0);
591 
592 
596  bool hasStops() const {
597  return !myStops.empty();
598  }
599 
603  bool isStopped() const;
604 
608  bool isParking() const;
609 
610 
614  bool isStoppedTriggered() const;
616 
617  bool knowsEdgeTest(MSEdge& edge) const;
618  unsigned int getLaneIndex() const;
619 
629  SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge);
630 
631 
638  SUMOReal processNextStop(SUMOReal currentVelocity);
639 
647  std::pair<const MSVehicle* const, SUMOReal> getLeader(SUMOReal dist = 0) const;
648 
655  SUMOReal getTimeGap() const;
656 
657 
659 
660 
664  SUMOReal getCO2Emissions() const;
665 
666 
670  SUMOReal getCOEmissions() const;
671 
672 
676  SUMOReal getHCEmissions() const;
677 
678 
682  SUMOReal getNOxEmissions() const;
683 
684 
688  SUMOReal getPMxEmissions() const;
689 
690 
695 
696 
702 
703 
704 
706 
707 
711  void addPerson(MSPerson* person);
712 
713 
717  unsigned int getPersonNumber() const;
718 
721 
725  enum Signalling {
756  };
757 
758 
764  LC_NEVER = 0, // lcModel shall never trigger changes at this level
765  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
766  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
767  };
768 
769 
772  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
773  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
774  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
775  LCP_OPPORTUNISTIC = 3 // change if not blocked
776  };
777 
778 
782  void switchOnSignal(int signal) {
783  mySignals |= signal;
784  }
785 
786 
790  void switchOffSignal(int signal) {
791  mySignals &= ~signal;
792  }
793 
794 
798  int getSignals() const {
799  return mySignals;
800  }
801 
802 
807  bool signalSet(int which) const {
808  return (mySignals & which) != 0;
809  }
811 
812 
813 #ifndef NO_TRACI
814 
822 
833  bool addTraciStop(MSLane* lane, SUMOReal pos, SUMOReal radius, SUMOTime duration,
834  bool parking, bool triggered, std::string& errorMsg);
835 
840  Stop& getNextStop();
841 
846  bool resumeFromStopping();
847 
848 
861  class Influencer {
862  public:
864  Influencer();
865 
866 
868  ~Influencer();
869 
870 
874  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, SUMOReal> >& speedTimeLine);
875 
876 
880  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, unsigned int> >& laneTimeLine);
881 
882 
894  SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax);
895 
903  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const unsigned int currentLaneIndex, int state);
904 
905 
911  SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const;
912 
916  void setConsiderSafeVelocity(bool value);
917 
918 
922  void setConsiderMaxAcceleration(bool value);
923 
924 
928  void setConsiderMaxDeceleration(bool value);
929 
930 
934  void setRespectJunctionPriority(bool value);
935 
936 
940  inline bool getRespectJunctionPriority() const {
942  }
943 
944 
948  void setEmergencyBrakeRedLight(bool value);
949 
950 
954  inline bool getEmergencyBrakeRedLight() const {
956  }
957 
958 
962  void setLaneChangeMode(int value);
963 
964 
968  inline SUMOReal getOriginalSpeed() const {
969  return myOriginalSpeed;
970  }
971 
972  void setVTDControlled(bool c, MSLane* l, SUMOReal pos, int edgeOffset, const MSEdgeVector& route) {
973  myAmVTDControlled = c;
974  myVTDLane = l;
975  myVTDPos = pos;
976  myVTDEdgeOffset = edgeOffset;
977  myVTDRoute = route;
978  }
979 
980  void postProcessVTD(MSVehicle* v);
981 
982  inline bool isVTDControlled() const {
983  return myAmVTDControlled;
984  }
985 
986  private:
988  std::vector<std::pair<SUMOTime, SUMOReal> > mySpeedTimeLine;
989 
991  std::vector<std::pair<SUMOTime, unsigned int> > myLaneTimeLine;
992 
995 
998 
1001 
1004 
1007 
1010 
1013 
1019 
1021 
1033 
1034  };
1035 
1036 
1043 
1044  bool hasInfluencer() const {
1045  return myInfluencer != 0;
1046  }
1047 
1049  int influenceChangeDecision(int state);
1050 
1052  SUMOReal getSafeFollowSpeed(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1053  const SUMOReal seen, const MSLane* const lane, SUMOReal distToCrossing) const;
1054 
1055 #endif
1056 
1058 
1059 
1061  void saveState(OutputDevice& out);
1062 
1065  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1067 
1068 protected:
1069 
1070  SUMOReal getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1071 
1074 
1090  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1092 
1093 
1094 
1095  void setBlinkerInformation();
1096 
1098  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1099 
1100 
1103 
1106 
1109 
1111 
1114 
1115  std::vector<std::vector<LaneQ> > myBestLanes;
1116  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1117  static std::vector<MSLane*> myEmptyLaneVector;
1118 
1120  std::list<Stop> myStops;
1121 
1124 
1127 
1129  std::vector<MSLane*> myFurtherLanes;
1130 
1133 
1136 
1139 
1141 
1143 
1144 protected:
1158 
1159  DriveProcessItem(MSLink* link, SUMOReal vPass, SUMOReal vWait, bool setRequest,
1160  SUMOTime arrivalTime, SUMOReal arrivalSpeed,
1161  SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking,
1162  SUMOReal distance,
1163  SUMOReal leaveSpeed = -1.) :
1164  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1165  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1166  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1167  myDistance(distance),
1168  accelV(leaveSpeed), hadVehicle(false), availableSpace(-1.) {
1169  assert(vWait >= 0);
1170  assert(vPass >= 0);
1171  };
1172 
1175  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1178  myDistance(distance),
1179  accelV(-1), hadVehicle(false), availableSpace(-1.) {
1180  assert(vWait >= 0);
1181  };
1182 
1183 
1184  inline void adaptLeaveSpeed(const SUMOReal v) {
1185  if (accelV < 0) {
1186  accelV = v;
1187  } else {
1188  accelV = MIN2(accelV, v);
1189  }
1190  }
1191  inline SUMOReal getLeaveSpeed() const {
1192  return accelV < 0 ? myVLinkPass : accelV;
1193  }
1194  };
1195 
1196  typedef std::vector< DriveProcessItem > DriveItemVector;
1197 
1200 
1201  void planMoveInternal(const SUMOTime t, const MSVehicle* pred, DriveItemVector& lfLinks) const;
1202  void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const;
1203 
1205  inline SUMOReal estimateLeaveSpeed(const MSLink* const link, const SUMOReal vLinkPass) const {
1206  // estimate leave speed for passing time computation
1207  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1208  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1209  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1211  }
1212 
1213  /* @brief estimate speed while accelerating for the given distance
1214  * @param[in] dist The distance during which accelerating takes place
1215  * @param[in] v The initial speed
1216  * @param[in] accel The acceleration
1217  */
1218  inline SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const {
1219  // dist=v*t + 0.5*accel*t^2, solve for t and multiply with accel, then add v
1220  return MIN2(getVehicleType().getMaxSpeed(),
1221  (SUMOReal)sqrt(2 * dist * accel + v * v));
1222  }
1223 
1224 
1225  /* @brief estimate speed while accelerating for the given distance
1226  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1227  * @param[in] seen the distance to the end of the current lane
1228  * @param[in] lastLink the lastLink index
1229  * @param[in] lane The current Lane the vehicle is on
1230  * @param[in,out] the safe velocity for driving
1231  * @param[in,out] the safe velocity for arriving at the next link
1232  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1233  */
1234  void adaptToLeader(const std::pair<const MSVehicle*, SUMOReal> leaderInfo,
1235  const SUMOReal seen, DriveProcessItem* const lastLink,
1236  const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass,
1237  SUMOReal distToCrossing = -1) const;
1238 
1239 #ifdef HAVE_INTERNAL_LANES
1240  mutable std::map<const MSJunction*, std::set<std::string> > myLinkLeaders;
1242 #endif
1243 
1244 private:
1245  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1246  * @note member is initialized on first access */
1248 
1251 
1252 #ifndef NO_TRACI
1255 #endif
1256 
1257 private:
1259  MSVehicle();
1260 
1262  MSVehicle(const MSVehicle&);
1263 
1265  MSVehicle& operator=(const MSVehicle&);
1266 
1268 
1269 };
1270 
1271 
1272 #endif
1273 
1274 /****************************************************************************/
1275 
void resetRoutePosition(unsigned int index)
Definition: MSVehicle.cpp:509
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:807
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1113
const MSVehicleType * myType
This Vehicle&#39;s type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:2300
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:1644
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:78
SUMOReal speed() const
Speed of this state.
Definition: MSVehicle.h:109
MSEdgeWeightsStorage * myEdgeWeights
Definition: MSVehicle.h:1247
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1112
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:763
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1110
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Definition: MSVehicle.h:1135
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1029
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1115
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:538
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1129
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1105
Stop & getNextStop()
Definition: MSVehicle.cpp:2385
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
Definition: MSVehicle.h:1199
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:136
bool resumeFromStopping()
Definition: MSVehicle.cpp:2357
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
Definition: MSVehicle.h:1138
bool hasInfluencer() const
Definition: MSVehicle.h:1044
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:464
void setBlinkerInformation()
Definition: MSVehicle.cpp:2269
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1191
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1126
MSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:60
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:2400
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
Definition: MSVehicle.cpp:323
bool isVTDControlled() const
Definition: MSVehicle.h:982
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:357
bool congested() const
Definition: MSVehicle.h:391
The front lights are on (no visualisation)
Definition: MSVehicle.h:737
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:725
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:595
The base class for an intersection.
Definition: MSJunction.h:59
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
Definition: MSVehicle.cpp:442
The car-following model abstraction.
Definition: MSCFModel.h:59
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1003
State(SUMOReal pos, SUMOReal speed)
Constructor.
Definition: MSVehicle.cpp:141
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:741
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:449
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:861
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:2209
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1009
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:578
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:121
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:743
vehicle doesn&#39;t want to change
Definition: MSVehicle.h:128
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2262
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:771
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:1205
SUMOReal mySpeed
the stored speed
Definition: MSVehicle.h:118
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:558
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:2197
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:1173
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:2163
SUMOReal getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:284
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:1159
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1140
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:809
A storage for edge travel times and efforts.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:596
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:1676
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:574
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:1801
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:1250
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:729
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:1729
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:55
A road/street connecting two junctions.
Definition: MSEdge.h:75
MSLane * lane
The described lane.
Definition: MSVehicle.h:456
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:1451
Left blinker lights are switched on.
Definition: MSVehicle.h:731
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:1174
The wipers are on.
Definition: MSVehicle.h:745
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:540
vehicle want&#39;s to change to right lane
Definition: MSVehicle.h:132
Encapsulated SAX-Attributes.
std::vector< const MSEdge * > MSEdgeVector
Definition: MSPerson.h:57
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:126
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:2085
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:1032
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
Definition: MSVehicle.cpp:497
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:1819
Position myCachedPosition
Definition: MSVehicle.h:1142
const MSLane * lane
The lane to stop at.
Definition: MSVehicle.h:562
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
Definition: MSVehicle.h:213
SUMOReal myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:994
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
Definition: MSVehicle.cpp:671
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1120
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:791
void setVTDControlled(bool c, MSLane *l, SUMOReal pos, int edgeOffset, const MSEdgeVector &route)
Definition: MSVehicle.h:972
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1006
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
void adaptLeaveSpeed(const SUMOReal v)
Definition: MSVehicle.h:1184
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1108
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:940
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:733
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in &quot;getInfluencer&quot;.
Definition: MSVehicle.h:1254
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1116
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:1152
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:1433
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:570
MSVehicle()
invalidated default constructor
T MIN2(T a, T b)
Definition: StdDefs.h:68
The brake lights are on.
Definition: MSVehicle.h:735
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
Definition: MSVehicle.h:1218
A blue emergency light is on.
Definition: MSVehicle.h:751
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:2437
Everything is switched off.
Definition: MSVehicle.h:727
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:428
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
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1102
One of the left doors is opened.
Definition: MSVehicle.h:747
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1027
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:797
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1025
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:1813
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:2233
Container that holds the vehicles driving state (position+speed).
Definition: MSVehicle.h:87
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:2423
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
Definition: MSVehicle.cpp:896
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.h:968
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle&#39;s car following model variables.
Definition: MSVehicle.h:547
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2215
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1012
MSEdgeWeightsStorage & _getWeightsStorage() const
Definition: MSVehicle.cpp:530
Influencer()
Constructor.
Definition: MSVehicle.cpp:149
MSEdgeVector myVTDRoute
Definition: MSVehicle.h:1018
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:1761
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:2221
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2203
Abstract in-vehicle device.
Definition: MSDevice.h:69
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:2068
vehicle want&#39;s to change to left lane
Definition: MSVehicle.h:130
~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:2391
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:2315
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:954
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered, std::string &errorMsg)
Definition: MSVehicle.cpp:2324
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:988
SUMOReal getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:584
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:2131
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&#39;s acceleration in m/s.
Definition: MSVehicle.h:300
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1132
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:580
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2227
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:1136
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
Definition: MSBaseVehicle.h:90
SUMOTime until
The time at which the vehicle may continue its journey.
Definition: MSVehicle.h:572
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:560
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge)
Definition: MSVehicle.cpp:2142
SUMOReal getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:292
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:111
SUMOReal getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:368
MSBusStop * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:564
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MSVehicle.cpp:803
std::vector< DriveProcessItem > DriveItemVector
Definition: MSVehicle.h:1196
std::vector< std::pair< SUMOTime, unsigned int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:991
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:888
SUMOReal endPos
The stopping position end.
Definition: MSVehicle.h:568
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:622
vehicle want&#39;s to keep the current lane
Definition: MSVehicle.h:134
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:798
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:790
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:782
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1117
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:2123
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:381
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:366
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:337
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:997
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:329
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:2409
void activateReminders(const MSMoveReminder::Notification reason)
&quot;Activates&quot; all current move reminder
Definition: MSVehicle.cpp:1613
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2187
void addPerson(MSPerson *person)
Adds a passenger.
Definition: MSVehicle.cpp:2239
SUMOReal startPos
The stopping position start.
Definition: MSVehicle.h:566
A red emergency light is on.
Definition: MSVehicle.h:753
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:518
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle&#39;s entering of a new lane.
Definition: MSVehicle.cpp:564
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
Definition: MSVehicle.h:1023
unsigned int getRoutePosition() const
Definition: MSVehicle.cpp:503
One of the right doors is opened.
Definition: MSVehicle.h:749
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1123
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2113
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1000
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:739
bool parking
whether the vehicle is removed from the net while stopping
Definition: MSVehicle.h:576
SUMOReal getAngle() const
Returns the vehicle&#39;s direction in degrees.
Definition: MSVehicle.cpp:638
A yellow emergency light is on.
Definition: MSVehicle.h:755
unsigned int getLaneIndex() const
Definition: MSVehicle.cpp:2308