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-2016 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 // ===========================================================================
45  SUMOReal dawdle, SUMOReal headwayTime)
46  : MSCFModel_Krauss(vtype, accel, decel, dawdle, headwayTime) {
47 }
48 
49 
51 
52 
54 MSCFModel_KraussPS::maxNextSpeed(SUMOReal speed, const MSVehicle* const veh) const {
55  const SUMOReal gravity = 9.80665;
56  const SUMOReal aMax = MAX2(0., getMaxAccel() - gravity * sin(DEG2RAD(veh->getSlope())));
57  // assuming drag force is proportional to the square of speed
58  const SUMOReal vMax = sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed();
59  return MIN2(speed + (SUMOReal) ACCEL2SPEED(aMax), vMax);
60 }
61 
62 
63 MSCFModel*
66 }
67 
68 
69 /****************************************************************************/
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:81
SUMOReal getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
const MSVehicleType * myType
The type to which this model definition belongs to.
Definition: MSCFModel.h:344
#define ACCEL2SPEED(x)
Definition: SUMOTime.h:61
The car-following model abstraction.
Definition: MSCFModel.h:59
SUMOReal myAccel
The vehicle&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:347
T MAX2(T a, T b)
Definition: StdDefs.h:75
SUMOReal myHeadwayTime
The driver&#39;s desired time headway (aka reaction time tau) [s].
Definition: MSCFModel.h:353
The car-following model and parameter.
Definition: MSVehicleType.h:74
SUMOReal myDawdle
The vehicle&#39;s dawdle-parameter. 0 for no dawdling, 1 for max.
T MIN2(T a, T b)
Definition: StdDefs.h:69
#define DEG2RAD(x)
Definition: GeomHelper.h:45
SUMOReal getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:178
SUMOReal getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:750
#define SUMOReal
Definition: config.h:213
SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
Krauss car-following model, with acceleration decrease and faster start.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
~MSCFModel_KraussPS()
Destructor.
MSCFModel_KraussPS(const MSVehicleType *vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, SUMOReal headwayTime)
Constructor.
SUMOReal myDecel
The vehicle&#39;s maximum deceleration [m/s^2].
Definition: MSCFModel.h:350