MSCFModel.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MSCFModel_h
00020 #define MSCFModel_h
00021
00022
00023
00024
00025 #ifdef _MSC_VER
00026 #include <windows_config.h>
00027 #else
00028 #include <config.h>
00029 #endif
00030
00031 #include <cassert>
00032 #include <string>
00033 #include <utils/common/StdDefs.h>
00034 #include <utils/common/FileHelpers.h>
00035
00036
00037
00038
00039
00040 class MSVehicleType;
00041 class MSVehicle;
00042 class MSLane;
00043
00044
00045
00046
00047
00055 class MSCFModel {
00056 public:
00060 MSCFModel(const MSVehicleType* vtype, SUMOReal decel) throw();
00061
00062
00064 virtual ~MSCFModel() throw();
00065
00066
00069
00076 virtual SUMOReal moveHelper(MSVehicle * const veh, const MSLane * const lane, SUMOReal vPos) const throw() = 0;
00077
00078
00089 virtual SUMOReal ffeV(const MSVehicle * const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed) const throw() = 0;
00090
00091
00101 virtual SUMOReal ffeV(const MSVehicle * const veh, SUMOReal gap2pred, SUMOReal predSpeed) const throw() = 0;
00102
00103
00112 virtual SUMOReal ffeV(const MSVehicle * const veh, const MSVehicle * const pred) const throw() = 0;
00113
00114
00123 virtual SUMOReal ffeS(const MSVehicle * const veh, SUMOReal gap2pred) const throw() = 0;
00124
00125
00134 virtual SUMOReal interactionGap(const MSVehicle * const veh, SUMOReal vL) const throw() = 0;
00135
00136
00147 virtual bool hasSafeGap(SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal laneMaxSpeed) const throw() = 0;
00148
00149
00158 virtual SUMOReal getMaxAccel(SUMOReal v) const throw() = 0;
00159
00160
00164 virtual void saveState(std::ostream &os);
00165
00166
00170 virtual int getModelID() const throw() = 0;
00172
00173
00174
00177
00181 virtual SUMOReal getTau() const throw() {
00182 return 1.;
00183 }
00185
00186
00187
00190
00198 void leftVehicleVsafe(const MSVehicle * const ego, const MSVehicle * const neigh, SUMOReal &vSafe) const throw();
00199
00200
00212 SUMOReal maxNextSpeed(SUMOReal speed) const throw();
00213
00214
00218 SUMOReal getMaxDecel() const throw() {
00219 return myDecel;
00220 }
00221
00222
00227 SUMOReal brakeGap(SUMOReal speed) const throw();
00228
00229
00234 SUMOReal getSecureGap(const SUMOReal speed, const SUMOReal leaderSpeedAfterDecel) const throw() {
00235 const SUMOReal speedDiff = speed - leaderSpeedAfterDecel;
00236 return speedDiff * speedDiff / getMaxDecel() + speed * getTau();
00237 }
00238
00239
00244 SUMOReal getSpeedAfterMaxDecel(SUMOReal v) const throw() {
00245 return MAX2((SUMOReal) 0, v - (SUMOReal) ACCEL2SPEED(myDecel));
00246 }
00248
00249
00250 protected:
00252 const MSVehicleType* myType;
00253
00255 SUMOReal myDecel;
00256
00258 SUMOReal myInverseTwoDecel;
00259
00260
00261 };
00262
00263
00264 #endif
00265