39 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light! 71 MSCFModel(
const MSVehicleType* vtype,
double accel,
double decel,
double emergencyDecel,
double apparentDecel,
double headwayTime);
102 double maxSpeed,
const bool onInsertion =
false)
const;
114 virtual double followSpeed(
const MSVehicle*
const veh,
double speed,
double gap2pred,
double predSpeed,
double predMaxDecel)
const = 0;
141 virtual double stopSpeed(
const MSVehicle*
const veh,
const double speed,
double gap)
const = 0;
165 virtual double followSpeedTransient(
double duration,
const MSVehicle*
const veh,
double speed,
double gap2pred,
double predSpeed,
double predMaxDecel)
const;
293 static double brakeGap(
const double speed,
const double decel,
const double headwayTime);
295 static double brakeGapEuler(
const double speed,
const double decel,
const double headwayTime);
297 static double freeSpeed(
const double currentSpeed,
const double decel,
const double dist,
const double maxSpeed,
const bool onInsertion,
const double actionStepLength);
304 inline double getSecureGap(
const double speed,
const double leaderSpeed,
const double leaderMaxDecel)
const {
308 const double maxDecel =
MAX2(
myDecel, leaderMaxDecel);
339 static double estimateArrivalTime(
double dist,
double speed,
double maxSpeed,
double accel);
354 static double estimateArrivalTime(
double dist,
double initialSpeed,
double arrivalSpeed,
double maxSpeed,
double accel,
double decel);
391 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());
405 static double passingTime(
const double lastPos,
const double passedPos,
const double currentPos,
const double lastSpeed,
const double currentSpeed);
420 static double speedAfterTime(
const double t,
const double oldSpeed,
const double dist);
424 static double distAfterTime(
double t,
double speed,
double accel);
496 double maximumSafeFollowSpeed(
double gap,
double egoSpeed,
double predSpeed,
double predMaxDecel,
bool onInsertion =
false)
const;
505 double maximumSafeStopSpeed(
double gap,
double currentSpeed,
bool onInsertion =
false,
double headway = -1)
const;
static double speedAfterTime(const double t, const double oldSpeed, const double dist)
Calculates the speed after a time t [0,TS] given the initial speed and the distance traveled in an i...
Representation of a vehicle in the micro simulation.
const MSVehicleType * myType
The type to which this model definition belongs to.
virtual double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
double myApparentDecel
The vehicle's deceleration as expected by surrounding traffic [m/s^2].
virtual ~VehicleVariables()
virtual double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
virtual double interactionGap(const MSVehicle *const veh, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
virtual double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const =0
Computes the vehicle's follow speed (no dawdling)
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const =0
Duplicates the car-following model.
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)
The car-following model abstraction.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
double myAccel
The vehicle's maximum acceleration [m/s^2].
double getMinimalArrivalSpeed(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance.
static double avoidArrivalAccel(double dist, double time, double speed)
Computes the acceleration needed to arrive not before the given time.
#define UNUSED_PARAMETER(x)
virtual void setApparentDecel(double decel)
Sets a new value for the apparent deceleration [m/s^2].
The car-following model and parameter.
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
SUMOTime getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const
Computes the minimal time needed to cover a distance given the desired speed at arrival.
static double distAfterTime(double t, double speed, double accel)
calculates the distance travelled after accelerating for time t
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...
virtual int getModelID() const =0
Returns the model's ID; the XML-Tag number is used.
static double brakeGapEuler(const double speed, const double decel, const double headwayTime)
virtual double getImperfection() const
Get the driver's imperfection.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
virtual void setHeadwayTime(double headwayTime)
Sets a new value for desired headway [s].
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.
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...
double maximumSafeStopSpeedEuler(double gap) const
Returns the maximum next velocity for stopping within gap when using the semi-implicit Euler update...
virtual double insertionFollowSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const
Computes the vehicle's safe speed (no dawdling) This method is used during the insertion stage...
double myDecel
The vehicle's maximum deceleration [m/s^2].
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 ~MSCFModel()
Destructor.
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...
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
virtual void setMaxAccel(double accel)
Sets a new value for maximum acceleration [m/s^2].
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
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...
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...
virtual void setImperfection(double imperfection)
Sets a new value for driver imperfection.
double myEmergencyDecel
The vehicle's maximum emergency deceleration [m/s^2].
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
MSCFModel(const MSVehicleType *vtype, double accel, double decel, double emergencyDecel, double apparentDecel, double headwayTime)
Constructor.
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 void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
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 lane in the micro simulation.
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i...
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) ...
double getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance for Euler update...