LCOV - code coverage report
Current view: top level - src/microsim/cfmodels - MSCFModel_Krauss.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 5 5
Test Date: 2024-12-21 15:45:41 Functions: 100.0 % 2 2

            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    MSCFModel_Krauss.h
      15              : /// @author  Tobias Mayer
      16              : /// @author  Daniel Krajzewicz
      17              : /// @author  Jakob Erdmann
      18              : /// @author  Michael Behrisch
      19              : /// @date    Tue, 28 Jul 2009
      20              : ///
      21              : // Krauss car-following model, with acceleration decrease and faster start
      22              : /****************************************************************************/
      23              : #pragma once
      24              : #include <config.h>
      25              : 
      26              : #include "MSCFModel_KraussOrig1.h"
      27              : #include <utils/xml/SUMOXMLDefinitions.h>
      28              : 
      29              : 
      30              : // ===========================================================================
      31              : // class definitions
      32              : // ===========================================================================
      33              : /** @class MSCFModel_Krauss
      34              :  * @brief Krauss car-following model, with acceleration decrease and faster start
      35              :  * @see MSCFModel
      36              :  */
      37              : class MSCFModel_Krauss : public MSCFModel_KraussOrig1 {
      38              : public:
      39              :     /** @brief Constructor
      40              :      *  @param[in] vtype the type for which this model is built and also the parameter object to configure this model
      41              :      */
      42              :     MSCFModel_Krauss(const MSVehicleType* vtype);
      43              : 
      44              : 
      45              :     /// @brief Destructor
      46              :     ~MSCFModel_Krauss();
      47              : 
      48              :     /// @name Implementations of the MSCFModel interface
      49              :     /// @{
      50              :     /// @brief apply dawdling
      51              :     double patchSpeedBeforeLC(const MSVehicle* veh, double vMin, double vMax) const;
      52              : 
      53              :     /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
      54              :      * this uses the maximumSafeStopSpeed
      55              :      * @param[in] veh The vehicle (EGO)
      56              :      * @param[in] gap2pred The (net) distance to the obstacle
      57              :      * @return EGO's safe speed for approaching a non-moving obstacle
      58              :      * @todo generic Interface, models can call for the values they need
      59              :      */
      60              :     double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred, double decel, const CalcReason usage = CalcReason::CURRENT) const;
      61              : 
      62              : 
      63              :     /** @brief Computes the vehicle's safe speed (no dawdling)
      64              :      * this uses the maximumSafeFollowSpeed
      65              :      * @param[in] veh The vehicle (EGO)
      66              :      * @param[in] speed The vehicle's speed
      67              :      * @param[in] gap2pred The (net) distance to the LEADER
      68              :      * @param[in] predSpeed The speed of LEADER
      69              :      * @param[in] pred The leading vehicle (LEADER)
      70              :      * @return EGO's safe speed
      71              :      */
      72              :     double followSpeed(const MSVehicle* const veh, double speed, double gap2pred,
      73              :                        double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
      74              : 
      75              : 
      76              :     /** @brief Returns the model's name
      77              :      * @return The model's name
      78              :      * @see MSCFModel::getModelName
      79              :      */
      80       153961 :     int getModelID() const {
      81       153961 :         return SUMO_TAG_CF_KRAUSS;
      82              :     }
      83              :     /// @}
      84              : 
      85              : 
      86              :     /** @brief Duplicates the car-following model
      87              :      * @param[in] vtype The vehicle type this model belongs to (1:1)
      88              :      * @return A duplicate of this car-following model
      89              :      */
      90              :     MSCFModel* duplicate(const MSVehicleType* vtype) const;
      91              : 
      92      4092455 :     VehicleVariables* createVehicleVariables() const {
      93      4092455 :         if (myDawdleStep > DELTA_T) {
      94           12 :             return new VehicleVariables(myDawdleStep);
      95              :         }
      96              :         return 0;
      97              :     }
      98              : 
      99              : 
     100              : private:
     101              :     class VehicleVariables : public MSCFModel::VehicleVariables {
     102              :     public:
     103              :         // no speed update happens in the insertion step
     104              :         VehicleVariables(SUMOTime dawdleStep);
     105              : 
     106              :         /// @brief the accleration due to dawdling
     107              :         double accelDawdle;
     108              :         SUMOTime updateOffset;
     109              :     };
     110              : 
     111              : protected:
     112              : 
     113              :     /** @brief Applies driver imperfection (dawdling / sigma)
     114              :      * @param[in] speed The speed with no dawdling
     115              :      * @param[in] sigma The sigma value to use
     116              :      * @return The speed after dawdling
     117              :      */
     118              :     double dawdle2(double speed, double sigma, SumoRNG* rng) const;
     119              : 
     120              :     /// @brief The vehicle's update period for dawdling
     121              :     SUMOTime myDawdleStep;
     122              : 
     123              : 
     124              : };
        

Generated by: LCOV version 2.0-1