SUMO - Simulation of Urban MObility
MSCFModel_KraussPS.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Krauss car-following model, changing accel and speed by slope
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <utils/geom/GeomHelper.h>
29 #include <microsim/MSVehicle.h>
30 #include <microsim/MSLane.h>
31 #include "MSCFModel_KraussPS.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38  MSCFModel_Krauss(vtype) {
39 }
40 
41 
43 
44 
45 double
46 MSCFModel_KraussPS::maxNextSpeed(double speed, const MSVehicle* const veh) const {
47  const double gravity = 9.80665;
48  const double aMax = MAX2(0., getMaxAccel() - gravity * sin(DEG2RAD(veh->getSlope())));
49  // assuming drag force is proportional to the square of speed
50  const double vMax = sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed();
51  return MIN2(speed + (double) ACCEL2SPEED(aMax), vMax);
52 }
53 
54 
55 MSCFModel*
57  return new MSCFModel_KraussPS(vtype);
58 }
59 
60 
61 /****************************************************************************/
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
const MSVehicleType * myType
The type to which this model definition belongs to.
Definition: MSCFModel.h:587
#define ACCEL2SPEED(x)
Definition: SUMOTime.h:54
The car-following model abstraction.
Definition: MSCFModel.h:57
T MAX2(T a, T b)
Definition: StdDefs.h:76
The car-following model and parameter.
Definition: MSVehicleType.h:66
double getMaxAccel() const
Get the vehicle type&#39;s maximum acceleration [m/s^2].
Definition: MSCFModel.h:210
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
T MIN2(T a, T b)
Definition: StdDefs.h:70
#define DEG2RAD(x)
Definition: GeomHelper.h:38
MSCFModel_KraussPS(const MSVehicleType *vtype)
Constructor.
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:1115
double maxNextSpeed(double 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_KraussPS()
Destructor.