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 */
MSCFModel_IDM::MSCFModel_IDM
MSCFModel_IDM(const MSVehicleType *vtype, bool idmm)
Constructor.
Definition: MSCFModel_IDM.cpp:34
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
MSCFModel_IDM::myTwoSqrtAccelDecel
const double myTwoSqrtAccelDecel
A computational shortcut.
Definition: MSCFModel_IDM.h:192
MSCFModel_IDM::getSecureGap
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)
Definition: MSCFModel_IDM.cpp:115
SUMO_TAG_CF_IDMM
Definition: SUMOXMLDefinitions.h:283
MSCFModel_IDM::createVehicleVariables
VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
Definition: MSCFModel_IDM.h:153
MSCFModel_IDM::myAdaptationTime
const double myAdaptationTime
The IDMM adaptation time tau.
Definition: MSCFModel_IDM.h:186
MSCFModel_IDM::myIterations
const int myIterations
The number of iterations in speed calculations.
Definition: MSCFModel_IDM.h:189
SUMO_TAG_CF_IDM
Definition: SUMOXMLDefinitions.h:282
MSVehicle.h
MSVehicleType.h
MSCFModel_IDM::duplicate
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
Definition: MSCFModel_IDM.cpp:165
MSCFModel_IDM::getModelID
int getModelID() const
Returns the model's name.
Definition: MSCFModel_IDM.h:139
MSCFModel_IDM::VehicleVariables::VehicleVariables
VehicleVariables()
Definition: MSCFModel_IDM.h:164
MSCFModel_IDM::finalizeSpeed
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
Definition: MSCFModel_IDM.cpp:50
MSCFModel_IDM::~MSCFModel_IDM
~MSCFModel_IDM()
Destructor.
Definition: MSCFModel_IDM.cpp:46
MSCFModel_IDM::myDelta
const double myDelta
The IDM delta exponent.
Definition: MSCFModel_IDM.h:180
MSCFModel_IDM::myAdaptationFactor
const double myAdaptationFactor
The IDMM adaptation factor beta.
Definition: MSCFModel_IDM.h:183
MSCFModel_IDM::insertionFollowSpeed
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....
Definition: MSCFModel_IDM.cpp:70
MSCFModel_IDM::followSpeed
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)
Definition: MSCFModel_IDM.cpp:61
MSCFModel_IDM::stopSpeed
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)
Definition: MSCFModel_IDM.cpp:83
MSCFModel_IDM
The Intelligent Driver Model (IDM) car-following model.
Definition: MSCFModel_IDM.h:41
MSCFModel::VehicleVariables
Definition: MSCFModel.h:61
MSCFModel.h
MSCFModel_IDM::_v
double _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
Definition: MSCFModel_IDM.cpp:122
MSCFModel_IDM::myIDMM
const bool myIDMM
whether the model is IDMM or IDM
Definition: MSCFModel_IDM.h:177
MSCFModel
The car-following model abstraction.
Definition: MSCFModel.h:57
config.h
MSCFModel_IDM::operator=
MSCFModel_IDM & operator=(const MSCFModel_IDM &s)
Invalidated assignment operator.
MSLane.h
MSCFModel_IDM::VehicleVariables
Definition: MSCFModel_IDM.h:162
MSCFModel_IDM::interactionGap
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
Definition: MSCFModel_IDM.cpp:102
SUMOXMLDefinitions.h
MSCFModel_IDM::VehicleVariables::levelOfService
double levelOfService
state variable for remembering speed deviation history (lambda)
Definition: MSCFModel_IDM.h:166
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80