40 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light! 72 MSCFModel(
const MSVehicleType* vtype,
double accel,
double decel,
double emergencyDecel,
double apparentDecel,
double headwayTime);
103 double maxSpeed,
const bool onInsertion =
false)
const;
115 virtual double followSpeed(
const MSVehicle*
const veh,
double speed,
double gap2pred,
double predSpeed,
double predMaxDecel)
const = 0;
142 virtual double stopSpeed(
const MSVehicle*
const veh,
const double speed,
double gap)
const = 0;
267 static double brakeGap(
const double speed,
const double decel,
const double headwayTime);
269 static double freeSpeed(
const double currentSpeed,
const double decel,
const double dist,
const double maxSpeed,
const bool onInsertion);
276 inline double getSecureGap(
const double speed,
const double leaderSpeed,
const double leaderMaxDecel)
const {
292 const double followDecel =
MIN2(
myDecel, leaderMaxDecel);
355 static double passingTime(
const double lastPos,
const double passedPos,
const double currentPos,
const double lastSpeed,
const double currentSpeed);
370 static double speedAfterTime(
const double t,
const double oldSpeed,
const double dist);
428 double maximumSafeFollowSpeed(
double gap,
double egoSpeed,
double predSpeed,
double predMaxDecel,
bool onInsertion =
false)
const;
437 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.
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const =0
Duplicates the car-following model.
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 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 ~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.
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 reaction time [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.
virtual int getModelID() const =0
Returns the model's ID; the XML-Tag number is used.
#define UNUSED_PARAMETER(x)
The car-following model and parameter.
SUMOTime getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const
Computes the minimal time needed to cover a distance given the desired speed at arrival.
virtual double getImperfection() const
Get the driver's imperfection.
double getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
virtual void setHeadwayTime(double headwayTime)
Sets a new value for driver reaction time [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 maximum 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...
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
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) ...
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...
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, assuming that during...
double getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance for Euler update...