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-2012 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 <cassert>
37
#include <vector>
38
#include <limits>
39
#include <
microsim/MSMoveReminder.h
>
40
#include <
microsim/output/MSDetectorFileOutput.h
>
41
#include <
utils/common/Named.h
>
42
#include <
microsim/output/MSCrossSection.h
>
43
#include <
utils/common/UtilExceptions.h
>
44
45
46
// ===========================================================================
47
// class declarations
48
// ===========================================================================
49
class
SUMOVehicle
;
50
class
OutputDevice
;
51
52
53
// ===========================================================================
54
// class definitions
55
// ===========================================================================
65
class
MSE3Collector
:
public
MSDetectorFileOutput
{
66
public
:
71
class
MSE3EntryReminder
:
public
MSMoveReminder
{
72
public
:
78
MSE3EntryReminder
(
const
MSCrossSection
& crossSection,
MSE3Collector
& collector) ;
79
80
83
99
bool
notifyMove
(
SUMOVehicle
& veh,
SUMOReal
,
SUMOReal
newPos,
SUMOReal
) ;
100
101
112
bool
notifyLeave
(
SUMOVehicle
& veh,
SUMOReal
lastPos,
MSMoveReminder::Notification
reason) ;
114
115
116
private
:
118
MSE3Collector
&
myCollector
;
119
121
SUMOReal
myPosition
;
122
123
private
:
125
MSE3EntryReminder
(
const
MSE3EntryReminder
&);
126
128
MSE3EntryReminder
&
operator=
(
const
MSE3EntryReminder
&);
129
130
};
131
132
133
138
class
MSE3LeaveReminder
:
public
MSMoveReminder
{
139
public
:
145
MSE3LeaveReminder
(
const
MSCrossSection
& crossSection,
MSE3Collector
& collector) ;
146
147
149
150
166
bool
notifyMove
(
SUMOVehicle
& veh,
SUMOReal
,
SUMOReal
newPos,
SUMOReal
) ;
168
169
170
private
:
172
MSE3Collector
&
myCollector
;
173
175
SUMOReal
myPosition
;
176
177
private
:
179
MSE3LeaveReminder
(
const
MSE3LeaveReminder
&);
180
182
MSE3LeaveReminder
&
operator=
(
const
MSE3LeaveReminder
&);
183
184
};
185
186
197
MSE3Collector
(
const
std::string&
id
,
198
const
CrossSectionVector
& entries,
const
CrossSectionVector
& exits,
199
SUMOReal
haltingSpeedThreshold,
200
SUMOTime
haltingTimeThreshold) ;
201
202
204
virtual
~MSE3Collector
() ;
205
206
209
void
reset
() ;
210
211
219
void
enter
(
SUMOVehicle
& veh,
SUMOReal
entryTimestep) ;
220
221
229
void
leave
(
SUMOVehicle
& veh,
SUMOReal
leaveTimestep) ;
230
231
234
241
SUMOReal
getCurrentMeanSpeed
()
const
;
242
243
250
SUMOReal
getCurrentHaltingNumber
()
const
;
251
252
256
SUMOReal
getVehiclesWithin
()
const
;
257
258
263
std::vector<std::string>
getCurrentVehicleIDs
()
const
;
265
266
269
278
void
writeXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime);
279
280
289
void
writeXMLDetectorProlog
(
OutputDevice
& dev)
const
;
291
292
293
302
void
detectorUpdate
(
const
SUMOTime
step) ;
303
304
305
protected
:
307
CrossSectionVector
myEntries
;
308
310
CrossSectionVector
myExits
;
311
313
std::vector<MSE3EntryReminder*>
myEntryReminders
;
314
316
std::vector<MSE3LeaveReminder*>
myLeaveReminders
;
317
318
319
// @brief Time-threshold to determine if a vehicle is halting.
320
SUMOTime
myHaltingTimeThreshold
;
321
323
SUMOReal
myHaltingSpeedThreshold
;
324
333
struct
E3Values
{
335
SUMOReal
entryTime
;
337
SUMOReal
leaveTime
;
339
SUMOReal
speedSum
;
341
unsigned
haltings
;
343
SUMOReal
haltingBegin
;
345
SUMOReal
intervalSpeedSum
;
347
unsigned
intervalHaltings
;
349
bool
hadUpdate
;
350
};
351
353
std::map<SUMOVehicle*, E3Values>
myEnteredContainer
;
354
356
std::map<SUMOVehicle*, E3Values>
myLeftContainer
;
357
358
361
363
SUMOReal
myCurrentMeanSpeed
;
364
366
SUMOReal
myCurrentHaltingsNumber
;
367
373
SUMOReal
myCurrentTouchedVehicles
;
375
376
378
SUMOTime
myLastResetTime
;
379
380
381
private
:
383
MSE3Collector
(
const
MSE3Collector
&);
384
386
MSE3Collector
&
operator=
(
const
MSE3Collector
&);
387
388
389
};
390
391
392
#endif
393
394
/****************************************************************************/
395
build
buildd
sumo-0.15.0~dfsg
src
microsim
output
MSE3Collector.h
Generated on Wed Jul 18 2012 22:58:32 for SUMO - Simulation of Urban MObility by
1.8.1.1