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 
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
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:282
#define ACCEL2SPEED(x)
Definition: SUMOTime.h:61
The car-following model abstraction.
Definition: MSCFModel.h:58
SUMOReal myAccel
The vehicle&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:285
T MAX2(T a, T b)
Definition: StdDefs.h:63
SUMOReal myHeadwayTime
The driver&#39;s desired time headway (aka reaction time tau) [s].
Definition: MSCFModel.h:291
SUMOReal getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:284
The car-following model and parameter.
Definition: MSVehicleType.h:74
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
SUMOReal myDawdle
The vehicle&#39;s dawdle-parameter. 0 for no dawdling, 1 for max.
T MIN2(T a, T b)
Definition: StdDefs.h:57
#define DEG2RAD(x)
Definition: GeomHelper.h:45
SUMOReal getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:157
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition: MSLane.h:324
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:318
#define SUMOReal
Definition: config.h:221
SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:323
Krauss car-following model, with acceleration decrease and faster start.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
Representation of a lane in the micro simulation.
Definition: MSLane.h:73
~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:288