Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSCFModel_KraussPS.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
22// Krauss car-following model, changing accel and speed by slope
23/****************************************************************************/
24#include <config.h>
25
27#include <microsim/MSVehicle.h>
28#include <microsim/MSLane.h>
29#include "MSCFModel_KraussPS.h"
30
31
32// ===========================================================================
33// method definitions
34// ===========================================================================
38
39
41
42
43double
44MSCFModel_KraussPS::maxNextSpeed(double speed, const MSVehicle* const veh) const {
45 const double aMax = MAX2(0., getMaxAccel() - GRAVITY * sin(DEG2RAD(veh->getSlope())));
46 // assuming drag force is proportional to the square of speed
47 const double vMax = MAX2(
48 sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed(),
49 // prevent emergency braking when inclination changes suddenly (momentum)
50 speed - ACCEL2SPEED(getMaxDecel()));
51 return MAX2(
52 // prevent stalling at low speed
53 getMaxAccel() / 2,
54 MIN2(speed + ACCEL2SPEED(aMax), vMax));
55}
56
57
60 return new MSCFModel_KraussPS(vtype);
61}
62
63
64/****************************************************************************/
#define DEG2RAD(x)
Definition GeomHelper.h:35
#define GRAVITY
Definition GeomHelper.h:37
#define ACCEL2SPEED(x)
Definition SUMOTime.h:51
T MIN2(T a, T b)
Definition StdDefs.h:76
T MAX2(T a, T b)
Definition StdDefs.h:82
Krauss car-following model, with acceleration decrease and faster start.
Krauss car-following model, changing accel and speed by slope.
MSCFModel_KraussPS(const MSVehicleType *vtype)
Constructor.
~MSCFModel_KraussPS()
Destructor.
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
The car-following model abstraction.
Definition MSCFModel.h:55
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition MSCFModel.h:256
const MSVehicleType * myType
The type to which this model definition belongs to.
Definition MSCFModel.h:695
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition MSCFModel.h:264
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
double getSlope() const
Returns the slope of the road at vehicle's position in degrees.
The car-following model and parameter.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].