 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
41 myTwoSqrtAccelDecel(double(2 * sqrt(myAccel * myDecel))) {
77 return followSpeed(v, speed, gap2pred, predSpeed, predMaxDecel);
107 const double vNext = veh->
getSpeed() + acc;
108 const double gap = (vNext - vL) * (veh->
getSpeed() + vL) / (2 *
myDecel) + vL;
116 const double delta_v = speed - leaderSpeed;
123 const double predSpeed,
const double desSpeed,
const bool respectMinGap)
const {
132 double newSpeed = egoSpeed;
133 double gap = gap2pred;
139 const double delta_v = newSpeed - predSpeed;
145 const double acc =
myAccel * (1. - pow(newSpeed / desSpeed,
myDelta) - (s * s) / (gap * gap));
148 std::cout <<
" gap=" << gap <<
" t=" <<
myHeadwayTime <<
" t2=" << headwayTime <<
" s=" << s <<
" pow=" << pow(newSpeed / desSpeed,
myDelta) <<
" gapDecel=" << (s * s) / (gap * gap) <<
" a=" << acc;
154 std::cout <<
" v2=" << newSpeed <<
"\n";
160 return MAX2(0., newSpeed);
MSCFModel_IDM(const MSVehicleType *vtype, bool idmm)
Constructor.
The car-following model and parameter.
const double myTwoSqrtAccelDecel
A computational shortcut.
double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
const double myAdaptationTime
The IDMM adaptation time tau.
const int myIterations
The number of iterations in speed calculations.
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
virtual bool isSelected() const
whether this vehicle is selected in the GUI
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
~MSCFModel_IDM()
Destructor.
const double myDelta
The IDM delta exponent.
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
const double myAdaptationFactor
The IDMM adaptation factor beta.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
double myHeadwayTime
The driver's desired time headway (aka reaction time tau) [s].
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....
double getMinGap() const
Get the free space in front of vehicles of this class.
double followSpeed(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)
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.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
MSLane * getLane() const
Returns the lane the vehicle is on.
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 _v(const MSVehicle *const veh, const double gap2pred, const double mySpeed, const double predSpeed, const double desSpeed, const bool respectMinGap=true) const
const SUMOVTypeParameter & getParameter() const
const MSVehicleType * myType
The type to which this model definition belongs to.
const bool myIDMM
whether the model is IDMM or IDM
The car-following model abstraction.
bool gDebugFlag1
global utility flags for debugging
double getSpeed() const
Returns the vehicle's current speed.
double myAccel
The vehicle's maximum acceleration [m/s^2].
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
double levelOfService
state variable for remembering speed deviation history (lambda)
Representation of a vehicle in the micro simulation.