SUMO - Simulation of Urban MObility
MSCFModel_KraussPS.cpp
Go to the documentation of this file.
1 /****************************************************************************/
11 // Krauss car-following model, changing accel and speed by slope
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
14 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <utils/geom/GeomHelper.h>
36 #include <microsim/MSVehicle.h>
37 #include <microsim/MSLane.h>
38 #include "MSCFModel_KraussPS.h"
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
44 MSCFModel_KraussPS::MSCFModel_KraussPS(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel,
45  double dawdle, double headwayTime) :
46  MSCFModel_Krauss(vtype, accel, decel, emergencyDecel, decel, dawdle, headwayTime) {
47 }
48 
49 
51 
52 
53 double
54 MSCFModel_KraussPS::maxNextSpeed(double speed, const MSVehicle* const veh) const {
55  const double gravity = 9.80665;
56  const double aMax = MAX2(0., getMaxAccel() - gravity * sin(DEG2RAD(veh->getSlope())));
57  // assuming drag force is proportional to the square of speed
58  const double vMax = sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed();
59  return MIN2(speed + (double) ACCEL2SPEED(aMax), vMax);
60 }
61 
62 
63 MSCFModel*
66 }
67 
68 
69 /****************************************************************************/
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
const MSVehicleType * myType
The type to which this model definition belongs to.
Definition: MSCFModel.h:463
#define ACCEL2SPEED(x)
Definition: SUMOTime.h:61
MSCFModel_KraussPS(const MSVehicleType *vtype, double accel, double decel, double emergencyDecel, double dawdle, double headwayTime)
Constructor.
The car-following model abstraction.
Definition: MSCFModel.h:60
double myAccel
The vehicle&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:466
T MAX2(T a, T b)
Definition: StdDefs.h:70
The car-following model and parameter.
Definition: MSVehicleType.h:74
double getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:193
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double myDawdle
The vehicle&#39;s dawdle-parameter. 0 for no dawdling, 1 for max.
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
T MIN2(T a, T b)
Definition: StdDefs.h:64
#define DEG2RAD(x)
Definition: GeomHelper.h:45
double myDecel
The vehicle&#39;s maximum deceleration [m/s^2].
Definition: MSCFModel.h:469
double myEmergencyDecel
The vehicle&#39;s maximum emergency deceleration [m/s^2].
Definition: MSCFModel.h:471
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:766
double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
double myHeadwayTime
The driver&#39;s desired time headway (aka reaction time tau) [s].
Definition: MSCFModel.h:476
Krauss car-following model, with acceleration decrease and faster start.
~MSCFModel_KraussPS()
Destructor.