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.dev/sumo
3// Copyright (C) 2001-2023 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>
30
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
39class MSCFModel_IDM : public MSCFModel {
40public:
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 CalcReason usage = CalcReason::CURRENT) const;
91
100 double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed,
101 double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
102
103
111 double stopSpeed(const MSVehicle* const veh, const double speed, double gap, double decel, const CalcReason usage = CalcReason::CURRENT) const;
112
113
123 double interactionGap(const MSVehicle* const, double vL) const;
124
125
138 double insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0) const;
139
140
148 double getSecureGap(const MSVehicle* const veh, const MSVehicle* const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const;
149
154 int getModelID() const {
156 }
157
158 double minNextSpeed(double speed, const MSVehicle* const veh = 0) const;
160
161
162
167 MSCFModel* duplicate(const MSVehicleType* vtype) const;
168
169
171 if (myAdaptationFactor != 1.) {
172 return new VehicleVariables();
173 }
174 return 0;
175 }
176
177
178private:
180 public:
184 };
185
186
187private:
188 double _v(const MSVehicle* const veh, const double gap2pred, const double mySpeed,
189 const double predSpeed, const double desSpeed, const bool respectMinGap = true) const;
190
191
192private:
194 const bool myIDMM;
195
197 const double myDelta;
198
200 const double myAdaptationFactor;
201
203 const double myAdaptationTime;
204
206 const int myIterations;
207
210
211private:
214};
215
@ 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 stopSpeed(const MSVehicle *const veh, const double speed, double gap, double decel, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
double minNextSpeed(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed (no dawdling)
int getModelID() const
Returns the model's name.
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed without a leader.
~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....
const double myAdaptationTime
The IDMM adaptation time tau.
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.
const double myDelta
The IDM delta exponent.
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.
VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
MSCFModel_IDM & operator=(const MSCFModel_IDM &s)
Invalidated assignment operator.
The car-following model abstraction.
Definition: MSCFModel.h:55
CalcReason
What the return value of stop/follow/free-Speed is used for.
Definition: MSCFModel.h:77
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:63