SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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.sourceforge.net/
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
// ===========================================================================
44
MSCFModel_KraussPS::MSCFModel_KraussPS
(
const
MSVehicleType
* vtype,
SUMOReal
accel,
SUMOReal
decel,
45
SUMOReal
dawdle,
SUMOReal
headwayTime)
46
:
MSCFModel_Krauss
(vtype, accel, decel, dawdle, headwayTime) {
47
}
48
49
50
MSCFModel_KraussPS::~MSCFModel_KraussPS
() {}
51
52
53
54
SUMOReal
55
MSCFModel_KraussPS::maxNextSpeed
(
SUMOReal
speed,
const
MSVehicle
*
const
veh)
const
{
56
const
SUMOReal
gravity = 9.80665;
57
const
MSLane
*
const
lane = veh->
getLane
();
58
const
SUMOReal
gp = lane->
interpolateLanePosToGeometryPos
(veh->
getPositionOnLane
());
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
*
69
MSCFModel_KraussPS::duplicate
(
const
MSVehicleType
* vtype)
const
{
70
return
new
MSCFModel_KraussPS
(vtype,
myAccel
,
myDecel
,
myDawdle
,
myHeadwayTime
);
71
}
72
73
74
//void MSCFModel::saveState(std::ostream &os) {}
75
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
microsim
cfmodels
MSCFModel_KraussPS.cpp
Generated on Sun Jun 16 2013 07:07:29 for SUMO - Simulation of Urban MObility by
1.8.1.2