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>
32#include "MSRoute.h"
33#include "MSMoveReminder.h"
34#include "MSVehicleType.h"
35
36
37// ===========================================================================
38// class declarations
39// ===========================================================================
40class MSLane;
41class MSStop;
44class MSVehicleDevice;
46
47
48// ===========================================================================
49// class definitions
50// ===========================================================================
55class MSBaseVehicle : public SUMOVehicle {
56public:
57 // XXX: This definition was introduced to make the MSVehicle's previousSpeed
58 // available in the context of MSMoveReminder::notifyMove(). Another solution
59 // would be to modify notifyMove()'s interface to work with MSVehicle instead
60 // of SUMOVehicle (it is only called with MSVehicles!). Refs. #2579
64 double getPreviousSpeed() const;
65
66 friend class GUIBaseVehicle;
67
74 ROUTE_INVALID = 1 << 1,
75 // starting edge permissions invalid (could change)
77 // insertion lane does not exist
79 };
80
88 MSBaseVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
89 MSVehicleType* type, const double speedFactor);
90
91
93 virtual ~MSBaseVehicle();
94
95 virtual void initDevices();
96
97 bool isVehicle() const {
98 return true;
99 }
100
102 void setID(const std::string& newID);
103
108 const SUMOVehicleParameter& getParameter() const;
109
111 std::string getPrefixedParameter(const std::string& key, std::string& error) const;
112
114 void replaceParameter(const SUMOVehicleParameter* newParameter);
115
117 bool hasDevice(const std::string& deviceName) const;
118
120 void createDevice(const std::string& deviceName);
121
123 std::string getDeviceParameter(const std::string& deviceName, const std::string& key) const;
124
126 void setDeviceParameter(const std::string& deviceName, const std::string& key, const std::string& value);
127
129 void setJunctionModelParameter(const std::string& key, const std::string& value);
130
134 inline const MSRoute& getRoute() const {
135 return *myRoute;
136 }
137
141 inline const MSVehicleType& getVehicleType() const {
142 return *myType;
143 }
144
150 }
151
155 double getMaxSpeed() const;
156
164 const MSEdge* succEdge(int nSuccs) const;
165
170 const MSEdge* getEdge() const;
171
175 virtual const MSEdge* getCurrentEdge() const {
176 return getEdge();
177 }
178
180 virtual const MSEdge* getNextEdgePtr() const {
181 return nullptr;
182 }
183
187 virtual bool isOnRoad() const {
188 return true;
189 }
190
195 virtual bool isRemoteControlled() const {
196 return false;
197 }
198
199 virtual bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const {
200 UNUSED_PARAMETER(lookBack);
201 return false;
202 }
203
207 virtual bool isFrontOnLane(const MSLane*) const {
208 return true;
209 }
210
215 virtual double getLateralPositionOnLane() const {
216 return 0;
217 }
218
224 virtual double getRightSideOnEdge(const MSLane* lane = 0) const {
225 UNUSED_PARAMETER(lane);
226 return 0;
227 }
228
234 virtual const MSEdge* getRerouteOrigin() const {
235 return *myCurrEdge;
236 }
237
240 virtual double getTimeLossSeconds() const {
241 // better timeLoss for meso?
242 return 0;
243 }
244
251 double getWaitingSeconds() const {
252 return STEPS2TIME(getWaitingTime());
253 }
254
255
256
261 return myCurrEdge;
262 }
263
264
274 void reroute(SUMOTime t, const std::string& info, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, const bool onInit = false, const bool withTaz = false, const bool silent = false);
275
276
289 bool replaceRouteEdges(ConstMSEdgeVector& edges, double cost, double savings, const std::string& info, bool onInit = false, bool check = false, bool removeStops = true,
290 std::string* msgReturn = nullptr);
291
302 virtual bool replaceRoute(const MSRoute* route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true,
303 std::string* msgReturn = nullptr);
304
310 virtual double getAcceleration() const;
311
317 void onDepart();
318
322 inline SUMOTime getDeparture() const {
323 return myDeparture;
324 }
325
327 SUMOTime getDepartDelay() const;
328
331 virtual double getStopDelay() const {
333 return -1;
334 }
335
338 virtual double getStopArrivalDelay() const {
340 return INVALID_DOUBLE;
341 }
342
346 inline double getDepartPos() const {
347 return myDepartPos;
348 }
349
354 virtual double getArrivalPos() const {
355 return myArrivalPos;
356 }
357
358 virtual int getArrivalLane() const {
359 return myArrivalLane;
360 }
361
364 virtual void setArrivalPos(double arrivalPos) {
365 myArrivalPos = arrivalPos;
366 }
367
375 virtual void onRemovalFromNet(const MSMoveReminder::Notification /*reason*/) {}
376
379 inline bool hasDeparted() const {
381 }
382
386 virtual bool hasArrived() const;
387
389 int getRoutePosition() const;
390
392 void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure);
393
397 double getOdometer() const;
398
400 void addToOdometer(double value) {
401 myOdometer += value;
402 }
403
407 inline int getNumberReroutes() const {
408 return myNumberReroutes;
409 }
410
412 double getImpatience() const;
413
417 int getPersonNumber() const;
418
422 std::vector<std::string> getPersonIDList() const;
423
427 int getContainerNumber() const;
428
429
433 inline const std::vector<MSVehicleDevice*>& getDevices() const {
434 return myDevices;
435 }
436
438 bool allowsBoarding(const MSTransportable* t) const;
439
444 virtual void addTransportable(MSTransportable* transportable);
445
448
450 const std::vector<MSTransportable*>& getPersons() const;
451
453 const std::vector<MSTransportable*>& getContainers() const;
454
456 bool isLineStop(double position) const;
457
463 bool hasValidRoute(std::string& msg, const MSRoute* route = 0) const;
464
466 virtual bool hasValidRouteStart(std::string& msg);
467
469 int getRouteValidity(bool update = true, bool silent = false, std::string* msgReturn = nullptr);
470
476 void addReminder(MSMoveReminder* rem);
477
484
496 virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
497
498
502 inline double getLength() const {
503 return myType->getLength();
504 }
505
506
510 inline double getWidth() const {
511 return myType->getWidth();
512 }
513
514
518 inline double getChosenSpeedFactor() const {
519 return myChosenSpeedFactor;
520 }
521
525 inline void setChosenSpeedFactor(const double factor) {
526 myChosenSpeedFactor = factor;
527 }
528
530 MSVehicleDevice* getDevice(const std::type_info& type) const;
531
532
541 virtual void replaceVehicleType(MSVehicleType* type);
542
543
552
554
555
557 virtual void saveState(OutputDevice& out);
558
560
561 virtual bool handleCollisionStop(MSStop& stop, const double distToStop);
562
566 bool isStopped() const;
567
571 bool isParking() const;
572
576 bool isStoppedTriggered() const;
577
581 bool isStoppedParking() const;
582
585 bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture = false) const;
586
590 bool hasStops() const {
591 return !myStops.empty();
592 }
593
595 double basePos(const MSEdge* edge) const;
596
603 bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0,
604 MSRouteIterator* searchStart = nullptr);
605
613 void addStops(const bool ignoreStopErrors, MSRouteIterator* searchStart = nullptr, bool addRouteStops = true);
614
616 bool haveValidStopEdges() const;
617
621 const ConstMSEdgeVector getStopEdges(double& firstPos, double& lastPos) const;
622
624 std::vector<std::pair<int, double> > getStopIndices() const;
625
630 inline const std::list<MSStop>& getStops() const {
631 return myStops;
632 }
633
634 inline const std::vector<SUMOVehicleParameter::Stop>& getPastStops() const {
635 return myPastStops;
636 }
637
643
646
651 MSStop& getStop(int nextStopIndex);
652
655
662 virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
663
668 virtual bool resumeFromStopping() = 0;
669
671 bool abortNextStop(int nextStopIndex = 0);
672
684 bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
685
693 bool rerouteBetweenStops(int nextStopIndex, const std::string& info, bool teleport, std::string& errorMsg);
694
705 bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
706
707
709 virtual bool isSelected() const {
710 return false;
711 }
712
714 int getRNGIndex() const;
715
717 SumoRNG* getRNG() const;
718
720 return myNumericalID;
721 }
722
724 return myPersonDevice;
725 }
726
728 return myContainerDevice;
729 }
730
733 if (myEnergyParams == nullptr) {
735 }
736 return myEnergyParams;
737 }
738
740
741
746 template<PollutantsInterface::EmissionType ET>
747 double getEmissions() const {
748 if (isOnRoad() || isIdling()) {
750 }
751 return 0.;
752 }
753
758 double getStateOfCharge() const;
759
765 double getElecHybridCurrent() const;
766
770 double getHarmonoise_NoiseEmissions() const;
772
786 public:
789
791 virtual ~BaseInfluencer() {}
792
794 static void init();
796 static void cleanup();
797
798
800 int getRoutingMode() const {
801 return myRoutingMode;
802 }
803
807 void setRoutingMode(int value) {
808 myRoutingMode = value;
809 }
810
811
813
814 protected:
817
818 };
819
820
821
828
829 virtual const BaseInfluencer* getBaseInfluencer() const = 0;
830
831 virtual bool hasInfluencer() const = 0;
832
833
841
849 virtual std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const {
850 UNUSED_PARAMETER(dist);
851 WRITE_WARNING("getLeader not yet implemented for meso");
852 return std::make_pair(nullptr, -1);
853 }
854
863 virtual std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const {
864 UNUSED_PARAMETER(dist);
865 WRITE_WARNING("getFollwer not yet implemented for meso");
866 return std::make_pair(nullptr, -1);
867 }
868
871 void calculateArrivalParams(bool onInit);
872
875
878
880
881 void rememberBlockedParkingArea(const MSParkingArea* pa, bool local);
882 SUMOTime sawBlockedParkingArea(const MSParkingArea* pa, bool local) const;
883
885 void rememberParkingAreaScore(const MSParkingArea* pa, const std::string& score);
887
889 struct PaMemory {
891
894 std::string score;
895 };
896
899 }
900 void setNumberParkingReroutes(int value) {
902 }
903
904 typedef std::map<const MSParkingArea*, PaMemory, ComparatorIdLess> ParkingMemory;
906 return myParkingMemory;
907 }
909
910protected:
913
916
919
922
925
927 std::list<MSStop> myStops;
928
930 std::vector<SUMOVehicleParameter::Stop> myPastStops;
931
932
935
937 // The double value holds the relative position offset, i.e.,
938 // offset + vehicle-position - moveReminder-position = distance,
939 // i.e. the offset is counted up when the vehicle continues to a
940 // succeeding lane.
941 typedef std::vector< std::pair<MSMoveReminder*, double> > MoveReminderCont;
942
946
948 std::vector<MSVehicleDevice*> myDevices;
949
952
955
958
961
964
967
970
973
976
979
982
986
989
990 /* @brief magic value for undeparted vehicles
991 * @note: in previous versions this was -1
992 */
994
995 static std::vector<MSTransportable*> myEmptyTransportableVector;
996
997private:
999
1000 /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1001 * @note member is initialized on first access */
1003
1005
1007
1009
1010private:
1013
1014#ifdef _DEBUG
1015public:
1016 static void initMoveReminderOutput(const OptionsCont& oc);
1017
1018protected:
1020 void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const;
1021
1023 const bool myTraceMoveReminders;
1024private:
1026 static std::set<std::string> myShallTraceMoveReminders;
1027#endif
1028
1029
1030};
long long int SUMOTime
Definition: GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:54
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
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:60
#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:55
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and technical maximum speed)
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
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)
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.
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...
const std::vector< MSVehicleDevice * > & getDevices() const
Returns this vehicle's devices.
bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, bool teleport, std::string &errorMsg)
virtual const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
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.
static NumericalID myCurrentNumericalIndex
virtual double getStopDelay() const
Returns the estimated public transport stop (departure) delay in seconds.
bool rerouteBetweenStops(int nextStopIndex, const std::string &info, bool teleport, std::string &errorMsg)
MoveReminderCont myMoveReminders
Currently relevant move reminders.
double myDepartPos
The real depart position.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
virtual const BaseInfluencer * getBaseInfluencer() const =0
void replaceParameter(const SUMOVehicleParameter *newParameter)
replace the vehicle parameter (deleting the old one)
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.
virtual const MSEdge * getCurrentEdge() const
Returns the edge the vehicle is currently at (possibly an internal edge)
double getPreviousSpeed() const
Returns the vehicle's previous speed.
virtual void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
virtual BaseInfluencer & getBaseInfluencer()=0
Returns the velocity/lane influencer.
const SUMOVehicleParameter::Stop * getNextStopParameter() const
return parameters for the next stop (SUMOVehicle Interface)
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
bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture=false) const
return whether the given position is within range of the current stop
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.
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
bool isStoppedParking() const
Returns whether the vehicle is on a parking stop.
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.
MSBaseVehicle & operator=(const MSBaseVehicle &s)=delete
invalidated assignment operator
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
virtual int getArrivalLane() const
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
int getPersonNumber() const
Returns the number of persons.
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
void setID(const std::string &newID)
set the id (inherited from Named but forbidden for vehicles)
MSRouteIterator myCurrEdge
Iterator to current route-edge.
static MSLane * interpretOppositeStop(SUMOVehicleParameter::Stop &stop)
interpret stop lane on opposite side of the road
virtual const MSEdge * getNextEdgePtr() const
returns the next edge (possibly an internal edge)
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.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
MSBaseVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
const std::list< MSStop > & getStops() const
bool allowsBoarding(const MSTransportable *t) const
whether the given transportable is allowed to board this vehicle
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:97
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equiped with a device of the given type
SumoRNG * getRNG() const
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)
const MSDevice_Transportable * getPersonDevice() const
EnergyParams * getEmissionParameters() const
retrieve parameters for the energy consumption model
double basePos(const MSEdge *edge) const
departure position where the vehicle fits fully onto the edge (if possible)
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.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
void addToOdometer(double value)
Manipulate the odometer.
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:74
@ ROUTE_START_INVALID_LANE
Definition: MSBaseVehicle.h:78
@ ROUTE_START_INVALID_PERMISSIONS
Definition: MSBaseVehicle.h:76
std::string getPrefixedParameter(const std::string &key, std::string &error) const
retrieve parameters of devices, models and the vehicle itself
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr, bool addRouteStops=true)
Adds stops to the built vehicle.
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
MSStop & getStop(int nextStopIndex)
virtual std::pair< const MSVehicle *const, double > getFollower(double dist=0) const
Returns the follower of the vehicle looking for a fixed distance.
virtual ~MSBaseVehicle()
Destructor.
bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, bool teleport, std::string &errorMsg)
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.
const std::vector< SUMOVehicleParameter::Stop > & getPastStops() const
virtual bool resumeFromStopping()=0
virtual bool hasInfluencer() const =0
whether the vehicle is individually influenced (via TraCI or special parameters)
void rememberParkingAreaScore(const MSParkingArea *pa, const std::string &score)
score only needed when running with gui
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, MSRouteIterator *searchStart=nullptr)
Adds a stop.
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.
SUMOTime getStopDuration() const
get remaining stop duration or 0 if the vehicle isn't stopped
bool haveValidStopEdges() const
check whether all stop.edge MSRouteIterators are valid and in order
virtual double getAcceleration() const
Returns the vehicle's acceleration.
virtual double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
const MSRoute & getRoute() const
Returns the current route.
int getRoutePosition() const
return index of edge within route
const MSDevice_Transportable * getContainerDevice() const
static const SUMOTime NOT_YET_DEPARTED
int myNumberParkingReroutes
SUMOTime getDepartDelay() const
Returns the depart delay.
double getEmissions() const
Returns emissions of the current state The value is always per 1s, so multiply by step length if nece...
double getElecHybridCurrent() const
Returns actual current (A) of ElecHybrid device RICE_CHECK: Is this the current consumed from the ove...
bool myAmRegisteredAsWaiting
Whether this vehicle is registered as waiting for a person or container (for deadlock-recognition)
EnergyParams * myEnergyParams
The emission parameters this vehicle may have.
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.
virtual std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
int getRNGIndex() const
MSEdgeWeightsStorage * myEdgeWeights
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void createDevice(const std::string &deviceName)
create device of the given type
bool isStopped() const
Returns whether the vehicle is at a stop.
const ParkingMemory * getParkingMemory() const
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 device which collects vehicular emissions.
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:84
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:63
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
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
static double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const EnergyParams *param)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
virtual SUMOTime getWaitingTime() const =0
virtual double getSlope() const =0
Returns the slope of the road at object's position in degrees.
long long int NumericalID
virtual double getSpeed() const =0
Returns the object's current speed.
SUMOVehicleClass vehicleClass
The vehicle's class.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
virtual bool isIdling() const =0
Returns whether the vehicle is idling (waiting to re-enter the net.
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.
store information for a single parking area