1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    MSCFModel_Krauss.h
11 /// @author  Tobias Mayer
12 /// @author  Daniel Krajzewicz
13 /// @author  Jakob Erdmann
14 /// @author  Michael Behrisch
15 /// @date    Tue, 28 Jul 2009
16 /// @version $Id$
17 ///
18 // Krauss car-following model, with acceleration decrease and faster start
19 /****************************************************************************/
20 #ifndef MSCFModel_Krauss_h
21 #define MSCFModel_Krauss_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include "MSCFModel_KraussOrig1.h"
29 #include <utils/xml/SUMOXMLDefinitions.h>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 /** @class MSCFModel_Krauss
36  * @brief Krauss car-following model, with acceleration decrease and faster start
37  * @see MSCFModel
38  */
39 class MSCFModel_Krauss : public MSCFModel_KraussOrig1 {
40 public:
41     /** @brief Constructor
42      *  @param[in] vtype the type for which this model is built and also the parameter object to configure this model
43      */
44     MSCFModel_Krauss(const MSVehicleType* vtype);
45 
46 
47     /// @brief Destructor
48     ~MSCFModel_Krauss();
49 
50     /// @name Implementations of the MSCFModel interface
51     /// @{
52     /// @brief apply dawdling
53     double patchSpeedBeforeLC(const MSVehicle* veh, double vMin, double vMax) const;
54 
55     /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
56      * this uses the maximumSafeStopSpeed
57      * @param[in] veh The vehicle (EGO)
58      * @param[in] gap2pred The (netto) distance to the the obstacle
59      * @return EGO's safe speed for approaching a non-moving obstacle
60      * @todo generic Interface, models can call for the values they need
61      */
62     double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const;
63 
64 
65     /** @brief Computes the vehicle's safe speed (no dawdling)
66      * this uses the maximumSafeFollowSpeed
67      * @param[in] veh The vehicle (EGO)
68      * @param[in] speed The vehicle's speed
69      * @param[in] gap2pred The (netto) distance to the LEADER
70      * @param[in] predSpeed The speed of LEADER
71      * @param[in] pred The leading vehicle (LEADER)
72      * @return EGO's safe speed
73      */
74     double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
75 
76 
77     /** @brief Returns the model's name
78      * @return The model's name
79      * @see MSCFModel::getModelName
80      */
getModelID()81     int getModelID() const {
82         return SUMO_TAG_CF_KRAUSS;
83     }
84     /// @}
85 
86 
87     /** @brief Duplicates the car-following model
88      * @param[in] vtype The vehicle type this model belongs to (1:1)
89      * @return A duplicate of this car-following model
90      */
91     MSCFModel* duplicate(const MSVehicleType* vtype) const;
92 
93 
94 protected:
95 
96     /** @brief Applies driver imperfection (dawdling / sigma)
97      * @param[in] speed The speed with no dawdling
98      * @param[in] sigma The sigma value to use
99      * @return The speed after dawdling
100      */
101     double dawdle2(double speed, double sigma, std::mt19937* rng) const;
102 
103 };
104 
105 #endif /* MSCFMODEL_KRAUSS_H */
106 
107