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
MSVehicleType.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// The car-following model and parameter
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
14
/****************************************************************************/
15
//
16
// This file is part of SUMO.
17
// SUMO is free software: you can redistribute it and/or modify
18
// it under the terms of the GNU General Public License as published by
19
// the Free Software Foundation, either version 3 of the License, or
20
// (at your option) any later version.
21
//
22
/****************************************************************************/
23
#ifndef MSVehicleType_h
24
#define MSVehicleType_h
25
26
27
// ===========================================================================
28
// included modules
29
// ===========================================================================
30
#ifdef _MSC_VER
31
#include <
windows_config.h
>
32
#else
33
#include <
config.h
>
34
#endif
35
36
#include <cassert>
37
#include <map>
38
#include <string>
39
#include "
MSCFModel.h
"
40
#include <
utils/common/SUMOTime.h
>
41
#include <
utils/common/StdDefs.h
>
42
#include <
utils/common/SUMOVehicleClass.h
>
43
#include <
utils/common/RandHelper.h
>
44
#include <
utils/common/SUMOVTypeParameter.h
>
45
#include <
utils/common/RGBColor.h
>
46
47
48
// ===========================================================================
49
// class declarations
50
// ===========================================================================
51
class
MSLane
;
52
class
BinaryInputDevice
;
53
class
MSCFModel
;
54
class
SUMOVTypeParameter
;
55
56
57
// ===========================================================================
58
// class definitions
59
// ===========================================================================
73
class
MSVehicleType
{
74
public
:
93
MSVehicleType
(
const
std::string&
id
,
const
SUMOReal
lengthWithGap,
94
const
SUMOReal
minGap,
const
SUMOReal
maxSpeed,
95
const
SUMOReal
prob,
const
SUMOReal
speedFactor,
96
const
SUMOReal
speedDev,
const
SUMOVehicleClass
vclass,
97
const
SUMOEmissionClass
emissionClass,
98
const
SUMOReal
width,
const
SUMOReal
height,
99
const
SUMOVehicleShape
shape,
const
std::string osgFile,
100
const
std::string& lcModel,
101
const
RGBColor
& c) ;
102
103
105
virtual
~MSVehicleType
() ;
106
107
108
111
115
const
std::string&
getID
()
const
{
116
return
myID
;
117
}
118
119
123
SUMOReal
getLength
()
const
{
124
return
myLength
;
125
}
126
127
131
SUMOReal
getLengthWithGap
()
const
{
132
return
myLength
+
myMinGap
;
133
}
134
135
139
SUMOReal
getMinGap
()
const
{
140
return
myMinGap
;
141
}
142
143
147
inline
const
MSCFModel
&
getCarFollowModel
()
const
{
148
return
*
myCarFollowModel
;
149
}
150
151
155
inline
MSCFModel
&
getCarFollowModel
() {
156
return
*
myCarFollowModel
;
157
}
158
159
163
SUMOReal
getMaxSpeed
()
const
{
164
return
myMaxSpeed
;
165
}
166
170
SUMOReal
hasSpeedDeviation
()
const
{
171
return
mySpeedDev
!= 0.0 ||
mySpeedFactor
!= 1.0;
172
}
173
174
181
SUMOReal
getMaxSpeedWithDeviation
(
SUMOReal
referenceSpeed)
const
{
182
SUMOReal
meanSpeed =
mySpeedFactor
* referenceSpeed;
183
SUMOReal
speedDev =
mySpeedDev
* meanSpeed;
184
SUMOReal
speed =
MIN3
(
RandHelper::randNorm
(meanSpeed, speedDev), meanSpeed + 2 * speedDev,
myMaxSpeed
);
185
return
MAX3
((
SUMOReal
)0.0, speed, meanSpeed - 2 * speedDev);
186
}
187
188
192
SUMOReal
getDefaultProbability
()
const
{
193
return
myDefaultProbability
;
194
}
195
196
201
SUMOVehicleClass
getVehicleClass
()
const
{
202
return
myVehicleClass
;
203
}
204
205
210
SUMOEmissionClass
getEmissionClass
()
const
{
211
return
myEmissionClass
;
212
}
213
214
218
const
RGBColor
&
getColor
()
const
{
219
return
myColor
;
220
}
221
222
226
SUMOReal
getSpeedFactor
()
const
{
227
return
mySpeedFactor
;
228
}
229
230
234
SUMOReal
getSpeedDeviation
()
const
{
235
return
mySpeedDev
;
236
}
238
239
240
243
247
SUMOReal
getWidth
()
const
{
248
return
myWidth
;
249
}
250
254
SUMOReal
getHeight
()
const
{
255
return
myHeight
;
256
}
257
262
SUMOVehicleShape
getGuiShape
()
const
{
263
return
myShape
;
264
}
265
269
std::string
getOSGFile
()
const
{
270
return
myOSGFile
;
271
}
272
274
275
276
277
278
280
void
saveState
(std::ostream& os);
281
282
283
286
294
void
setLength
(
const
SUMOReal
& length) ;
295
296
304
void
setMinGap
(
const
SUMOReal
& minGap) ;
305
306
314
void
setMaxSpeed
(
const
SUMOReal
& maxSpeed) ;
315
316
320
void
setVClass
(
SUMOVehicleClass
vclass) ;
321
322
330
void
setDefaultProbability
(
const
SUMOReal
& prob) ;
331
332
340
void
setSpeedFactor
(
const
SUMOReal
& factor) ;
341
342
350
void
setSpeedDeviation
(
const
SUMOReal
& dev) ;
351
352
356
void
setEmissionClass
(
SUMOEmissionClass
eclass) ;
357
358
362
void
setColor
(
const
RGBColor
& color) ;
363
364
372
void
setWidth
(
const
SUMOReal
& width) ;
373
374
378
void
setShape
(
SUMOVehicleShape
shape) ;
380
381
382
385
391
static
MSVehicleType
*
build
(
SUMOVTypeParameter
& from) ;
392
393
399
static
MSVehicleType
*
build
(
const
std::string&
id
,
const
MSVehicleType
* from) ;
401
402
406
bool
amVehicleSpecific
()
const
{
407
return
myOriginalType
!= 0;
408
}
409
410
411
private
:
413
std::string
myID
;
414
416
SUMOReal
myLength
;
417
419
SUMOReal
myMinGap
;
420
422
SUMOReal
myMaxSpeed
;
423
425
SUMOReal
myDefaultProbability
;
426
428
SUMOReal
mySpeedFactor
;
429
431
SUMOReal
mySpeedDev
;
432
434
MSCFModel
*
myCarFollowModel
;
435
437
std::string
myLaneChangeModel
;
438
440
SUMOEmissionClass
myEmissionClass
;
441
443
RGBColor
myColor
;
444
446
SUMOVehicleClass
myVehicleClass
;
447
448
451
453
SUMOReal
myWidth
;
454
456
SUMOReal
myHeight
;
457
459
SUMOVehicleShape
myShape
;
460
462
std::string
myOSGFile
;
464
465
467
const
MSVehicleType
*
myOriginalType
;
468
469
470
private
:
472
MSVehicleType
(
const
MSVehicleType
&);
473
475
MSVehicleType
&
operator=
(
const
MSVehicleType
&);
476
477
};
478
479
480
#endif
481
482
/****************************************************************************/
483
tmp
buildd
sumo-0.15.0~dfsg
src
microsim
MSVehicleType.h
Generated on Sun May 27 2012 14:52:07 for SUMO - Simulation of Urban MObility by
1.8.1