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-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 /****************************************************************************/
17 // The Intelligent Driver Model (IDM) car-following model
18 /****************************************************************************/
19 #ifndef MSCFMODEL_IDM_H
20 #define MSCFMODEL_IDM_H
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include "MSCFModel.h"
28 #include <microsim/MSLane.h>
29 #include <microsim/MSVehicle.h>
30 #include <microsim/MSVehicleType.h>
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
41 class MSCFModel_IDM : public MSCFModel {
42 public:
47  MSCFModel_IDM(const MSVehicleType* vtype, bool idmm);
48 
49 
60  MSCFModel_IDM(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double apparentDecel,
61  double headwayTime, double adaptationFactor, double adaptationTime,
62  double internalStepping);
63 
64 
67 
68 
71 
77  double finalizeSpeed(MSVehicle* const veh, double vPos) const;
78 
79 
88  double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
89 
90 
98  double stopSpeed(const MSVehicle* const veh, const double speed, double gap) const;
99 
100 
110  double interactionGap(const MSVehicle* const, double vL) const;
111 
112 
125  double insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
126 
127 
133  double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
134 
139  int getModelID() const {
141  }
143 
144 
145 
150  MSCFModel* duplicate(const MSVehicleType* vtype) const;
151 
152 
154  if (myAdaptationFactor != 1.) {
155  return new VehicleVariables();
156  }
157  return 0;
158  }
159 
160 
161 private:
163  public:
167  };
168 
169 
170 private:
171  double _v(const MSVehicle* const veh, const double gap2pred, const double mySpeed,
172  const double predSpeed, const double desSpeed, const bool respectMinGap = true) const;
173 
174 
175 private:
177  const bool myIDMM;
178 
180  const double myDelta;
181 
183  const double myAdaptationFactor;
184 
186  const double myAdaptationTime;
187 
189  const int myIterations;
190 
192  const double myTwoSqrtAccelDecel;
193 
194 private:
197 };
198 
199 #endif /* MSCFMODEL_IDM_H */
double insertionFollowSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle&#39;s safe speed (no dawdling) This method is used during the insertion stage...
~MSCFModel_IDM()
Destructor.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
const bool myIDMM
whether the model is IDMM or IDM
const double myDelta
The IDM delta exponent.
The Intelligent Driver Model (IDM) car-following model.
Definition: MSCFModel_IDM.h:41
The car-following model abstraction.
Definition: MSCFModel.h:57
const double myAdaptationFactor
The IDMM adaptation factor beta.
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
MSCFModel_IDM(const MSVehicleType *vtype, bool idmm)
Constructor.
The car-following model and parameter.
Definition: MSVehicleType.h:66
MSCFModel_IDM & operator=(const MSCFModel_IDM &s)
Invalidated assignment operator.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const
Computes the vehicle&#39;s safe speed for approaching a non-moving obstacle (no dawdling) ...
double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
const double myAdaptationTime
The IDMM adaptation time tau.
double levelOfService
state variable for remembering speed deviation history (lambda)
double _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
const double myTwoSqrtAccelDecel
A computational shortcut.
const int myIterations
The number of iterations in speed calculations.
int getModelID() const
Returns the model&#39;s name.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle&#39;s safe speed (no dawdling)
VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...