47 #define DEBUG_COND (veh->isSelected()) 53 #define DEFAULT_SC_GAIN -0.4 54 #define DEFAULT_GCC_GAIN_SPEED 0.8 55 #define DEFAULT_GCC_GAIN_SPACE 0.04 56 #define DEFAULT_GC_GAIN_SPEED 0.07 57 #define DEFAULT_GC_GAIN_SPACE 0.23 58 #define DEFAULT_CA_GAIN_SPACE 0.8 59 #define DEFAULT_CA_GAIN_SPEED 0.23 62 #define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD 2.0 88 const double vACC =
_v(veh, gap2pred, speed, predSpeed, desSpeed,
true);
124 std::cout <<
" applying gapControl" << std::endl;
129 double gclAccel = 0.0;
134 double spacingErr = gap - desSpacing;
135 double deltaVel = predSpeed - speed;
138 if (fabs(spacingErr) < 0.2 && fabs(vErr) < 0.1) {
141 }
else if (spacingErr < 0) {
155 const double predSpeed,
const double desSpeed,
const bool )
const {
158 double gapLimit_SC = 120;
159 double gapLimit_GC = 100;
163 std::cout <<
SIMTIME <<
" MSCFModel_ACC::_v() for veh '" << veh->
getID() <<
"'\n" 164 <<
" gap=" << gap2pred <<
" speed=" << speed <<
" predSpeed=" << predSpeed
165 <<
" desSpeed=" << desSpeed << std::endl;
171 double vErr = speed - desSpeed;
172 int setControlMode = 0;
178 if (gap2pred > gapLimit_SC) {
182 std::cout <<
" applying speedControl" << std::endl;
188 if (setControlMode) {
191 }
else if (gap2pred < gapLimit_GC) {
195 if (setControlMode) {
205 std::cout <<
" applying speedControl" << std::endl;
219 std::cout <<
" result: accel=" << accelACC <<
" newSpeed=" << newSpeed << std::endl;
223 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.
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.
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 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