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 104 return _v(veh, gap2pred, speed, predSpeed, desSpeed,
true);
133 std::cout <<
" applying gapControl" << std::endl;
138 double gclAccel = 0.0;
143 double spacingErr = gap - desSpacing;
144 double deltaVel = predSpeed - speed;
147 if (fabs(spacingErr) < 0.2 && fabs(vErr) < 0.1) {
150 }
else if (spacingErr < 0) {
164 const double predSpeed,
const double desSpeed,
const bool )
const {
167 double gapLimit_SC = 120;
168 double gapLimit_GC = 100;
172 std::cout <<
SIMTIME <<
" MSCFModel_ACC::_v() for veh '" << veh->
getID() <<
"'\n" 173 <<
" gap=" << gap2pred <<
" speed=" << speed <<
" predSpeed=" << predSpeed
174 <<
" desSpeed=" << desSpeed << std::endl;
180 double vErr = speed - desSpeed;
181 int setControlMode = 0;
187 if (gap2pred > gapLimit_SC) {
191 std::cout <<
" applying speedControl" << std::endl;
197 if (setControlMode) {
200 }
else if (gap2pred < gapLimit_GC) {
204 if (setControlMode) {
214 std::cout <<
" applying speedControl" << std::endl;
228 std::cout <<
" result: accel=" << accelACC <<
" newSpeed=" << newSpeed << std::endl;
232 return MAX2(0., newSpeed);
#define DEFAULT_GCC_GAIN_SPEED
double myGapControlGainSpeed
#define DEFAULT_GCC_GAIN_SPACE
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
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.
virtual double minNextSpeed(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
#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.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
~MSCFModel_ACC()
Destructor.
double myCollisionAvoidanceGainSpace
The car-following model and parameter.
MSAbstractLaneChangeModel & getLaneChangeModel()
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)=0
Called to adapt the speed in order to allow a lane change. It uses information on LC-related desired ...
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
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.
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
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 _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].
double getSpeed() const
Returns the vehicle's current speed.
const std::string & getID() const
Returns the name of the vehicle.
double myGapClosingControlGainSpeed
double myGapControlGainSpace
#define DEFAULT_CA_GAIN_SPACE