LCOV - code coverage report
Current view: top level - src/microsim - MSBaseVehicle.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 87.8 % 123 108
Test Date: 2026-04-16 16:39:47 Functions: 82.5 % 57 47

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2010-2026 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              : /****************************************************************************/
      14              : /// @file    MSBaseVehicle.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @author  Jakob Erdmann
      18              : /// @date    Mon, 8 Nov 2010
      19              : ///
      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>
      28              : #include <utils/common/StdDefs.h>
      29              : #include <utils/emissions/EnergyParams.h>
      30              : #include <utils/emissions/PollutantsInterface.h>
      31              : #include <utils/vehicle/SUMOVehicle.h>
      32              : #include <utils/foxtools/MFXOptionalLock.h>
      33              : #include "MSRoute.h"
      34              : #include "MSMoveReminder.h"
      35              : #include "MSVehicleType.h"
      36              : 
      37              : 
      38              : // ===========================================================================
      39              : // class declarations
      40              : // ===========================================================================
      41              : class MSLane;
      42              : class MSStop;
      43              : class MSDevice_Transportable;
      44              : class MSDevice_Emissions;
      45              : class MSVehicleDevice;
      46              : class MSEdgeWeightsStorage;
      47              : class MSChargingStation;
      48              : class StoppingPlaceMemory;
      49              : 
      50              : 
      51              : // ===========================================================================
      52              : // class definitions
      53              : // ===========================================================================
      54              : /**
      55              :  * @class MSBaseVehicle
      56              :  * @brief The base class for microscopic and mesoscopic vehicles
      57              :  */
      58              : class MSBaseVehicle : public SUMOVehicle {
      59              : public:
      60              :     // XXX: This definition was introduced to make the MSVehicle's previousSpeed
      61              :     //      available in the context of MSMoveReminder::notifyMove(). Another solution
      62              :     //      would be to modify notifyMove()'s interface to work with MSVehicle instead
      63              :     //      of SUMOVehicle (it is only called with MSVehicles!). Refs. #2579
      64              :     /** @brief Returns the vehicle's previous speed
      65              :      * @return The vehicle's speed
      66              :      */
      67              :     double getPreviousSpeed() const;
      68              : 
      69              :     friend class GUIBaseVehicle;
      70              : 
      71              :     /** @enum RouteValidity
      72              :      */
      73              :     enum RouteValidity {
      74              :         ROUTE_VALID = 0,
      75              :         ROUTE_UNCHECKED = 1 << 0,
      76              :         /// route was checked and is valid
      77              :         ROUTE_INVALID = 1 << 1,
      78              :         // starting edge permissions invalid (could change)
      79              :         ROUTE_START_INVALID_PERMISSIONS = 1 << 2,
      80              :         // insertion lane does not exist
      81              :         ROUTE_START_INVALID_LANE = 1 << 3
      82              :     };
      83              : 
      84              :     /** @brief Constructor
      85              :      * @param[in] pars The vehicle description
      86              :      * @param[in] route The vehicle's route
      87              :      * @param[in] type The vehicle's type
      88              :      * @param[in] speedFactor The factor for driven lane's speed limits
      89              :      * @exception ProcessError If a value is wrong
      90              :      */
      91              :     MSBaseVehicle(SUMOVehicleParameter* pars, ConstMSRoutePtr route,
      92              :                   MSVehicleType* type, const double speedFactor);
      93              : 
      94              : 
      95              :     /// @brief Destructor
      96              :     virtual ~MSBaseVehicle();
      97              : 
      98              :     virtual void initDevices();
      99              : 
     100    646786082 :     bool isVehicle() const {
     101    646786082 :         return true;
     102              :     }
     103              : 
     104              :     /// @brief set the id (inherited from Named but forbidden for vehicles)
     105              :     void setID(const std::string& newID);
     106              : 
     107              :     /** @brief Returns the vehicle's parameter (including departure definition)
     108              :      *
     109              :      * @return The vehicle's parameter
     110              :      */
     111              :     const SUMOVehicleParameter& getParameter() const;
     112              : 
     113              :     /// @brief retrieve parameters of devices, models and the vehicle itself
     114              :     std::string getPrefixedParameter(const std::string& key, std::string& error) const;
     115              : 
     116              :     /// @brief replace the vehicle parameter (deleting the old one)
     117              :     void replaceParameter(const SUMOVehicleParameter* newParameter);
     118              : 
     119              :     /// @brief check whether the vehicle is equiped with a device of the given name
     120              :     bool hasDevice(const std::string& deviceName) const;
     121              : 
     122              :     /// @brief create device of the given type
     123              :     void createDevice(const std::string& deviceName);
     124              : 
     125              :     /// @brief try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no device parameter by that name exists
     126              :     std::string getDeviceParameter(const std::string& deviceName, const std::string& key) const;
     127              : 
     128              :     /// @brief try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device parameter by that name exists
     129              :     void setDeviceParameter(const std::string& deviceName, const std::string& key, const std::string& value);
     130              : 
     131              :     /// @brief set individual junction model paramete (not type related)
     132              :     void setJunctionModelParameter(const std::string& key, const std::string& value);
     133              : 
     134              :     /// @brief set individual carFollow model parameters (not type related)
     135              :     void setCarFollowModelParameter(const std::string& key, const std::string& value);
     136              : 
     137              :     /** @brief Returns the current route
     138              :      * @return The route the vehicle uses
     139              :      */
     140     88633994 :     inline const MSRoute& getRoute() const {
     141     88633994 :         return *myRoute;
     142              :     }
     143              : 
     144              :     /** @brief Returns the current route
     145              :      * @return The route the vehicle uses
     146              :      */
     147      1186175 :     inline ConstMSRoutePtr getRoutePtr() const {
     148      1186175 :         return myRoute;
     149              :     }
     150              : 
     151              :     /** @brief Returns the vehicle's type definition
     152              :      * @return The vehicle's type definition
     153              :      */
     154  50779251030 :     inline const MSVehicleType& getVehicleType() const {
     155  50779251030 :         return *myType;
     156              :     }
     157              : 
     158              :     /** @brief Returns the vehicle's type parameter
     159              :      * @return The vehicle's type parameter
     160              :      */
     161     23603708 :     inline const SUMOVTypeParameter& getVTypeParameter() const {
     162     23603708 :         return myType->getParameter();
     163              :     }
     164              : 
     165              :     /** @brief Returns the vehicle's access class
     166              :      * @return The vehicle's access class
     167              :      */
     168  11111101748 :     inline SUMOVehicleClass getVClass() const {
     169  11111101748 :         return myType->getParameter().vehicleClass;
     170              :     }
     171              : 
     172              :     /** @brief Returns whether this object is ignoring transient permission
     173              :      * changes (during routing)
     174              :      */
     175              :     bool ignoreTransientPermissions() const;
     176              : 
     177              :     /// @brief whether instant stopping is permitted
     178         5406 :     virtual bool instantStopping() const {
     179         5406 :         return false;
     180              :     }
     181              : 
     182              :     /** @brief Returns the maximum speed (the minimum of desired and technical maximum speed)
     183              :      * @return The vehicle's maximum speed
     184              :      */
     185              :     double getMaxSpeed() const;
     186              : 
     187              :     /** @brief Returns the nSuccs'th successor of edge the vehicle is currently at
     188              :      *
     189              :      * If the rest of the route (counted from the current edge) has less than nSuccs edges,
     190              :      *  0 is returned.
     191              :      * @param[in] nSuccs The number of edge to look forward
     192              :      * @return The nSuccs'th following edge in the vehicle's route
     193              :      */
     194              :     const MSEdge* succEdge(int nSuccs) const;
     195              : 
     196              :     /** @brief Returns the edge the vehicle is currently at
     197              :      *
     198              :      * @return The current edge in the vehicle's route
     199              :      */
     200              :     const MSEdge* getEdge() const;
     201              : 
     202              :     /** @brief Returns the edge the vehicle is currently at (possibly an
     203              :      * internal edge)
     204              :      */
     205            0 :     virtual const MSEdge* getCurrentEdge() const {
     206            0 :         return getEdge();
     207              :     }
     208              : 
     209              :     /// @brief returns the numerical ids of edges to travel
     210              :     const std::set<SUMOTrafficObject::NumericalID> getUpcomingEdgeIDs() const;
     211              : 
     212              :     /** @brief Returns whether the vehicle stops at the given stopping place */
     213              :     bool stopsAt(MSStoppingPlace* stop) const;
     214              : 
     215              :     /** @brief Returns whether the vehicle stops at the given edge */
     216              :     bool stopsAtEdge(const MSEdge* edge) const;
     217              : 
     218              :     /// @brief returns the next edge (possibly an internal edge)
     219            0 :     virtual const MSEdge* getNextEdgePtr() const {
     220            0 :         return nullptr;
     221              :     }
     222              : 
     223              :     /** @brief Returns the information whether the vehicle is on a road (is simulated)
     224              :      * @return Whether the vehicle is simulated
     225              :      */
     226            0 :     virtual bool isOnRoad() const {
     227            0 :         return true;
     228              :     }
     229              : 
     230              :     /** @brief Returns the information whether the vehicle is fully controlled
     231              :      * via TraCI
     232              :      * @return Whether the vehicle is remote-controlled
     233              :      */
     234        54621 :     virtual bool isRemoteControlled() const {
     235        54621 :         return false;
     236              :     }
     237              : 
     238         5696 :     virtual bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const {
     239              :         UNUSED_PARAMETER(lookBack);
     240         5696 :         return false;
     241              :     }
     242              : 
     243              :     /** @brief Returns the information whether the front of the vehhicle is on the given lane
     244              :      * @return Whether the vehicle's front is on that lane
     245              :      */
     246            0 :     virtual bool isFrontOnLane(const MSLane*) const {
     247            0 :         return true;
     248              :     }
     249              : 
     250              :     /** @brief Get the vehicle's lateral position on the lane
     251              :      * @return The lateral position of the vehicle (in m relative to the
     252              :      * centerline of the lane)
     253              :      */
     254           22 :     virtual double getLateralPositionOnLane() const {
     255           22 :         return 0;
     256              :     }
     257              : 
     258              :     /** @brief Get the vehicle's lateral position on the edge of the given lane
     259              :      * (or its current edge if lane == 0)
     260              :      * @return The lateral position of the vehicle (in m distance between right
     261              :      * side of vehicle and ride side of edge
     262              :      */
     263            0 :     virtual double getRightSideOnEdge(const MSLane* lane = 0) const {
     264              :         UNUSED_PARAMETER(lane);
     265            0 :         return 0;
     266              :     }
     267              : 
     268              :     /** @brief Returns the starting point for reroutes (usually the current edge)
     269              :      *
     270              :      * This differs from *myCurrEdge only if the vehicle is on an internal edge
     271              :      * @return The rerouting start point
     272              :      */
     273        42251 :     virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const {
     274        42251 :         return myCurrEdge;
     275              :     }
     276              : 
     277              :     /** @brief Returns the end point for reroutes (usually the last edge of the route)
     278              :      *
     279              :      * @return The rerouting end point
     280              :      */
     281       635791 :     virtual const MSEdge* getRerouteDestination() const {
     282       635791 :         return myRoute->getLastEdge();
     283              :     }
     284              : 
     285              :     /** @brief Returns the time loss in seconds
     286              :      */
     287           11 :     virtual double getTimeLossSeconds() const {
     288              :         // better timeLoss for meso?
     289           11 :         return 0;
     290              :     }
     291              : 
     292              :     /** @brief Returns the number of seconds waited (speed was lesser than 0.1m/s)
     293              :      *
     294              :      * The value is reset if the vehicle moves faster than 0.1m/s
     295              :      * Intentional stopping does not count towards this time.
     296              :      * @return The time the vehicle is standing
     297              :      */
     298            0 :     double getWaitingSeconds() const {
     299     47918917 :         return STEPS2TIME(getWaitingTime());
     300              :     }
     301              : 
     302              : 
     303              : 
     304              :     /** @brief Returns an iterator pointing to the current edge in this vehicles route
     305              :      * @return The current route pointer
     306              :      */
     307     14260475 :     const MSRouteIterator& getCurrentRouteEdge() const {
     308     14260475 :         return myCurrEdge;
     309              :     }
     310              : 
     311              : 
     312              :     /** @brief Performs a rerouting using the given router
     313              :      *
     314              :      * Tries to find a new route between the current edge and the destination edge, first.
     315              :      * Tries to replace the current route by the new one using replaceRoute.
     316              :      *
     317              :      * @param[in] t The time for which the route is computed
     318              :      * @param[in] router The router to use
     319              :      * @param[in] sink (optionally) a new destination edge
     320              :      * @see replaceRoute
     321              :      */
     322              :     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);
     323              : 
     324              : 
     325              :     /** @brief Replaces the current route by the given edges
     326              :      *
     327              :      * It is possible that the new route is not accepted, if a) it does not
     328              :      *  contain the vehicle's current edge, or b) something fails on insertion
     329              :      *  into the routes container (see in-line comments).
     330              :      *
     331              :      * @param[in] edges The new list of edges to pass
     332              :      * @param[in] onInit Whether the vehicle starts with this route
     333              :      * @param[in] check Whether the route should be checked for validity
     334              :      * @param[in] removeStops Whether stops should be removed if they do not fit onto the new route
     335              :      * @return Whether the new route was accepted
     336              :      */
     337              :     bool replaceRouteEdges(ConstMSEdgeVector& edges, double cost, double savings, const std::string& info, bool onInit = false, bool check = false, bool removeStops = true,
     338              :                            std::string* msgReturn = nullptr);
     339              : 
     340              :     /** @brief Replaces the current route by the given one
     341              :      *
     342              :      * It is possible that the new route is not accepted, if it does not
     343              :      *  contain the vehicle's current edge.
     344              :      *
     345              :      * @param[in] route The new route to pass
     346              :      * @param[in] info Information regarding the replacement
     347              :      * @param[in] addRouteStops Whether stops from the replacement route should be added
     348              :      * @param[in] removeStops Whether stops should be removed if they do not fit onto the new route
     349              :      * @return Whether the new route was accepted
     350              :      */
     351              :     virtual bool replaceRoute(ConstMSRoutePtr route, const std::string& info, bool onInit = false, int offset = 0, bool addRouteStops = true, bool removeStops = true,
     352              :                               std::string* msgReturn = nullptr);
     353              : 
     354              :     /** @brief Returns the vehicle's acceleration
     355              :      *
     356              :      * This default implementation returns always 0.
     357              :      * @return The acceleration
     358              :      */
     359              :     virtual double getAcceleration() const;
     360              : 
     361              :     /** @brief Called when the vehicle is inserted into the network
     362              :      *
     363              :      * Sets optional information about departure time, informs the vehicle
     364              :      *  control about a further running vehicle.
     365              :      */
     366              :     void onDepart();
     367              : 
     368              :     /** @brief Returns this vehicle's real departure time
     369              :      * @return This vehicle's real departure time
     370              :      */
     371     13623940 :     inline SUMOTime getDeparture() const {
     372     13623940 :         return myDeparture;
     373              :     }
     374              : 
     375              :     /** @brief Returns the depart delay */
     376              :     SUMOTime getDepartDelay() const;
     377              : 
     378              :     /** @brief Returns the estimated public transport stop (departure) delay in seconds
     379              :      */
     380          332 :     virtual double getStopDelay() const {
     381              :         /// @todo implement for meso
     382          332 :         return -1;
     383              :     }
     384              : 
     385              :     /** @brief Returns the estimated public transport stop arrival delay in seconds
     386              :      */
     387         1798 :     virtual double getStopArrivalDelay() const {
     388              :         /// @todo implement for meso
     389         1798 :         return INVALID_DOUBLE;
     390              :     }
     391              : 
     392              :     /// @brief return time (s) and distance to the next stop
     393            5 :     virtual std::pair<double, double> estimateTimeToNextStop() const {
     394            5 :         return std::make_pair(-1, -1);
     395              :     }
     396              : 
     397              :     /** @brief Returns this vehicle's real departure position
     398              :      * @return This vehicle's real departure position
     399              :      */
     400       247094 :     inline double getDepartPos() const {
     401       247094 :         return myDepartPos;
     402              :     }
     403              : 
     404              :     /** @brief Returns this vehicle's desired arrivalPos for its current route
     405              :      * (may change on reroute)
     406              :      * @return This vehicle's real arrivalPos
     407              :      */
     408      1770322 :     virtual double getArrivalPos() const {
     409      1770322 :         return myArrivalPos;
     410              :     }
     411              : 
     412            0 :     virtual int getArrivalLane() const {
     413            0 :         return myArrivalLane;
     414              :     }
     415              : 
     416              :     /** @brief Sets this vehicle's desired arrivalPos for its current route
     417              :      */
     418         1621 :     virtual void setArrivalPos(double arrivalPos) {
     419         1621 :         myArrivalPos = arrivalPos;
     420         1621 :     }
     421              : 
     422              :     /** @brief Called when the vehicle is removed from the network.
     423              :      *
     424              :      * Moves along work reminders and
     425              :      *  informs all devices about quitting. Calls "leaveLane" then.
     426              :      *
     427              :      * @param[in] reason why the vehicle leaves (reached its destination, parking, teleport)
     428              :      */
     429            0 :     virtual void onRemovalFromNet(const MSMoveReminder::Notification /*reason*/) {}
     430              : 
     431              :     /** @brief Returns whether this vehicle has already departed
     432              :      */
     433     25256331 :     inline bool hasDeparted() const {
     434     25256331 :         return myDeparture != NOT_YET_DEPARTED;
     435              :     }
     436              : 
     437              :     /** @brief Returns whether this vehicle has already arived
     438              :      * (by default this is true if the vehicle has reached its final edge)
     439              :      */
     440              :     virtual bool hasArrived() const;
     441              : 
     442              :     /// @brief return index of edge within route
     443              :     int getRoutePosition() const;
     444              : 
     445              :     /// @brief return the number of edges remaining in the route (include the current)
     446              :     int getNumRemainingEdges() const;
     447              : 
     448              :     int getArrivalIndex() const {
     449              :         return myParameter->arrivalEdge;
     450              :     }
     451              : 
     452              :     /// @brief reset index of edge within route
     453              :     void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure);
     454              : 
     455              :     /** @brief Returns the distance that was already driven by this vehicle
     456              :      * @return the distance driven [m]
     457              :      */
     458              :     double getOdometer() const;
     459              : 
     460              :     /// @brief Manipulate the odometer
     461              :     void addToOdometer(double value) {
     462           73 :         myOdometer += value;
     463           21 :     }
     464              : 
     465              :     /** @brief Returns the number of new routes this vehicle got
     466              :      * @return the number of new routes this vehicle got
     467              :      */
     468       366402 :     inline int getNumberReroutes() const {
     469       366402 :         return myNumberReroutes;
     470              :     }
     471              : 
     472              :     /// @brief Returns this vehicles impatience
     473              :     double getImpatience() const;
     474              : 
     475              :     /** @brief Returns the number of persons
     476              :      * @return The number of passengers on-board
     477              :      */
     478              :     int getPersonNumber() const;
     479              : 
     480              :     /** @brief Returns the number of leaving persons
     481              :      * @return The number of leaving passengers
     482              :      */
     483              :     int getLeavingPersonNumber() const;
     484              : 
     485              :     /** @brief Returns the list of persons
     486              :      * @return The list of passengers on-board
     487              :      */
     488              :     std::vector<std::string> getPersonIDList() const;
     489              : 
     490              :     /** @brief Returns the number of containers
     491              :      * @return The number of contaiers on-board
     492              :      */
     493              :     int getContainerNumber() const;
     494              : 
     495              : 
     496              :     /** @brief Returns this vehicle's devices
     497              :      * @return This vehicle's devices
     498              :      */
     499      4266761 :     inline const std::vector<MSVehicleDevice*>& getDevices() const {
     500      4266761 :         return myDevices;
     501              :     }
     502              : 
     503              :     /// @brief whether the given transportable is allowed to board this vehicle
     504              :     bool allowsBoarding(const MSTransportable* t) const;
     505              : 
     506              :     /** @brief Adds a person or container to this vehicle
     507              :      *
     508              :      * @param[in] transportable The person/container to add
     509              :      */
     510              :     virtual void addTransportable(MSTransportable* transportable);
     511              : 
     512              :     /// @brief init device during state loading
     513              :     void initTransportableDevice(bool isPerson);
     514              : 
     515              :     /// @brief removes a person or container
     516              :     void removeTransportable(MSTransportable* t);
     517              : 
     518              :     /// @brief removes a person or containers mass
     519              :     void removeTransportableMass(MSTransportable* t);
     520              : 
     521              :     /// @brief retrieve riding persons
     522              :     const std::vector<MSTransportable*>& getPersons() const;
     523              : 
     524              :     /// @brief retrieve riding containers
     525              :     const std::vector<MSTransportable*>& getContainers() const;
     526              : 
     527              :     /// @brief returns whether the vehicle serves a public transport line that serves the given stop
     528              :     bool isLineStop(double position) const;
     529              : 
     530              :     /// @brief check wether the vehicle has jump at the given part of its route
     531              :     bool hasJump(const MSRouteIterator& it) const;
     532              : 
     533              :     /** @brief Validates the current or given route
     534              :      * @param[out] msg Description why the route is not valid (if it is the case)
     535              :      * @param[in] route The route to check (or 0 if the current route shall be checked)
     536              :      * @return Whether the vehicle's current route is valid
     537              :      */
     538              :     bool hasValidRoute(std::string& msg, ConstMSRoutePtr route = 0) const;
     539              : 
     540              :     bool hasValidRoute(std::string& msg, MSRouteIterator start, MSRouteIterator last, bool checkJumps) const;
     541              : 
     542              :     /// @brief checks wether the vehicle can depart on the first edge
     543              :     virtual bool hasValidRouteStart(std::string& msg);
     544              : 
     545              :     /// @brief check for route validity at first insertion attempt
     546              :     int getRouteValidity(bool update = true, bool silent = false, std::string* msgReturn = nullptr);
     547              : 
     548              :     /// @brief Checks whether the vehilce has the given MoveReminder
     549              :     bool hasReminder(MSMoveReminder* rem) const;
     550              : 
     551              :     /** @brief Adds a MoveReminder dynamically
     552              :      *
     553              :      * @param[in] rem the reminder to add
     554              :      * @see MSMoveReminder
     555              :      */
     556              :     void addReminder(MSMoveReminder* rem, double pos = 0);
     557              : 
     558              :     /** @brief Removes a MoveReminder dynamically
     559              :      *
     560              :      * @param[in] rem the reminder to remove
     561              :      * @see MSMoveReminder
     562              :      */
     563              :     void removeReminder(MSMoveReminder* rem);
     564              : 
     565              :     /** @brief "Activates" all current move reminder
     566              :      *
     567              :      * For all move reminder stored in "myMoveReminders", their method
     568              :      *  "MSMoveReminder::notifyEnter" is called.
     569              :      *
     570              :      * @param[in] reason The reason for changing the reminders' states
     571              :      * @param[in] enteredLane The lane, which is entered (if applicable)
     572              :      * @see MSMoveReminder
     573              :      * @see MSMoveReminder::notifyEnter
     574              :      * @see MSMoveReminder::Notification
     575              :      */
     576              :     virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
     577              : 
     578              : 
     579              :     /** @brief Returns the vehicle's length
     580              :      * @return vehicle's length
     581              :      */
     582    852453889 :     inline double getLength() const {
     583    852453889 :         return myType->getLength();
     584              :     }
     585              : 
     586              :     /* @brief Return whether this vehicle must be treated like a railway vehicle
     587              :      * either due to its vClass or the vClass of it's edge */
     588              :     bool isRail() const;
     589              : 
     590              :     /** @brief Returns the vehicle's width
     591              :      * @return vehicle's width
     592              :      */
     593              :     inline double getWidth() const {
     594     80393228 :         return myType->getWidth();
     595              :     }
     596              : 
     597              : 
     598              :     /** @brief Returns the precomputed factor by which the driver wants to be faster than the speed limit
     599              :      * @return Speed limit factor
     600              :      */
     601   7435925893 :     inline double getChosenSpeedFactor() const {
     602   7435925893 :         return myChosenSpeedFactor;
     603              :     }
     604              : 
     605              :     inline double getDesiredMaxSpeed() const {
     606    629460017 :         return myType->getDesiredMaxSpeed() * myChosenSpeedFactor;
     607              :     }
     608              : 
     609              :     /** @brief Returns the precomputed factor by which the driver wants to be faster than the speed limit
     610              :      * @return Speed limit factor
     611              :      */
     612        36698 :     inline void setChosenSpeedFactor(const double factor) {
     613        36698 :         myChosenSpeedFactor = factor;
     614        36698 :     }
     615              : 
     616              :     /// @brief Returns a device of the given type if it exists, nullptr otherwise
     617              :     MSDevice* getDevice(const std::type_info& type) const;
     618              : 
     619              : 
     620              :     /** @brief Replaces the current vehicle type by the one given
     621              :      *
     622              :      * If the currently used vehicle type is marked as being used by this vehicle
     623              :      *  only, it is deleted, first. The new, given type is then assigned to
     624              :      *  "myType".
     625              :      * @param[in] type The new vehicle type
     626              :      * @see MSBaseVehicle::myType
     627              :      */
     628              :     virtual void replaceVehicleType(const MSVehicleType* type);
     629              : 
     630        19506 :     virtual std::unique_ptr<MFXOptionalLock> getScopeLock() {
     631        19506 :         return std::unique_ptr<MFXOptionalLock>(new MFXNoOpLock());
     632              :     }
     633              : 
     634              :     /** @brief Replaces the current vehicle type with a new one used by this vehicle only
     635              :      *
     636              :      * If the currently used vehicle type is already marked as being used by this vehicle
     637              :      *  only, no new type is created.
     638              :      * @return The new modifiable vehicle type
     639              :      * @see MSBaseVehicle::myType
     640              :      */
     641              :     MSVehicleType& getSingularType();
     642              : 
     643              :     /// @name state io
     644              :     //@{
     645              : 
     646              :     /// Saves the (common) state of a vehicle
     647              :     virtual void saveState(OutputDevice& out);
     648              : 
     649              :     //@}
     650              : 
     651              :     virtual bool handleCollisionStop(MSStop& stop, const double distToStop);
     652              : 
     653              :     /** @brief Returns whether the vehicle is at a stop
     654              :      * @return Whether the vehicle has stopped
     655              :      */
     656              :     bool isStopped() const;
     657              : 
     658              :     /** @brief Returns whether the vehicle is parking
     659              :      * @return whether the vehicle is parking
     660              :      */
     661              :     bool isParking() const;
     662              : 
     663              :     /** @brief Returns whether the vehicle is perform a jump
     664              :      * @return whether the vehicle is starting to jump
     665              :      */
     666              :     bool isJumping() const;
     667              : 
     668              :     /** @brief Returns whether the logical state of the vehicle is reversed - for drawing
     669              :     * @return whether the logical state of the vehicle is reversed
     670              :     */
     671              :     inline bool isReversed() const {
     672     14606048 :         return myAmReversed;
     673              :     }
     674              : 
     675              :     /** @brief Returns whether the vehicle is on a triggered stop
     676              :      * @return whether the vehicle is on a triggered stop
     677              :      */
     678              :     bool isStoppedTriggered() const;
     679              : 
     680              :     /** @brief Returns whether the vehicle is on a parking stop
     681              :      * @return whether the vehicle is on a parking stop
     682              :      */
     683              :     bool isStoppedParking() const;
     684              : 
     685              :     /** @brief return whether the given position is within range of the current stop
     686              :      */
     687              :     bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture = false) const;
     688              : 
     689              :     /** @brief Returns whether the vehicle has to stop somewhere
     690              :      * @return Whether the vehicle has to stop somewhere
     691              :      */
     692   1656349386 :     bool hasStops() const {
     693   1656349386 :         return !myStops.empty();
     694              :     }
     695              : 
     696              : 
     697              :     /// @brief unregisters from a parking reservation when changing or skipping stops
     698              :     void cleanupParkingReservation();
     699              : 
     700              :     /** @brief replace the current parking area stop with a new stop with merge duration
     701              :      */
     702              :     bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
     703              : 
     704              :     /** @brief get the upcoming parking area stop or nullptr
     705              :      */
     706              :     MSParkingArea* getNextParkingArea();
     707              : 
     708              :     /** @brief get the current  parking area stop or nullptr */
     709              :     MSParkingArea* getCurrentParkingArea();
     710              : 
     711              :     /// @brief get the valid parking access rights (vehicle settings override vehicle type settings)
     712              :     const std::vector<std::string>& getParkingBadges() const;
     713              : 
     714              :     /// @brief departure position where the vehicle fits fully onto the edge (if possible)
     715              :     double basePos(const MSEdge* edge) const;
     716              : 
     717              :     /** @brief Adds a stop
     718              :      *
     719              :      * The stop is put into the sorted list.
     720              :      * @param[in] stop The stop to add
     721              :      * @return Whether the stop could be added
     722              :      */
     723              :     bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0,
     724              :                  MSRouteIterator* searchStart = nullptr);
     725              : 
     726              :     /** @brief Adds stops to the built vehicle
     727              :      *
     728              :      * This code needs to be separated from the MSBaseVehicle constructor
     729              :      *  since it is not allowed to call virtual functions from a constructor
     730              :      *
     731              :      * @param[in] ignoreStopErrors whether invalid stops trigger a warning only
     732              :      */
     733              :     void addStops(const bool ignoreStopErrors, MSRouteIterator* searchStart = nullptr, bool addRouteStops = true);
     734              : 
     735              :     /// @brief check whether all stop.edge MSRouteIterators are valid and in order
     736              :     bool haveValidStopEdges(bool silent = false) const;
     737              : 
     738              :     /// @brief return list of route indices for the remaining stops
     739              :     std::vector<std::pair<int, double> > getStopIndices() const;
     740              : 
     741              :     /**
     742              :     * returns the list of stops not yet reached in the stop queue
     743              :     * @return the list of upcoming stops
     744              :     */
     745      3557945 :     inline const std::list<MSStop>& getStops() const {
     746      3557945 :         return myStops;
     747              :     }
     748              : 
     749              :     inline const StopParVector& getPastStops() const {
     750              :         return myPastStops;
     751              :     }
     752              : 
     753              :     /**
     754              :     * returns the next imminent stop in the stop queue
     755              :     * @return the upcoming stop
     756              :     */
     757              :     const MSStop& getNextStop() const;
     758              : 
     759              :     /**
     760              :     * returns the next imminent stop in the stop queue
     761              :     * @return the upcoming stop
     762              :     */
     763              :     MSStop& getNextStopMutable();
     764              : 
     765              :     /// @brief get remaining stop duration or 0 if the vehicle isn't stopped
     766              :     SUMOTime getStopDuration() const;
     767              : 
     768              :     /**
     769              :     * returns the upcoming stop with the given index in the stop queue
     770              :     * @return an upcoming stop
     771              :     */
     772              :     MSStop& getStop(int nextStopIndex);
     773              : 
     774              :     /// @brief return parameters for the next stop (SUMOVehicle Interface)
     775              :     const SUMOVehicleParameter::Stop* getNextStopParameter() const;
     776              : 
     777              :     /**
     778              :      * schedule a new stop for the vehicle; each time a stop is reached, the vehicle
     779              :      * will wait for the given duration before continuing on its route
     780              :      * @param[in] stop Stop parameters
     781              :      * @param[out] errorMsg returned error message
     782              :      */
     783              :     virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
     784              : 
     785              :     /**
     786              :     * resumes a vehicle from stopping
     787              :     * @return true on success, the resuming fails if the vehicle wasn't parking in the first place
     788              :     */
     789              :     virtual bool resumeFromStopping() = 0;
     790              : 
     791              :     /// @brief mark vehicle as active
     792              :     void unregisterWaiting();
     793              : 
     794              :     /// @brief deletes the next stop at the given index if it exists
     795              :     bool abortNextStop(int nextStopIndex = 0);
     796              : 
     797              :     /**
     798              :      * replace the next stop at the given index with the given stop parameters
     799              :      * will wait for the given duration before continuing on its route
     800              :      * The route between start other stops and destination will be kept unchanged and
     801              :      * only the part around the replacement index will be adapted according to the new stop location
     802              :      * @param[in] nextStopIndex The replacement index
     803              :      * @param[in] stop Stop parameters
     804              :      * @param[in] info The rerouting info
     805              :      * @param[in] teleport Whether to cover the route to the replacement stop via teleporting
     806              :      * @param[out] errorMsg returned error message
     807              :      */
     808              :     bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
     809              : 
     810              :     /**
     811              :      * reroute between stops nextStopIndex - 1 and nextStopIndex (defaults to current position / final edge) if the respective stops do not exist
     812              :      * @param[in] nextStopIndex The replacement index
     813              :      * @param[in] info The rerouting info
     814              :      * @param[in] teleport Whether to cover the route between stops via teleporting
     815              :      * @param[out] errorMsg returned error message
     816              :      */
     817              :     bool rerouteBetweenStops(int nextStopIndex, const std::string& info, bool teleport, std::string& errorMsg);
     818              : 
     819              :     /**
     820              :      * insert stop at the given index with the given stop parameters
     821              :      * will wait for the given duration before continuing on its route
     822              :      * The route will be adapted to pass the new stop edge but only from the previous stop (or start) to the new stop and only up to the next stop (or end).
     823              :      * @param[in] nextStopIndex The replacement index
     824              :      * @param[in] stop Stop parameters
     825              :      * @param[in] info The rerouting info
     826              :      * @param[in] teleport Whether to cover the route to the new stop via teleporting
     827              :      * @param[out] errorMsg returned error message
     828              :      */
     829              :     bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
     830              : 
     831              : 
     832              :     /// @brief whether this vehicle is selected in the GUI
     833    261188165 :     virtual bool isSelected() const {
     834    261188165 :         return false;
     835              :     }
     836              : 
     837           35 :     virtual void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0) {
     838              :         UNUSED_PARAMETER(forceRebuild);
     839              :         UNUSED_PARAMETER(startLane);
     840           35 :     }
     841              : 
     842              :     /// @brief @return The index of the vehicle's associated RNG
     843              :     int getRNGIndex() const;
     844              : 
     845              :     /// @brief @return The vehicle's associated RNG
     846              :     SumoRNG* getRNG() const;
     847              : 
     848  27877632241 :     inline NumericalID getNumericalID() const {
     849  27877632241 :         return myNumericalID;
     850              :     }
     851              : 
     852              :     /// @brief return vehicle-specific random number
     853       192273 :     long long int getRandomSeed() const {
     854       192273 :         return myRandomSeed;
     855              :     }
     856              : 
     857              :     const MSDevice_Transportable* getPersonDevice() const {
     858     14609878 :         return myPersonDevice;
     859              :     }
     860              : 
     861              :     const MSDevice_Transportable* getContainerDevice() const {
     862     14609878 :         return myContainerDevice;
     863              :     }
     864              : 
     865              :     /// @brief retrieve parameters for the energy consumption model
     866              :     EnergyParams* getEmissionParameters() const;
     867              : 
     868              :     /// @name Emission retrieval
     869              :     //@{
     870              : 
     871              :     /** @brief Returns emissions of the current state
     872              :      * The value is always per 1s, so multiply by step length if necessary.
     873              :      * @return The current emission
     874              :      */
     875              :     template<PollutantsInterface::EmissionType ET>
     876         6032 :     double getEmissions() const {
     877         6032 :         if (isOnRoad() || isIdling()) {
     878         5960 :             return PollutantsInterface::compute(myType->getEmissionClass(), ET, getSpeed(), getAcceleration(), getSlope(), getEmissionParameters());
     879              :         }
     880              :         return 0.;
     881              :     }
     882              : 
     883              :     /** @brief Returns actual state of charge of battery (Wh)
     884              :     * RICE_CHECK: This may be a misnomer, SOC is typically percentage of the maximum battery capacity.
     885              :     * @return The actual battery state of charge
     886              :     */
     887              :     double getStateOfCharge() const;
     888              : 
     889              :     /** @brief Returns actual relative state of charge of battery (-)
     890              :     * @return The actual relative battery state of charge, normalised to the maximum battery capacity.
     891              :     */
     892              :     double getRelativeStateOfCharge() const;
     893              : 
     894              :     /** @brief Returns the energy charged to the battery in the current time step (Wh)
     895              :     * @return The energy charged to the battery in the current time step.
     896              :     */
     897              :     double getChargedEnergy() const;
     898              : 
     899              :     /** @brief Returns the maximum charge rate allowed by the battery in the current time step (W)
     900              :     * @return The maximum charge rate in the current time step.
     901              :     */
     902              :     double getMaxChargeRate() const;
     903              : 
     904              :     /** @brief Returns actual current (A) of ElecHybrid device
     905              :     * RICE_CHECK: Is this the current consumed from the overhead wire or the current driving the powertrain of the vehicle?
     906              :     * RICE_REV_JS: It is the current drawn from the overhead wire (value if the vehicle is not connected to overhead wire?)
     907              :     * @return The current of ElecHybrid device
     908              :     */
     909              :     double getElecHybridCurrent() const;
     910              : 
     911              :     /** @brief Returns noise emissions of the current state
     912              :      * @return The noise produced
     913              :      */
     914              :     double getHarmonoise_NoiseEmissions() const;
     915              :     //@}
     916              : 
     917              :     /** @class Influencer
     918              :       * @brief Changes the wished vehicle speed / lanes
     919              :       *
     920              :       * The class is used for passing velocities or velocity profiles obtained via TraCI to the vehicle.
     921              :       * The speed adaptation is controlled by the stored speedTimeLine
     922              :       * Additionally, the variables myConsiderSafeVelocity, myConsiderMaxAcceleration, and myConsiderMaxDeceleration
     923              :       * control whether the safe velocity, the maximum acceleration, and the maximum deceleration
     924              :       * have to be regarded.
     925              :       *
     926              :       * Furthermore this class is used to affect lane changing decisions according to
     927              :       * LaneChangeMode and any given laneTimeLine
     928              :       */
     929              :     class BaseInfluencer {
     930              :     public:
     931              :         /// @brief Constructor
     932              :         BaseInfluencer();
     933              : 
     934              :         /// @brief Destructor
     935            0 :         virtual ~BaseInfluencer() {}
     936              : 
     937              :         /// @brief Static initalization
     938              :         static void init();
     939              :         /// @brief Static cleanup
     940              :         static void cleanup();
     941              : 
     942              : 
     943              :         /// @brief return the current routing mode
     944              :         double getExtraImpatience() const {
     945       234550 :             return myExtraImpatience;
     946              :         }
     947              : 
     948              :         /** @brief Sets routing behavior
     949              :          * @param[in] value an enum value controlling the different modes
     950              :          */
     951              :         void setExtraImpatience(double value) {
     952       271397 :             myExtraImpatience = value;
     953       271370 :         }
     954              : 
     955              :     protected:
     956              :         /// @brief dynamic impatience offset
     957              :         double myExtraImpatience = 0;
     958              : 
     959              :     };
     960              : 
     961              : 
     962              : 
     963              :     /** @brief Returns the velocity/lane influencer
     964              :      *
     965              :      * If no influencer was existing before, one is built, first
     966              :      * @return Reference to this vehicle's speed influencer
     967              :      */
     968              :     virtual BaseInfluencer& getBaseInfluencer() = 0;
     969              : 
     970              :     virtual const BaseInfluencer* getBaseInfluencer() const = 0;
     971              : 
     972              :     virtual bool hasInfluencer() const  = 0;
     973              : 
     974              :     /// @brief return routing mode (configures router choice but also handling of transient permission changes)
     975   2908178948 :     int getRoutingMode() const {
     976   2908178948 :         return myRoutingMode;
     977              :     }
     978              : 
     979              :     /** @brief Sets routing behavior
     980              :      * @param[in] value an enum value controlling the different modes
     981              :      */
     982              :     void setRoutingMode(int value) {
     983         6004 :         myRoutingMode = value;
     984          114 :     }
     985              : 
     986              : 
     987              :     SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterTT() const;
     988              : 
     989              :     /** @brief Returns the vehicle's internal edge travel times/efforts container
     990              :      *
     991              :      * If the vehicle does not have such a container, it is built.
     992              :      * @return The vehicle's knowledge about edge weights
     993              :      */
     994              :     const MSEdgeWeightsStorage& getWeightsStorage() const;
     995              :     MSEdgeWeightsStorage& getWeightsStorage();
     996              : 
     997              :     /** @brief Returns the leader of the vehicle looking for a fixed distance.
     998              :      *
     999              :      * If the distance is not given it is calculated from the brake gap.
    1000              :      * The gap returned does not include the minGap.
    1001              :      * @param dist    up to which distance to look at least for a leader
    1002              :      * @param considerCrossingFoes Whether vehicles on crossing foe links should be considered
    1003              :      * @return The leading vehicle together with the gap; (0, -1) if no leader was found.
    1004              :      */
    1005          872 :     virtual std::pair<const MSVehicle* const, double> getLeader(double dist = 0, bool considerCrossingFoes = true) const {
    1006              :         UNUSED_PARAMETER(dist);
    1007              :         UNUSED_PARAMETER(considerCrossingFoes);
    1008          872 :         WRITE_WARNING(TL("getLeader not yet implemented for meso"));
    1009          872 :         return std::make_pair(nullptr, -1);
    1010              :     }
    1011              : 
    1012              :     /** @brief Returns the follower of the vehicle looking for a fixed distance.
    1013              :      *
    1014              :      * If the distance is not given it is set to the value of MSCFModel::brakeGap(2*roadSpeed, 4.5, 0)
    1015              :      * The gap returned does not include the minGap.
    1016              :      * If there are multiple followers, the one that maximizes the term (getSecureGap - gap) is returned.
    1017              :      * @param dist    up to which distance to look at least for a leader
    1018              :      * @return The leading vehicle together with the gap; (0, -1) if no leader was found.
    1019              :      */
    1020           56 :     virtual std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const {
    1021              :         UNUSED_PARAMETER(dist);
    1022           56 :         WRITE_WARNING(TL("getFollower not yet implemented for meso"));
    1023           56 :         return std::make_pair(nullptr, -1);
    1024              :     }
    1025              : 
    1026              :     /** @brief (Re-)Calculates the arrival position and lane from the vehicle parameters
    1027              :      */
    1028              :     void calculateArrivalParams(bool onInit);
    1029              : 
    1030              :     /// @brief apply departEdge and arrivalEdge attributes
    1031              :     void setDepartAndArrivalEdge();
    1032              : 
    1033              :     int getDepartEdge() const;
    1034              : 
    1035              :     int getInsertionChecks() const;
    1036              : 
    1037              :     /// @brief interpret stop lane on opposite side of the road
    1038              :     static MSLane* interpretOppositeStop(SUMOVehicleParameter::Stop& stop);
    1039              : 
    1040              :     /// @name state io
    1041              :     //@{
    1042              :     void rememberBlockedParkingArea(const MSStoppingPlace* pa, bool local);
    1043              :     SUMOTime sawBlockedParkingArea(const MSStoppingPlace* pa, bool local) const;
    1044              :     void rememberBlockedChargingStation(const MSStoppingPlace* cs, bool local);
    1045              :     SUMOTime sawBlockedChargingStation(const MSStoppingPlace* cs, bool local) const;
    1046              : 
    1047              :     /// @brief score only needed when running with gui
    1048              :     void rememberParkingAreaScore(const MSStoppingPlace* pa, const std::string& score);
    1049              :     void resetParkingAreaScores();
    1050              :     void rememberChargingStationScore(const MSStoppingPlace* cs, const std::string& score);
    1051              :     void resetChargingStationScores();
    1052              : 
    1053        68677 :     int getNumberParkingReroutes() const {
    1054        68677 :         return myNumberParkingReroutes;
    1055              :     }
    1056        39415 :     void setNumberParkingReroutes(int value) {
    1057        39415 :         myNumberParkingReroutes = value;
    1058        39415 :     }
    1059              : 
    1060              :     const StoppingPlaceMemory* getParkingMemory() const {
    1061           65 :         return myParkingMemory;
    1062              :     }
    1063              : 
    1064              :     const StoppingPlaceMemory* getChargingMemory() const {
    1065          127 :         return myChargingMemory;
    1066              :     }
    1067              :     //@}
    1068              : 
    1069      5840339 :     struct StopEdgeInfo {
    1070              : 
    1071      2900354 :         StopEdgeInfo(const MSEdge* _edge, double _priority, SUMOTime _arrival, double _pos, bool _isSink = false):
    1072      2900354 :             edge(_edge), pos(_pos),
    1073      2900354 :             priority(_priority),
    1074      2900354 :             arrival(_arrival),
    1075      2900354 :             isSink(_isSink) {}
    1076              : 
    1077              :         const MSEdge* edge;
    1078              :         double pos;
    1079              :         double priority;
    1080              :         SUMOTime arrival;
    1081              :         bool isSink;
    1082              :         const SUMOVehicleParameter::Stop* stopPar = nullptr;
    1083              :         /// @brief values set during routing and used during optimization
    1084              :         int routeIndex = -1;
    1085              :         bool skipped = false;
    1086              :         bool backtracked = false;
    1087              :         SUMOTime delay = 0;
    1088              :         /// @brief optional info about stopping place
    1089              :         std::pair<std::string, SumoXMLTag> nameTag;
    1090              :         /// @brief set when replacing stop with an alternative
    1091              :         const MSEdge* origEdge = nullptr;
    1092              : 
    1093              :         bool operator==(const StopEdgeInfo& o) const {
    1094              :             return edge == o.edge;
    1095              :         }
    1096              :         bool operator!=(const StopEdgeInfo& o) const {
    1097              :             return !(*this == o);
    1098              :         }
    1099              :     };
    1100              : 
    1101              : protected:
    1102              :     /// @brief reset rail signal approach information
    1103           49 :     virtual void resetApproachOnReroute() {};
    1104              : 
    1105              :     /** @brief Returns the list of still pending stop edges
    1106              :      * also returns the first and last stop position
    1107              :      */
    1108              :     std::vector<StopEdgeInfo> getStopEdges(double& firstPos, double& lastPos, std::set<int>& jumps) const;
    1109              : 
    1110              :     static double addStopPriority(double p1, double p2);
    1111              : 
    1112              :     /// @brief replace stop with a same-name alternative that is on the route and return success
    1113              :     bool replaceWithAlternative(std::list<MSStop>::iterator iter, const MSRouteIterator searchStart, const MSRouteIterator end);
    1114              : 
    1115              : protected:
    1116              :     /// @brief This vehicle's parameter.
    1117              :     const SUMOVehicleParameter* myParameter;
    1118              : 
    1119              :     /// @brief This vehicle's route.
    1120              :     ConstMSRoutePtr myRoute;
    1121              : 
    1122              :     /// @brief This vehicle's type.
    1123              :     const MSVehicleType* myType;
    1124              : 
    1125              :     /// @brief Iterator to current route-edge
    1126              :     MSRouteIterator myCurrEdge;
    1127              : 
    1128              :     /// @brief A precomputed factor by which the driver wants to be faster than the speed limit
    1129              :     double myChosenSpeedFactor;
    1130              : 
    1131              :     /// @brief The vehicle's list of stops
    1132              :     std::list<MSStop> myStops;
    1133              : 
    1134              :     /// @brief The list of stops that the vehicle has already reached
    1135              :     StopParVector myPastStops;
    1136              : 
    1137              :     /// @name Move reminder structures
    1138              :     /// @{
    1139              : 
    1140              :     /// @brief Definition of a move reminder container
    1141              :     //         The double value holds the relative position offset, i.e.,
    1142              :     //         offset + vehicle-position - moveReminder-position = distance,
    1143              :     //         i.e. the offset is counted up when the vehicle continues to a
    1144              :     //         succeeding lane.
    1145              :     typedef std::vector< std::pair<MSMoveReminder*, double> > MoveReminderCont;
    1146              : 
    1147              :     /// @brief Currently relevant move reminders
    1148              :     MoveReminderCont myMoveReminders;
    1149              :     /// @}
    1150              : 
    1151              :     /// @brief The devices this vehicle has
    1152              :     std::vector<MSVehicleDevice*> myDevices;
    1153              : 
    1154              :     /// @brief The passengers this vehicle may have
    1155              :     MSDevice_Transportable* myPersonDevice;
    1156              : 
    1157              :     /// @brief The containers this vehicle may have
    1158              :     MSDevice_Transportable* myContainerDevice;
    1159              : 
    1160              :     /// @brief The emission parameters this vehicle may have
    1161              :     mutable EnergyParams* myEnergyParams;
    1162              : 
    1163              :     /// @brief The real departure time
    1164              :     SUMOTime myDeparture;
    1165              : 
    1166              :     /// @brief The real depart position
    1167              :     double myDepartPos;
    1168              : 
    1169              :     /// @brief The position on the destination lane where the vehicle stops
    1170              :     double myArrivalPos;
    1171              : 
    1172              :     /// @brief The destination lane where the vehicle stops
    1173              :     int myArrivalLane;
    1174              : 
    1175              :     /// @brief The number of reroutings
    1176              :     int myNumberReroutes;
    1177              : 
    1178              :     /// @brief The offset when adding route stops with 'until' on route replacement
    1179              :     SUMOTime myStopUntilOffset;
    1180              : 
    1181              :     /// @brief A simple odometer to keep track of the length of the route already driven
    1182              :     double myOdometer;
    1183              : 
    1184              :     /// @brief status of the current vehicle route
    1185              :     int myRouteValidity;
    1186              : 
    1187              :     /// memory for parking search
    1188              :     StoppingPlaceMemory* myParkingMemory = nullptr;
    1189              :     StoppingPlaceMemory* myChargingMemory = nullptr;
    1190              :     int myNumberParkingReroutes = 0;
    1191              : 
    1192              :     /// @brief Whether this vehicle is registered as waiting for a person or container (for deadlock-recognition)
    1193              :     bool myAmRegisteredAsWaiting = false;
    1194              : 
    1195              :     /* @brief magic value for undeparted vehicles
    1196              :      * @note: in previous versions this was -1
    1197              :      */
    1198              :     static const SUMOTime NOT_YET_DEPARTED;
    1199              : 
    1200              :     static std::vector<MSTransportable*> myEmptyTransportableVector;
    1201              : 
    1202              :     /* @brief The logical 'reversed' state of the vehicle - intended to be used by drawing functions
    1203              :      * @note:   only set by vClass rail reversing at the moment
    1204              :      */
    1205              :     bool myAmReversed = false;
    1206              : 
    1207              :     ///@brief routing mode (see TraCIConstants.h)
    1208              :     int myRoutingMode;
    1209              : 
    1210              : private:
    1211              :     const NumericalID myNumericalID;
    1212              : 
    1213              :     const long long int myRandomSeed;
    1214              : 
    1215              :     /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
    1216              :      * @note member is initialized on first access */
    1217              :     mutable MSEdgeWeightsStorage* myEdgeWeights;
    1218              : 
    1219              :     MSEdgeWeightsStorage& _getWeightsStorage() const;
    1220              : 
    1221              :     static NumericalID myCurrentNumericalIndex;
    1222              : 
    1223              :     /// @brief init model parameters from generic params
    1224              :     void initTransientModelParams();
    1225              : 
    1226              :     /// @brief reconstruct flow id from vehicle id
    1227              :     std::string getFlowID() const;
    1228              : 
    1229              :     /// @brief remove route at the end of the simulation
    1230              :     void checkRouteRemoval();
    1231              : 
    1232              :     /// @brief helper function
    1233              :     bool insertJump(int nextStopIndex, MSRouteIterator itStart, std::string& errorMsg);
    1234              : 
    1235              :     /// @brief patch stop.pars.index to record the number of skipped candidate edges before stop.edge (in a looped route)
    1236              :     void setSkips(MSStop& stop, int prevActiveStops);
    1237              : 
    1238              :     /// @brief remove outdated driveways on reroute
    1239              :     SUMOTime activateRemindersOnReroute(SUMOTime currentTime);
    1240              : 
    1241              : private:
    1242              :     /// invalidated assignment operator
    1243              :     MSBaseVehicle& operator=(const MSBaseVehicle& s) = delete;
    1244              : 
    1245              : #ifdef _DEBUG
    1246              : public:
    1247              :     static void initMoveReminderOutput(const OptionsCont& oc);
    1248              : 
    1249              : protected:
    1250              :     /// @brief optionally generate movereminder-output for this vehicle
    1251              :     void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const;
    1252              : 
    1253              :     /// @brief whether this vehicle shall trace its moveReminders
    1254              :     const bool myTraceMoveReminders;
    1255              : private:
    1256              :     /// @brief vehicles which shall trace their move reminders
    1257              :     static std::set<std::string> myShallTraceMoveReminders;
    1258              : #endif
    1259              : 
    1260              : 
    1261              : };
        

Generated by: LCOV version 2.0-1