38 myTauDecel(myDecel * myHeadwayTime),
39 myDecelDivTau(myDecel / myHeadwayTime),
54 std::ostringstream internals;
64 const std::string cfmID = attrs.
get<std::string>(
SUMO_ATTR_ID,
nullptr, ok);
65 if (cfmID !=
"PWagner2009") {
66 throw ProcessError(
TLF(
"incompatible carFollowModel '%' when loading state for PWagner2009", cfmID));
96 if (predSpeed == 0 && gap < 0.01) {
102 double apref = vars->
aOld;
125 if (apref <= asafe) {
@ SUMO_ATTR_CF_PWAGNER2009_TAULAST
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
@ SUMO_ATTR_CF_PWAGNER2009_APPROB
@ SUMO_ATTR_STATE
The state of a link.
void saveState(OutputDevice &out, const MSCFModel &cfm) const
Saves the vehicle variables.
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the vehicle variables from the given description.
Scalable model based on Krauss by Peter Wagner.
~MSCFModel_PWag2009()
Destructor.
double myDecelDivTau
The precomputed value for myDecel/myTau.
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 myTauLastDecel
The precomputed value for (minimum headway time)*myDecel.
double myActionPointProbability
The probability for any action.
double patchSpeedBeforeLC(const MSVehicle *veh, double vMin, double vMax) const
apply dawdling
MSCFModel_PWag2009(const MSVehicleType *vtype)
Constructor.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double myTauDecel
The precomputed value for myDecel*myTau.
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)
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
The car-following model abstraction.
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
CalcReason
What the return value of stop/follow/free-Speed is used for.
double myCollisionMinGapFactor
The factor of minGap that must be maintained to avoid a collision event.
double myDecel
The vehicle's maximum deceleration [m/s^2].
double myAccel
The vehicle's maximum acceleration [m/s^2].
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
Representation of a vehicle in the micro simulation.
double getSpeed() const
Returns the vehicle's current speed.
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
The car-following model and parameter.
const SUMOVTypeParameter & getParameter() const
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
Structure representing possible vehicle parameter.
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
#define UNUSED_PARAMETER(x)