54 double emergencyDecel,
double apparentDecel,
55 double dawdle,
double headwayTime) :
84 const double vDawdle =
MAX2(vMin,
dawdle2(vMax, sigma));
88 assert(vNext >= vMin);
89 assert(vNext <= vMax);
91 #ifdef DEBUG_MOVE_HELPER 93 std::cout <<
"\nMOVE_HELPER\n" 94 <<
"veh '" << veh->
getID() <<
"' vMin=" << vMin
95 <<
" vMax=" << vMax <<
" vDawdle=" << vDawdle
96 <<
" vSafe" << vSafe <<
" vNext=" << vNext <<
" vPos=" << vPos <<
" veh->getSpeed()=" << oldV
121 return MIN2(vsafe, vmax);
125 return MAX2(
MIN2(vsafe, vmax), vmin);
151 return MAX2(0., speed);
Representation of a vehicle in the micro simulation.
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const
Computes the vehicle's safe speed (no dawdling) this uses the maximumSafeFollowSpeed.
double myApparentDecel
The vehicle's deceleration as expected by surrounding traffic [m/s^2].
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.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
The original Krauss (1998) car-following model and parameter.
double myAccel
The vehicle's maximum acceleration [m/s^2].
~MSCFModel_Krauss()
Destructor.
The car-following model and parameter.
double dawdle2(double speed, double sigma) const
Applies driver imperfection (dawdling / sigma)
MSAbstractLaneChangeModel & getLaneChangeModel()
virtual double vsafe(double gap, double predSpeed, double predMaxDecel) const
Returns the "safe" velocity.
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)=0
Called to adapt the speed in order to allow a lane change. It uses information on LC-related desired ...
const SUMOVTypeParameter & getParameter() const
virtual double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
double myDawdle
The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max.
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
double myDecel
The vehicle's maximum deceleration [m/s^2].
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
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) this uses the m...
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
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...
double myEmergencyDecel
The vehicle's maximum emergency deceleration [m/s^2].
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
static bool gSemiImplicitEulerUpdate
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points...
MSLane * getLane() const
Returns the lane the vehicle is on.
double maximumSafeFollowSpeed(double gap, double egoSpeed, double predSpeed, double predMaxDecel, bool onInsertion=false) const
Returns the maximum safe velocity for following the given leader.
MSCFModel_Krauss(const MSVehicleType *vtype, double accel, double decel, double emergencyDecel, double apparentDecel, double dawdle, double headwayTime)
Constructor.
const std::string & getID() const
Returns the name of the vehicle.
double getSpeed() const
Returns the vehicle's current speed.