 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
36 #define INTERACTION_GAP 150
41 #define DEBUG_FOLLOW_SPEED
43 #define DEBUG_COND (veh->isSelected())
77 double& sdxc,
double& sdxo,
double& sdxv)
const {
79 const double dv = predSpeed - speed;
82 const double v_slower = (dv >= 0 || leaderAccel < 1) ? speed : predSpeed + dv * rndVal;
93 const double dv = predSpeed - speed;
97 const double leaderAccel = pred !=
nullptr ? pred->
getAcceleration() : 0;
101 double sdxc, sdxo, sdxv;
104 const double sdv =
myCC6 * dx * dx / 10000;
105 const double sdvc = speed > 0 ?
myCC4 - sdv : 0;
106 const double sdvo = predSpeed >
myCC5 ? sdv +
myCC5 : sdv;
111 if (dv < sdvo && dx <= sdxc) {
117 accel =
MIN2(leaderAccel + dv * dv / (cc0 - dx), 0.0);
120 accel =
MIN2(leaderAccel + 0.5 * (dv - sdvo), 0.0);
124 if (accel > -
myCC7) {
128 accel =
MAX2(accel, -10 + 0.5 * sqrt(speed));
133 }
else if (dv < sdvc && dx < sdxv) {
135 accel = 0.5 * dv * dv / (sdxc - dx - 0.1);
138 }
else if (dv < sdvo && dx < sdxo) {
157 accel =
MIN2(dv * dv / (sdxo - dx), accelMax);
168 #ifdef DEBUG_FOLLOW_SPEED
171 <<
" v=" << speed <<
" pV=" << predSpeed <<
" g=" << gap2pred
172 <<
" dv=" << dv <<
" dx=" << dx
173 <<
" sdxc=" << sdxc <<
" sdxo=" << sdxo <<
" sdxv=" << sdxv <<
" sdv=" << sdv <<
" sdvo=" << sdvo <<
" sdvc=" << sdvc
175 <<
" a=" << accel <<
" V=" << vNew <<
"\n";
181 vNew =
MAX2(0.0, vNew);
191 const double vFollow =
followSpeed(veh, speed, gap + sqrt(gap) + 2, 0, 4.5, 0);
211 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.
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)
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 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.
virtual 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 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 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 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.