00001 #ifndef _IDM_H 00002 #define _IDM_H 00003 00004 #include "stdafx.h" 00005 #include "DriverModel.h" 00006 00009 class IDM : public DriverModel 00010 { 00011 00012 public: 00013 IDM(); 00014 virtual ~IDM(); 00015 double update(double vel, double dist); 00016 00017 // The gets 00018 double get_T(); 00019 double get_A(); 00020 double get_B(); 00021 double get_S0(); 00022 double get_S1(); 00023 double get_V0(); 00024 double get_Delta(); 00025 double get_Polite(); 00026 double get_Bias(); 00027 double get_DeltaAth(); 00028 00029 // The sets 00030 void set_T (double val); 00031 void set_A (double val); 00032 void set_B (double val); 00033 void set_S0 (double val); 00034 void set_S1 (double val); 00035 void set_V0 (double val); 00036 void set_Delta (double val); 00037 void set_Polite (double val); 00038 void set_Bias (double val); 00039 void set_DeltaAth (double val); 00040 00041 private: 00042 // Parameters of model 00044 double m_T; 00046 double m_A; 00048 double m_B; 00049 /*Jam distance s0*/ 00050 double m_S0; 00051 /*Jam distance s1*/ 00052 double m_S1; 00053 /*Desired velocity*/ 00054 double m_V0; 00055 /*Acceleration exponent*/ 00056 double m_Delta; 00057 00059 double m_Polite; 00061 double m_Bias; 00063 double m_DeltaAth; 00064 00065 double m_V0_BeforeSpeedLimit; // for storing previous values for retrieval 00066 double m_T_BeforeGradient; 00067 double m_A_BeforeGradient; 00068 double m_B_BeforeGradient; 00069 double m_V0_BeforeGradient; 00070 double m_V0_Initial; 00071 00072 00073 // Operations 00074 public: 00075 virtual void ClearRestriction(); 00076 virtual void ClearGradient(); 00077 virtual void SetGradient(double gradient); 00078 virtual void ClearSpeedLimit(); 00079 virtual void SetSpeedLimit(double newV0); 00080 virtual double getDesiredVel(); // kept because of base class 00081 virtual void setVel(double vel); // set current velocity 00082 00083 // Lane changing 00084 double LaneChange( double GapToFront, 00085 double GapToBack, 00086 double FrontChangeAccel, 00087 double CurrentBackAccel, 00088 double ProposedBackAccel, 00089 bool overtake); 00090 00091 private: 00092 // properties of vehicle 00093 double m_speed; 00094 double s_star(double vel); 00095 double dvdt(double m_speed, double s); 00096 00097 double LANECHANGE_MIN_GAP; 00098 double SAFE_BRAKING; 00099 bool A_FLAG; 00100 double A_MIN; 00101 bool B_FLAG; 00102 double T_SLOPE; 00103 double V0_MIN; 00104 double V0_SLOPE; 00105 00106 }; 00107 #endif