54 #define DEFAULT_SC_GAIN -0.4 55 #define DEFAULT_GCC_GAIN_SPEED 0.8 56 #define DEFAULT_GCC_GAIN_SPACE 0.04 57 #define DEFAULT_GC_GAIN_SPEED 0.07 58 #define DEFAULT_GC_GAIN_SPACE 0.23 59 #define DEFAULT_CA_GAIN_SPACE 0.8 60 #define DEFAULT_CA_GAIN_SPEED 0.23 65 #define GAP_THRESHOLD_SPEEDCTRL 120 66 #define GAP_THRESHOLD_GAPCTRL 100 72 #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;
174 std::cout <<
" applying gapControl" << std::endl;
179 double gclAccel = 0.0;
184 double spacingErr = gap - desSpacing;
185 double deltaVel = predSpeed - speed;
188 if (fabs(spacingErr) < 0.2 && fabs(vErr) < 0.1) {
191 }
else if (spacingErr < 0) {
205 const double predSpeed,
const double desSpeed,
const bool )
const {
213 std::cout <<
SIMTIME <<
" MSCFModel_ACC::_v() for veh '" << veh->
getID() <<
"'\n" 214 <<
" gap=" << gap2pred <<
" speed=" << speed <<
" predSpeed=" << predSpeed
215 <<
" desSpeed=" << desSpeed << std::endl;
221 double vErr = speed - desSpeed;
222 int setControlMode = 0;
228 if (gap2pred > gapLimit_SC) {
232 std::cout <<
" applying speedControl" << std::endl;
238 if (setControlMode) {
241 }
else if (gap2pred < gapLimit_GC) {
245 if (setControlMode) {
255 std::cout <<
" applying speedControl" << std::endl;
269 std::cout <<
" result: accel=" << accelACC <<
" newSpeed=" << newSpeed << std::endl;
273 return MAX2(0., newSpeed);
#define DEFAULT_GCC_GAIN_SPEED
double myGapControlGainSpeed
#define DEFAULT_GCC_GAIN_SPACE
double maximumSafeFollowSpeed(double gap, double egoSpeed, double predSpeed, double predMaxDecel, bool onInsertion=false) const
Returns the maximum safe velocity for following the given leader.
Representation of a vehicle in the micro simulation.
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
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.
#define GAP_THRESHOLD_GAPCTRL
MSLane * getLane() const
Returns the lane the vehicle is on.
#define DEFAULT_GC_GAIN_SPEED
double myGapClosingControlGainSpace
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) ...
The car-following model abstraction.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
#define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
~MSCFModel_ACC()
Destructor.
double myCollisionAvoidanceGainSpace
The car-following model and parameter.
double getMaxSpeed() const
Returns the maximum speed.
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points...
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
MSCFModel_ACC(const MSVehicleType *vtype)
Constructor.
#define DEFAULT_GC_GAIN_SPACE
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
double getMinGap() const
Get the free space in front of vehicles of this class.
#define GAP_THRESHOLD_SPEEDCTRL
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
double mySpeedControlGain
const SUMOVTypeParameter & getParameter() const
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.
double accelGapControl(const MSVehicle *const veh, const double gap2pred, const double speed, const double predSpeed, double vErr) const
double accelSpeedControl(double vErr) const
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
int ACC_ControlMode
The vehicle's ACC control mode. 0 for speed control and 1 for gap control.
double myCollisionAvoidanceGainSpeed
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 myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
double _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
#define DEFAULT_CA_GAIN_SPEED
double getSecureGap(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 myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
const std::string & getID() const
Returns the name of the vehicle.
double myGapClosingControlGainSpeed
double myGapControlGainSpace
#define DEFAULT_CA_GAIN_SPACE