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-2023 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
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
142 return myRoute;
143 }
144
148 inline const MSVehicleType& getVehicleType() const {
149 return *myType;
150 }
151
157 }
158
162 double getMaxSpeed() const;
163
171 const MSEdge* succEdge(int nSuccs) const;
172
177 const MSEdge* getEdge() const;
178
182 virtual const MSEdge* getCurrentEdge() const {
183 return getEdge();
184 }
185
187 bool stopsAt(MSStoppingPlace* stop) const;
188
190 bool stopsAtEdge(const MSEdge* edge) const;
191
193 virtual const MSEdge* getNextEdgePtr() const {
194 return nullptr;
195 }
196
200 virtual bool isOnRoad() const {
201 return true;
202 }
203
208 virtual bool isRemoteControlled() const {
209 return false;
210 }
211
212 virtual bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const {
213 UNUSED_PARAMETER(lookBack);
214 return false;
215 }
216
220 virtual bool isFrontOnLane(const MSLane*) const {
221 return true;
222 }
223
228 virtual double getLateralPositionOnLane() const {
229 return 0;
230 }
231
237 virtual double getRightSideOnEdge(const MSLane* lane = 0) const {
238 UNUSED_PARAMETER(lane);
239 return 0;
240 }
241
247 virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const {
248 return myCurrEdge;
249 }
250
253 virtual double getTimeLossSeconds() const {
254 // better timeLoss for meso?
255 return 0;
256 }
257
264 double getWaitingSeconds() const {
265 return STEPS2TIME(getWaitingTime());
266 }
267
268
269
274 return myCurrEdge;
275 }
276
277
287 void reroute(SUMOTime t, const std::string& info, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, const bool onInit = false, const bool withTaz = false, const bool silent = false);
288
289
302 bool replaceRouteEdges(ConstMSEdgeVector& edges, double cost, double savings, const std::string& info, bool onInit = false, bool check = false, bool removeStops = true,
303 std::string* msgReturn = nullptr);
304
315 virtual bool replaceRoute(ConstMSRoutePtr route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true,
316 std::string* msgReturn = nullptr);
317
323 virtual double getAcceleration() const;
324
330 void onDepart();
331
335 inline SUMOTime getDeparture() const {
336 return myDeparture;
337 }
338
340 SUMOTime getDepartDelay() const;
341
344 virtual double getStopDelay() const {
346 return -1;
347 }
348
351 virtual double getStopArrivalDelay() const {
353 return INVALID_DOUBLE;
354 }
355
359 inline double getDepartPos() const {
360 return myDepartPos;
361 }
362
367 virtual double getArrivalPos() const {
368 return myArrivalPos;
369 }
370
371 virtual int getArrivalLane() const {
372 return myArrivalLane;
373 }
374
377 virtual void setArrivalPos(double arrivalPos) {
378 myArrivalPos = arrivalPos;
379 }
380
388 virtual void onRemovalFromNet(const MSMoveReminder::Notification /*reason*/) {}
389
392 inline bool hasDeparted() const {
394 }
395
399 virtual bool hasArrived() const;
400
402 int getRoutePosition() const;
403
405 void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure);
406
410 double getOdometer() const;
411
413 void addToOdometer(double value) {
414 myOdometer += value;
415 }
416
420 inline int getNumberReroutes() const {
421 return myNumberReroutes;
422 }
423
425 double getImpatience() const;
426
430 int getPersonNumber() const;
431
435 std::vector<std::string> getPersonIDList() const;
436
440 int getContainerNumber() const;
441
442
446 inline const std::vector<MSVehicleDevice*>& getDevices() const {
447 return myDevices;
448 }
449
451 bool allowsBoarding(const MSTransportable* t) const;
452
457 virtual void addTransportable(MSTransportable* transportable);
458
461
463 const std::vector<MSTransportable*>& getPersons() const;
464
466 const std::vector<MSTransportable*>& getContainers() const;
467
469 bool isLineStop(double position) const;
470
472 bool hasJump(const MSRouteIterator& it) const;
473
479 bool hasValidRoute(std::string& msg, ConstMSRoutePtr route = 0) const;
480
482 virtual bool hasValidRouteStart(std::string& msg);
483
485 int getRouteValidity(bool update = true, bool silent = false, std::string* msgReturn = nullptr);
486
492 void addReminder(MSMoveReminder* rem);
493
500
512 virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
513
514
518 inline double getLength() const {
519 return myType->getLength();
520 }
521
522
526 inline double getWidth() const {
527 return myType->getWidth();
528 }
529
530
534 inline double getChosenSpeedFactor() const {
535 return myChosenSpeedFactor;
536 }
537
541 inline void setChosenSpeedFactor(const double factor) {
542 myChosenSpeedFactor = factor;
543 }
544
546 MSVehicleDevice* getDevice(const std::type_info& type) const;
547
548
557 virtual void replaceVehicleType(MSVehicleType* type);
558
559
568
570
571
573 virtual void saveState(OutputDevice& out);
574
576
577 virtual bool handleCollisionStop(MSStop& stop, const double distToStop);
578
582 bool isStopped() const;
583
587 bool isParking() const;
588
592 bool isJumping() const;
593
597 inline bool isReversed() const {
598 return myAmReversed;
599 }
600
604 bool isStoppedTriggered() const;
605
609 bool isStoppedParking() const;
610
613 bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture = false) const;
614
618 bool hasStops() const {
619 return !myStops.empty();
620 }
621
623 double basePos(const MSEdge* edge) const;
624
631 bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0,
632 MSRouteIterator* searchStart = nullptr);
633
641 void addStops(const bool ignoreStopErrors, MSRouteIterator* searchStart = nullptr, bool addRouteStops = true);
642
644 bool haveValidStopEdges(bool silent = false) const;
645
649 const ConstMSEdgeVector getStopEdges(double& firstPos, double& lastPos, std::set<int>& jumps) const;
650
652 std::vector<std::pair<int, double> > getStopIndices() const;
653
658 inline const std::list<MSStop>& getStops() const {
659 return myStops;
660 }
661
662 inline const std::vector<SUMOVehicleParameter::Stop>& getPastStops() const {
663 return myPastStops;
664 }
665
671
674
679 MSStop& getStop(int nextStopIndex);
680
683
690 virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
691
696 virtual bool resumeFromStopping() = 0;
697
699 bool abortNextStop(int nextStopIndex = 0);
700
712 bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
713
721 bool rerouteBetweenStops(int nextStopIndex, const std::string& info, bool teleport, std::string& errorMsg);
722
733 bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
734
735
737 virtual bool isSelected() const {
738 return false;
739 }
740
742 int getRNGIndex() const;
743
745 SumoRNG* getRNG() const;
746
748 return myNumericalID;
749 }
750
752 return myPersonDevice;
753 }
754
756 return myContainerDevice;
757 }
758
761 if (myEnergyParams == nullptr) {
763 }
764 return myEnergyParams;
765 }
766
768
769
774 template<PollutantsInterface::EmissionType ET>
775 double getEmissions() const {
776 if (isOnRoad() || isIdling()) {
778 }
779 return 0.;
780 }
781
786 double getStateOfCharge() const;
787
793 double getElecHybridCurrent() const;
794
798 double getHarmonoise_NoiseEmissions() const;
800
814 public:
817
819 virtual ~BaseInfluencer() {}
820
822 static void init();
824 static void cleanup();
825
826
828 int getRoutingMode() const {
829 return myRoutingMode;
830 }
831
835 void setRoutingMode(int value) {
836 myRoutingMode = value;
837 }
838
839
841
842 protected:
845
846 };
847
848
849
856
857 virtual const BaseInfluencer* getBaseInfluencer() const = 0;
858
859 virtual bool hasInfluencer() const = 0;
860
861
869
877 virtual std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const {
878 UNUSED_PARAMETER(dist);
879 WRITE_WARNING(TL("getLeader not yet implemented for meso"));
880 return std::make_pair(nullptr, -1);
881 }
882
891 virtual std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const {
892 UNUSED_PARAMETER(dist);
893 WRITE_WARNING(TL("getFollower not yet implemented for meso"));
894 return std::make_pair(nullptr, -1);
895 }
896
899 void calculateArrivalParams(bool onInit);
900
903
906
908
909 void rememberBlockedParkingArea(const MSParkingArea* pa, bool local);
910 SUMOTime sawBlockedParkingArea(const MSParkingArea* pa, bool local) const;
911
913 void rememberParkingAreaScore(const MSParkingArea* pa, const std::string& score);
915
917 struct PaMemory {
919
922 std::string score;
923 };
924
927 }
928 void setNumberParkingReroutes(int value) {
930 }
931
932 typedef std::map<const MSParkingArea*, PaMemory, ComparatorIdLess> ParkingMemory;
934 return myParkingMemory;
935 }
937
938protected:
941
944
947
950
953
955 std::list<MSStop> myStops;
956
958 std::vector<SUMOVehicleParameter::Stop> myPastStops;
959
960
963
965 // The double value holds the relative position offset, i.e.,
966 // offset + vehicle-position - moveReminder-position = distance,
967 // i.e. the offset is counted up when the vehicle continues to a
968 // succeeding lane.
969 typedef std::vector< std::pair<MSMoveReminder*, double> > MoveReminderCont;
970
974
976 std::vector<MSVehicleDevice*> myDevices;
977
980
983
986
989
992
995
998
1001
1004
1007
1010
1014
1017
1018 /* @brief magic value for undeparted vehicles
1019 * @note: in previous versions this was -1
1020 */
1022
1023 static std::vector<MSTransportable*> myEmptyTransportableVector;
1024
1025 /* @brief The logical 'reversed' state of the vehicle - intended to be used by drawing functions
1026 * @note: only set by vClass rail reversing at the moment
1027 */
1028 bool myAmReversed = false;
1029
1030private:
1032
1033 /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1034 * @note member is initialized on first access */
1036
1038
1040
1042
1043private:
1046
1047#ifdef _DEBUG
1048public:
1049 static void initMoveReminderOutput(const OptionsCont& oc);
1050
1051protected:
1053 void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const;
1054
1056 const bool myTraceMoveReminders;
1057private:
1059 static std::set<std::string> myShallTraceMoveReminders;
1060#endif
1061
1062
1063};
long long int SUMOTime
Definition: GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:56
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:267
#define TL(string)
Definition: MsgHandler.h:284
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:32
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
invalid double
Definition: StdDefs.h:64
#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, nullptr otherwise.
bool haveValidStopEdges(bool silent=false) const
check whether all stop.edge MSRouteIterators are valid and in order
bool hasJump(const MSRouteIterator &it) const
check wether the vehicle has jump at the given part of it's route
ParkingMemory * myParkingMemory
memory for parking search
double getDepartPos() const
Returns this vehicle's real departure position.
ConstMSRoutePtr getRoutePtr() const
Returns the current route.
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.
virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
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)
MSBaseVehicle(SUMOVehicleParameter *pars, ConstMSRoutePtr route, MSVehicleType *type, const double speedFactor)
Constructor.
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.
bool isReversed() const
Returns whether the logical state of the vehicle is reversed - for drawing.
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
bool isJumping() const
Returns whether the vehicle is perform a jump.
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.
bool hasValidRoute(std::string &msg, ConstMSRoutePtr route=0) const
Validates the current or given route.
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
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()
ConstMSRoutePtr myRoute
This vehicle's route.
const ConstMSEdgeVector getStopEdges(double &firstPos, double &lastPos, std::set< int > &jumps) const
Returns the list of still pending stop edges also returns the first and last stop position.
double getWidth() const
Returns the vehicle's width.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
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 name
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.
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.
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)
bool stopsAtEdge(const MSEdge *edge) const
Returns whether the vehicle stops at the given edge.
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
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.
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 replaceRoute(ConstMSRoutePtr 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.
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
bool stopsAt(MSStoppingPlace *stop) const
Returns whether the vehicle stops at the given stopping place.
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
A lane area vehicles can halt at.
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:62
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