LCOV - code coverage report
Current view: top level - src/microsim/cfmodels - MSCFModel_Kerner.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 33.3 % 3 1
Test Date: 2024-12-21 15:45:41 Functions: 0.0 % 1 0

            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_Kerner.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    03.04.2010
      18              : ///
      19              : // car-following model by B. Kerner
      20              : /****************************************************************************/
      21              : #pragma once
      22              : #include <config.h>
      23              : 
      24              : #include "MSCFModel.h"
      25              : #include <utils/xml/SUMOXMLDefinitions.h>
      26              : 
      27              : 
      28              : // ===========================================================================
      29              : // class definitions
      30              : // ===========================================================================
      31              : /** @class MSCFModel_Kerner
      32              :  * @brief car-following model by B. Kerner
      33              :  * @see MSCFModel
      34              :  */
      35              : class MSCFModel_Kerner : public MSCFModel {
      36              : public:
      37              :     /** @brief Constructor
      38              :      *  @param[in] vtype the type for which this model is built and also the parameter object to configure this model
      39              :      */
      40              :     MSCFModel_Kerner(const MSVehicleType* vtype);
      41              : 
      42              : 
      43              :     /// @brief Destructor
      44              :     ~MSCFModel_Kerner();
      45              : 
      46              : 
      47              :     /// @name Implementations of the MSCFModel interface
      48              :     /// @{
      49              : 
      50              :     /** @brief Applies interaction with stops and lane changing model influences
      51              :      * @param[in] veh The ego vehicle
      52              :      * @param[in] vPos The possible velocity
      53              :      * @return The velocity after applying interactions with stops and lane change model influences
      54              :      */
      55              :     double finalizeSpeed(MSVehicle* const veh, double vPos) const;
      56              : 
      57              :     /** @brief Computes the vehicle's safe speed (no dawdling)
      58              :      * @param[in] veh The vehicle (EGO)
      59              :      * @param[in] speed The vehicle's speed
      60              :      * @param[in] gap2pred The (net) distance to the LEADER
      61              :      * @param[in] predSpeed The speed of LEADER
      62              :      * @return EGO's safe speed
      63              :      * @see MSCFModel::ffeV
      64              :      */
      65              :     double followSpeed(const MSVehicle* const veh, double speed, double gap2pred,
      66              :                        double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
      67              : 
      68              : 
      69              :     /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
      70              :      * @param[in] veh The vehicle (EGO)
      71              :      * @param[in] gap2pred The (net) distance to the obstacle
      72              :      * @return EGO's safe speed for approaching a non-moving obstacle
      73              :      * @see MSCFModel::ffeS
      74              :      * @todo generic Interface, models can call for the values they need
      75              :      */
      76              :     double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred, double decel, const CalcReason usage = CalcReason::CURRENT) const;
      77              : 
      78              : 
      79              :     /** @brief Returns the model's name
      80              :      * @return The model's name
      81              :      * @see MSCFModel::getModelName
      82              :      */
      83            0 :     int getModelID() const {
      84            0 :         return SUMO_TAG_CF_BKERNER;
      85              :     }
      86              :     /// @}
      87              : 
      88              : 
      89              : 
      90              :     /** @brief Duplicates the car-following model
      91              :      * @param[in] vtype The vehicle type this model belongs to (1:1)
      92              :      * @return A duplicate of this car-following model
      93              :      */
      94              :     MSCFModel* duplicate(const MSVehicleType* vtype) const;
      95              : 
      96              : 
      97              :     MSCFModel::VehicleVariables* createVehicleVariables() const;
      98              : 
      99              : 
     100              : private:
     101         6829 :     class VehicleVariables : public MSCFModel::VehicleVariables {
     102              :     public:
     103              :         double rand;
     104              :     };
     105              : 
     106              :     /** @brief Returns the "safe" velocity
     107              :      * @param[in] gap2pred The (net) distance to the LEADER
     108              :      * @param[in] predSpeed The LEADER's speed
     109              :      * @return the safe velocity
     110              :      */
     111              :     double _v(const MSVehicle* const veh, double speed, double vfree, double gap, double predSpeed) const;
     112              : 
     113              : 
     114              : 
     115              : private:
     116              :     /// @name model parameter
     117              :     /// @{
     118              :     /// @brief Kerner's k
     119              :     double myK;
     120              : 
     121              :     /// @brief Kerner's phi
     122              :     double myPhi;
     123              : 
     124              :     /// @brief The precomputed value for myDecel*myTau
     125              :     double myTauDecel;
     126              :     /// @}
     127              : 
     128              : };
        

Generated by: LCOV version 2.0-1