 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
40 myTwoSqrtAccelDecel(double(2 * sqrt(myAccel * myDecel))) {
67 if (speed <= maxSpeed) {
78 vSafe =
MIN2(vSafe, maxSpeed);
103 return followSpeed(v, speed, gap2pred, predSpeed, predMaxDecel);
134 const double vNext = veh->
getSpeed() + acc;
135 const double gap = (vNext - vL) * (veh->
getSpeed() + vL) / (2 *
myDecel) + vL;
143 const double delta_v = speed - leaderSpeed;
150 const double predSpeed,
const double desSpeed,
const bool respectMinGap)
const {
159 double newSpeed = egoSpeed;
160 double gap = gap2pred;
166 const double delta_v = newSpeed - predSpeed;
172 const double acc =
myAccel * (1. - pow(newSpeed / desSpeed,
myDelta) - (s * s) / (gap * gap));
175 std::cout <<
" gap=" << gap <<
" t=" <<
myHeadwayTime <<
" t2=" << headwayTime <<
" s=" << s <<
" pow=" << pow(newSpeed / desSpeed,
myDelta) <<
" gapDecel=" << (s * s) / (gap * gap) <<
" a=" << acc;
181 std::cout <<
" v2=" << newSpeed <<
"\n";
187 return MAX2(0., newSpeed);
MSCFModel_IDM(const MSVehicleType *vtype, bool idmm)
Constructor.
The car-following model and parameter.
const double myTwoSqrtAccelDecel
A computational shortcut.
@ SUMO_ATTR_CF_IDMM_ADAPT_FACTOR
@ SUMO_ATTR_CF_IDM_STEPPING
void applyHeadwayAndSpeedDifferencePerceptionErrors(const MSVehicle *const veh, double speed, double &gap, double &predSpeed, double predMaxDecel, const MSVehicle *const pred) const
Overwrites gap2pred and predSpeed by the perceived values obtained from the vehicle's driver state,...
double getSecureGap(const MSVehicle *const veh, const MSVehicle *const pred, 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.
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
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
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
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.
void applyHeadwayPerceptionError(const MSVehicle *const veh, double speed, double &gap) const
Overwrites gap by the perceived value obtained from the vehicle's driver state.
double levelOfService
state variable for remembering speed deviation history (lambda)
@ SUMO_ATTR_CF_IDMM_ADAPT_TIME
Representation of a vehicle in the micro simulation.