Eclipse SUMO - Simulation of Urban MObility
MSCFModel_KraussOrig1.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // The original Krauss (1998) car-following model and parameter
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include "MSCFModel.h"
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
38 public:
43 
44 
47 
48 
52  double patchSpeedBeforeLC(const MSVehicle* veh, double vMin, double vMax) const;
53 
62  double followSpeed(const MSVehicle* const veh, double speed, double gap2pred,
63  double predSpeed, double predMaxDecel, const MSVehicle* const pred = 0, const CalcReason usage = CalcReason::CURRENT) const;
64 
65 
73  virtual double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred, double decel, const CalcReason usage = CalcReason::CURRENT) const;
74 
75 
80  virtual int getModelID() const {
82  }
83 
84 
88  double getImperfection() const {
89  return myDawdle;
90  }
92 
93 
94 
97 
100  void setMaxDecel(double decel) {
101  myDecel = decel;
103  }
104 
105 
109  void setImperfection(double imperfection) {
110  myDawdle = imperfection;
111  }
112 
113 
117  void setHeadwayTime(double headwayTime) {
118  myHeadwayTime = headwayTime;
119  myTauDecel = myDecel * headwayTime;
120  }
122 
123 
128  virtual MSCFModel* duplicate(const MSVehicleType* vtype) const;
129 
130 protected:
137  virtual double vsafe(double gap, double predSpeed, double predMaxDecel) const;
138 
139 
144  virtual double dawdle(double speed, SumoRNG* rng) const;
145 
146 protected:
148  double myDawdle;
149 
151  double myTauDecel;
152 };
@ SUMO_TAG_CF_KRAUSS_ORIG1
The original Krauss (1998) car-following model and parameter.
double getImperfection() const
Get the driver's imperfection.
virtual double vsafe(double gap, double predSpeed, double predMaxDecel) const
Returns the "safe" velocity.
virtual double dawdle(double speed, SumoRNG *rng) const
Applies driver imperfection (dawdling / sigma)
double myDawdle
The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max.
double myTauDecel
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)
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)
virtual int getModelID() const
Returns the model's name.
MSCFModel_KraussOrig1(const MSVehicleType *vtype)
Constructor.
void setImperfection(double imperfection)
Sets a new value for driver imperfection.
void setMaxDecel(double decel)
Sets a new value for maximum deceleration [m/s^2].
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double patchSpeedBeforeLC(const MSVehicle *veh, double vMin, double vMax) const
apply custom speed adaptations within the given speed bounds
void setHeadwayTime(double headwayTime)
Sets a new value for desired headway [s].
The car-following model abstraction.
Definition: MSCFModel.h:55
CalcReason
What the return value of stop/follow/free-Speed is used for.
Definition: MSCFModel.h:77
double myDecel
The vehicle's maximum deceleration [m/s^2].
Definition: MSCFModel.h:701
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
Definition: MSCFModel.h:710
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:63