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_SmartSK.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// A smarter SK
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12
// Copyright (C) 2012-2014 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
#ifndef MSCFModel_SmartSK_h
23
#define MSCFModel_SmartSK_h
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include "
MSCFModel.h
"
35
#include <
utils/xml/SUMOXMLDefinitions.h
>
36
37
38
// ===========================================================================
39
// class definitions
40
// ===========================================================================
45
class
MSCFModel_SmartSK
:
public
MSCFModel
{
46
public
:
53
MSCFModel_SmartSK
(
const
MSVehicleType
* vtype,
SUMOReal
accel,
SUMOReal
decel,
SUMOReal
dawdle
,
SUMOReal
headwayTime,
54
SUMOReal
tmp1,
SUMOReal
tmp2,
SUMOReal
tmp3,
SUMOReal
tmp4,
SUMOReal
tmp5);
55
56
58
~MSCFModel_SmartSK
();
59
60
63
69
SUMOReal
moveHelper
(
MSVehicle
*
const
veh,
SUMOReal
vPos)
const
;
70
71
80
virtual
SUMOReal
followSpeed
(
const
MSVehicle
*
const
veh,
SUMOReal
speed,
SUMOReal
gap2pred,
SUMOReal
predSpeed,
SUMOReal
predMaxDecel)
const
;
81
82
90
virtual
SUMOReal
stopSpeed
(
const
MSVehicle
*
const
veh,
const
SUMOReal
speed,
SUMOReal
gap2pred)
const
;
91
92
97
virtual
int
getModelID
()
const
{
98
return
SUMO_TAG_CF_SMART_SK
;
99
}
100
101
105
SUMOReal
getImperfection
()
const
{
106
return
myDawdle
;
107
}
109
110
111
114
117
void
setMaxDecel
(
SUMOReal
decel) {
118
myDecel
= decel;
119
myTauDecel
=
myDecel
*
myHeadwayTime
;
120
}
121
122
126
void
setImperfection
(
SUMOReal
imperfection) {
127
myDawdle
= imperfection;
128
}
129
130
134
void
setHeadwayTime
(
SUMOReal
headwayTime) {
135
myHeadwayTime
= headwayTime;
136
myTauDecel
=
myDecel
* headwayTime;
137
}
139
140
145
virtual
MSCFModel
*
duplicate
(
const
MSVehicleType
* vtype)
const
;
146
147
private
:
153
virtual
SUMOReal
_vsafe
(
const
MSVehicle
*
const
veh,
SUMOReal
gap,
SUMOReal
predSpeed)
const
;
154
155
160
virtual
SUMOReal
dawdle
(
SUMOReal
speed)
const
;
161
162
virtual
void
updateMyHeadway
(
const
MSVehicle
*
const
veh)
const
{
163
// this is the point were the preferred headway changes slowly:
164
SSKVehicleVariables
* vars = (
SSKVehicleVariables
*)veh->
getCarFollowVariables
();
165
SUMOReal
tTau = vars->
myHeadway
;
166
tTau = tTau + (
myHeadwayTime
- tTau) *
myTmp2
+
myTmp3
* tTau *
RandHelper::rand
(
SUMOReal
(-1.0),
SUMOReal
(1.0));
167
if
(tTau <
TS
) {
// this ensures the SK safety condition
168
tTau =
TS
;
169
}
170
vars->
myHeadway
= tTau;
171
}
172
173
virtual
MSCFModel::VehicleVariables
*
createVehicleVariables
()
const
{
174
SSKVehicleVariables
* ret =
new
SSKVehicleVariables
();
175
ret->
gOld
= 0.0;
176
ret->
myHeadway
=
myHeadwayTime
;
177
return
ret;
178
}
179
180
#include <map>
181
182
private
:
183
class
SSKVehicleVariables
:
public
MSCFModel::VehicleVariables
{
184
public
:
185
SUMOReal
gOld
,
myHeadway
;
186
std::map<int, SUMOReal>
ggOld
;
187
};
188
189
protected
:
191
SUMOReal
myDawdle
;
192
194
SUMOReal
myTauDecel
;
195
197
SUMOReal
myTmp1
,
myTmp2
,
myTmp3
,
myTmp4
,
myTmp5
;
198
202
SUMOReal
myS2Sspeed
,
maxDeltaGap
;
203
204
};
205
206
#endif
/* MSCFModel_SmartSK_H */
207
tmp
buildd
sumo-0.21.0+dfsg
src
microsim
cfmodels
MSCFModel_SmartSK.h
Generated on Thu Nov 20 2014 19:49:54 for SUMO - Simulation of Urban MObility by
1.8.1.2