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
MSE3Collector.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// A detector of vehicles passing an area between entry/exit points
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2013 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 MSE3Collector_h
23
#define MSE3Collector_h
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 <string>
36
#include <vector>
37
#include <limits>
38
#include <
microsim/MSMoveReminder.h
>
39
#include <
microsim/output/MSDetectorFileOutput.h
>
40
#include <
utils/common/Named.h
>
41
#include <
microsim/output/MSCrossSection.h
>
42
#include <
utils/common/UtilExceptions.h
>
43
44
45
// ===========================================================================
46
// class declarations
47
// ===========================================================================
48
class
SUMOVehicle
;
49
class
OutputDevice
;
50
51
52
// ===========================================================================
53
// class definitions
54
// ===========================================================================
64
class
MSE3Collector
:
public
MSDetectorFileOutput
{
65
public
:
70
class
MSE3EntryReminder
:
public
MSMoveReminder
{
71
public
:
77
MSE3EntryReminder
(
const
MSCrossSection
& crossSection,
MSE3Collector
& collector);
78
79
82
98
bool
notifyMove
(
SUMOVehicle
& veh,
SUMOReal
,
SUMOReal
newPos,
SUMOReal
);
99
100
111
bool
notifyLeave
(
SUMOVehicle
& veh,
SUMOReal
lastPos,
MSMoveReminder::Notification
reason);
113
114
115
private
:
117
MSE3Collector
&
myCollector
;
118
120
SUMOReal
myPosition
;
121
122
private
:
124
MSE3EntryReminder
(
const
MSE3EntryReminder
&);
125
127
MSE3EntryReminder
&
operator=
(
const
MSE3EntryReminder
&);
128
129
};
130
131
132
137
class
MSE3LeaveReminder
:
public
MSMoveReminder
{
138
public
:
144
MSE3LeaveReminder
(
const
MSCrossSection
& crossSection,
MSE3Collector
& collector);
145
146
148
149
165
bool
notifyMove
(
SUMOVehicle
& veh,
SUMOReal
,
SUMOReal
newPos,
SUMOReal
);
166
176
bool
notifyLeave
(
SUMOVehicle
& veh,
SUMOReal
lastPos,
MSMoveReminder::Notification
reason);
178
179
180
private
:
182
MSE3Collector
&
myCollector
;
183
185
SUMOReal
myPosition
;
186
187
private
:
189
MSE3LeaveReminder
(
const
MSE3LeaveReminder
&);
190
192
MSE3LeaveReminder
&
operator=
(
const
MSE3LeaveReminder
&);
193
194
};
195
196
207
MSE3Collector
(
const
std::string&
id
,
208
const
CrossSectionVector
& entries,
const
CrossSectionVector
& exits,
209
SUMOReal
haltingSpeedThreshold,
210
SUMOTime
haltingTimeThreshold);
211
212
214
virtual
~MSE3Collector
();
215
216
219
void
reset
();
220
221
229
void
enter
(
SUMOVehicle
& veh,
SUMOReal
entryTimestep);
230
231
239
void
leave
(
SUMOVehicle
& veh,
SUMOReal
leaveTimestep);
240
241
244
251
SUMOReal
getCurrentMeanSpeed
()
const
;
252
253
260
SUMOReal
getCurrentHaltingNumber
()
const
;
261
262
266
SUMOReal
getVehiclesWithin
()
const
;
267
268
273
std::vector<std::string>
getCurrentVehicleIDs
()
const
;
275
276
279
288
void
writeXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime);
289
290
299
void
writeXMLDetectorProlog
(
OutputDevice
& dev)
const
;
301
302
303
312
void
detectorUpdate
(
const
SUMOTime
step);
313
314
315
protected
:
317
CrossSectionVector
myEntries
;
318
320
CrossSectionVector
myExits
;
321
323
std::vector<MSE3EntryReminder*>
myEntryReminders
;
324
326
std::vector<MSE3LeaveReminder*>
myLeaveReminders
;
327
328
329
// @brief Time-threshold to determine if a vehicle is halting.
330
SUMOTime
myHaltingTimeThreshold
;
331
333
SUMOReal
myHaltingSpeedThreshold
;
334
343
struct
E3Values
{
345
SUMOReal
entryTime
;
347
SUMOReal
leaveTime
;
349
SUMOReal
speedSum
;
351
unsigned
haltings
;
353
SUMOReal
haltingBegin
;
355
SUMOReal
intervalSpeedSum
;
357
unsigned
intervalHaltings
;
359
bool
hadUpdate
;
360
};
361
363
std::map<SUMOVehicle*, E3Values>
myEnteredContainer
;
364
366
std::map<SUMOVehicle*, E3Values>
myLeftContainer
;
367
368
371
373
SUMOReal
myCurrentMeanSpeed
;
374
376
SUMOReal
myCurrentHaltingsNumber
;
377
383
SUMOReal
myCurrentTouchedVehicles
;
385
386
388
SUMOTime
myLastResetTime
;
389
390
391
private
:
393
MSE3Collector
(
const
MSE3Collector
&);
394
396
MSE3Collector
&
operator=
(
const
MSE3Collector
&);
397
398
399
};
400
401
402
#endif
403
404
/****************************************************************************/
405
build
buildd
sumo-0.17.1~dfsg
src
microsim
output
MSE3Collector.h
Generated on Sun Jun 16 2013 17:30:16 for SUMO - Simulation of Urban MObility by
1.8.3.1