34 #define INTERACTION_GAP 150
39 #define DEBUG_FOLLOW_SPEED
41 #define DEBUG_COND (veh->isSelected())
75 double& sdxc,
double& sdxo,
double& sdxv)
const {
77 const double dv = predSpeed - speed;
80 const double v_slower = (dv >= 0 || leaderAccel < 1) ? speed : predSpeed + dv * rndVal;
91 const double dv = predSpeed - speed;
95 const double leaderAccel = pred !=
nullptr ? pred->
getAcceleration() : 0;
99 double sdxc, sdxo, sdxv;
102 const double sdv =
myCC6 * dx * dx / 10000;
103 const double sdvc = speed > 0 ?
myCC4 - sdv : 0;
104 const double sdvo = predSpeed >
myCC5 ? sdv +
myCC5 : sdv;
109 if (dv < sdvo && dx <= sdxc) {
115 accel =
MIN2(leaderAccel + dv * dv / (cc0 - dx), 0.0);
118 accel =
MIN2(leaderAccel + 0.5 * (dv - sdvo), 0.0);
122 if (accel > -
myCC7) {
126 accel =
MAX2(accel, -10 + 0.5 * sqrt(speed));
131 }
else if (dv < sdvc && dx < sdxv) {
133 accel = 0.5 * dv * dv / (sdxc - dx - 0.1);
136 }
else if (dv < sdvo && dx < sdxo) {
155 accel =
MIN2(dv * dv / (sdxo - dx), accelMax);
166 #ifdef DEBUG_FOLLOW_SPEED
169 <<
" v=" << speed <<
" pV=" << predSpeed <<
" g=" << gap2pred
170 <<
" dv=" << dv <<
" dx=" << dx
171 <<
" sdxc=" << sdxc <<
" sdxo=" << sdxo <<
" sdxv=" << sdxv <<
" sdv=" << sdv <<
" sdvo=" << sdvo <<
" sdvc=" << sdvc
173 <<
" a=" << accel <<
" V=" << vNew <<
"\n";
179 vNew =
MAX2(0.0, vNew);
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
#define UNUSED_PARAMETER(x)
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)
MSCFModel_W99(const MSVehicleType *vtype)
Constructor.
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap, double decel) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
void computeThresholds(double speed, double predSpeed, double leaderAccel, double rndVal, double &sdxc, double &sdxo, double &sdxv) const
~MSCFModel_W99()
Destructor.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
The car-following model abstraction.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
double maximumSafeStopSpeed(double gap, double decel, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
double myAccel
The vehicle's maximum acceleration [m/s^2].
const MSVehicleType * myType
The type to which this model definition belongs to.
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
static bool gSemiImplicitEulerUpdate
Representation of a vehicle in the micro simulation.
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
double getAcceleration() const
Returns the vehicle's acceleration in m/s (this is computed as the last step's mean acceleration in c...
The car-following model and parameter.
double getMinGap() const
Get the free space in front of vehicles of this class.
const SUMOVTypeParameter & getParameter() const
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
const std::string & getID() const
Returns the id.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
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.