LCOV - code coverage report
Current view: top level - src/microsim - MSVehicleControl.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 80.0 % 60 48
Test Date: 2024-11-22 15:46:21 Functions: 9.1 % 11 1

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    MSVehicleControl.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Michael Behrisch
      18              : /// @date    Wed, 10. Dec 2003
      19              : ///
      20              : // The class responsible for building and deletion of vehicles
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <cmath>
      26              : #include <string>
      27              : #include <map>
      28              : #include <set>
      29              : #ifdef HAVE_FOX
      30              : #include <utils/foxtools/fxheader.h>
      31              : #include <utils/foxtools/MFXSynchQue.h>
      32              : #endif
      33              : #include <utils/distribution/RandomDistributor.h>
      34              : #include <utils/common/SUMOTime.h>
      35              : #include <utils/common/SUMOVehicleClass.h>
      36              : #include <utils/common/Command.h>
      37              : #include <microsim/MSRouterDefs.h>
      38              : 
      39              : 
      40              : // ===========================================================================
      41              : // class declarations
      42              : // ===========================================================================
      43              : class SUMOVehicle;
      44              : class SUMOVehicleParameter;
      45              : class MSBaseVehicle;
      46              : class MSVehicle;
      47              : class MSRoute;
      48              : class MSVehicleType;
      49              : class OutputDevice;
      50              : class MSEdge;
      51              : 
      52              : 
      53              : // ===========================================================================
      54              : // class definitions
      55              : // ===========================================================================
      56              : /**
      57              :  * @class MSVehicleControl
      58              :  * @brief The class responsible for building and deletion of vehicles
      59              :  *
      60              :  * This class is responsible for vehicle building and deletion. It stores
      61              :  *  vehicle types, vehicles and statistics about the last.
      62              :  *
      63              :  * This class also realizes the tripinfos and the vehroutes - outputs, both
      64              :  *  generated when a vehicle is removed from the simulation, see
      65              :  *  scheduleVehicleRemoval.
      66              :  *
      67              :  * Use this class for the pure microsim and GUIVehicleControl within the gui.
      68              :  *
      69              :  * @see GUIVehicleControl
      70              :  */
      71              : class MSVehicleControl {
      72              : public:
      73              :     /// @brief Definition of the internal vehicles map iterator
      74              :     typedef std::map<std::string, SUMOVehicle*>::const_iterator constVehIt;
      75              : 
      76              :     /// @brief possible origins of a vehicle definition
      77              :     enum VehicleDefinitionSource {
      78              :         ROUTEFILE,
      79              :         STATE,
      80              :         TRIGGER,
      81              :         LIBSUMO,
      82              :         OTHER
      83              :     };
      84              : 
      85              : public:
      86              :     /// @brief Constructor
      87              :     MSVehicleControl();
      88              : 
      89              : 
      90              :     /// @brief Destructor
      91              :     virtual ~MSVehicleControl();
      92              : 
      93              :     /// @name Vehicle creation
      94              :     /// @{
      95              : 
      96              :     /** @brief Builds a vehicle, increases the number of built vehicles
      97              :      *
      98              :      * Builds a MSVehicle instance using the given parameter.
      99              :      *  Increases the number of loaded vehicles ("myLoadedVehNo").
     100              :      *
     101              :      * @param[in] defs The parameter defining the vehicle
     102              :      * @param[in] route The route of this vehicle
     103              :      * @param[in] type The type of this vehicle
     104              :      * @param[in] ignoreStopErrors whether invalid stops trigger a warning only
     105              :      * @param[in] source whether we are just reading the route file or creating via trigger, traci, ...
     106              :      * @return The built vehicle (MSVehicle instance)
     107              :      */
     108              :     virtual SUMOVehicle* buildVehicle(SUMOVehicleParameter* defs, ConstMSRoutePtr route,
     109              :                                       MSVehicleType* type,
     110              :                                       const bool ignoreStopErrors, const VehicleDefinitionSource source = ROUTEFILE,
     111              :                                       bool addRouteStops = true);
     112              :     /// @}
     113              : 
     114              : 
     115              : 
     116              :     /// @name Insertion, deletion and retrieval of vehicles
     117              :     /// @{
     118              : 
     119              :     /** @brief Tries to insert the vehicle into the internal vehicle container
     120              :      *
     121              :      * Checks whether another vehicle with the same id exists; returns false
     122              :      *  if so. Otherwise, the vehicle is added to "myVehicleDict".
     123              :      *  It also checks whether the vehicle has a "triggered" departure
     124              :      *  and registers it accordingly.
     125              :      *
     126              :      * The vehicle control gets responsible for vehicle deletion.
     127              :      *
     128              :      * @param[in] id The id of the vehicle
     129              :      * @param[in] v The vehicle
     130              :      * @return Whether the vehicle could be inserted (no other vehicle with the same id was inserted before)
     131              :      */
     132              :     virtual bool addVehicle(const std::string& id, SUMOVehicle* v);
     133              : 
     134              : 
     135              :     /** @brief Returns the vehicle with the given id
     136              :      *
     137              :      * If no vehicle with the given id is store din "myVehicleDict", 0
     138              :      *  is returned.
     139              :      *
     140              :      * @param[in] id The id of the vehicle to retrieve
     141              :      * @return The vehicle with the given id, 0 if no such vehicle exists
     142              :      */
     143              :     SUMOVehicle* getVehicle(const std::string& id) const;
     144              : 
     145              : 
     146              :     /** @brief Deletes the vehicle
     147              :      *
     148              :      * @param[in] v The vehicle to delete
     149              :      * @param[discard] Whether the vehicle is discard during loading (scale < 1)
     150              :      * @todo Isn't this quite insecure?
     151              :      */
     152              :     virtual void deleteVehicle(SUMOVehicle* v, bool discard = false, bool wasKept = false);
     153              : 
     154              :     /** @brief when a vehicle is kept after arrival, schedule later deletion **/
     155              :     void deleteKeptVehicle(SUMOVehicle* veh);
     156              : 
     157              :     void fixVehicleCounts() {
     158           15 :         myLoadedVehNo++;
     159           15 :         myEndedVehNo++;
     160           15 :         myDiscarded++;
     161              :     }
     162              : 
     163              :     /** @brief Removes a vehicle after it has ended
     164              :      *
     165              :      * Writes output to tripinfos and vehroutes if wished; decrements
     166              :      *  the number of running vehicles and increments the number of ended
     167              :      *  vehicles. Then deletes the vehicle using "deleteVehicle".
     168              :      *
     169              :      * This method should be called for each vehicle that was inserted
     170              :      *  into the network and quits its ride.
     171              :      *
     172              :      * @param[in] veh The vehicle to remove
     173              :      */
     174              :     void scheduleVehicleRemoval(SUMOVehicle* veh, bool checkDuplicate = false);
     175              : 
     176              : 
     177              :     /** @brief Removes a vehicle after it has ended
     178              :      *
     179              :      * Writes output to tripinfos and vehroutes if wished; decrements
     180              :      *  the number of running vehicles and increments the number of ended
     181              :      *  vehicles. Then deletes the vehicle using "deleteVehicle".
     182              :      *
     183              :      * This method should be called for each vehicle that was inserted
     184              :      *  into the network and quits its ride.
     185              :      *
     186              :      * @param[in] veh The vehicle to remove
     187              :      */
     188              :     void removePending();
     189              : 
     190              : 
     191              :     /** @brief Returns the begin of the internal vehicle map
     192              :      * @return The begin of the internal vehicle map
     193              :      */
     194              :     constVehIt loadedVehBegin() const {
     195              :         return myVehicleDict.begin();
     196              :     }
     197              : 
     198              : 
     199              :     /** @brief Returns the end of the internal vehicle map
     200              :      * @return The end of the internal vehicle map
     201              :      */
     202              :     constVehIt loadedVehEnd() const {
     203              :         return myVehicleDict.end();
     204              :     }
     205              :     /// @}
     206              : 
     207              : 
     208              :     /// @brief register / unregister depart-triggered vehicles with edges
     209              :     void handleTriggeredDepart(SUMOVehicle* v, bool add);
     210              : 
     211              :     /// @name Setting vehicle statistics
     212              :     /// @{
     213              : 
     214              :     /** @brief Informs this control about a vehicle's departure
     215              :      *
     216              :      * If the mean waiting time shall be computed (f.e. for summary-output),
     217              :      *  the absolut waiting time is increased by the waiting time of the given
     218              :      *  vehicle.
     219              :      * @param[in] v The inserted vehicle
     220              :      */
     221              :     void vehicleDeparted(const SUMOVehicle& v);
     222              :     /// @}
     223              : 
     224              : 
     225              : 
     226              :     /// @name Retrieval of vehicle statistics (always accessable)
     227              :     /// @{
     228              : 
     229              :     /** @brief Returns the number of build vehicles
     230              :      * @return The number of loaded (build) vehicles
     231              :      */
     232            0 :     int getLoadedVehicleNo() const {
     233       518272 :         return myLoadedVehNo;
     234              :     }
     235              : 
     236              : 
     237              :     /** @brief Returns the number of halting vehicles
     238              :      * @return The number of halting vehicles
     239              :      */
     240              :     virtual int getHaltingVehicleNo() const;
     241              : 
     242              :     /// @brief get current absolute and relative mean vehicle speed in the network
     243              :     virtual std::pair<double, double> getVehicleMeanSpeeds() const;
     244            0 :     double getVehicleMeanSpeed() const {
     245            0 :         return getVehicleMeanSpeeds().first;
     246              :     }
     247            0 :     double getVehicleMeanSpeedRelative() const {
     248            0 :         return getVehicleMeanSpeeds().second;
     249              :     }
     250              : 
     251              :     /** @brief Returns the number of removed vehicles
     252              :      * @return The number of vehicles that have left the simulation
     253              :      */
     254              :     int getEndedVehicleNo() const {
     255       517886 :         return myEndedVehNo;
     256              :     }
     257              : 
     258              :     /** @brief Returns the number of arrived vehicles
     259              :      * @return The number of vehicles that have arrived at their destination
     260              :      */
     261            0 :     int getArrivedVehicleNo() const {
     262       517886 :         return myEndedVehNo - myDiscarded;
     263              :     }
     264              : 
     265              :     /** @brief Returns the number of discarded vehicles
     266              :      * @return The number of vehicles that could not be inserted and were permantently discarded
     267              :      */
     268            0 :     int getDiscardedVehicleNo() const {
     269            0 :         return myDiscarded;
     270              :     }
     271              : 
     272              : 
     273              :     /** @brief Returns the number of build and inserted, but not yet deleted vehicles
     274              :      * @return The number simulated vehicles (including those in teleporter)
     275              :      */
     276            0 :     int getRunningVehicleNo() const {
     277     64520341 :         return myRunningVehNo;
     278              :     }
     279              : 
     280              : 
     281              :     /** @brief Returns the number of inserted vehicles
     282              :      * @return The number of vehicles that have entered the simulation so far
     283              :      */
     284            0 :     int getDepartedVehicleNo() const {
     285     11095704 :         return myRunningVehNo + myEndedVehNo - myDiscarded;
     286              :     }
     287              : 
     288              : 
     289              :     /** @brief Returns the number of instances of the current vehicle that shall be emitted
     290              :      * considering that "frac" of all vehicles shall be emitted overall
     291              :      * if a negative fraction is given the demand scaling factor is used
     292              :      * (--scale)
     293              :      * if a negative loaded number is is given, myLoadedVehNo is used
     294              :      * @return the number of vehicles to create (something between 0 and ceil(frac))
     295              :      */
     296              :     int getQuota(double frac = -1, int loaded = -1) const;
     297              : 
     298              : 
     299              :     /** @brief Returns the number of build vehicles that have not been removed or
     300              :      * need to wait for a passenger or a container
     301              :      * @return Number of active vehicles
     302              :      */
     303              :     int getActiveVehicleCount() const {
     304     53080399 :         return myLoadedVehNo - (myWaitingForTransportable + myEndedVehNo);
     305              :     }
     306              : 
     307              :     /// @brief return the number of vehicles that are waiting for a transportable or a join
     308              :     int getTriggeredVehicleCount() const {
     309              :         return myWaitingForTransportable;
     310              :     }
     311              : 
     312              : 
     313              :     /// @brief return the number of collisions
     314            0 :     int getCollisionCount() const {
     315       529448 :         return myCollisions;
     316              :     }
     317              : 
     318              :     /// @brief return the number of collisions
     319              :     int getTeleportsCollisions() const {
     320              :         return myTeleportsCollision;
     321              :     }
     322              : 
     323              :     /// @brief return the number of teleports due to jamming
     324              :     int getTeleportsJam() const {
     325          988 :         return myTeleportsJam;
     326              :     }
     327              : 
     328              :     /// @brief return the number of teleports due to vehicles stuck on a minor road
     329              :     int getTeleportsYield() const {
     330          988 :         return myTeleportsYield;
     331              :     }
     332              : 
     333              :     /// @brief return the number of teleports due to vehicles stuck on the wrong lane
     334              :     int getTeleportsWrongLane() const {
     335          988 :         return myTeleportsWrongLane;
     336              :     }
     337              : 
     338              :     /// @brief return the number of teleports (including collisions)
     339              :     int getTeleportCount() const;
     340              : 
     341              :     /// @brief return the number of emergency stops
     342              :     int getEmergencyStops() const {
     343        11615 :         return myEmergencyStops;
     344              :     }
     345              : 
     346              :     /// @brief return the number of emergency stops
     347              :     int getEmergencyBrakingCount() const {
     348        11839 :         return myEmergencyBrakingCount;
     349              :     }
     350              : 
     351              :     /// @brief return the number of vehicles that are currently stopped
     352            0 :     int getStoppedVehiclesCount() const {
     353       517886 :         return myStoppedVehicles;
     354              :     }
     355              : 
     356              :     /** @brief Returns the total departure delay
     357              :      * @return Sum of steps vehicles had to wait until being inserted
     358              :      */
     359              :     double getTotalDepartureDelay() const {
     360       515413 :         return myTotalDepartureDelay;
     361              :     }
     362              : 
     363              : 
     364              :     /** @brief Returns the total travel time
     365              :      * @return Sum of travel times of arrived vehicles
     366              :      */
     367              :     double getTotalTravelTime() const {
     368       449505 :         return myTotalTravelTime;
     369              :     }
     370              :     /// @}
     371              : 
     372              : 
     373              : 
     374              :     /// @name Insertion and retrieval of vehicle types
     375              :     /// @{
     376              : 
     377              :     /** @brief Adds a vehicle type
     378              :      *
     379              :      * If another vehicle type (or distribution) with the same id exists, false is returned.
     380              :      *  Otherwise, the vehicle type is added to the internal vehicle type
     381              :      *  container "myVTypeDict".
     382              :      *
     383              :      * This control get responsible for deletion of the added vehicle
     384              :      *  type.
     385              :      *
     386              :      * @param[in] vehType The vehicle type to add
     387              :      * @return Whether the vehicle type could be added
     388              :      */
     389              :     bool addVType(MSVehicleType* vehType);
     390              : 
     391              :     /*
     392              :      * @param[in] vehType The vehicle type to remove
     393              :      * @return Whether the vehicle type could be removed
     394              :      */
     395              :     void removeVType(const MSVehicleType* vehType);
     396              : 
     397              : 
     398              :     /** @brief Adds a vehicle type distribution
     399              :      *
     400              :      * If another vehicle type (or distribution) with the same id exists, false is returned.
     401              :      *  Otherwise, the vehicle type distribution is added to the internal vehicle type distribution
     402              :      *  container "myVTypeDistDict".
     403              :      *
     404              :      * This control get responsible for deletion of the added vehicle
     405              :      *  type distribution.
     406              :      *
     407              :      * @param[in] id The id of the distribution to add
     408              :      * @param[in] vehTypeDistribution The vehicle type distribution to add
     409              :      * @return Whether the vehicle type could be added
     410              :      */
     411              :     bool addVTypeDistribution(const std::string& id, RandomDistributor<MSVehicleType*>* vehTypeDistribution);
     412              : 
     413              : 
     414              :     /** @brief Asks for existence of a vehicle type
     415              :      *
     416              :      * If vehicle type or distribution with the id exists, true is returned, false otherwise.
     417              :      *
     418              :      * @param[in] id The id of the type or distribution
     419              :      * @return Whether the vehicle type or distribution exists
     420              :      */
     421              :     bool hasVType(const std::string& id) const;
     422              : 
     423              : 
     424              :     /** @brief Asks for a vehicle type distribution
     425              :      *
     426              :      * If vehicle type distribution with the id exists, true is returned, false otherwise.
     427              :      *
     428              :      * @param[in] id The id of the distribution
     429              :      * @return Whether the vehicle type distribution exists
     430              :      */
     431              :     bool hasVTypeDistribution(const std::string& id) const;
     432              : 
     433              : 
     434              :     /** @brief Returns the named vehicle type or a sample from the named distribution
     435              :      * @param[in] id The id of the vehicle type to return. If left out, the default type is returned.
     436              :      * @return The named vehicle type, or nullptr if no such type exists
     437              :      */
     438              :     MSVehicleType* getVType(const std::string& id = DEFAULT_VTYPE_ID, SumoRNG* rng = nullptr, bool readOnly = false);
     439              : 
     440              : 
     441              :     /** @brief Inserts ids of all known vehicle types and vehicle type distributions to the given vector
     442              :      * @param[in] into The vector to fill with ids
     443              :      */
     444              :     void insertVTypeIDs(std::vector<std::string>& into) const;
     445              : 
     446              : 
     447              :     /** @brief Return the distribution IDs the vehicle type is a member of
     448              :     * @param[in] vehType The vehicle type to look for membership in distributions
     449              :     */
     450              :     const std::set<std::string> getVTypeDistributionMembership(const std::string& id) const;
     451              : 
     452              :     /// @brief return the vehicle type distribution with the given id
     453              :     const RandomDistributor<MSVehicleType*>* getVTypeDistribution(const std::string& typeDistID) const;
     454              : 
     455              :     /// @brief Return all pedestrian vehicle types.
     456              :     const std::vector<MSVehicleType*> getPedestrianTypes(void) const;
     457              : 
     458              :     /// @}
     459              : 
     460              :     /** @brief increases the count of vehicles waiting for a transport to allow recognition of person / container related deadlocks
     461              :      */
     462              :     void registerOneWaiting() {
     463         5705 :         myWaitingForTransportable++;
     464         2143 :     }
     465              : 
     466              :     /** @brief decreases the count of vehicles waiting for a transport to allow recognition of person / container related deadlocks
     467              :      */
     468              :     void unregisterOneWaiting() {
     469         2626 :         myWaitingForTransportable--;
     470         2425 :     }
     471              : 
     472              :     /// @brief registers one collision-related teleport
     473              :     void registerCollision(bool teleport) {
     474         6509 :         myCollisions++;
     475         6509 :         if (teleport) {
     476         5153 :             myTeleportsCollision++;
     477              :         }
     478              :     }
     479              : 
     480              :     /// @brief register one non-collision-related teleport
     481              :     void registerTeleportJam() {
     482         3767 :         myTeleportsJam++;
     483         1784 :     }
     484              : 
     485              :     /// @brief register one non-collision-related teleport
     486              :     void registerTeleportYield() {
     487         1371 :         myTeleportsYield++;
     488         1371 :     }
     489              : 
     490              :     /// @brief register one non-collision-related teleport
     491              :     void registerTeleportWrongLane() {
     492          626 :         myTeleportsWrongLane++;
     493          626 :     }
     494              : 
     495              :     /// @brief register emergency stop
     496              :     void registerEmergencyStop() {
     497          275 :         myEmergencyStops++;
     498              :     }
     499              : 
     500              :     /// @brief register emergency stop
     501              :     void registerEmergencyBraking() {
     502        30932 :         myEmergencyBrakingCount++;
     503        30932 :     }
     504              : 
     505              :     /// @brief register emergency stop
     506              :     void registerStopStarted() {
     507        53845 :         myStoppedVehicles++;
     508              :     }
     509              : 
     510              :     /// @brief register emergency stop
     511              :     void registerStopEnded() {
     512        47010 :         myStoppedVehicles--;
     513              :     }
     514              : 
     515              :     /// @name State I/O
     516              :     /// @{
     517              : 
     518              :     /** @brief Sets the current state variables as loaded from the stream
     519              :      */
     520              :     void setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime);
     521              : 
     522              :     /** @brief Saves the current state into the given stream
     523              :      */
     524              :     void saveState(OutputDevice& out);
     525              : 
     526              :     /** @brief Remove all vehicles before quick-loading state */
     527              :     void clearState(const bool reinit);
     528              :     /// @}
     529              : 
     530              :     /// @brief discount vehicles that were removed during state loading
     531              :     void discountStateRemoved(int n) {
     532            6 :         myRunningVehNo -= n;
     533            6 :         myDiscarded += n;
     534            6 :         myEndedVehNo += n;
     535            6 :     }
     536              : 
     537              : 
     538              :     /** @brief informes about all waiting vehicles (deletion in destructor)
     539              :      */
     540              :     void abortWaiting();
     541              : 
     542              :     /// @brief return the maximum speed factor for all vehicles that ever entered the network
     543              :     double getMaxSpeedFactor() const {
     544    299384828 :         return myMaxSpeedFactor;
     545              :     }
     546              : 
     547              :     /// @brief return the minimum deceleration capability for all road vehicles that ever entered the network
     548              :     double getMinDeceleration() const {
     549    298939027 :         return myMinDeceleration;
     550              :     }
     551              : 
     552              :     /// @brief return the minimum deceleration capability for all ral vehicles that ever entered the network
     553              :     double getMinDecelerationRail() const {
     554       445801 :         return myMinDecelerationRail;
     555              :     }
     556              : 
     557              :     void adaptIntermodalRouter(MSTransportableRouter& router) const;
     558              : 
     559              :     /// @brief sets the demand scaling factor
     560              :     void setScale(double scale) {
     561         7110 :         myScale = scale;
     562         7105 :     }
     563              : 
     564              :     /// @brief sets the demand scaling factor
     565              :     double getScale() const {
     566     31038060 :         return myScale;
     567              :     }
     568              : 
     569              : private:
     570              :     /// @brief create default types
     571              :     void initDefaultTypes();
     572              : 
     573              :     /** @brief Checks whether the vehicle type (distribution) may be added
     574              :      *
     575              :      * This method checks also whether the default type may still be replaced
     576              :      * @param[in] id The id of the vehicle type (distribution) to add
     577              :      * @return Whether the type (distribution) may be added
     578              :      */
     579              :     bool checkVType(const std::string& id);
     580              : 
     581              :     /// @brief whether the given vehicle is scheduled for removal
     582              :     bool isPendingRemoval(SUMOVehicle* veh);
     583              : 
     584              : protected:
     585              :     void initVehicle(MSBaseVehicle* built, const bool ignoreStopErrors, bool addRouteStops, const VehicleDefinitionSource source);
     586              : 
     587              : private:
     588              :     /// @name Vehicle statistics (always accessible)
     589              :     /// @{
     590              : 
     591              :     /// @brief The number of build vehicles
     592              :     int myLoadedVehNo;
     593              : 
     594              :     /// @brief The number of vehicles within the network (build and inserted but not removed)
     595              :     int myRunningVehNo;
     596              : 
     597              :     /// @brief The number of removed vehicles
     598              :     int myEndedVehNo;
     599              : 
     600              :     /// @brief The number of vehicles which were discarded while loading
     601              :     int myDiscarded;
     602              : 
     603              :     /// @brief The number of collisions
     604              :     int myCollisions;
     605              : 
     606              :     /// @brief The number of teleports due to collision
     607              :     int myTeleportsCollision;
     608              : 
     609              :     /// @brief The number of teleports due to jam
     610              :     int myTeleportsJam;
     611              : 
     612              :     /// @brief The number of teleports due to vehicles stuck on a minor road
     613              :     int myTeleportsYield;
     614              : 
     615              :     /// @brief The number of teleports due to vehicles stuck on the wrong lane
     616              :     int myTeleportsWrongLane;
     617              : 
     618              :     /// @brief The number of emergency stops
     619              :     int myEmergencyStops;
     620              : 
     621              :     /// @brief The number of emergency stops
     622              :     int myEmergencyBrakingCount;
     623              : 
     624              :     /// @brief The number of stopped vehicles
     625              :     int myStoppedVehicles;
     626              :     /// @}
     627              : 
     628              : 
     629              :     /// @name Vehicle statistics
     630              :     /// @{
     631              : 
     632              :     /// @brief The aggregated time vehicles had to wait for departure (in seconds)
     633              :     double myTotalDepartureDelay;
     634              : 
     635              :     /// @brief The aggregated time vehicles needed to aacomplish their route (in seconds)
     636              :     double myTotalTravelTime;
     637              :     /// @}
     638              : 
     639              : 
     640              : protected:
     641              :     /// @name Vehicle container
     642              :     /// @{
     643              : 
     644              :     /// @brief Vehicle dictionary type
     645              :     typedef std::map< std::string, SUMOVehicle* > VehicleDictType;
     646              :     /// @brief Dictionary of vehicles
     647              :     VehicleDictType myVehicleDict;
     648              :     /// @}
     649              : 
     650              : 
     651              : private:
     652              :     class DeleteKeptVehicle : public Command {
     653              :     public:
     654           12 :         DeleteKeptVehicle(SUMOVehicle* veh) : myVehicle(veh) {};
     655           12 :         ~DeleteKeptVehicle() {};
     656              :         SUMOTime execute(SUMOTime currentTime);
     657              :     private:
     658              :         SUMOVehicle* myVehicle;
     659              :     private:
     660              :         /// @brief Invalidated assignment operator.
     661              :         DeleteKeptVehicle& operator=(const DeleteKeptVehicle&) = delete;
     662              :     };
     663              : 
     664              :     /// @name Vehicle type container
     665              :     /// @{
     666              : 
     667              :     /// @brief Vehicle type dictionary type
     668              :     typedef std::map< std::string, MSVehicleType* > VTypeDictType;
     669              :     /// @brief Dictionary of vehicle types
     670              :     VTypeDictType myVTypeDict;
     671              : 
     672              :     /// @brief Vehicle type distribution dictionary type
     673              :     typedef std::map< std::string, RandomDistributor<MSVehicleType*>* > VTypeDistDictType;
     674              :     /// @brief A distribution of vehicle types (probability->vehicle type)
     675              :     VTypeDistDictType myVTypeDistDict;
     676              : 
     677              :     /// @brief Inverse lookup from vehicle type to distributions it is a member of
     678              :     std::map<std::string, std::set<std::string>> myVTypeToDist;
     679              : 
     680              :     /// @brief the default vehicle types which may still be replaced
     681              :     std::set<std::string> myReplaceableDefaultVTypes;
     682              : 
     683              :     /// the number of vehicles waiting for persons or containers contained in myWaiting which can only continue by being triggered
     684              :     int myWaitingForTransportable;
     685              : 
     686              :     /// @brief The scaling factor (especially for inc-dua)
     687              :     double myScale;
     688              : 
     689              :     SUMOTime myKeepTime;
     690              : 
     691              :     /// @brief The maximum speed factor for all vehicles in the network
     692              :     double myMaxSpeedFactor;
     693              : 
     694              :     /// @brief The minimum deceleration capability for all road vehicles in the network
     695              :     double myMinDeceleration;
     696              :     /// @brief The minimum deceleration capability for all rail vehicles in the network
     697              :     double myMinDecelerationRail;
     698              : 
     699              :     /// @brief List of vehicles which belong to public transport
     700              :     std::vector<SUMOVehicle*> myPTVehicles;
     701              : 
     702              :     /// @brief List of vehicles which are going to be removed
     703              : #ifdef HAVE_FOX
     704              :     MFXSynchQue<SUMOVehicle*, std::vector<SUMOVehicle*> > myPendingRemovals;
     705              : #else
     706              :     std::vector<SUMOVehicle*> myPendingRemovals;
     707              : #endif
     708              : 
     709              : private:
     710              :     /// @brief invalidated copy constructor
     711              :     MSVehicleControl(const MSVehicleControl& s) = delete;
     712              : 
     713              :     /// @brief invalidated assignment operator
     714              :     MSVehicleControl& operator=(const MSVehicleControl& s) = delete;
     715              : 
     716              : 
     717              : };
        

Generated by: LCOV version 2.0-1