 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
35 #define INTERACTION_GAP 150
40 #define DEBUG_FOLLOW_SPEED
42 #define DEBUG_COND (veh->isSelected())
76 double& sdxc,
double& sdxo,
double& sdxv)
const {
78 const double dv = predSpeed - speed;
81 const double v_slower = (dv >= 0 || leaderAccel < 1) ? speed : predSpeed + dv * rndVal;
92 const double dv = predSpeed - speed;
96 const double leaderAccel = pred !=
nullptr ? pred->
getAcceleration() : 0;
100 double sdxc, sdxo, sdxv;
103 const double sdv =
myCC6 * dx * dx / 10000;
104 const double sdvc = speed > 0 ?
myCC4 - sdv : 0;
105 const double sdvo = predSpeed >
myCC5 ? sdv +
myCC5 : sdv;
110 if (dv < sdvo && dx <= sdxc) {
116 accel =
MIN2(leaderAccel + dv * dv / (cc0 - dx), 0.0);
119 accel =
MIN2(leaderAccel + 0.5 * (dv - sdvo), 0.0);
123 if (accel > -
myCC7) {
127 accel =
MAX2(accel, -10 + 0.5 * sqrt(speed));
132 }
else if (dv < sdvc && dx < sdxv) {
134 accel = 0.5 * dv * dv / (sdxc - dx - 0.1);
137 }
else if (dv < sdvo && dx < sdxo) {
156 accel =
MIN2(dv * dv / (sdxo - dx), accelMax);
167 #ifdef DEBUG_FOLLOW_SPEED
170 <<
" v=" << speed <<
" pV=" << predSpeed <<
" g=" << gap2pred
171 <<
" dv=" << dv <<
" dx=" << dx
172 <<
" sdxc=" << sdxc <<
" sdxo=" << sdxo <<
" sdxv=" << sdxv <<
" sdv=" << sdv <<
" sdvo=" << sdvo <<
" sdvc=" << sdvc
174 <<
" a=" << accel <<
" V=" << vNew <<
"\n";
180 vNew =
MAX2(0.0, vNew);
190 const double vFollow =
followSpeed(veh, speed, gap + sqrt(gap) + 2, 0, 4.5, 0);
210 double sdxc, sdxo, sdxv;
The car-following model and parameter.
#define UNUSED_PARAMETER(x)
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
virtual double getSecureGap(const MSVehicle *const, const MSVehicle *const, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
void computeThresholds(double speed, double predSpeed, double leaderAccel, double rndVal, double &sdxc, double &sdxo, double &sdxv) const
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
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)
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
double getMinGap() const
Get the free space in front of vehicles of this class.
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.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
MSCFModel_W99(const MSVehicleType *vtype)
Constructor.
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
const SUMOVTypeParameter & getParameter() const
const std::string & getID() const
Returns the name of the vehicle.
const MSVehicleType * myType
The type to which this model definition belongs to.
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 abstraction.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
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 myAccel
The vehicle's maximum acceleration [m/s^2].
static bool gSemiImplicitEulerUpdate
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)
~MSCFModel_W99()
Destructor.
std::mt19937 * getRNG() const
Representation of a vehicle in the micro simulation.