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-2018 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 
117  double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
118 
123  int getModelID() const {
125  }
127 
128 
129 
134  MSCFModel* duplicate(const MSVehicleType* vtype) const;
135 
136 
138  if (myAdaptationFactor != 1.) {
139  return new VehicleVariables();
140  }
141  return 0;
142  }
143 
144 
145 private:
147  public:
151  };
152 
153 
154 private:
155  double _v(const MSVehicle* const veh, const double gap2pred, const double mySpeed,
156  const double predSpeed, const double desSpeed, const bool respectMinGap = true) const;
157 
158 
159 private:
161  const bool myIDMM;
162 
164  const double myDelta;
165 
167  const double myAdaptationFactor;
168 
170  const double myAdaptationTime;
171 
173  const int myIterations;
174 
176  const double myTwoSqrtAccelDecel;
177 
178 private:
181 };
182 
183 #endif /* MSCFMODEL_IDM_H */
~MSCFModel_IDM()
Destructor.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
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...