Eclipse SUMO - Simulation of Urban MObility
MSCFModel_IDM.h
Go to the documentation of this file.
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 /****************************************************************************/
20 // The Intelligent Driver Model (IDM) car-following model
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include "MSCFModel.h"
26 #include <microsim/MSLane.h>
27 #include <microsim/MSVehicle.h>
28 #include <microsim/MSVehicleType.h>
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
39 class MSCFModel_IDM : public MSCFModel {
40 public:
45  MSCFModel_IDM(const MSVehicleType* vtype, bool idmm);
46 
47 
58  MSCFModel_IDM(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double apparentDecel,
59  double headwayTime, double adaptationFactor, double adaptationTime,
60  double internalStepping);
61 
62 
65 
66 
69 
75  double finalizeSpeed(MSVehicle* const veh, double vPos) const;
76 
89  virtual double freeSpeed(const MSVehicle* const veh, double speed, double seen,
90  double maxSpeed, const bool onInsertion = false, const CalcReason usage = CalcReason::CURRENT) const;
91 
100  double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed,
101  double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
102 
103 
111  double stopSpeed(const MSVehicle* const veh, const double speed, double gap, double decel, const CalcReason usage = CalcReason::CURRENT) const;
112 
113 
123  double interactionGap(const MSVehicle* const, double vL) const;
124 
125 
138  double insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
139 
149  double insertionStopSpeed(const MSVehicle* const veh, double speed, double gap) const;
150 
158  double getSecureGap(const MSVehicle* const veh, const MSVehicle* const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
159 
164  int getModelID() const {
166  }
167 
168  double minNextSpeed(double speed, const MSVehicle* const veh = 0) const;
170 
171 
172 
177  MSCFModel* duplicate(const MSVehicleType* vtype) const;
178 
179 
181  if (myAdaptationFactor != 1.) {
182  return new VehicleVariables();
183  }
184  return 0;
185  }
186 
187 
188 private:
190  public:
194  };
195 
196 
197 private:
198  double _v(const MSVehicle* const veh, const double gap2pred, const double mySpeed,
199  const double predSpeed, const double desSpeed, const bool respectMinGap = true) const;
200 
201 
202 private:
204  const bool myIDMM;
205 
207  const double myDelta;
208 
210  const double myAdaptationFactor;
211 
213  const double myAdaptationTime;
214 
216  const int myIterations;
217 
219  const double myTwoSqrtAccelDecel;
220 
221 private:
224 };
@ SUMO_TAG_CF_IDM
@ SUMO_TAG_CF_IDMM
double levelOfService
state variable for remembering speed deviation history (lambda)
The Intelligent Driver Model (IDM) car-following model.
Definition: MSCFModel_IDM.h:39
const int myIterations
The number of iterations in speed calculations.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap, double decel, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
double minNextSpeed(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed (no dawdling)
int getModelID() const
Returns the model's name.
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed without a leader.
~MSCFModel_IDM()
Destructor.
const bool myIDMM
whether the model is IDMM or IDM
double getSecureGap(const MSVehicle *const veh, const MSVehicle *const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
MSCFModel_IDM(const MSVehicleType *vtype, bool idmm)
Constructor.
double insertionFollowSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's safe speed (no dawdling) This method is used during the insertion stage....
const double myAdaptationTime
The IDMM adaptation time tau.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
MSCFModel_IDM(const MSVehicleType *vtype, double accel, double decel, double emergencyDecel, double apparentDecel, double headwayTime, double adaptationFactor, double adaptationTime, double internalStepping)
Constructor.
const double myTwoSqrtAccelDecel
A computational shortcut.
const double myAdaptationFactor
The IDMM adaptation factor beta.
MSCFModel_IDM & operator=(const MSCFModel_IDM &s)
Invalidated assignment operator.
VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
const double myDelta
The IDM delta exponent.
double insertionStopSpeed(const MSVehicle *const veh, double speed, double gap) const
Computes the vehicle's safe speed for approaching an obstacle at insertion without constraints due to...
double _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
The car-following model abstraction.
Definition: MSCFModel.h:55
CalcReason
What the return value of stop/follow/free-Speed is used for.
Definition: MSCFModel.h:77
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:63