44 double accel,
double decel,
double emergencyDecel,
45 double headwayTime,
double delta,
46 double internalStepping) :
47 MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myDelta(delta),
48 myAdaptationFactor(1.), myAdaptationTime(0.),
49 myIterations(
MAX2(1, int(
TS / internalStepping + .5))),
50 myTwoSqrtAccelDecel(double(2 * sqrt(accel * decel))) {
55 double accel,
double decel,
double emergencyDecel,
57 double adaptationFactor,
double adaptationTime,
58 double internalStepping) :
59 MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime),
myDelta(4.),
88 if (gap2pred < 0.01) {
102 const double vNext = veh->
getSpeed() + acc;
103 const double gap = (vNext - vL) * (veh->
getSpeed() + vL) / (2 *
myDecel) + vL;
112 const double predSpeed,
const double desSpeed,
const bool respectMinGap)
const {
121 double newSpeed = egoSpeed;
122 double gap = gap2pred;
124 const double delta_v = newSpeed - predSpeed;
129 const double acc =
myAccel * (1. - pow(newSpeed / desSpeed,
myDelta) - (s * s) / (gap * gap));
135 return MAX2(0., newSpeed);
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
~MSCFModel_IDM()
Destructor.
Representation of a vehicle in the micro simulation.
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
const MSVehicleType * myType
The type to which this model definition belongs to.
MSLane * getLane() const
Returns the lane the vehicle is on.
double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const
Computes the vehicle's safe speed (no dawdling)
const double myDelta
The IDM delta exponent.
The car-following model abstraction.
const double myAdaptationFactor
The IDMM adaptation factor beta.
MSCFModel_IDM(const MSVehicleType *vtype, double accel, double decel, double emergencyDecel, double headwayTime, double delta, double internalStepping)
Constructor.
double myAccel
The vehicle's maximum acceleration [m/s^2].
virtual double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
The car-following model and parameter.
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
double getMinGap() const
Get the free space in front of vehicles of this class.
const double myTwoSqrtAccelDecel
A computational shortcut.
double myDecel
The vehicle's maximum deceleration [m/s^2].
double stopSpeed(const MSVehicle *const veh, const double speed, double gap2pred) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
const int myIterations
The number of iterations in speed calculations.
double myEmergencyDecel
The vehicle's maximum emergency deceleration [m/s^2].
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
double getSpeed() const
Returns the vehicle's current speed.