SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSCFModel_IDM.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The Intelligent Driver Model (IDM) car-following model
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSCFMODEL_IDM_H
23 #define MSCFMODEL_IDM_H
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include "MSCFModel.h"
35 #include <microsim/MSLane.h>
36 #include <microsim/MSVehicle.h>
37 #include <microsim/MSVehicleType.h>
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 class MSCFModel_IDM : public MSCFModel {
49 public:
57  MSCFModel_IDM(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel,
58  SUMOReal headwayTime, SUMOReal delta, SUMOReal internalStepping);
59 
60 
69  MSCFModel_IDM(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel,
70  SUMOReal headwayTime, SUMOReal adaptationFactor, SUMOReal adaptationTime,
71  SUMOReal internalStepping);
72 
73 
76 
77 
80 
86  SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const;
87 
88 
97  SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const;
98 
99 
107  SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const;
108 
109 
119  SUMOReal interactionGap(const MSVehicle* const , SUMOReal vL) const;
120 
121 
126  int getModelID() const {
128  }
130 
131 
132 
137  MSCFModel* duplicate(const MSVehicleType* vtype) const;
138 
139 
141  if (myAdaptationFactor != 1.) {
142  return new VehicleVariables();
143  }
144  return 0;
145  }
146 
147 
148 private:
150  public:
154  };
155 
156 
157 private:
158  SUMOReal _v(const MSVehicle* const veh, const SUMOReal gap2pred, const SUMOReal mySpeed,
159  const SUMOReal predSpeed, const SUMOReal desSpeed, const bool respectMinGap = true) const;
160 
161  SUMOReal desiredSpeed(const MSVehicle* const veh) const {
162  return MIN2(myType->getMaxSpeed(), veh->getLane()->getVehicleMaxSpeed(veh));
163  }
164 
165 
166 private:
169 
172 
175 
177  const int myIterations;
178 
181 
182 private:
185 };
186 
187 #endif /* MSCFMODEL_IDM_H */
SUMOReal stopSpeed(const MSVehicle *const veh, const SUMOReal speed, SUMOReal gap2pred) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
~MSCFModel_IDM()
Destructor.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
const MSVehicleType * myType
The type to which this model definition belongs to.
Definition: MSCFModel.h:342
SUMOReal moveHelper(MSVehicle *const veh, SUMOReal vPos) const
Applies interaction with stops and lane changing model influences.
The Intelligent Driver Model (IDM) car-following model.
Definition: MSCFModel_IDM.h:48
The car-following model abstraction.
Definition: MSCFModel.h:59
SUMOReal followSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const
Computes the vehicle's safe speed (no dawdling)
const SUMOReal myDelta
The IDM delta exponent.
SUMOReal levelOfService
state variable for remembering speed deviation history (lambda)
The car-following model and parameter.
Definition: MSVehicleType.h:74
MSCFModel_IDM & operator=(const MSCFModel_IDM &s)
Invalidated assignment operator.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
MSCFModel_IDM(const MSVehicleType *vtype, SUMOReal accel, SUMOReal decel, SUMOReal headwayTime, SUMOReal delta, SUMOReal internalStepping)
Constructor.
const SUMOReal myTwoSqrtAccelDecel
A computational shortcut.
SUMOReal interactionGap(const MSVehicle *const , SUMOReal vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
T MIN2(T a, T b)
Definition: StdDefs.h:68
SUMOReal desiredSpeed(const MSVehicle *const veh) const
const int myIterations
The number of iterations in speed calculations.
int getModelID() const
Returns the model's name.
SUMOReal _v(const MSVehicle *const veh, const SUMOReal gap2pred, const SUMOReal mySpeed, const SUMOReal predSpeed, const SUMOReal desSpeed, const bool respectMinGap=true) const
#define SUMOReal
Definition: config.h:218
VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:354
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:331
const SUMOReal myAdaptationFactor
The IDMM adaptation factor beta.
const SUMOReal myAdaptationTime
The IDMM adaptation time tau.