57#define DEFAULT_SC_GAIN -0.4
58#define DEFAULT_GCC_GAIN_SPEED 0.8
59#define DEFAULT_GCC_GAIN_SPACE 0.04
60#define DEFAULT_GC_GAIN_SPEED 0.07
61#define DEFAULT_GC_GAIN_SPACE 0.23
62#define DEFAULT_CA_GAIN_SPACE 0.8
63#define DEFAULT_CA_GAIN_SPEED 0.23
68#define GAP_THRESHOLD_SPEEDCTRL 120
69#define GAP_THRESHOLD_GAPCTRL 100
71#define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD 2.0
98 const double vACC =
_v(veh, gap2pred, speed, predSpeed, desSpeed,
true);
135 const int max_iter = 50;
137 const double tol = 0.1;
138 const double damping = 0.1;
141 while (n_iter < max_iter) {
144 res = res + damping * a;
173 double gclAccel = 0.0;
174 const double deltaVel = predSpeed - speed;
177 const double d0 =
MAX2(0.,
MIN2(75. / speed - 5., 2.));
179 const double spacingErr = gap2pred -
myHeadwayTime * speed - d0;
182 if (fabs(spacingErr) < 0.2 && fabs(vErr) < 0.1) {
187 std::cout <<
" applying gap control: spacingErr=" << spacingErr <<
" speedErr=" << vErr << std::endl;
190 }
else if (spacingErr < 0) {
195 std::cout <<
" applying collision avoidance: spacingErr=" << spacingErr <<
" speedErr=" << vErr << std::endl;
203 std::cout <<
" applying gap closing: spacingErr=" << spacingErr <<
" speedErr=" << vErr << std::endl;
213 const double predSpeed,
const double desSpeed,
const bool )
const {
221 std::cout <<
SIMTIME <<
" MSCFModel_ACC::_v() for veh '" << veh->
getID() <<
"'\n"
222 <<
" gap=" << gap2pred <<
" speed=" << speed <<
" predSpeed=" << predSpeed
223 <<
" desSpeed=" << desSpeed <<
" tau=" <<
myHeadwayTime << std::endl;
229 double vErr = speed - desSpeed;
230 int setControlMode = 0;
236 if (gap2pred > gapLimit_SC) {
240 std::cout <<
" applying speedControl" << std::endl;
246 if (setControlMode) {
249 }
else if (gap2pred < gapLimit_GC) {
253 if (setControlMode) {
263 std::cout <<
" applying speedControl" << std::endl;
277 std::cout <<
" result: accel=" << accelACC <<
" newSpeed=" << newSpeed << std::endl;
281 return MAX2(0., newSpeed);
#define DEFAULT_GC_GAIN_SPACE
#define DEFAULT_GCC_GAIN_SPEED
#define DEFAULT_GCC_GAIN_SPACE
#define DEFAULT_CA_GAIN_SPACE
#define DEFAULT_GC_GAIN_SPEED
#define DEFAULT_CA_GAIN_SPEED
#define GAP_THRESHOLD_SPEEDCTRL
#define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD
#define GAP_THRESHOLD_GAPCTRL
@ SUMO_ATTR_GCC_GAIN_SPEED
@ SUMO_ATTR_GC_GAIN_SPACE
@ SUMO_ATTR_CA_GAIN_SPACE
@ SUMO_ATTR_GCC_GAIN_SPACE
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
@ SUMO_ATTR_CA_GAIN_SPEED
@ SUMO_ATTR_GC_GAIN_SPEED
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and technical maximum speed)
int ACC_ControlMode
The vehicle's ACC control mode. 0 for speed control and 1 for gap control.
The ACC car-following model.
double accelSpeedControl(double vErr) const
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed (no dawdling)
double myCollisionAvoidanceGainSpeed
double myCollisionAvoidanceGainSpace
double myGapControlGainSpace
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 gap2pred, double decel, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
double accelGapControl(const MSVehicle *const veh, const double gap2pred, const double speed, const double predSpeed, double vErr) const
double myGapClosingControlGainSpeed
double insertionFollowSpeed(const MSVehicle *const v, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's acceptable speed at insertion.
double myGapControlGainSpeed
double getSecureGap(const MSVehicle *const veh, const MSVehicle *const pred, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the a gap such that the gap mode acceleration of the follower is zero.
~MSCFModel_ACC()
Destructor.
MSCFModel_ACC(const MSVehicleType *vtype)
Constructor.
double myEmergencyThreshold
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
double myGapClosingControlGainSpace
double mySpeedControlGain
The car-following model abstraction.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
double maximumSafeFollowSpeed(double gap, double egoSpeed, double predSpeed, double predMaxDecel, bool onInsertion=false) const
Returns the maximum safe velocity for following the given leader.
CalcReason
What the return value of stop/follow/free-Speed is used for.
@ FUTURE
the return value is used for calculating future speeds
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
double maximumSafeStopSpeed(double gap, double decel, double currentSpeed, bool onInsertion=false, double headway=-1, bool relaxEmergency=true) const
Returns the maximum next velocity for stopping within gap.
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
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.
const MSLane * getLane() const
Returns the lane the vehicle is on.
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
The car-following model and parameter.
const SUMOVTypeParameter & getParameter() const
const std::string & getID() const
Returns the id.
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.