Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSBaseVehicle.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2010-2024 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;
48
49
50// ===========================================================================
51// class definitions
52// ===========================================================================
57class MSBaseVehicle : public SUMOVehicle {
58public:
59 // XXX: This definition was introduced to make the MSVehicle's previousSpeed
60 // available in the context of MSMoveReminder::notifyMove(). Another solution
61 // would be to modify notifyMove()'s interface to work with MSVehicle instead
62 // of SUMOVehicle (it is only called with MSVehicles!). Refs. #2579
66 double getPreviousSpeed() const;
67
68 friend class GUIBaseVehicle;
69
76 ROUTE_INVALID = 1 << 1,
77 // starting edge permissions invalid (could change)
79 // insertion lane does not exist
81 };
82
91 MSVehicleType* type, const double speedFactor);
92
93
95 virtual ~MSBaseVehicle();
96
97 virtual void initDevices();
98
99 bool isVehicle() const {
100 return true;
101 }
102
104 void setID(const std::string& newID);
105
110 const SUMOVehicleParameter& getParameter() const;
111
113 std::string getPrefixedParameter(const std::string& key, std::string& error) 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
134 void setCarFollowModelParameter(const std::string& key, const std::string& value);
135
139 inline const MSRoute& getRoute() const {
140 return *myRoute;
141 }
142
147 return myRoute;
148 }
149
153 inline const MSVehicleType& getVehicleType() const {
154 return *myType;
155 }
156
160 inline const SUMOVTypeParameter& getVTypeParameter() const {
161 return myType->getParameter();
162 }
163
169 }
170
174 bool ignoreTransientPermissions() const;
175
179 double getMaxSpeed() const;
180
188 const MSEdge* succEdge(int nSuccs) const;
189
194 const MSEdge* getEdge() const;
195
199 virtual const MSEdge* getCurrentEdge() const {
200 return getEdge();
201 }
202
204 const std::set<SUMOTrafficObject::NumericalID> getUpcomingEdgeIDs() const;
205
207 bool stopsAt(MSStoppingPlace* stop) const;
208
210 bool stopsAtEdge(const MSEdge* edge) const;
211
213 virtual const MSEdge* getNextEdgePtr() const {
214 return nullptr;
215 }
216
220 virtual bool isOnRoad() const {
221 return true;
222 }
223
228 virtual bool isRemoteControlled() const {
229 return false;
230 }
231
232 virtual bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const {
233 UNUSED_PARAMETER(lookBack);
234 return false;
235 }
236
240 virtual bool isFrontOnLane(const MSLane*) const {
241 return true;
242 }
243
248 virtual double getLateralPositionOnLane() const {
249 return 0;
250 }
251
257 virtual double getRightSideOnEdge(const MSLane* lane = 0) const {
258 UNUSED_PARAMETER(lane);
259 return 0;
260 }
261
267 virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const {
268 return myCurrEdge;
269 }
270
275 virtual const MSEdge* getRerouteDestination() const {
276 return myRoute->getLastEdge();
277 }
278
281 virtual double getTimeLossSeconds() const {
282 // better timeLoss for meso?
283 return 0;
284 }
285
292 double getWaitingSeconds() const {
293 return STEPS2TIME(getWaitingTime());
294 }
295
296
297
302 return myCurrEdge;
303 }
304
305
316 bool reroute(SUMOTime t, const std::string& info, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, const bool onInit = false, const bool withTaz = false, const bool silent = false, const MSEdge* sink = nullptr);
317
318
331 bool replaceRouteEdges(ConstMSEdgeVector& edges, double cost, double savings, const std::string& info, bool onInit = false, bool check = false, bool removeStops = true,
332 std::string* msgReturn = nullptr);
333
345 virtual bool replaceRoute(ConstMSRoutePtr route, const std::string& info, bool onInit = false, int offset = 0, bool addRouteStops = true, bool removeStops = true,
346 std::string* msgReturn = nullptr);
347
353 virtual double getAcceleration() const;
354
360 void onDepart();
361
365 inline SUMOTime getDeparture() const {
366 return myDeparture;
367 }
368
370 SUMOTime getDepartDelay() const;
371
374 virtual double getStopDelay() const {
376 return -1;
377 }
378
381 virtual double getStopArrivalDelay() const {
383 return INVALID_DOUBLE;
384 }
385
389 inline double getDepartPos() const {
390 return myDepartPos;
391 }
392
397 virtual double getArrivalPos() const {
398 return myArrivalPos;
399 }
400
401 virtual int getArrivalLane() const {
402 return myArrivalLane;
403 }
404
407 virtual void setArrivalPos(double arrivalPos) {
408 myArrivalPos = arrivalPos;
409 }
410
418 virtual void onRemovalFromNet(const MSMoveReminder::Notification /*reason*/) {}
419
422 inline bool hasDeparted() const {
424 }
425
429 virtual bool hasArrived() const;
430
432 int getRoutePosition() const;
433
435 void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure);
436
440 double getOdometer() const;
441
443 void addToOdometer(double value) {
444 myOdometer += value;
445 }
446
450 inline int getNumberReroutes() const {
451 return myNumberReroutes;
452 }
453
455 double getImpatience() const;
456
460 int getPersonNumber() const;
461
465 int getLeavingPersonNumber() const;
466
470 std::vector<std::string> getPersonIDList() const;
471
475 int getContainerNumber() const;
476
477
481 inline const std::vector<MSVehicleDevice*>& getDevices() const {
482 return myDevices;
483 }
484
486 bool allowsBoarding(const MSTransportable* t) const;
487
492 virtual void addTransportable(MSTransportable* transportable);
493
496
498 const std::vector<MSTransportable*>& getPersons() const;
499
501 const std::vector<MSTransportable*>& getContainers() const;
502
504 bool isLineStop(double position) const;
505
507 bool hasJump(const MSRouteIterator& it) const;
508
514 bool hasValidRoute(std::string& msg, ConstMSRoutePtr route = 0) const;
515
517 virtual bool hasValidRouteStart(std::string& msg);
518
520 int getRouteValidity(bool update = true, bool silent = false, std::string* msgReturn = nullptr);
521
527 void addReminder(MSMoveReminder* rem);
528
535
547 virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
548
549
553 inline double getLength() const {
554 return myType->getLength();
555 }
556
557
561 inline double getWidth() const {
562 return myType->getWidth();
563 }
564
565
569 inline double getChosenSpeedFactor() const {
570 return myChosenSpeedFactor;
571 }
572
576 inline void setChosenSpeedFactor(const double factor) {
577 myChosenSpeedFactor = factor;
578 }
579
581 MSDevice* getDevice(const std::type_info& type) const;
582
583
592 virtual void replaceVehicleType(MSVehicleType* type);
593
594
603
605
606
608 virtual void saveState(OutputDevice& out);
609
611
612 virtual bool handleCollisionStop(MSStop& stop, const double distToStop);
613
617 bool isStopped() const;
618
622 bool isParking() const;
623
627 bool isJumping() const;
628
632 inline bool isReversed() const {
633 return myAmReversed;
634 }
635
639 bool isStoppedTriggered() const;
640
644 bool isStoppedParking() const;
645
648 bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture = false) const;
649
653 bool hasStops() const {
654 return !myStops.empty();
655 }
656
659 bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
660
664
667
669 const std::vector<std::string>& getParkingBadges() const;
670
672 double basePos(const MSEdge* edge) const;
673
680 bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0,
681 MSRouteIterator* searchStart = nullptr);
682
690 void addStops(const bool ignoreStopErrors, MSRouteIterator* searchStart = nullptr, bool addRouteStops = true);
691
693 bool haveValidStopEdges(bool silent = false) const;
694
698 const ConstMSEdgeVector getStopEdges(double& firstPos, double& lastPos, std::set<int>& jumps) const;
699
701 std::vector<std::pair<int, double> > getStopIndices() const;
702
707 inline const std::list<MSStop>& getStops() const {
708 return myStops;
709 }
710
711 inline const std::vector<SUMOVehicleParameter::Stop>& getPastStops() const {
712 return myPastStops;
713 }
714
720
723
728 MSStop& getStop(int nextStopIndex);
729
732
739 virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
740
745 virtual bool resumeFromStopping() = 0;
746
748 void unregisterWaiting();
749
751 bool abortNextStop(int nextStopIndex = 0);
752
764 bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
765
773 bool rerouteBetweenStops(int nextStopIndex, const std::string& info, bool teleport, std::string& errorMsg);
774
785 bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
786
787
789 virtual bool isSelected() const {
790 return false;
791 }
792
794 int getRNGIndex() const;
795
797 SumoRNG* getRNG() const;
798
800 return myNumericalID;
801 }
802
804 return myPersonDevice;
805 }
806
810
813 if (myEnergyParams == nullptr) {
815 }
816 return myEnergyParams;
817 }
818
820
821
826 template<PollutantsInterface::EmissionType ET>
827 double getEmissions() const {
828 if (isOnRoad() || isIdling()) {
830 }
831 return 0.;
832 }
833
838 double getStateOfCharge() const;
839
843 double getRelativeStateOfCharge() const;
844
848 double getChargedEnergy() const;
849
853 double getMaxChargeRate() const;
854
860 double getElecHybridCurrent() const;
861
865 double getHarmonoise_NoiseEmissions() const;
867
881 public:
884
886 virtual ~BaseInfluencer() {}
887
889 static void init();
891 static void cleanup();
892
893
895 double getExtraImpatience() const {
896 return myExtraImpatience;
897 }
898
902 void setExtraImpatience(double value) {
903 myExtraImpatience = value;
904 }
905
906 protected:
909
910 };
911
912
913
920
921 virtual const BaseInfluencer* getBaseInfluencer() const = 0;
922
923 virtual bool hasInfluencer() const = 0;
924
926 int getRoutingMode() const {
927 return myRoutingMode;
928 }
929
933 void setRoutingMode(int value) {
934 myRoutingMode = value;
935 }
936
937
939
947
955 virtual std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const {
956 UNUSED_PARAMETER(dist);
957 WRITE_WARNING(TL("getLeader not yet implemented for meso"));
958 return std::make_pair(nullptr, -1);
959 }
960
969 virtual std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const {
970 UNUSED_PARAMETER(dist);
971 WRITE_WARNING(TL("getFollower not yet implemented for meso"));
972 return std::make_pair(nullptr, -1);
973 }
974
977 void calculateArrivalParams(bool onInit);
978
981
984
986
987 void rememberBlockedParkingArea(const MSStoppingPlace* pa, bool local);
988 SUMOTime sawBlockedParkingArea(const MSStoppingPlace* pa, bool local) const;
989 void rememberBlockedChargingStation(const MSStoppingPlace* cs, bool local);
990 SUMOTime sawBlockedChargingStation(const MSStoppingPlace* cs, bool local) const;
991
993 void rememberParkingAreaScore(const MSStoppingPlace* pa, const std::string& score);
995 void rememberChargingStationScore(const MSStoppingPlace* cs, const std::string& score);
997
1000 }
1003 }
1004
1006 return myParkingMemory;
1007 }
1008
1010 return myChargingMemory;
1011 }
1013
1014protected:
1017
1020
1023
1026
1029
1031 std::list<MSStop> myStops;
1032
1034 std::vector<SUMOVehicleParameter::Stop> myPastStops;
1035
1036
1039
1041 // The double value holds the relative position offset, i.e.,
1042 // offset + vehicle-position - moveReminder-position = distance,
1043 // i.e. the offset is counted up when the vehicle continues to a
1044 // succeeding lane.
1045 typedef std::vector< std::pair<MSMoveReminder*, double> > MoveReminderCont;
1046
1050
1052 std::vector<MSVehicleDevice*> myDevices;
1053
1056
1059
1062
1065
1068
1071
1074
1077
1080
1083
1086
1091
1094
1095 /* @brief magic value for undeparted vehicles
1096 * @note: in previous versions this was -1
1097 */
1099
1100 static std::vector<MSTransportable*> myEmptyTransportableVector;
1101
1102 /* @brief The logical 'reversed' state of the vehicle - intended to be used by drawing functions
1103 * @note: only set by vClass rail reversing at the moment
1104 */
1105 bool myAmReversed = false;
1106
1109
1110private:
1112
1113 /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
1114 * @note member is initialized on first access */
1116
1118
1120
1123
1125 std::string getFlowID() const;
1126
1128 void checkRouteRemoval();
1129
1131 bool insertJump(int nextStopIndex, MSRouteIterator itStart, std::string& errorMsg);
1132
1134 void setSkips(MSStop& stop, int prevActiveStops);
1135
1136private:
1139
1140#ifdef _DEBUG
1141public:
1142 static void initMoveReminderOutput(const OptionsCont& oc);
1143
1144protected:
1146 void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const;
1147
1149 const bool myTraceMoveReminders;
1150private:
1152 static std::set<std::string> myShallTraceMoveReminders;
1153#endif
1154
1155
1156};
long long int SUMOTime
Definition GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:74
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition MSRoute.h:57
#define WRITE_WARNING(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:315
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition Route.h:32
SUMOTime DELTA_T
Definition SUMOTime.cpp:38
#define STEPS2TIME(x)
Definition SUMOTime.h:55
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.
A MSVehicle extended by some values for usage within the gui.
void setExtraImpatience(double value)
Sets routing behavior.
double getExtraImpatience() const
return the current routing mode
static void cleanup()
Static cleanup.
static void init()
Static initalization.
virtual ~BaseInfluencer()
Destructor.
double myExtraImpatience
dynamic impatience offset
The base class for microscopic and mesoscopic vehicles.
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and technical maximum speed)
bool haveValidStopEdges(bool silent=false) const
check whether all stop.edge MSRouteIterators are valid and in order
int myRoutingMode
routing mode (see TraCIConstants.h)
bool hasJump(const MSRouteIterator &it) const
check wether the vehicle has jump at the given part of its route
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
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.
StoppingPlaceMemory * myParkingMemory
memory for parking search
double getImpatience() const
Returns this vehicles impatience.
void setSkips(MSStop &stop, int prevActiveStops)
patch stop.pars.index to record the number of skipped candidate edges before stop....
virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
const StoppingPlaceMemory * getParkingMemory() const
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
virtual void initDevices()
void rememberParkingAreaScore(const MSStoppingPlace *pa, const std::string &score)
score only needed when running with gui
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure)
reset index of edge within route
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...
StoppingPlaceMemory * myChargingMemory
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)
int getLeavingPersonNumber() const
Returns the number of leaving persons.
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 setCarFollowModelParameter(const std::string &key, const std::string &value)
set individual carFollow model parameters (not type related)
void setRoutingMode(int value)
Sets routing behavior.
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.
void rememberChargingStationScore(const MSStoppingPlace *cs, const std::string &score)
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.
double getMaxChargeRate() const
Returns the maximum charge rate allowed by the battery in the current time step (W)
virtual const BaseInfluencer * getBaseInfluencer() const =0
void replaceParameter(const SUMOVehicleParameter *newParameter)
replace the vehicle parameter (deleting the old one)
void rememberBlockedParkingArea(const MSStoppingPlace *pa, bool local)
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)
void rememberBlockedChargingStation(const MSStoppingPlace *cs, bool local)
std::vector< std::pair< MSMoveReminder *, double > > MoveReminderCont
Definition of a move reminder container.
virtual bool replaceRoute(ConstMSRoutePtr route, const std::string &info, bool onInit=false, int offset=0, bool addRouteStops=true, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given one.
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.
void checkRouteRemoval()
remove route at the end of the simulation
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
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)
void unregisterWaiting()
mark vehicle as active
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.
MSParkingArea * getCurrentParkingArea()
get the current parking area stop or nullptr
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.
double getRelativeStateOfCharge() const
Returns actual relative state of charge of battery (-)
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
const std::vector< std::string > & getParkingBadges() const
get the valid parking access rights (vehicle settings override vehicle type settings)
bool hasDeparted() const
Returns whether this vehicle has already departed.
MSStop & getNextStop()
bool ignoreTransientPermissions() const
Returns whether this object is ignoring transient permission changes (during routing)
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
void resetChargingStationScores()
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.
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
SUMOTime sawBlockedChargingStation(const MSStoppingPlace *cs, bool local) 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.
std::string getFlowID() const
reconstruct flow id from vehicle id
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
@ ROUTE_START_INVALID_PERMISSIONS
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
SUMOTime sawBlockedParkingArea(const MSStoppingPlace *pa, bool local) const
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
virtual double getStopArrivalDelay() const
Returns the estimated public transport stop arrival delay in seconds.
MSParkingArea * getNextParkingArea()
get the upcoming parking area stop or nullptr
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
const SUMOVTypeParameter & getVTypeParameter() const
Returns the vehicle's type parameter.
virtual bool resumeFromStopping()=0
virtual bool hasInfluencer() const =0
whether the vehicle is individually influenced (via TraCI or special parameters)
const std::set< SUMOTrafficObject::NumericalID > getUpcomingEdgeIDs() const
returns the numerical ids of edges to travel
bool stopsAtEdge(const MSEdge *edge) const
Returns whether the vehicle stops at the given edge.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, MSRouteIterator *searchStart=nullptr)
Adds a stop.
double getChargedEnergy() const
Returns the energy charged to the battery in the current time step (Wh)
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 getRoutingMode() const
return routing mode (configures router choice but also handling of transient permission changes)
int getRoutePosition() const
return index of edge within route
virtual const MSEdge * getRerouteDestination() const
Returns the end point for reroutes (usually the last edge of the route)
const MSDevice_Transportable * getContainerDevice() const
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
static const SUMOTime NOT_YET_DEPARTED
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)
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT() const
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 isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
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
const StoppingPlaceMemory * getChargingMemory() const
bool reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false, const MSEdge *sink=nullptr)
Performs a rerouting using the given router.
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.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists, nullptr otherwise.
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.
bool insertJump(int nextStopIndex, MSRouteIterator itStart, std::string &errorMsg)
helper function
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.
void initTransientModelParams()
init model parameters from generic params
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.
Abstract in-vehicle / in-person device.
Definition MSDevice.h:62
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.
A lane area vehicles can halt at.
Abstract in-vehicle device.
The car-following model and parameter.
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.
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 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.
virtual SUMOTime getWaitingTime(const bool accumulated=false) const =0
Structure representing possible vehicle parameter.
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.