52 #define DEFAULT_SC_GAIN -0.4
53 #define DEFAULT_GCC_GAIN_SPEED 0.8
54 #define DEFAULT_GCC_GAIN_SPACE 0.04
55 #define DEFAULT_GC_GAIN_SPEED 0.07
56 #define DEFAULT_GC_GAIN_SPACE 0.23
57 #define DEFAULT_CA_GAIN_SPACE 0.8
58 #define DEFAULT_CA_GAIN_SPEED 0.23
63 #define GAP_THRESHOLD_SPEEDCTRL 120
64 #define GAP_THRESHOLD_GAPCTRL 100
70 #define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD 2.0
96 const double vACC =
_v(veh, gap2pred, speed, predSpeed, desSpeed,
true);
133 const int max_iter = 50;
135 const double tol = 0.1;
136 const double damping = 0.1;
139 while (n_iter < max_iter) {
142 res = res + damping * a;
172 std::cout <<
" applying gapControl" << std::endl;
177 double gclAccel = 0.0;
179 double spacingErr = gap2pred - desSpacing;
180 double deltaVel = predSpeed - speed;
183 if (fabs(spacingErr) < 0.2 && fabs(vErr) < 0.1) {
186 }
else if (spacingErr < 0) {
200 const double predSpeed,
const double desSpeed,
const bool )
const {
208 std::cout <<
SIMTIME <<
" MSCFModel_ACC::_v() for veh '" << veh->
getID() <<
"'\n"
209 <<
" gap=" << gap2pred <<
" speed=" << speed <<
" predSpeed=" << predSpeed
210 <<
" desSpeed=" << desSpeed << std::endl;
216 double vErr = speed - desSpeed;
217 int setControlMode = 0;
223 if (gap2pred > gapLimit_SC) {
227 std::cout <<
" applying speedControl" << std::endl;
233 if (setControlMode) {
236 }
else if (gap2pred < gapLimit_GC) {
240 if (setControlMode) {
250 std::cout <<
" applying speedControl" << std::endl;
264 std::cout <<
" result: accel=" << accelACC <<
" newSpeed=" << newSpeed << std::endl;
268 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.
int ACC_ControlMode
The vehicle's ACC control mode. 0 for speed control and 1 for gap control.
double accelSpeedControl(double vErr) const
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 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 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.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap2pred) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
~MSCFModel_ACC()
Destructor.
MSCFModel_ACC(const MSVehicleType *vtype)
Constructor.
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.
double maximumSafeStopSpeed(double gap, 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 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.
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
const MSLane * getLane() const
Returns the lane the vehicle is on.
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.