 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
33 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light!
35 #define EMERGENCY_DECEL_AMPLIFIER 1.2
109 double maxSpeed,
const bool onInsertion =
false)
const;
121 virtual double followSpeed(
const MSVehicle*
const veh,
double speed,
double gap2pred,
double predSpeed,
double predMaxDecel,
const MSVehicle*
const pred = 0)
const = 0;
148 virtual double stopSpeed(
const MSVehicle*
const veh,
const double speed,
double gap)
const = 0;
172 virtual double followSpeedTransient(
double duration,
const MSVehicle*
const veh,
double speed,
double gap2pred,
double predSpeed,
double predMaxDecel)
const;
317 static double brakeGap(
const double speed,
const double decel,
const double headwayTime);
319 static double brakeGapEuler(
const double speed,
const double decel,
const double headwayTime);
321 static double freeSpeed(
const double currentSpeed,
const double decel,
const double dist,
const double maxSpeed,
const bool onInsertion,
const double actionStepLength);
328 inline virtual double getSecureGap(
const double speed,
const double leaderSpeed,
const double leaderMaxDecel)
const {
332 const double maxDecel =
MAX2(
myDecel, leaderMaxDecel);
362 static double estimateArrivalTime(
double dist,
double speed,
double maxSpeed,
double accel);
377 static double estimateArrivalTime(
double dist,
double initialSpeed,
double arrivalSpeed,
double maxSpeed,
double accel,
double decel);
385 static double avoidArrivalAccel(
double dist,
double time,
double speed,
double maxDecel);
414 static double gapExtrapolation(
const double duration,
const double currentGap,
double v1,
double v2,
double a1 = 0,
double a2 = 0,
const double maxV1 = std::numeric_limits<double>::max(),
const double maxV2 = std::numeric_limits<double>::max());
428 static double passingTime(
const double lastPos,
const double passedPos,
const double currentPos,
const double lastSpeed,
const double currentSpeed);
443 static double speedAfterTime(
const double t,
const double oldSpeed,
const double dist);
447 static double distAfterTime(
double t,
double speed,
double accel);
519 double maximumSafeFollowSpeed(
double gap,
double egoSpeed,
double predSpeed,
double predMaxDecel,
bool onInsertion =
false)
const;
542 double maximumSafeStopSpeed(
double gap,
double currentSpeed,
bool onInsertion =
false,
double headway = -1)
const;
The car-following model and parameter.
virtual ~VehicleVariables()
#define UNUSED_PARAMETER(x)
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i....
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
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 getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Representation of a lane in the micro simulation.
virtual double getImperfection() const
Get the driver's imperfection.
virtual void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
double maximumSafeStopSpeedBallistic(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap when using the ballistic positional update.
static double gapExtrapolation(const double duration, const double currentGap, double v1, double v2, double a1=0, double a2=0, const double maxV1=std::numeric_limits< double >::max(), const double maxV2=std::numeric_limits< double >::max())
return the resulting gap if, starting with gap currentGap, two vehicles continue with constant accele...
virtual void setImperfection(double imperfection)
Sets a new value for driver imperfection.
static double estimateArrivalTime(double dist, double speed, double maxSpeed, double accel)
Computes the time needed to travel a distance dist given an initial speed and constant acceleration....
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
void applyHeadwayAndSpeedDifferencePerceptionErrors(const MSVehicle *const veh, double speed, double &gap, double &predSpeed, double predMaxDecel, const MSVehicle *const pred) const
Overwrites gap2pred and predSpeed by the perceived values obtained from the vehicle's driver state,...
SUMOTime getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const
Computes the minimal time needed to cover a distance given the desired speed at arrival.
double getMinimalArrivalSpeed(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance.
virtual void setApparentDecel(double decel)
Sets a new value for the apparent deceleration [m/s^2].
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
virtual void setHeadwayTime(double headwayTime)
Sets a new value for desired headway [s].
virtual double interactionGap(const MSVehicle *const veh, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
double myEmergencyDecel
The vehicle's maximum emergency deceleration [m/s^2].
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
virtual void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
virtual double patchSpeedBeforeLC(const MSVehicle *veh, double vMin, double vMax) const
apply custom speed adaptations within the given speed bounds
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
virtual double insertionFollowSpeed(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) This method is used during the insertion stage....
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
virtual double insertionStopSpeed(const MSVehicle *const veh, double speed, double gap) const
Computes the vehicle's safe speed for approaching an obstacle at insertion without constraints due to...
virtual double minNextSpeedEmergency(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed after emergency braking, given the current speed (depends on the numerical ...
static double avoidArrivalAccel(double dist, double time, double speed, double maxDecel)
Computes the acceleration needed to arrive not before the given time.
virtual void setMaxAccel(double accel)
Sets a new value for maximum acceleration [m/s^2].
static double speedAfterTime(const double t, const double oldSpeed, const double dist)
Calculates the speed after a time t \in [0,TS] given the initial speed and the distance traveled in a...
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const =0
Duplicates the car-following model.
MSCFModel(const MSVehicleType *vtype)
Constructor.
virtual std::string getParameter(const MSVehicle *veh, const std::string &key) const
try to get the given parameter for this carFollowingModel
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
virtual double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
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...
virtual double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
virtual double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
virtual double followSpeedTransient(double duration, const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const
Computes the vehicle's follow speed that avoids a collision for the given amount of time.
double myDecel
The vehicle's maximum deceleration [m/s^2].
double calculateEmergencyDeceleration(double gap, double egoSpeed, double predSpeed, double predMaxDecel) const
Returns the minimal deceleration for following the given leader safely.
double getCollisionMinGapFactor() const
Get the factor of minGap that must be maintained to avoid a collision event.
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
const MSVehicleType * myType
The type to which this model definition belongs to.
The car-following model abstraction.
static double passingTime(const double lastPos, const double passedPos, const double currentPos, const double lastSpeed, const double currentSpeed)
Calculates the time at which the position passedPosition has been passed In case of a ballistic updat...
static double brakeGapEuler(const double speed, const double decel, const double headwayTime)
double myAccel
The vehicle's maximum acceleration [m/s^2].
virtual int getModelID() const =0
Returns the model's ID; the XML-Tag number is used.
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
void applyHeadwayPerceptionError(const MSVehicle *const veh, double speed, double &gap) const
Overwrites gap by the perceived value obtained from the vehicle's driver state.
double maximumSafeStopSpeedEuler(double gap, double headway=-1) const
Returns the maximum next velocity for stopping within gap when using the semi-implicit Euler update.
static double distAfterTime(double t, double speed, double accel)
calculates the distance travelled after accelerating for time t
virtual double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const =0
Computes the vehicle's follow speed (no dawdling)
double getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance for Euler update.
virtual ~MSCFModel()
Destructor.
double myApparentDecel
The vehicle's deceleration as expected by surrounding traffic [m/s^2].
Representation of a vehicle in the micro simulation.