 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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
64 #define GAP_THRESHOLD_SPEEDCTRL 120
65 #define GAP_THRESHOLD_GAPCTRL 100
71 #define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD 2.0
97 const double vACC =
_v(veh, gap2pred, speed, predSpeed, desSpeed,
true);
134 const int max_iter = 50;
136 const double tol = 0.1;
137 const double damping = 0.1;
140 while (n_iter < max_iter) {
143 res = res + damping * a;
173 std::cout <<
" applying gapControl" << std::endl;
178 double gclAccel = 0.0;
183 double spacingErr = gap - desSpacing;
184 double deltaVel = predSpeed - speed;
187 if (fabs(spacingErr) < 0.2 && fabs(vErr) < 0.1) {
190 }
else if (spacingErr < 0) {
204 const double predSpeed,
const double desSpeed,
const bool )
const {
212 std::cout <<
SIMTIME <<
" MSCFModel_ACC::_v() for veh '" << veh->
getID() <<
"'\n"
213 <<
" gap=" << gap2pred <<
" speed=" << speed <<
" predSpeed=" << predSpeed
214 <<
" desSpeed=" << desSpeed << std::endl;
220 double vErr = speed - desSpeed;
221 int setControlMode = 0;
227 if (gap2pred > gapLimit_SC) {
231 std::cout <<
" applying speedControl" << std::endl;
237 if (setControlMode) {
240 }
else if (gap2pred < gapLimit_GC) {
244 if (setControlMode) {
254 std::cout <<
" applying speedControl" << std::endl;
268 std::cout <<
" result: accel=" << accelACC <<
" newSpeed=" << newSpeed << std::endl;
272 return MAX2(0., newSpeed);
The car-following model and parameter.
double accelGapControl(const MSVehicle *const veh, const double gap2pred, const double speed, const double predSpeed, double vErr) const
double myCollisionAvoidanceGainSpeed
double myCollisionAvoidanceGainSpace
double maximumSafeFollowSpeed(double gap, double egoSpeed, double predSpeed, double predMaxDecel, bool onInsertion=false) const
Returns the maximum safe velocity for following the given leader.
#define DEFAULT_GCC_GAIN_SPACE
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
double _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
#define DEFAULT_GCC_GAIN_SPEED
#define DEFAULT_GC_GAIN_SPEED
double myGapClosingControlGainSpeed
#define GAP_THRESHOLD_GAPCTRL
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.
#define DEFAULT_EMERGENCY_OVERRIDE_THRESHOLD
double mySpeedControlGain
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
double myGapControlGainSpace
double accelSpeedControl(double vErr) const
double getMaxSpeed() const
Returns the maximum speed.
double myGapClosingControlGainSpace
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
#define DEFAULT_GC_GAIN_SPACE
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
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)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
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 myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
@ SUMO_ATTR_CA_GAIN_SPEED
double getMinGap() const
Get the free space in front of vehicles of this class.
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.
~MSCFModel_ACC()
Destructor.
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.
MSLane * getLane() const
Returns the lane the vehicle is on.
double myGapControlGainSpeed
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSCFModel_ACC(const MSVehicleType *vtype)
Constructor.
const SUMOVTypeParameter & getParameter() const
const std::string & getID() const
Returns the name of the vehicle.
@ SUMO_ATTR_GC_GAIN_SPEED
The car-following model abstraction.
@ SUMO_ATTR_GCC_GAIN_SPACE
@ SUMO_ATTR_GC_GAIN_SPACE
#define GAP_THRESHOLD_SPEEDCTRL
#define DEFAULT_CA_GAIN_SPEED
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
@ SUMO_ATTR_GCC_GAIN_SPEED
#define DEFAULT_CA_GAIN_SPACE
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)
@ SUMO_ATTR_CA_GAIN_SPACE
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
Representation of a vehicle in the micro simulation.