LCOV - code coverage report
Current view: top level - src/microsim - MSBaseVehicle.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 89.3 % 121 108
Test Date: 2026-03-02 16:00:03 Functions: 83.9 % 56 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    664358611 :     bool isVehicle() const {
     101    664358611 :         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     99358104 :     inline const MSRoute& getRoute() const {
     141     99358104 :         return *myRoute;
     142              :     }
     143              : 
     144              :     /** @brief Returns the current route
     145              :      * @return The route the vehicle uses
     146              :      */
     147      1183545 :     inline ConstMSRoutePtr getRoutePtr() const {
     148      1183545 :         return myRoute;
     149              :     }
     150              : 
     151              :     /** @brief Returns the vehicle's type definition
     152              :      * @return The vehicle's type definition
     153              :      */
     154  64773251808 :     inline const MSVehicleType& getVehicleType() const {
     155  64773251808 :         return *myType;
     156              :     }
     157              : 
     158              :     /** @brief Returns the vehicle's type parameter
     159              :      * @return The vehicle's type parameter
     160              :      */
     161     29810542 :     inline const SUMOVTypeParameter& getVTypeParameter() const {
     162     29810542 :         return myType->getParameter();
     163              :     }
     164              : 
     165              :     /** @brief Returns the vehicle's access class
     166              :      * @return The vehicle's access class
     167              :      */
     168  15849902613 :     inline SUMOVehicleClass getVClass() const {
     169  15849902613 :         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         5030 :     virtual bool instantStopping() const {
     179         5030 :         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       137401 :     virtual const MSEdge* getCurrentEdge() const {
     206       137401 :         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        54298 :     virtual bool isRemoteControlled() const {
     235        54298 :         return false;
     236              :     }
     237              : 
     238          227 :     virtual bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const {
     239              :         UNUSED_PARAMETER(lookBack);
     240          227 :         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        39552 :     virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const {
     274        39552 :         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       631466 :     virtual const MSEdge* getRerouteDestination() const {
     282       631466 :         return myRoute->getLastEdge();
     283              :     }
     284              : 
     285              :     /** @brief Returns the time loss in seconds
     286              :      */
     287            9 :     virtual double getTimeLossSeconds() const {
     288              :         // better timeLoss for meso?
     289            9 :         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     47893556 :         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     14269857 :     const MSRouteIterator& getCurrentRouteEdge() const {
     308     14269857 :         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     14291593 :     inline SUMOTime getDeparture() const {
     372     14291593 :         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          308 :     virtual double getStopDelay() const {
     381              :         /// @todo implement for meso
     382          308 :         return -1;
     383              :     }
     384              : 
     385              :     /** @brief Returns the estimated public transport stop arrival delay in seconds
     386              :      */
     387         1786 :     virtual double getStopArrivalDelay() const {
     388              :         /// @todo implement for meso
     389         1786 :         return INVALID_DOUBLE;
     390              :     }
     391              : 
     392              :     /// @brief return time (s) and distance to the next stop
     393            4 :     virtual std::pair<double, double> estimateTimeToNextStop() const {
     394            4 :         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       246210 :     inline double getDepartPos() const {
     401       246210 :         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      1765335 :     virtual double getArrivalPos() const {
     409      1765335 :         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         1643 :     virtual void setArrivalPos(double arrivalPos) {
     419         1643 :         myArrivalPos = arrivalPos;
     420         1643 :     }
     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     25151060 :     inline bool hasDeparted() const {
     434     25151060 :         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           86 :         myOdometer += value;
     463           27 :     }
     464              : 
     465              :     /** @brief Returns the number of new routes this vehicle got
     466              :      * @return the number of new routes this vehicle got
     467              :      */
     468       365376 :     inline int getNumberReroutes() const {
     469       365376 :         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      4533517 :     inline const std::vector<MSVehicleDevice*>& getDevices() const {
     500      4533517 :         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 removes a person or container
     513              :     void removeTransportable(MSTransportable* t);
     514              : 
     515              :     /// @brief removes a person or containers mass
     516              :     void removeTransportableMass(MSTransportable* t);
     517              : 
     518              :     /// @brief retrieve riding persons
     519              :     const std::vector<MSTransportable*>& getPersons() const;
     520              : 
     521              :     /// @brief retrieve riding containers
     522              :     const std::vector<MSTransportable*>& getContainers() const;
     523              : 
     524              :     /// @brief returns whether the vehicle serves a public transport line that serves the given stop
     525              :     bool isLineStop(double position) const;
     526              : 
     527              :     /// @brief check wether the vehicle has jump at the given part of its route
     528              :     bool hasJump(const MSRouteIterator& it) const;
     529              : 
     530              :     /** @brief Validates the current or given route
     531              :      * @param[out] msg Description why the route is not valid (if it is the case)
     532              :      * @param[in] route The route to check (or 0 if the current route shall be checked)
     533              :      * @return Whether the vehicle's current route is valid
     534              :      */
     535              :     bool hasValidRoute(std::string& msg, ConstMSRoutePtr route = 0) const;
     536              : 
     537              :     bool hasValidRoute(std::string& msg, MSRouteIterator start, MSRouteIterator last, bool checkJumps) const;
     538              : 
     539              :     /// @brief checks wether the vehicle can depart on the first edge
     540              :     virtual bool hasValidRouteStart(std::string& msg);
     541              : 
     542              :     /// @brief check for route validity at first insertion attempt
     543              :     int getRouteValidity(bool update = true, bool silent = false, std::string* msgReturn = nullptr);
     544              : 
     545              :     /// @brief Checks whether the vehilce has the given MoveReminder
     546              :     bool hasReminder(MSMoveReminder* rem) const;
     547              : 
     548              :     /** @brief Adds a MoveReminder dynamically
     549              :      *
     550              :      * @param[in] rem the reminder to add
     551              :      * @see MSMoveReminder
     552              :      */
     553              :     void addReminder(MSMoveReminder* rem, double pos = 0);
     554              : 
     555              :     /** @brief Removes a MoveReminder dynamically
     556              :      *
     557              :      * @param[in] rem the reminder to remove
     558              :      * @see MSMoveReminder
     559              :      */
     560              :     void removeReminder(MSMoveReminder* rem);
     561              : 
     562              :     /** @brief "Activates" all current move reminder
     563              :      *
     564              :      * For all move reminder stored in "myMoveReminders", their method
     565              :      *  "MSMoveReminder::notifyEnter" is called.
     566              :      *
     567              :      * @param[in] reason The reason for changing the reminders' states
     568              :      * @param[in] enteredLane The lane, which is entered (if applicable)
     569              :      * @see MSMoveReminder
     570              :      * @see MSMoveReminder::notifyEnter
     571              :      * @see MSMoveReminder::Notification
     572              :      */
     573              :     virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
     574              : 
     575              : 
     576              :     /** @brief Returns the vehicle's length
     577              :      * @return vehicle's length
     578              :      */
     579    851583480 :     inline double getLength() const {
     580    851583480 :         return myType->getLength();
     581              :     }
     582              : 
     583              :     /* @brief Return whether this vehicle must be treated like a railway vehicle
     584              :      * either due to its vClass or the vClass of it's edge */
     585              :     bool isRail() const;
     586              : 
     587              :     /** @brief Returns the vehicle's width
     588              :      * @return vehicle's width
     589              :      */
     590              :     inline double getWidth() const {
     591     80877090 :         return myType->getWidth();
     592              :     }
     593              : 
     594              : 
     595              :     /** @brief Returns the precomputed factor by which the driver wants to be faster than the speed limit
     596              :      * @return Speed limit factor
     597              :      */
     598   5884350867 :     inline double getChosenSpeedFactor() const {
     599   5884350867 :         return myChosenSpeedFactor;
     600              :     }
     601              : 
     602              :     inline double getDesiredMaxSpeed() const {
     603    631506929 :         return myType->getDesiredMaxSpeed() * myChosenSpeedFactor;
     604              :     }
     605              : 
     606              :     /** @brief Returns the precomputed factor by which the driver wants to be faster than the speed limit
     607              :      * @return Speed limit factor
     608              :      */
     609        40573 :     inline void setChosenSpeedFactor(const double factor) {
     610        40573 :         myChosenSpeedFactor = factor;
     611        40573 :     }
     612              : 
     613              :     /// @brief Returns a device of the given type if it exists, nullptr otherwise
     614              :     MSDevice* getDevice(const std::type_info& type) const;
     615              : 
     616              : 
     617              :     /** @brief Replaces the current vehicle type by the one given
     618              :      *
     619              :      * If the currently used vehicle type is marked as being used by this vehicle
     620              :      *  only, it is deleted, first. The new, given type is then assigned to
     621              :      *  "myType".
     622              :      * @param[in] type The new vehicle type
     623              :      * @see MSBaseVehicle::myType
     624              :      */
     625              :     virtual void replaceVehicleType(const MSVehicleType* type);
     626              : 
     627        18912 :     virtual std::unique_ptr<MFXOptionalLock> getScopeLock() {
     628        18912 :         return std::unique_ptr<MFXOptionalLock>(new MFXNoOpLock());
     629              :     }
     630              : 
     631              :     /** @brief Replaces the current vehicle type with a new one used by this vehicle only
     632              :      *
     633              :      * If the currently used vehicle type is already marked as being used by this vehicle
     634              :      *  only, no new type is created.
     635              :      * @return The new modifiable vehicle type
     636              :      * @see MSBaseVehicle::myType
     637              :      */
     638              :     MSVehicleType& getSingularType();
     639              : 
     640              :     /// @name state io
     641              :     //@{
     642              : 
     643              :     /// Saves the (common) state of a vehicle
     644              :     virtual void saveState(OutputDevice& out);
     645              : 
     646              :     //@}
     647              : 
     648              :     virtual bool handleCollisionStop(MSStop& stop, const double distToStop);
     649              : 
     650              :     /** @brief Returns whether the vehicle is at a stop
     651              :      * @return Whether the vehicle has stopped
     652              :      */
     653              :     bool isStopped() const;
     654              : 
     655              :     /** @brief Returns whether the vehicle is parking
     656              :      * @return whether the vehicle is parking
     657              :      */
     658              :     bool isParking() const;
     659              : 
     660              :     /** @brief Returns whether the vehicle is perform a jump
     661              :      * @return whether the vehicle is starting to jump
     662              :      */
     663              :     bool isJumping() const;
     664              : 
     665              :     /** @brief Returns whether the logical state of the vehicle is reversed - for drawing
     666              :     * @return whether the logical state of the vehicle is reversed
     667              :     */
     668              :     inline bool isReversed() const {
     669     15804301 :         return myAmReversed;
     670              :     }
     671              : 
     672              :     /** @brief Returns whether the vehicle is on a triggered stop
     673              :      * @return whether the vehicle is on a triggered stop
     674              :      */
     675              :     bool isStoppedTriggered() const;
     676              : 
     677              :     /** @brief Returns whether the vehicle is on a parking stop
     678              :      * @return whether the vehicle is on a parking stop
     679              :      */
     680              :     bool isStoppedParking() const;
     681              : 
     682              :     /** @brief return whether the given position is within range of the current stop
     683              :      */
     684              :     bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture = false) const;
     685              : 
     686              :     /** @brief Returns whether the vehicle has to stop somewhere
     687              :      * @return Whether the vehicle has to stop somewhere
     688              :      */
     689   1658034340 :     bool hasStops() const {
     690   1658034340 :         return !myStops.empty();
     691              :     }
     692              : 
     693              : 
     694              :     /// @brief unregisters from a parking reservation when changing or skipping stops
     695              :     void cleanupParkingReservation();
     696              : 
     697              :     /** @brief replace the current parking area stop with a new stop with merge duration
     698              :      */
     699              :     bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
     700              : 
     701              :     /** @brief get the upcoming parking area stop or nullptr
     702              :      */
     703              :     MSParkingArea* getNextParkingArea();
     704              : 
     705              :     /** @brief get the current  parking area stop or nullptr */
     706              :     MSParkingArea* getCurrentParkingArea();
     707              : 
     708              :     /// @brief get the valid parking access rights (vehicle settings override vehicle type settings)
     709              :     const std::vector<std::string>& getParkingBadges() const;
     710              : 
     711              :     /// @brief departure position where the vehicle fits fully onto the edge (if possible)
     712              :     double basePos(const MSEdge* edge) const;
     713              : 
     714              :     /** @brief Adds a stop
     715              :      *
     716              :      * The stop is put into the sorted list.
     717              :      * @param[in] stop The stop to add
     718              :      * @return Whether the stop could be added
     719              :      */
     720              :     bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0,
     721              :                  MSRouteIterator* searchStart = nullptr);
     722              : 
     723              :     /** @brief Adds stops to the built vehicle
     724              :      *
     725              :      * This code needs to be separated from the MSBaseVehicle constructor
     726              :      *  since it is not allowed to call virtual functions from a constructor
     727              :      *
     728              :      * @param[in] ignoreStopErrors whether invalid stops trigger a warning only
     729              :      */
     730              :     void addStops(const bool ignoreStopErrors, MSRouteIterator* searchStart = nullptr, bool addRouteStops = true);
     731              : 
     732              :     /// @brief check whether all stop.edge MSRouteIterators are valid and in order
     733              :     bool haveValidStopEdges(bool silent = false) const;
     734              : 
     735              :     /// @brief return list of route indices for the remaining stops
     736              :     std::vector<std::pair<int, double> > getStopIndices() const;
     737              : 
     738              :     /**
     739              :     * returns the list of stops not yet reached in the stop queue
     740              :     * @return the list of upcoming stops
     741              :     */
     742      3550388 :     inline const std::list<MSStop>& getStops() const {
     743      3550388 :         return myStops;
     744              :     }
     745              : 
     746              :     inline const StopParVector& getPastStops() const {
     747              :         return myPastStops;
     748              :     }
     749              : 
     750              :     /**
     751              :     * returns the next imminent stop in the stop queue
     752              :     * @return the upcoming stop
     753              :     */
     754              :     const MSStop& getNextStop() const;
     755              : 
     756              :     /**
     757              :     * returns the next imminent stop in the stop queue
     758              :     * @return the upcoming stop
     759              :     */
     760              :     MSStop& getNextStopMutable();
     761              : 
     762              :     /// @brief get remaining stop duration or 0 if the vehicle isn't stopped
     763              :     SUMOTime getStopDuration() const;
     764              : 
     765              :     /**
     766              :     * returns the upcoming stop with the given index in the stop queue
     767              :     * @return an upcoming stop
     768              :     */
     769              :     MSStop& getStop(int nextStopIndex);
     770              : 
     771              :     /// @brief return parameters for the next stop (SUMOVehicle Interface)
     772              :     const SUMOVehicleParameter::Stop* getNextStopParameter() const;
     773              : 
     774              :     /**
     775              :      * schedule a new stop for the vehicle; each time a stop is reached, the vehicle
     776              :      * will wait for the given duration before continuing on its route
     777              :      * @param[in] stop Stop parameters
     778              :      * @param[out] errorMsg returned error message
     779              :      */
     780              :     virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
     781              : 
     782              :     /**
     783              :     * resumes a vehicle from stopping
     784              :     * @return true on success, the resuming fails if the vehicle wasn't parking in the first place
     785              :     */
     786              :     virtual bool resumeFromStopping() = 0;
     787              : 
     788              :     /// @brief mark vehicle as active
     789              :     void unregisterWaiting();
     790              : 
     791              :     /// @brief deletes the next stop at the given index if it exists
     792              :     bool abortNextStop(int nextStopIndex = 0);
     793              : 
     794              :     /**
     795              :      * replace the next stop at the given index with the given stop parameters
     796              :      * will wait for the given duration before continuing on its route
     797              :      * The route between start other stops and destination will be kept unchanged and
     798              :      * only the part around the replacement index will be adapted according to the new stop location
     799              :      * @param[in] nextStopIndex The replacement index
     800              :      * @param[in] stop Stop parameters
     801              :      * @param[in] info The rerouting info
     802              :      * @param[in] teleport Whether to cover the route to the replacement stop via teleporting
     803              :      * @param[out] errorMsg returned error message
     804              :      */
     805              :     bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
     806              : 
     807              :     /**
     808              :      * reroute between stops nextStopIndex - 1 and nextStopIndex (defaults to current position / final edge) if the respective stops do not exist
     809              :      * @param[in] nextStopIndex The replacement index
     810              :      * @param[in] info The rerouting info
     811              :      * @param[in] teleport Whether to cover the route between stops via teleporting
     812              :      * @param[out] errorMsg returned error message
     813              :      */
     814              :     bool rerouteBetweenStops(int nextStopIndex, const std::string& info, bool teleport, std::string& errorMsg);
     815              : 
     816              :     /**
     817              :      * insert stop at the given index with the given stop parameters
     818              :      * will wait for the given duration before continuing on its route
     819              :      * 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).
     820              :      * @param[in] nextStopIndex The replacement index
     821              :      * @param[in] stop Stop parameters
     822              :      * @param[in] info The rerouting info
     823              :      * @param[in] teleport Whether to cover the route to the new stop via teleporting
     824              :      * @param[out] errorMsg returned error message
     825              :      */
     826              :     bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, bool teleport, std::string& errorMsg);
     827              : 
     828              : 
     829              :     /// @brief whether this vehicle is selected in the GUI
     830    261823528 :     virtual bool isSelected() const {
     831    261823528 :         return false;
     832              :     }
     833              : 
     834              :     /// @brief @return The index of the vehicle's associated RNG
     835              :     int getRNGIndex() const;
     836              : 
     837              :     /// @brief @return The vehicle's associated RNG
     838              :     SumoRNG* getRNG() const;
     839              : 
     840  27750903716 :     inline NumericalID getNumericalID() const {
     841  27750903716 :         return myNumericalID;
     842              :     }
     843              : 
     844              :     /// @brief return vehicle-specific random number
     845        58105 :     long long int getRandomSeed() const {
     846        58105 :         return myRandomSeed;
     847              :     }
     848              : 
     849              :     const MSDevice_Transportable* getPersonDevice() const {
     850     15808169 :         return myPersonDevice;
     851              :     }
     852              : 
     853              :     const MSDevice_Transportable* getContainerDevice() const {
     854     15808169 :         return myContainerDevice;
     855              :     }
     856              : 
     857              :     /// @brief retrieve parameters for the energy consumption model
     858              :     EnergyParams* getEmissionParameters() const;
     859              : 
     860              :     /// @name Emission retrieval
     861              :     //@{
     862              : 
     863              :     /** @brief Returns emissions of the current state
     864              :      * The value is always per 1s, so multiply by step length if necessary.
     865              :      * @return The current emission
     866              :      */
     867              :     template<PollutantsInterface::EmissionType ET>
     868         6060 :     double getEmissions() const {
     869         6060 :         if (isOnRoad() || isIdling()) {
     870         5988 :             return PollutantsInterface::compute(myType->getEmissionClass(), ET, getSpeed(), getAcceleration(), getSlope(), getEmissionParameters());
     871              :         }
     872              :         return 0.;
     873              :     }
     874              : 
     875              :     /** @brief Returns actual state of charge of battery (Wh)
     876              :     * RICE_CHECK: This may be a misnomer, SOC is typically percentage of the maximum battery capacity.
     877              :     * @return The actual battery state of charge
     878              :     */
     879              :     double getStateOfCharge() const;
     880              : 
     881              :     /** @brief Returns actual relative state of charge of battery (-)
     882              :     * @return The actual relative battery state of charge, normalised to the maximum battery capacity.
     883              :     */
     884              :     double getRelativeStateOfCharge() const;
     885              : 
     886              :     /** @brief Returns the energy charged to the battery in the current time step (Wh)
     887              :     * @return The energy charged to the battery in the current time step.
     888              :     */
     889              :     double getChargedEnergy() const;
     890              : 
     891              :     /** @brief Returns the maximum charge rate allowed by the battery in the current time step (W)
     892              :     * @return The maximum charge rate in the current time step.
     893              :     */
     894              :     double getMaxChargeRate() const;
     895              : 
     896              :     /** @brief Returns actual current (A) of ElecHybrid device
     897              :     * RICE_CHECK: Is this the current consumed from the overhead wire or the current driving the powertrain of the vehicle?
     898              :     * RICE_REV_JS: It is the current drawn from the overhead wire (value if the vehicle is not connected to overhead wire?)
     899              :     * @return The current of ElecHybrid device
     900              :     */
     901              :     double getElecHybridCurrent() const;
     902              : 
     903              :     /** @brief Returns noise emissions of the current state
     904              :      * @return The noise produced
     905              :      */
     906              :     double getHarmonoise_NoiseEmissions() const;
     907              :     //@}
     908              : 
     909              :     /** @class Influencer
     910              :       * @brief Changes the wished vehicle speed / lanes
     911              :       *
     912              :       * The class is used for passing velocities or velocity profiles obtained via TraCI to the vehicle.
     913              :       * The speed adaptation is controlled by the stored speedTimeLine
     914              :       * Additionally, the variables myConsiderSafeVelocity, myConsiderMaxAcceleration, and myConsiderMaxDeceleration
     915              :       * control whether the safe velocity, the maximum acceleration, and the maximum deceleration
     916              :       * have to be regarded.
     917              :       *
     918              :       * Furthermore this class is used to affect lane changing decisions according to
     919              :       * LaneChangeMode and any given laneTimeLine
     920              :       */
     921              :     class BaseInfluencer {
     922              :     public:
     923              :         /// @brief Constructor
     924              :         BaseInfluencer();
     925              : 
     926              :         /// @brief Destructor
     927            0 :         virtual ~BaseInfluencer() {}
     928              : 
     929              :         /// @brief Static initalization
     930              :         static void init();
     931              :         /// @brief Static cleanup
     932              :         static void cleanup();
     933              : 
     934              : 
     935              :         /// @brief return the current routing mode
     936              :         double getExtraImpatience() const {
     937       236661 :             return myExtraImpatience;
     938              :         }
     939              : 
     940              :         /** @brief Sets routing behavior
     941              :          * @param[in] value an enum value controlling the different modes
     942              :          */
     943              :         void setExtraImpatience(double value) {
     944       275704 :             myExtraImpatience = value;
     945       275677 :         }
     946              : 
     947              :     protected:
     948              :         /// @brief dynamic impatience offset
     949              :         double myExtraImpatience = 0;
     950              : 
     951              :     };
     952              : 
     953              : 
     954              : 
     955              :     /** @brief Returns the velocity/lane influencer
     956              :      *
     957              :      * If no influencer was existing before, one is built, first
     958              :      * @return Reference to this vehicle's speed influencer
     959              :      */
     960              :     virtual BaseInfluencer& getBaseInfluencer() = 0;
     961              : 
     962              :     virtual const BaseInfluencer* getBaseInfluencer() const = 0;
     963              : 
     964              :     virtual bool hasInfluencer() const  = 0;
     965              : 
     966              :     /// @brief return routing mode (configures router choice but also handling of transient permission changes)
     967   7694548340 :     int getRoutingMode() const {
     968   7694548340 :         return myRoutingMode;
     969              :     }
     970              : 
     971              :     /** @brief Sets routing behavior
     972              :      * @param[in] value an enum value controlling the different modes
     973              :      */
     974              :     void setRoutingMode(int value) {
     975         5906 :         myRoutingMode = value;
     976          254 :     }
     977              : 
     978              : 
     979              :     SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterTT() const;
     980              : 
     981              :     /** @brief Returns the vehicle's internal edge travel times/efforts container
     982              :      *
     983              :      * If the vehicle does not have such a container, it is built.
     984              :      * @return The vehicle's knowledge about edge weights
     985              :      */
     986              :     const MSEdgeWeightsStorage& getWeightsStorage() const;
     987              :     MSEdgeWeightsStorage& getWeightsStorage();
     988              : 
     989              :     /** @brief Returns the leader of the vehicle looking for a fixed distance.
     990              :      *
     991              :      * If the distance is not given it is calculated from the brake gap.
     992              :      * The gap returned does not include the minGap.
     993              :      * @param dist    up to which distance to look at least for a leader
     994              :      * @param considerCrossingFoes Whether vehicles on crossing foe links should be considered
     995              :      * @return The leading vehicle together with the gap; (0, -1) if no leader was found.
     996              :      */
     997          479 :     virtual std::pair<const MSVehicle* const, double> getLeader(double dist = 0, bool considerCrossingFoes = true) const {
     998              :         UNUSED_PARAMETER(dist);
     999              :         UNUSED_PARAMETER(considerCrossingFoes);
    1000          479 :         WRITE_WARNING(TL("getLeader not yet implemented for meso"));
    1001          479 :         return std::make_pair(nullptr, -1);
    1002              :     }
    1003              : 
    1004              :     /** @brief Returns the follower of the vehicle looking for a fixed distance.
    1005              :      *
    1006              :      * If the distance is not given it is set to the value of MSCFModel::brakeGap(2*roadSpeed, 4.5, 0)
    1007              :      * The gap returned does not include the minGap.
    1008              :      * If there are multiple followers, the one that maximizes the term (getSecureGap - gap) is returned.
    1009              :      * @param dist    up to which distance to look at least for a leader
    1010              :      * @return The leading vehicle together with the gap; (0, -1) if no leader was found.
    1011              :      */
    1012           54 :     virtual std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const {
    1013              :         UNUSED_PARAMETER(dist);
    1014           54 :         WRITE_WARNING(TL("getFollower not yet implemented for meso"));
    1015           54 :         return std::make_pair(nullptr, -1);
    1016              :     }
    1017              : 
    1018              :     /** @brief (Re-)Calculates the arrival position and lane from the vehicle parameters
    1019              :      */
    1020              :     void calculateArrivalParams(bool onInit);
    1021              : 
    1022              :     /// @brief apply departEdge and arrivalEdge attributes
    1023              :     void setDepartAndArrivalEdge();
    1024              : 
    1025              :     int getDepartEdge() const;
    1026              : 
    1027              :     int getInsertionChecks() const;
    1028              : 
    1029              :     /// @brief interpret stop lane on opposite side of the road
    1030              :     static MSLane* interpretOppositeStop(SUMOVehicleParameter::Stop& stop);
    1031              : 
    1032              :     /// @name state io
    1033              :     //@{
    1034              :     void rememberBlockedParkingArea(const MSStoppingPlace* pa, bool local);
    1035              :     SUMOTime sawBlockedParkingArea(const MSStoppingPlace* pa, bool local) const;
    1036              :     void rememberBlockedChargingStation(const MSStoppingPlace* cs, bool local);
    1037              :     SUMOTime sawBlockedChargingStation(const MSStoppingPlace* cs, bool local) const;
    1038              : 
    1039              :     /// @brief score only needed when running with gui
    1040              :     void rememberParkingAreaScore(const MSStoppingPlace* pa, const std::string& score);
    1041              :     void resetParkingAreaScores();
    1042              :     void rememberChargingStationScore(const MSStoppingPlace* cs, const std::string& score);
    1043              :     void resetChargingStationScores();
    1044              : 
    1045        68531 :     int getNumberParkingReroutes() const {
    1046        68531 :         return myNumberParkingReroutes;
    1047              :     }
    1048        39417 :     void setNumberParkingReroutes(int value) {
    1049        39417 :         myNumberParkingReroutes = value;
    1050        39417 :     }
    1051              : 
    1052              :     const StoppingPlaceMemory* getParkingMemory() const {
    1053           65 :         return myParkingMemory;
    1054              :     }
    1055              : 
    1056              :     const StoppingPlaceMemory* getChargingMemory() const {
    1057          127 :         return myChargingMemory;
    1058              :     }
    1059              :     //@}
    1060              : 
    1061      6401012 :     struct StopEdgeInfo {
    1062              : 
    1063      3168496 :         StopEdgeInfo(const MSEdge* _edge, double _priority, SUMOTime _arrival, double _pos, bool _isSink = false):
    1064      3168496 :             edge(_edge), pos(_pos),
    1065      3168496 :             priority(_priority),
    1066      3168496 :             arrival(_arrival),
    1067      3168496 :             isSink(_isSink) {}
    1068              : 
    1069              :         const MSEdge* edge;
    1070              :         double pos;
    1071              :         double priority;
    1072              :         SUMOTime arrival;
    1073              :         bool isSink;
    1074              :         const SUMOVehicleParameter::Stop* stopPar = nullptr;
    1075              :         /// @brief values set during routing and used during optimization
    1076              :         int routeIndex = -1;
    1077              :         bool skipped = false;
    1078              :         bool backtracked = false;
    1079              :         SUMOTime delay = 0;
    1080              :         /// @brief optional info about stopping place
    1081              :         std::pair<std::string, SumoXMLTag> nameTag;
    1082              :         /// @brief set when replacing stop with an alternative
    1083              :         const MSEdge* origEdge = nullptr;
    1084              : 
    1085              :         bool operator==(const StopEdgeInfo& o) const {
    1086              :             return edge == o.edge;
    1087              :         }
    1088              :         bool operator!=(const StopEdgeInfo& o) const {
    1089              :             return !(*this == o);
    1090              :         }
    1091              :     };
    1092              : 
    1093              : protected:
    1094              :     /// @brief reset rail signal approach information
    1095           29 :     virtual void resetApproachOnReroute() {};
    1096              : 
    1097              :     /** @brief Returns the list of still pending stop edges
    1098              :      * also returns the first and last stop position
    1099              :      */
    1100              :     std::vector<StopEdgeInfo> getStopEdges(double& firstPos, double& lastPos, std::set<int>& jumps) const;
    1101              : 
    1102              :     static double addStopPriority(double p1, double p2);
    1103              : 
    1104              :     /// @brief replace stop with a same-name alternative that is on the route and return success
    1105              :     bool replaceWithAlternative(std::list<MSStop>::iterator iter, const MSRouteIterator searchStart, const MSRouteIterator end);
    1106              : 
    1107              : protected:
    1108              :     /// @brief This vehicle's parameter.
    1109              :     const SUMOVehicleParameter* myParameter;
    1110              : 
    1111              :     /// @brief This vehicle's route.
    1112              :     ConstMSRoutePtr myRoute;
    1113              : 
    1114              :     /// @brief This vehicle's type.
    1115              :     const MSVehicleType* myType;
    1116              : 
    1117              :     /// @brief Iterator to current route-edge
    1118              :     MSRouteIterator myCurrEdge;
    1119              : 
    1120              :     /// @brief A precomputed factor by which the driver wants to be faster than the speed limit
    1121              :     double myChosenSpeedFactor;
    1122              : 
    1123              :     /// @brief The vehicle's list of stops
    1124              :     std::list<MSStop> myStops;
    1125              : 
    1126              :     /// @brief The list of stops that the vehicle has already reached
    1127              :     StopParVector myPastStops;
    1128              : 
    1129              :     /// @name Move reminder structures
    1130              :     /// @{
    1131              : 
    1132              :     /// @brief Definition of a move reminder container
    1133              :     //         The double value holds the relative position offset, i.e.,
    1134              :     //         offset + vehicle-position - moveReminder-position = distance,
    1135              :     //         i.e. the offset is counted up when the vehicle continues to a
    1136              :     //         succeeding lane.
    1137              :     typedef std::vector< std::pair<MSMoveReminder*, double> > MoveReminderCont;
    1138              : 
    1139              :     /// @brief Currently relevant move reminders
    1140              :     MoveReminderCont myMoveReminders;
    1141              :     /// @}
    1142              : 
    1143              :     /// @brief The devices this vehicle has
    1144              :     std::vector<MSVehicleDevice*> myDevices;
    1145              : 
    1146              :     /// @brief The passengers this vehicle may have
    1147              :     MSDevice_Transportable* myPersonDevice;
    1148              : 
    1149              :     /// @brief The containers this vehicle may have
    1150              :     MSDevice_Transportable* myContainerDevice;
    1151              : 
    1152              :     /// @brief The emission parameters this vehicle may have
    1153              :     mutable EnergyParams* myEnergyParams;
    1154              : 
    1155              :     /// @brief The real departure time
    1156              :     SUMOTime myDeparture;
    1157              : 
    1158              :     /// @brief The real depart position
    1159              :     double myDepartPos;
    1160              : 
    1161              :     /// @brief The position on the destination lane where the vehicle stops
    1162              :     double myArrivalPos;
    1163              : 
    1164              :     /// @brief The destination lane where the vehicle stops
    1165              :     int myArrivalLane;
    1166              : 
    1167              :     /// @brief The number of reroutings
    1168              :     int myNumberReroutes;
    1169              : 
    1170              :     /// @brief The offset when adding route stops with 'until' on route replacement
    1171              :     SUMOTime myStopUntilOffset;
    1172              : 
    1173              :     /// @brief A simple odometer to keep track of the length of the route already driven
    1174              :     double myOdometer;
    1175              : 
    1176              :     /// @brief status of the current vehicle route
    1177              :     int myRouteValidity;
    1178              : 
    1179              :     /// memory for parking search
    1180              :     StoppingPlaceMemory* myParkingMemory = nullptr;
    1181              :     StoppingPlaceMemory* myChargingMemory = nullptr;
    1182              :     int myNumberParkingReroutes = 0;
    1183              : 
    1184              :     /// @brief Whether this vehicle is registered as waiting for a person or container (for deadlock-recognition)
    1185              :     bool myAmRegisteredAsWaiting = false;
    1186              : 
    1187              :     /* @brief magic value for undeparted vehicles
    1188              :      * @note: in previous versions this was -1
    1189              :      */
    1190              :     static const SUMOTime NOT_YET_DEPARTED;
    1191              : 
    1192              :     static std::vector<MSTransportable*> myEmptyTransportableVector;
    1193              : 
    1194              :     /* @brief The logical 'reversed' state of the vehicle - intended to be used by drawing functions
    1195              :      * @note:   only set by vClass rail reversing at the moment
    1196              :      */
    1197              :     bool myAmReversed = false;
    1198              : 
    1199              :     ///@brief routing mode (see TraCIConstants.h)
    1200              :     int myRoutingMode;
    1201              : 
    1202              : private:
    1203              :     const NumericalID myNumericalID;
    1204              : 
    1205              :     const long long int myRandomSeed;
    1206              : 
    1207              :     /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage
    1208              :      * @note member is initialized on first access */
    1209              :     mutable MSEdgeWeightsStorage* myEdgeWeights;
    1210              : 
    1211              :     MSEdgeWeightsStorage& _getWeightsStorage() const;
    1212              : 
    1213              :     static NumericalID myCurrentNumericalIndex;
    1214              : 
    1215              :     /// @brief init model parameters from generic params
    1216              :     void initTransientModelParams();
    1217              : 
    1218              :     /// @brief reconstruct flow id from vehicle id
    1219              :     std::string getFlowID() const;
    1220              : 
    1221              :     /// @brief remove route at the end of the simulation
    1222              :     void checkRouteRemoval();
    1223              : 
    1224              :     /// @brief helper function
    1225              :     bool insertJump(int nextStopIndex, MSRouteIterator itStart, std::string& errorMsg);
    1226              : 
    1227              :     /// @brief patch stop.pars.index to record the number of skipped candidate edges before stop.edge (in a looped route)
    1228              :     void setSkips(MSStop& stop, int prevActiveStops);
    1229              : 
    1230              :     /// @brief remove outdated driveways on reroute
    1231              :     SUMOTime activateRemindersOnReroute(SUMOTime currentTime);
    1232              : 
    1233              : private:
    1234              :     /// invalidated assignment operator
    1235              :     MSBaseVehicle& operator=(const MSBaseVehicle& s) = delete;
    1236              : 
    1237              : #ifdef _DEBUG
    1238              : public:
    1239              :     static void initMoveReminderOutput(const OptionsCont& oc);
    1240              : 
    1241              : protected:
    1242              :     /// @brief optionally generate movereminder-output for this vehicle
    1243              :     void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const;
    1244              : 
    1245              :     /// @brief whether this vehicle shall trace its moveReminders
    1246              :     const bool myTraceMoveReminders;
    1247              : private:
    1248              :     /// @brief vehicles which shall trace their move reminders
    1249              :     static std::set<std::string> myShallTraceMoveReminders;
    1250              : #endif
    1251              : 
    1252              : 
    1253              : };
        

Generated by: LCOV version 2.0-1