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
MSE2Collector.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// An areal (along a single lane) detector
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13
// Copyright (C) 2001-2013 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 MSE2Collector_h
24
#define MSE2Collector_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 <vector>
37
#include <list>
38
#include <
microsim/MSLane.h
>
39
#include <
microsim/MSMoveReminder.h
>
40
#include <
microsim/output/MSDetectorFileOutput.h
>
41
#include <
utils/common/UtilExceptions.h
>
42
#include <
utils/common/SUMOVehicle.h
>
43
44
45
// ===========================================================================
46
// class declarations
47
// ===========================================================================
48
class
OutputDevice
;
49
50
51
// ===========================================================================
52
// class definitions
53
// ===========================================================================
77
class
MSE2Collector
:
public
MSMoveReminder
,
public
MSDetectorFileOutput
{
78
public
:
91
MSE2Collector
(
const
std::string&
id
,
DetectorUsage
usage,
92
MSLane
*
const
lane,
SUMOReal
startPos,
SUMOReal
detLength,
93
SUMOTime
haltingTimeThreshold,
SUMOReal
haltingSpeedThreshold,
94
SUMOReal
jamDistThreshold);
95
96
98
virtual
~MSE2Collector
();
99
100
106
virtual
DetectorUsage
getUsageType
()
const
{
107
return
myUsage
;
108
}
109
110
111
114
130
bool
notifyMove
(
SUMOVehicle
& veh,
SUMOReal
oldPos,
SUMOReal
newPos,
131
SUMOReal
newSpeed);
132
133
145
bool
notifyLeave
(
SUMOVehicle
& veh,
SUMOReal
lastPos,
MSMoveReminder::Notification
reason);
146
147
160
bool
notifyEnter
(
SUMOVehicle
& veh,
MSMoveReminder::Notification
reason);
162
163
164
173
void
detectorUpdate
(
const
SUMOTime
step);
174
175
176
179
188
void
writeXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime);
189
190
197
void
writeXMLDetectorProlog
(
OutputDevice
& dev)
const
;
199
200
205
SUMOReal
getStartPos
()
const
{
206
return
myStartPos
;
207
}
208
209
214
SUMOReal
getEndPos
()
const
{
215
return
myEndPos
;
216
}
217
218
225
void
reset
();
226
227
230
232
unsigned
getCurrentVehicleNumber
()
const
;
233
235
SUMOReal
getCurrentOccupancy
()
const
;
236
238
SUMOReal
getCurrentMeanSpeed
()
const
;
239
241
SUMOReal
getCurrentMeanLength
()
const
;
242
244
unsigned
getCurrentJamNumber
()
const
;
245
247
unsigned
getCurrentMaxJamLengthInVehicles
()
const
;
248
250
SUMOReal
getCurrentMaxJamLengthInMeters
()
const
;
251
253
unsigned
getCurrentJamLengthInVehicles
()
const
;
254
256
SUMOReal
getCurrentJamLengthInMeters
()
const
;
257
259
unsigned
getCurrentStartedHalts
()
const
;
261
262
263
protected
:
269
struct
JamInfo
{
271
std::list<SUMOVehicle*>::const_iterator
firstStandingVehicle
;
272
274
std::list<SUMOVehicle*>::const_iterator
lastStandingVehicle
;
275
};
276
277
288
class
by_vehicle_position_sorter
{
289
public
:
294
by_vehicle_position_sorter
(
const
MSLane
*
const
lane)
295
:
myLane
(lane) { }
296
297
302
by_vehicle_position_sorter
(
const
by_vehicle_position_sorter
& s)
303
:
myLane
(s.
myLane
) { }
304
305
312
int
operator()
(
const
SUMOVehicle
* v1,
const
SUMOVehicle
* v2);
313
314
private
:
315
by_vehicle_position_sorter
&
operator=
(
const
by_vehicle_position_sorter
&);
// just to avoid a compiler warning
316
private
:
318
const
MSLane
*
const
myLane
;
319
};
320
321
322
private
:
325
327
SUMOReal
myJamHaltingSpeedThreshold
;
329
SUMOTime
myJamHaltingTimeThreshold
;
331
SUMOReal
myJamDistanceThreshold
;
333
SUMOReal
myStartPos
;
335
SUMOReal
myEndPos
;
337
339
DetectorUsage
myUsage
;
340
342
std::list<SUMOVehicle*>
myKnownVehicles
;
343
345
std::map<SUMOVehicle*, SUMOTime>
myHaltingVehicleDurations
;
346
348
std::map<SUMOVehicle*, SUMOTime>
myIntervalHaltingVehicleDurations
;
349
351
std::vector<SUMOTime>
myPastStandingDurations
;
352
354
std::vector<SUMOTime>
myPastIntervalStandingDurations
;
355
356
359
361
SUMOReal
mySpeedSum
;
363
SUMOReal
myStartedHalts
;
365
SUMOReal
myJamLengthInMetersSum
;
367
unsigned
myJamLengthInVehiclesSum
;
369
unsigned
myVehicleSamples
;
371
unsigned
myTimeSamples
;
373
SUMOReal
myOccupancySum
;
375
SUMOReal
myMaxOccupancy
;
377
unsigned
myMeanMaxJamInVehicles
;
379
SUMOReal
myMeanMaxJamInMeters
;
381
unsigned
myMaxJamInVehicles
;
383
SUMOReal
myMaxJamInMeters
;
385
unsigned
myMeanVehicleNumber
;
387
unsigned
myMaxVehicleNumber
;
389
390
393
395
SUMOReal
myCurrentOccupancy
;
397
SUMOReal
myCurrentMeanSpeed
;
399
SUMOReal
myCurrentMeanLength
;
401
unsigned
myCurrentJamNo
;
403
SUMOReal
myCurrentMaxJamLengthInMeters
;
405
unsigned
myCurrentMaxJamLengthInVehicles
;
407
SUMOReal
myCurrentJamLengthInMeters
;
409
unsigned
myCurrentJamLengthInVehicles
;
411
unsigned
myCurrentStartedHalts
;
413
414
415
private
:
417
MSE2Collector
(
const
MSE2Collector
&);
418
420
MSE2Collector
&
operator=
(
const
MSE2Collector
&);
421
422
423
};
424
425
426
#endif
427
428
/****************************************************************************/
429
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
microsim
output
MSE2Collector.h
Generated on Sun Jun 16 2013 07:07:31 for SUMO - Simulation of Urban MObility by
1.8.1.2