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.org/sumo
3 // Copyright (C) 2001-2020 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;
91 
100  double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
101 
102 
110  double stopSpeed(const MSVehicle* const veh, const double speed, double gap) const;
111 
112 
122  double interactionGap(const MSVehicle* const, double vL) const;
123 
124 
137  double insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
138 
139 
147  double getSecureGap(const MSVehicle* const veh, const MSVehicle* const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
148 
153  int getModelID() const {
155  }
157 
158 
159 
164  MSCFModel* duplicate(const MSVehicleType* vtype) const;
165 
166 
168  if (myAdaptationFactor != 1.) {
169  return new VehicleVariables();
170  }
171  return 0;
172  }
173 
174 
175 private:
177  public:
181  };
182 
183 
184 private:
185  double _v(const MSVehicle* const veh, const double gap2pred, const double mySpeed,
186  const double predSpeed, const double desSpeed, const bool respectMinGap = true) const;
187 
188 
189 private:
191  const bool myIDMM;
192 
194  const double myDelta;
195 
197  const double myAdaptationFactor;
198 
200  const double myAdaptationTime;
201 
203  const int myIterations;
204 
206  const double myTwoSqrtAccelDecel;
207 
208 private:
211 };
212 
@ 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 finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
int getModelID() const
Returns the model's name.
~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....
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
const double myAdaptationTime
The IDMM adaptation time tau.
double followSpeed(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)
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 stopSpeed(const MSVehicle *const veh, const double speed, double gap) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
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
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:62