43 myTauDecel(myDecel * myHeadwayTime),
57 std::cout <<
"# s2s-speed: " <<
myS2Sspeed << std::endl;
65 std::cout <<
"# maxDeltaGap = " <<
maxDeltaGap << std::endl;
79 std::ostringstream internals;
80 internals <<
gOld <<
" ";
82 internals <<
ggOld.size() <<
" ";
83 for (
auto item :
ggOld) {
84 internals << item.first <<
" " << item.second <<
" ";
94 const std::string cfmID = attrs.
get<std::string>(
SUMO_ATTR_ID,
nullptr, ok);
95 if (cfmID !=
"SmartSK") {
96 throw ProcessError(
TLF(
"incompatible carFollowModel '%' when loading state for SmartSK", cfmID));
103 for (
int i = 0; i < ggOldSize; i++) {
119 if (vars->
ggOld.size() > 1) {
120 std::cout <<
"# more than one entry in ggOld list. Speed is " << vPos <<
", corresponding dist is " << vars->
ggOld[(int) vPos] <<
"\n";
121 for (std::map<int, double>::iterator I = vars->
ggOld.begin(); I != vars->
ggOld.end(); I++) {
122 std::cout <<
"# " << (*I).first <<
' ' << (*I).second << std::endl;
137 double tTauTest = gap / speed;
139 if ((tTauTest < vars->myHeadway) && (tTauTest >
TS)) {
144 double vsafe =
_vsafe(veh, gap, predSpeed);
152 vars->
ggOld[(int)vNew] = gap;
162 double tTauTest = gap / speed;
164 if ((tTauTest < vars->myHeadway) && (tTauTest >
TS)) {
185 if (predSpeed == 0 && gap < 0.01) {
192 double vsafe = (double)(-1. * bTau
195 + (predSpeed * predSpeed)
@ SUMO_ATTR_STATE
The state of a link.
std::map< int, double > ggOld
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.
The original Krauss (1998) car-following model and parameter.
double patchSpeedBeforeLC(const MSVehicle *veh, double vMin, double vMax) const
apply dawdling
double myTauDecel
The precomputed value for myDecel*myTau.
double myDawdle
The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max.
virtual double _vsafe(const MSVehicle *const veh, double gap, double predSpeed) const
Returns the "safe" velocity.
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
virtual 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 myS2Sspeed
new variables needed in this model; myS2Sspeed is the speed below which the vehicle does not move whe...
double myTmp1
temporary (testing) parameter
virtual void updateMyHeadway(const MSVehicle *const veh) const
~MSCFModel_SmartSK()
Destructor.
MSCFModel_SmartSK(const MSVehicleType *vtype)
Constructor.
virtual double dawdle(double speed, SumoRNG *rng) const
Applies driver imperfection (dawdling / sigma)
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
virtual 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)
The car-following model abstraction.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
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 myDecel
The vehicle's maximum deceleration [m/s^2].
double myAccel
The vehicle's maximum acceleration [m/s^2].
virtual double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
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.
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.