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
/****************************************************************************/
7
// A smarter SK
8
/****************************************************************************/
9
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11
/****************************************************************************/
12
//
13
// This file is part of SUMO.
14
// SUMO is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU General Public License as published by
16
// the Free Software Foundation, either version 3 of the License, or
17
// (at your option) any later version.
18
//
19
/****************************************************************************/
20
#ifndef MSCFModel_SmartSK_h
21
#define MSCFModel_SmartSK_h
22
23
// ===========================================================================
24
// included modules
25
// ===========================================================================
26
#ifdef _MSC_VER
27
#include <
windows_config.h
>
28
#else
29
#include <
config.h
>
30
#endif
31
32
#include <
microsim/MSCFModel.h
>
33
#include <
utils/xml/SUMOXMLDefinitions.h
>
34
35
36
// ===========================================================================
37
// class definitions
38
// ===========================================================================
43
class
MSCFModel_SmartSK
:
public
MSCFModel
{
44
public
:
51
MSCFModel_SmartSK
(
const
MSVehicleType
* vtype,
SUMOReal
accel,
SUMOReal
decel,
SUMOReal
dawdle
,
SUMOReal
headwayTime,
52
SUMOReal
tmp1,
SUMOReal
tmp2,
SUMOReal
tmp3,
SUMOReal
tmp4,
SUMOReal
tmp5);
53
54
56
~MSCFModel_SmartSK
();
57
58
61
67
SUMOReal
moveHelper
(
MSVehicle
*
const
veh,
SUMOReal
vPos)
const
;
68
69
78
virtual
SUMOReal
followSpeed
(
const
MSVehicle
*
const
veh,
SUMOReal
speed,
SUMOReal
gap2pred,
SUMOReal
predSpeed,
SUMOReal
predMaxDecel)
const
;
79
80
88
virtual
SUMOReal
stopSpeed
(
const
MSVehicle
*
const
veh,
SUMOReal
gap2pred)
const
;
89
90
95
virtual
int
getModelID
()
const
{
96
return
SUMO_TAG_CF_SMART_SK
;
97
}
98
99
103
SUMOReal
getImperfection
()
const
{
104
return
myDawdle
;
105
}
107
108
109
112
115
void
setMaxDecel
(
SUMOReal
decel) {
116
myDecel
= decel;
117
myTauDecel
=
myDecel
*
myHeadwayTime
;
118
}
119
120
124
void
setImperfection
(
SUMOReal
imperfection) {
125
myDawdle
= imperfection;
126
}
127
128
132
void
setHeadwayTime
(
SUMOReal
headwayTime) {
133
myHeadwayTime
= headwayTime;
134
myTauDecel
=
myDecel
* headwayTime;
135
}
137
138
143
virtual
MSCFModel
*
duplicate
(
const
MSVehicleType
* vtype)
const
;
144
145
private
:
151
virtual
SUMOReal
_vsafe
(
const
MSVehicle
*
const
veh,
SUMOReal
gap,
SUMOReal
predSpeed)
const
;
152
153
158
virtual
SUMOReal
dawdle
(
SUMOReal
speed)
const
;
159
160
virtual
void
updateMyHeadway
(
const
MSVehicle
*
const
veh)
const
{
161
// this is the point were the preferred headway changes slowly:
162
SSKVehicleVariables
* vars = (
SSKVehicleVariables
*)veh->
getCarFollowVariables
();
163
SUMOReal
tTau = vars->
myHeadway
;
164
tTau = tTau + (
myHeadwayTime
- tTau) *
myTmp2
+
myTmp3
* tTau *
RandHelper::rand
(
SUMOReal
(-1.0),
SUMOReal
(1.0));
165
if
(tTau <
TS
) {
// this ensures the SK safety condition
166
tTau =
TS
;
167
}
168
vars->
myHeadway
= tTau;
169
}
170
171
virtual
MSCFModel::VehicleVariables
*
createVehicleVariables
()
const
{
172
SSKVehicleVariables
* ret =
new
SSKVehicleVariables
();
173
ret->
gOld
= 0.0;
174
ret->
myHeadway
=
myHeadwayTime
;
175
return
ret;
176
}
177
178
#include <map>
179
180
private
:
181
class
SSKVehicleVariables
:
public
MSCFModel::VehicleVariables
{
182
public
:
183
SUMOReal
gOld
,
myHeadway
;
184
std::map<int, SUMOReal>
ggOld
;
185
};
186
187
protected
:
189
SUMOReal
myDawdle
;
190
192
SUMOReal
myTauDecel
;
193
195
SUMOReal
myTmp1
,
myTmp2
,
myTmp3
,
myTmp4
,
myTmp5
;
196
200
SUMOReal
myS2Sspeed
,
maxDeltaGap
;
201
202
};
203
204
#endif
/* MSCFModel_SmartSK_H */
205
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
microsim
cfmodels
MSCFModel_SmartSK.h
Generated on Sun Jun 16 2013 07:07:29 for SUMO - Simulation of Urban MObility by
1.8.1.2