57 if (gap < NUMERICAL_EPS) {
73 return vsafe(veh, speed, gap2pred);
78 return vsafe(veh, speed, gap2pred);
84 return vsafe(veh, speed, gap2pred);
107 return -std::numeric_limits<double>::max();
The Nagel-Schreckenberg (1992) cellular automaton car-following model.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed (no dawdling)
double myDawdle
The probability of randomized deceleration by one cell per step ("sigma")
double patchSpeedBeforeLC(const MSVehicle *veh, double vMin, double vMax) const
NaSch rule 3 ("randomization"): dawdle by exactly one cell with probability sigma.
double vsafe(const MSVehicle *const veh, double speed, double gap) const
the safe speed considering only the gap to the leader/obstacle (NaSch rule 1+2)
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....
~MSCFModel_NaSch()
Destructor.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap2pred, double decel, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double minNextSpeedEmergency(double speed, const MSVehicle *const veh=0) const
NaSch does not impose an extra bound on emergency braking: a vehicle may always come to a full (Euler...
MSCFModel_NaSch(const MSVehicleType *vtype, double dawdle)
Constructor.
double myCellSpeed
The speed gained per step by accelerating at myAccel, i.e. one cell's worth of speed.
double roundToCell(double speed) const
Rounds a speed down to the nearest multiple of the cell speed (the speed gained by accelerating for e...
The car-following model abstraction.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
CalcReason
What the return value of stop/follow/free-Speed is used for.
static bool gSemiImplicitEulerUpdate
Representation of a vehicle in the micro simulation.
The car-following model and parameter.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)