SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
14 // Copyright (C) 2001-2013 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 
53 
55 MSCFModel_KraussPS::maxNextSpeed(SUMOReal speed, const MSVehicle* const veh) const {
56  const SUMOReal gravity = 9.80665;
57  const MSLane* const lane = veh->getLane();
59  const SUMOReal slope = lane->getShape().slopeDegreeAtOffset(gp);
60  const SUMOReal aMax = MAX2(0., getMaxAccel() - gravity * sin(DEG2RAD(slope)));
61  // assuming drag force is proportional to the square of speed
62  const SUMOReal vMax = sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed();
63  return MIN2(speed + (SUMOReal) ACCEL2SPEED(aMax), vMax);
64 }
65 
66 
67 
68 MSCFModel*
71 }
72 
73 
74 //void MSCFModel::saveState(std::ostream &os) {}
75