Eclipse SUMO - Simulation of Urban MObility
MSBaseVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2010-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // A base class for vehicle implementations
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <iostream>
26 #include <vector>
27 #include <set>
29 #include <utils/common/StdDefs.h>
30 #include "MSRoute.h"
31 #include "MSMoveReminder.h"
32 #include "MSVehicleType.h"
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class MSLane;
38 class MSStop;
40 class MSVehicleDevice;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class MSBaseVehicle : public SUMOVehicle {
52 public:
53  // XXX: This definition was introduced to make the MSVehicle's previousSpeed
54  // available in the context of MSMoveReminder::notifyMove(). Another solution
55  // would be to modify notifyMove()'s interface to work with MSVehicle instead
56  // of SUMOVehicle (it is only called with MSVehicles!). Refs. #2579
60  double getPreviousSpeed() const;
61 
62  friend class GUIBaseVehicle;
63 
68  ROUTE_UNCHECKED = 1 << 0,
70  ROUTE_INVALID = 1 << 1,
71  // starting edge permissions invalid (could change)
73  // insertion lane does not exist
75  };
76 
84  MSBaseVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
85  MSVehicleType* type, const double speedFactor);
86 
87 
89  virtual ~MSBaseVehicle();
90 
91  virtual void initDevices();
92 
93  bool isVehicle() const {
94  return true;
95  }
96 
98  void setID(const std::string& newID);
99 
104  const SUMOVehicleParameter& getParameter() const;
105 
107  std::string getPrefixedParameter(const std::string& key, std::string& error) const;
108 
113  const EnergyParams* getEmissionParameters() const;
114 
116  void replaceParameter(const SUMOVehicleParameter* newParameter);
117 
119  bool hasDevice(const std::string& deviceName) const;
120 
122  void createDevice(const std::string& deviceName);
123 
125  std::string getDeviceParameter(const std::string& deviceName, const std::string& key) const;
126 
128  void setDeviceParameter(const std::string& deviceName, const std::string& key, const std::string& value);
129 
131  void setJunctionModelParameter(const std::string& key, const std::string& value);
132 
136  inline const MSRoute& getRoute() const {
137  return *myRoute;
138  }
139 
140 
144  inline const MSVehicleType& getVehicleType() const {
145  return *myType;
146  }
147 
148 
152  inline SUMOVehicleClass getVClass() const {
153  return myType->getParameter().vehicleClass;
154  }
155 
159  double getMaxSpeed() const;
160 
161 
169  const MSEdge* succEdge(int nSuccs) const;
170 
175  const MSEdge* getEdge() const;
176 
177 
181  virtual bool isOnRoad() const {
182  return true;
183  }
184 
189  virtual bool isRemoteControlled() const {
190  return false;
191  }
192 
193  virtual bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const {
194  UNUSED_PARAMETER(lookBack);
195  return false;
196  }
197 
201  virtual bool isFrontOnLane(const MSLane*) const {
202  return true;
203  }
204 
209  virtual double getLateralPositionOnLane() const {
210  return 0;
211  }
212 
218  virtual const MSEdge* getRerouteOrigin() const {
219  return *myCurrEdge;
220  }
221 
224  virtual double getTimeLossSeconds() const {
225  // better timeLoss for meso?
226  return 0;
227  }
228 
235  double getWaitingSeconds() const {
236  return STEPS2TIME(getWaitingTime());
237  }
238 
239 
240 
245  return myCurrEdge;
246  }
247 
248 
258  void reroute(SUMOTime t, const std::string& info, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, const bool onInit = false, const bool withTaz = false, const bool silent = false);
259 
260 
273  bool replaceRouteEdges(ConstMSEdgeVector& edges, double cost, double savings, const std::string& info, bool onInit = false, bool check = false, bool removeStops = true,
274  std::string* msgReturn = nullptr);
275 
286  virtual bool replaceRoute(const MSRoute* route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true,
287  std::string* msgReturn = nullptr);
288 
294  virtual double getAcceleration() const;
295 
301  void onDepart();
302 
306  inline SUMOTime getDeparture() const {
307  return myDeparture;
308  }
309 
312  return getDeparture() - getParameter().depart;
313  }
314 
317  virtual double getStopDelay() const {
319  return -1;
320  }
321 
324  virtual double getStopArrivalDelay() const {
326  return INVALID_DOUBLE;
327  }
328 
332  inline double getDepartPos() const {
333  return myDepartPos;
334  }
335 
340  virtual double getArrivalPos() const {
341  return myArrivalPos;
342  }
343 
346  virtual void setArrivalPos(double arrivalPos) {
347  myArrivalPos = arrivalPos;
348  }
349 
357  virtual void onRemovalFromNet(const MSMoveReminder::Notification /*reason*/) {}
358 
361  bool hasDeparted() const;
362 
366  virtual bool hasArrived() const;
367 
369  int getRoutePosition() const;
370 
372  void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure);
373 
377  double getOdometer() const;
378 
380  void addToOdometer(double value) {
381  myOdometer += value;
382  }
383 
387  inline int getNumberReroutes() const {
388  return myNumberReroutes;
389  }
390 
392  double getImpatience() const;
393 
397  int getPersonNumber() const;
398 
402  std::vector<std::string> getPersonIDList() const;
403 
407  int getContainerNumber() const;
408 
409 
413  inline const std::vector<MSVehicleDevice*>& getDevices() const {
414  return myDevices;
415  }
416 
418  bool allowsBoarding(MSTransportable* t) const;
419 
424  virtual void addTransportable(MSTransportable* transportable);
425 
428 
430  const std::vector<MSTransportable*>& getPersons() const;
431 
433  const std::vector<MSTransportable*>& getContainers() const;
434 
436  bool isLineStop(double position) const;
437 
443  bool hasValidRoute(std::string& msg, const MSRoute* route = 0) const;
444 
446  virtual bool hasValidRouteStart(std::string& msg);
447 
449  int getRouteValidity(bool update = true, bool silent = false, std::string* msgReturn = nullptr);
450 
456  void addReminder(MSMoveReminder* rem);
457 
463  void removeReminder(MSMoveReminder* rem);
464 
476  virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
477 
478 
482  inline double getLength() const {
483  return myType->getLength();
484  }
485 
486 
490  inline double getWidth() const {
491  return myType->getWidth();
492  }
493 
494 
498  inline double getChosenSpeedFactor() const {
499  return myChosenSpeedFactor;
500  }
501 
505  inline void setChosenSpeedFactor(const double factor) {
506  myChosenSpeedFactor = factor;
507  }
508 
510  MSVehicleDevice* getDevice(const std::type_info& type) const;
511 
512 
521  virtual void replaceVehicleType(MSVehicleType* type);
522 
523 
532 
534 
535 
537  virtual void saveState(OutputDevice& out);
538 
540 
541  virtual bool handleCollisionStop(MSStop& stop, const double distToStop);
542 
546  bool isStopped() const;
547 
551  bool isParking() const;
552 
556  bool isStoppedTriggered() const;
557 
560  bool isStoppedInRange(const double pos, const double tolerance) const;
561 
565  bool hasStops() const {
566  return !myStops.empty();
567  }
568 
570  double basePos(const MSEdge* edge) const;
571 
578  bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false,
579  MSRouteIterator* searchStart = nullptr);
580 
588  void addStops(const bool ignoreStopErrors, MSRouteIterator* searchStart = nullptr);
589 
591  bool haveValidStopEdges() const;
592 
596  const ConstMSEdgeVector getStopEdges(double& firstPos, double& lastPos) const;
597 
599  std::vector<std::pair<int, double> > getStopIndices() const;
600 
605  inline const std::list<MSStop>& getStops() const {
606  return myStops;
607  }
608 
609  inline const std::vector<SUMOVehicleParameter::Stop>& getPastStops() const {
610  return myPastStops;
611  }
612 
617  MSStop& getNextStop();
618 
621 
628  virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
629 
634  virtual bool resumeFromStopping() = 0;
635 
637  bool abortNextStop(int nextStopIndex = 0);
638 
649  bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
650 
651 
653  virtual bool isSelected() const {
654  return false;
655  }
656 
658  int getRNGIndex() const;
659 
661  SumoRNG* getRNG() const;
662 
663  inline NumericalID getNumericalID() const {
664  return myNumericalID;
665  }
666 
668  return myPersonDevice;
669  }
670 
672  return myContainerDevice;
673  }
674 
675 
677 
678 
682  double getCO2Emissions() const;
683 
684 
688  double getCOEmissions() const;
689 
690 
694  double getHCEmissions() const;
695 
696 
700  double getNOxEmissions() const;
701 
702 
706  double getPMxEmissions() const;
707 
708 
712  double getFuelConsumption() const;
713 
714 
718  double getElectricityConsumption() const;
719 
724  double getStateOfCharge() const;
725 
731  double getElecHybridCurrent() const;
732 
736  double getHarmonoise_NoiseEmissions() const;
738 
752  public:
754  BaseInfluencer();
755 
757  virtual ~BaseInfluencer() {}
758 
760  static void init();
762  static void cleanup();
763 
764 
766  int getRoutingMode() const {
767  return myRoutingMode;
768  }
769 
773  void setRoutingMode(int value) {
774  myRoutingMode = value;
775  }
776 
777 
779 
780  protected:
783 
784  };
785 
786 
787 
794 
795  virtual const BaseInfluencer* getBaseInfluencer() const = 0;
796 
797  virtual bool hasInfluencer() const = 0;
798 
799 
807 
815  virtual std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const {
816  UNUSED_PARAMETER(dist);
817  WRITE_WARNING("getLeader not yet implemented for meso");
818  return std::make_pair(nullptr, -1);
819  }
820 
829  virtual std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const {
830  UNUSED_PARAMETER(dist);
831  WRITE_WARNING("getFollwer not yet implemented for meso");
832  return std::make_pair(nullptr, -1);
833  }
834 
837  void calculateArrivalParams(bool onInit);
838 
841 
844 
846 
847  void rememberBlockedParkingArea(const MSParkingArea* pa, bool local);
848  SUMOTime sawBlockedParkingArea(const MSParkingArea* pa, bool local) const;
849 
851  void rememberParkingAreaScore(const MSParkingArea* pa, const std::string& score);
852  void resetParkingAreaScores();
853 
855  struct PaMemory {
857 
860  std::string score;
861  };
862 
865  }
866  void setNumberParkingReroutes(int value) {
867  myNumberParkingReroutes = value;
868  }
869 
870  typedef std::map<const MSParkingArea*, PaMemory, ComparatorIdLess> ParkingMemory;
872  return myParkingMemory;
873  }
875 
876 protected:
879 
881  const MSRoute* myRoute;
882 
885 
888 
891 
893  std::list<MSStop> myStops;
894 
896  std::vector<SUMOVehicleParameter::Stop> myPastStops;
897 
898 
901 
903  // The double value holds the relative position offset, i.e.,
904  // offset + vehicle-position - moveReminder-position = distance,
905  // i.e. the offset is counted up when the vehicle continues to a
906  // succeeding lane.
907  typedef std::vector< std::pair<MSMoveReminder*, double> > MoveReminderCont;
908 
912 
914  std::vector<MSVehicleDevice*> myDevices;
915 
918 
921 
924 
926  double myDepartPos;
927 
929  double myArrivalPos;
930 
933 
936 
939 
941  double myOdometer;
942 
945 
949 
950  /* @brief magic value for undeparted vehicles
951  * @note: in previous versions this was -1
952  */
954 
955  static std::vector<MSTransportable*> myEmptyTransportableVector;
956 
957 private:
959 
960  /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
961  * @note member is initialized on first access */
963 
965 
967 
969 
970 private:
972  MSBaseVehicle& operator=(const MSBaseVehicle& s) = delete;
973 
974 #ifdef _DEBUG
975 public:
976  static void initMoveReminderOutput(const OptionsCont& oc);
977 
978 protected:
980  void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const;
981 
983  const bool myTraceMoveReminders;
984 private:
986  static std::set<std::string> myShallTraceMoveReminders;
987 #endif
988 
989 
990 };
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:54
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
long long int SUMOTime
Definition: SUMOTime.h:32
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
DepartLaneDefinition
Possible ways to choose a lane on depart.
const double INVALID_DOUBLE
Definition: StdDefs.h:63
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:30
An upper class for objects with additional parameters.
Definition: EnergyParams.h:41
A MSVehicle extended by some values for usage within the gui.
static void cleanup()
Static cleanup.
int myRoutingMode
routing mode (see TraCIConstants.h)
static void init()
Static initalization.
virtual ~BaseInfluencer()
Destructor.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, SUMOVehicleClass svc) const
void setRoutingMode(int value)
Sets routing behavior.
int getRoutingMode() const
return the current routing mode
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:51
double getMaxSpeed() const
Returns the maximum speed.
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr)
Adds stops to the built vehicle.
ParkingMemory * myParkingMemory
memory for parking search
double getDepartPos() const
Returns this vehicle's real departure position.
virtual bool isSelected() const
whether this vehicle is selected in the GUI
void rememberBlockedParkingArea(const MSParkingArea *pa, bool local)
const MSDevice_Transportable * getPersonDevice() const
virtual bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
std::list< MSStop > myStops
The vehicle's list of stops.
double getImpatience() const
Returns this vehicles impatience.
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
virtual void initDevices()
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
void initJunctionModelParams()
void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure)
reset index of edge within route
std::map< const MSParkingArea *, PaMemory, ComparatorIdLess > ParkingMemory
virtual double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
virtual BaseInfluencer & getBaseInfluencer()=0
Returns the velocity/lane influencer.
std::string getDeviceParameter(const std::string &deviceName, const std::string &key) const
try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no dev...
bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, bool teleport, std::string &errorMsg)
void calculateArrivalParams(bool onInit)
(Re-)Calculates the arrival position and lane from the vehicle parameters
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
virtual double getArrivalPos() const
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
void resetParkingAreaScores()
MSVehicleType * myType
This vehicle's type.
virtual double getStopDelay() const
Returns the estimated public transport stop (departure) delay in seconds.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
bool allowsBoarding(MSTransportable *t) const
whether the given transportable is allowed to board this vehicle
double myDepartPos
The real depart position.
const std::list< MSStop > & getStops() const
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
double getFuelConsumption() const
Returns fuel consumption of the current state.
void replaceParameter(const SUMOVehicleParameter *newParameter)
replace the vehicle parameter (deleting the old one)
double getCO2Emissions() const
Returns CO2 emission of the current state.
virtual std::pair< const MSVehicle *const, double > getFollower(double dist=0) const
Returns the follower of the vehicle looking for a fixed distance.
int getNumberParkingReroutes() const
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
double getPreviousSpeed() const
Returns the vehicle's previous speed.
virtual void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
const SUMOVehicleParameter::Stop * getNextStopParameter() const
return parameters for the next stop (SUMOVehicle Interface)
const EnergyParams * getEmissionParameters() const
Returns the vehicle's emission model parameter.
double getElectricityConsumption() const
Returns electricity consumption of the current state.
std::vector< std::pair< MSMoveReminder *, double > > MoveReminderCont
Definition of a move reminder container.
virtual double getTimeLossSeconds() const
Returns the time loss in seconds.
double getOdometer() const
Returns the distance that was already driven by this vehicle.
virtual bool hasArrived() const
Returns whether this vehicle has already arived (by default this is true if the vehicle has reached i...
const NumericalID myNumericalID
static NumericalID myCurrentNumericalIndex
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
SUMOTime sawBlockedParkingArea(const MSParkingArea *pa, bool local) const
virtual void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
void setNumberParkingReroutes(int value)
virtual bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI.
virtual void onRemovalFromNet(const MSMoveReminder::Notification)
Called when the vehicle is removed from the network.
double getLength() const
Returns the vehicle's length.
bool isParking() const
Returns whether the vehicle is parking.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
bool isStoppedInRange(const double pos, const double tolerance) const
return whether the given position is within range of the current stop
int getPersonNumber() const
Returns the number of persons.
virtual std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
const MSDevice_Transportable * getContainerDevice() const
void setJunctionModelParameter(const std::string &key, const std::string &value)
set individual junction model paramete (not type related)
void setDepartAndArrivalEdge()
apply departEdge and arrivalEdge attributes
double getNOxEmissions() const
Returns NOx emission of the current state.
void setID(const std::string &newID)
set the id (inherited from Named but forbidden for vehicles)
double getPMxEmissions() const
Returns PMx emission of the current state.
MSRouteIterator myCurrEdge
Iterator to current route-edge.
static MSLane * interpretOppositeStop(SUMOVehicleParameter::Stop &stop)
interpret stop lane on opposite side of the road
static std::vector< MSTransportable * > myEmptyTransportableVector
bool hasDeparted() const
Returns whether this vehicle has already departed.
MSStop & getNextStop()
double getWidth() const
Returns the vehicle's width.
double getCOEmissions() const
Returns CO emission of the current state.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
MSBaseVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
double getStateOfCharge() const
Returns actual state of charge of battery (Wh) RICE_CHECK: This may be a misnomer,...
MSEdgeWeightsStorage & _getWeightsStorage() const
virtual bool handleCollisionStop(MSStop &stop, const double distToStop)
bool isVehicle() const
Whether it is a vehicle.
Definition: MSBaseVehicle.h:93
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equiped with a device of the given type
SumoRNG * getRNG() const
virtual const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
SUMOTime getDeparture() const
Returns this vehicle's real departure time.
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
double basePos(const MSEdge *edge) const
departure position where the vehicle fits fully onto the edge (if possible)
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
void setDeviceParameter(const std::string &deviceName, const std::string &key, const std::string &value)
try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device p...
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
const MSRoute * myRoute
This vehicle's route.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
void addToOdometer(double value)
Manipulate the odometer.
const ParkingMemory * getParkingMemory() const
virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
bool isLineStop(double position) const
returns whether the vehicle serves a public transport line that serves the given stop
double myChosenSpeedFactor
A precomputed factor by which the driver wants to be faster than the speed limit.
@ ROUTE_INVALID
route was checked and is valid
Definition: MSBaseVehicle.h:70
@ ROUTE_START_INVALID_LANE
Definition: MSBaseVehicle.h:74
@ ROUTE_START_INVALID_PERMISSIONS
Definition: MSBaseVehicle.h:72
std::string getPrefixedParameter(const std::string &key, std::string &error) const
retrieve parameters of devices, models and the vehicle itself
void removeTransportable(MSTransportable *t)
removes a person or container
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
virtual double getStopArrivalDelay() const
Returns the estimated public transport stop arrival delay in seconds.
virtual bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given one.
int myArrivalLane
The destination lane where the vehicle stops.
int getRouteValidity(bool update=true, bool silent=false, std::string *msgReturn=nullptr)
check for route validity at first insertion attempt
virtual ~MSBaseVehicle()
Destructor.
SUMOTime myDeparture
The real departure time.
virtual void setArrivalPos(double arrivalPos)
Sets this vehicle's desired arrivalPos for its current route.
std::vector< std::string > getPersonIDList() const
Returns the list of persons.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
virtual bool resumeFromStopping()=0
const std::vector< MSVehicleDevice * > & getDevices() const
Returns this vehicle's devices.
virtual bool hasInfluencer() const =0
whether the vehicle is individually influenced (via TraCI or special parameters)
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=nullptr)
Adds a stop.
void rememberParkingAreaScore(const MSParkingArea *pa, const std::string &score)
score only needed when running with gui
double getHCEmissions() const
Returns HC emission of the current state.
NumericalID getNumericalID() const
return the numerical ID which is only for internal usage
std::vector< SUMOVehicleParameter::Stop > myPastStops
The list of stops that the vehicle has already reached.
void onDepart()
Called when the vehicle is inserted into the network.
void removeReminder(MSMoveReminder *rem)
Removes a MoveReminder dynamically.
bool haveValidStopEdges() const
check whether all stop.edge MSRouteIterators are valid and in order
virtual double getAcceleration() const
Returns the vehicle's acceleration.
virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
virtual const BaseInfluencer * getBaseInfluencer() const =0
int getRoutePosition() const
return index of edge within route
static const SUMOTime NOT_YET_DEPARTED
int myNumberParkingReroutes
SUMOTime getDepartDelay() const
Returns the depart delay.
double getElecHybridCurrent() const
Returns actual current (A) of ElecHybrid device RICE_CHECK: Is this the current consumed from the ove...
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
virtual bool hasValidRouteStart(std::string &msg)
checks wether the vehicle can depart on the first edge
int myRouteValidity
status of the current vehicle route
std::vector< std::pair< int, double > > getStopIndices() const
return list of route indices for the remaining stops
virtual bool isFrontOnLane(const MSLane *) const
Returns the information whether the front of the vehhicle is on the given lane.
const ConstMSEdgeVector getStopEdges(double &firstPos, double &lastPos) const
Returns the list of still pending stop edges also returns the first and last stop position.
SUMOTime myStopUntilOffset
The offset when adding route stops with 'until' on route replacement.
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
virtual bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
void reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false)
Performs a rerouting using the given router.
const std::vector< SUMOVehicleParameter::Stop > & getPastStops() const
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
const MSRoute & getRoute() const
Returns the current route.
int getRNGIndex() const
MSEdgeWeightsStorage * myEdgeWeights
MSBaseVehicle & operator=(const MSBaseVehicle &s)=delete
invalidated assignment operator
void createDevice(const std::string &deviceName)
create device of the given type
bool isStopped() const
Returns whether the vehicle is at a stop.
bool abortNextStop(int nextStopIndex=0)
deletes the next stop at the given index if it exists
int myNumberReroutes
The number of reroutings.
double myArrivalPos
The position on the destination lane where the vehicle stops.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
double myOdometer
A simple odometer to keep track of the length of the route already driven.
int getContainerNumber() const
Returns the number of containers.
bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given edges.
A road/street connecting two junctions.
Definition: MSEdge.h:77
A storage for edge travel times and efforts.
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
A lane area vehicles can halt at.
Definition: MSParkingArea.h:58
Definition: MSStop.h:44
Abstract in-vehicle device.
The car-following model and parameter.
Definition: MSVehicleType.h:62
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
virtual SUMOTime getWaitingTime() const =0
SUMOVehicleClass vehicleClass
The vehicle's class.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
long long int NumericalID
Definition: SUMOVehicle.h:62
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.
store information for a single parking area