41 myTwoSqrtAccelDecel(double(2 * sqrt(myAccel * myDecel))) {
90 const double vNext = veh->
getSpeed() + acc;
91 const double gap = (vNext - vL) * (veh->
getSpeed() + vL) / (2 *
myDecel) + vL;
99 const double delta_v = speed - leaderSpeed;
106 const double predSpeed,
const double desSpeed,
const bool respectMinGap)
const {
115 double newSpeed = egoSpeed;
116 double gap = gap2pred;
122 const double delta_v = newSpeed - predSpeed;
128 const double acc =
myAccel * (1. - pow(newSpeed / desSpeed,
myDelta) - (s * s) / (gap * gap));
131 std::cout <<
" gap=" << gap <<
" t=" <<
myHeadwayTime <<
" t2=" << headwayTime <<
" s=" << s <<
" pow=" << pow(newSpeed / desSpeed,
myDelta) <<
" gapDecel=" << (s * s) / (gap * gap) <<
" a=" << acc;
137 std::cout <<
" v2=" << newSpeed <<
"\n";
143 return MAX2(0., newSpeed);
bool gDebugFlag1
global utility flags for debugging
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.
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 car-following model abstraction.
const double myAdaptationFactor
The IDMM adaptation factor beta.
double myAccel
The vehicle's maximum acceleration [m/s^2].
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.
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
The car-following model and parameter.
virtual bool isSelected() const
whether this vehicle is selected in the GUI
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) ...
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)
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points...
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 maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
const SUMOVTypeParameter & getParameter() const
double myDecel
The vehicle's maximum deceleration [m/s^2].
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
const int myIterations
The number of iterations in speed calculations.
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)
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
double getSpeed() const
Returns the vehicle's current speed.