Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2010-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_PWag2009.h
15 : /// @author Peter Wagner
16 : /// @author Daniel Krajzewicz
17 : /// @author Michael Behrisch
18 : /// @date 03.04.2010
19 : ///
20 : // Scalable model based on Krauss by Peter Wagner
21 : /****************************************************************************/
22 : #pragma once
23 : #include <config.h>
24 :
25 : #include "MSCFModel.h"
26 : #include <utils/xml/SUMOXMLDefinitions.h>
27 :
28 :
29 : // ===========================================================================
30 : // class definitions
31 : // ===========================================================================
32 : /** @class MSCFModel_PWag2009
33 : * @brief Scalable model based on Krauss by Peter Wagner
34 : * @see MSCFModel
35 : */
36 : class MSCFModel_PWag2009 : public MSCFModel {
37 : public:
38 : /** @brief Constructor
39 : * @param[in] vtype the type for which this model is built and also the parameter object to configure this model
40 : */
41 : MSCFModel_PWag2009(const MSVehicleType* vtype);
42 :
43 :
44 : /// @brief Destructor
45 : ~MSCFModel_PWag2009();
46 :
47 :
48 : /// @name Implementations of the MSCFModel interface
49 : /// @{
50 :
51 : /** @brief Applies interaction with stops and lane changing model influences
52 : * @param[in] veh The ego vehicle
53 : * @param[in] vPos The possible velocity
54 : * @return The velocity after applying interactions with stops and lane change model influences
55 : */
56 : double finalizeSpeed(MSVehicle* const veh, double vPos) const;
57 :
58 : /// @brief apply dawdling
59 : double patchSpeedBeforeLC(const MSVehicle* veh, double vMin, double vMax) const;
60 :
61 : /** @brief Computes the vehicle's safe speed (no dawdling)
62 : * @param[in] veh The vehicle (EGO)
63 : * @param[in] speed The vehicle's speed
64 : * @param[in] gap2pred The (net) distance to the LEADER
65 : * @param[in] predSpeed The speed of LEADER
66 : * @return EGO's safe speed
67 : * @see MSCFModel::ffeV
68 : */
69 : double followSpeed(const MSVehicle* const veh, double speed, double gap2pred,
70 : double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
71 :
72 :
73 : /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
74 : * @param[in] veh The vehicle (EGO)
75 : * @param[in] gap2pred The (net) distance to the obstacle
76 : * @return EGO's safe speed for approaching a non-moving obstacle
77 : * @see MSCFModel::ffeS
78 : * @todo generic Interface, models can call for the values they need
79 : */
80 : double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred, double decel, const CalcReason usage = CalcReason::CURRENT) const;
81 :
82 :
83 : /** @brief Returns the model's name
84 : * @return The model's name
85 : * @see MSCFModel::getModelName
86 : */
87 0 : int getModelID() const {
88 0 : return SUMO_TAG_CF_PWAGNER2009;
89 : }
90 :
91 :
92 : /** @brief Get the driver's imperfection
93 : * @return The imperfection of drivers of this class
94 : */
95 0 : double getImperfection() const {
96 0 : return myDawdle;
97 : }
98 : /// @}
99 :
100 :
101 :
102 : /** @brief Duplicates the car-following model
103 : * @param[in] vtype The vehicle type this model belongs to (1:1)
104 : * @return A duplicate of this car-following model
105 : */
106 : MSCFModel* duplicate(const MSVehicleType* vtype) const;
107 :
108 :
109 0 : virtual MSCFModel::VehicleVariables* createVehicleVariables() const {
110 0 : VehicleVariables* ret = new VehicleVariables();
111 : ret->aOld = 0.0;
112 0 : return ret;
113 : }
114 :
115 :
116 : private:
117 0 : class VehicleVariables : public MSCFModel::VehicleVariables {
118 : public:
119 : double aOld;
120 : };
121 :
122 : /** @brief Returns the next velocity
123 : * @param[in] gap2pred The (net) distance to the LEADER
124 : * @param[in] predSpeed The LEADER's speed
125 : * @return the safe velocity
126 : */
127 : double _v(const MSVehicle* const veh, double speed, double gap, double predSpeed) const;
128 :
129 :
130 : /** @brief Applies driver imperfection (dawdling / sigma)
131 : * @param[in] speed The speed with no dawdling
132 : * @return The speed after dawdling
133 : */
134 : double dawdle(double speed) const;
135 :
136 : private:
137 : /// @name model parameter
138 : /// @{
139 : /// @brief The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max.
140 : double myDawdle;
141 :
142 : /// @brief The precomputed value for myDecel*myTau
143 : double myTauDecel;
144 :
145 : /// @brief The precomputed value for myDecel/myTau
146 : double myDecelDivTau;
147 :
148 : /// @brief The precomputed value for (minimum headway time)*myDecel
149 : double myTauLastDecel;
150 :
151 : /// @brief The probability for any action
152 : double myActionPointProbability;
153 : /// @}
154 :
155 : };
|