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_Wiedemann.h
15 : /// @author Jakob Erdmann
16 : /// @author Michael Behrisch
17 : /// @date June 2011
18 : ///
19 : // The psycho-physical model of Wiedemann
20 : /****************************************************************************/
21 : #pragma once
22 : #include <config.h>
23 :
24 : #include "MSCFModel.h"
25 : #include <microsim/MSLane.h>
26 : #include <microsim/MSVehicle.h>
27 : #include <microsim/MSVehicleType.h>
28 : #include <utils/xml/SUMOXMLDefinitions.h>
29 :
30 :
31 : // ===========================================================================
32 : // class definitions
33 : // ===========================================================================
34 : /** @class MSCFModel_Wiedemann
35 : * @brief The Wiedemann Model car-following model
36 : * @see MSCFModel
37 : */
38 : // XXX: which Wiedemann is this? There are several versions... Below it is stated that it is modified it with Krauss vsafe... (Leo)
39 : class MSCFModel_Wiedemann : public MSCFModel {
40 : public:
41 :
42 : /** @brief Constructor
43 : * @param[in] vtype the type for which this model is built and also the parameter object to configure this model
44 : */
45 : MSCFModel_Wiedemann(const MSVehicleType* vtype);
46 :
47 :
48 : /// @brief Destructor
49 : ~MSCFModel_Wiedemann();
50 :
51 :
52 : /// @name Implementations of the MSCFModel interface
53 : /// @{
54 :
55 : /** @brief Applies interaction with stops and lane changing model influences
56 : * @param[in] veh The ego vehicle
57 : * @param[in] vPos The possible velocity
58 : * @return The velocity after applying interactions with stops and lane change model influences
59 : */
60 : double finalizeSpeed(MSVehicle* const veh, double vPos) const;
61 :
62 :
63 : /** @brief Computes the vehicle's safe speed (no dawdling)
64 : * @param[in] veh The vehicle (EGO)
65 : * @param[in] speed The vehicle's speed
66 : * @param[in] gap2pred The (net) distance to the LEADER
67 : * @param[in] predSpeed The speed of LEADER
68 : * @return EGO's safe speed
69 : * @see MSCFModel::ffeV
70 : */
71 : double followSpeed(const MSVehicle* const veh, double speed, double gap2pred,
72 : double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
73 :
74 :
75 : /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
76 : * @param[in] veh The vehicle (EGO)
77 : * @param[in] gap The (net) distance to the obstacle
78 : * @return EGO's safe speed for approaching a non-moving obstacle
79 : * @see MSCFModel::ffeS
80 : * @todo generic Interface, models can call for the values they need
81 : */
82 : double stopSpeed(const MSVehicle* const veh, const double speed, double gap, double decel, const CalcReason usage = CalcReason::CURRENT) const;
83 :
84 :
85 : /** @brief Returns the maximum gap at which an interaction between both vehicles occurs
86 : *
87 : * "interaction" means that the LEADER influences EGO's speed.
88 : * @param[in] veh The EGO vehicle
89 : * @param[in] vL LEADER's speed
90 : * @return The interaction gap
91 : * @todo evaluate signature
92 : * @see MSCFModel::interactionGap
93 : */
94 : double interactionGap(const MSVehicle* const, double vL) const;
95 :
96 : /** @brief Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
97 : * @param[in] veh The vehicle itself, for obtaining other values
98 : * @param[in] pred The leader vehicle, for obtaining other values
99 : * @param[in] speed EGO's speed
100 : * @param[in] leaderSpeed LEADER's speed
101 : * @param[in] leaderMaxDecel LEADER's max. deceleration rate
102 : */
103 : double getSecureGap(const MSVehicle* const veh, const MSVehicle* const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
104 :
105 : /** @brief Returns the model's name
106 : * @return The model's name
107 : * @see MSCFModel::getModelName
108 : */
109 0 : int getModelID() const {
110 0 : return SUMO_TAG_CF_WIEDEMANN;
111 : }
112 :
113 :
114 : /** @brief Duplicates the car-following model
115 : * @param[in] vtype The vehicle type this model belongs to (1:1)
116 : * @return A duplicate of this car-following model
117 : */
118 : MSCFModel* duplicate(const MSVehicleType* vtype) const;
119 :
120 :
121 8041 : VehicleVariables* createVehicleVariables() const {
122 8041 : return new VehicleVariables();
123 : }
124 : /// @}
125 :
126 :
127 : private:
128 : class VehicleVariables : public MSCFModel::VehicleVariables {
129 : public:
130 8041 : VehicleVariables() : accelSign(1) {}
131 : /// @brief state variable for remembering the drift direction
132 : double accelSign;
133 : };
134 :
135 :
136 : private:
137 : /* @brief the main enty point for the speed computation
138 : * @param[in] gap The netto gap (front bumper of ego to back bumper of leader)
139 : */
140 : double _v(const MSVehicle* veh, double predSpeed, double gap, double predAccel) const;
141 :
142 : /// @name acceleration based on the 'driving regime'
143 : /// @{
144 : double fullspeed(double v, double vpref, double dx, double bx) const; // also 'WUNSCH'
145 : double following(double sign) const; // also 'FOLGEN'
146 : double approaching(double dv, double dx, double abx, double predAccel) const; // also 'BREMSBX'
147 : double emergency(double dv, double dx, double predAccel, double v, double gap, double abx, double bx) const; // also 'BREMSAX'
148 : /// @}
149 :
150 : private:
151 : /// @name model parameter
152 : /// @{
153 :
154 : /// @brief The driver's security parameter // also 'ZF1'
155 : const double mySecurity;
156 :
157 : /// @brief The driver's estimation parameter // also 'ZF2'
158 : const double myEstimation;
159 :
160 : /// @brief the minimum front-bumper to front-bumper distance when standing
161 : const double myAX;
162 :
163 : /// @brief perception threshold modifier
164 : const double myCX;
165 :
166 : /// @brief The vehicle's minimum acceleration [m/s^2] // also b_null
167 : const double myMinAccel;
168 :
169 : /// @brief The maximum deceleration when approaching
170 : const double myMaxApproachingDecel;
171 :
172 : /// @brief free-flow distance in m
173 : static const double D_MAX;
174 : /// @}
175 :
176 : private:
177 : /// @brief Invalidated assignment operator
178 : MSCFModel_Wiedemann& operator=(const MSCFModel_Wiedemann& s);
179 : };
|