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
/****************************************************************************/
10
// A detector of vehicles passing an area between entry/exit points
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13
// Copyright (C) 2003-2014 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 MSE3Collector_h
24
#define MSE3Collector_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 <string>
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
oldPos,
SUMOReal
newPos,
SUMOReal
);
167
177
bool
notifyLeave
(
SUMOVehicle
& veh,
SUMOReal
lastPos,
MSMoveReminder::Notification
reason);
179
180
181
private
:
183
MSE3Collector
&
myCollector
;
184
186
SUMOReal
myPosition
;
187
188
private
:
190
MSE3LeaveReminder
(
const
MSE3LeaveReminder
&);
191
193
MSE3LeaveReminder
&
operator=
(
const
MSE3LeaveReminder
&);
194
195
};
196
197
208
MSE3Collector
(
const
std::string&
id
,
209
const
CrossSectionVector
& entries,
const
CrossSectionVector
& exits,
210
SUMOReal
haltingSpeedThreshold,
211
SUMOTime
haltingTimeThreshold);
212
213
215
virtual
~MSE3Collector
();
216
217
220
void
reset
();
221
222
230
void
enter
(
SUMOVehicle
& veh,
SUMOReal
entryTimestep);
231
232
240
void
leave
(
SUMOVehicle
& veh,
SUMOReal
leaveTimestep);
241
242
245
252
SUMOReal
getCurrentMeanSpeed
()
const
;
253
254
261
SUMOReal
getCurrentHaltingNumber
()
const
;
262
263
267
SUMOReal
getVehiclesWithin
()
const
;
268
269
274
std::vector<std::string>
getCurrentVehicleIDs
()
const
;
276
277
280
289
void
writeXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime);
290
291
300
void
writeXMLDetectorProlog
(
OutputDevice
& dev)
const
;
302
303
304
313
void
detectorUpdate
(
const
SUMOTime
step);
314
315
316
protected
:
318
CrossSectionVector
myEntries
;
319
321
CrossSectionVector
myExits
;
322
324
std::vector<MSE3EntryReminder*>
myEntryReminders
;
325
327
std::vector<MSE3LeaveReminder*>
myLeaveReminders
;
328
329
330
// @brief Time-threshold to determine if a vehicle is halting.
331
SUMOTime
myHaltingTimeThreshold
;
332
334
SUMOReal
myHaltingSpeedThreshold
;
335
344
struct
E3Values
{
346
SUMOReal
entryTime
;
348
SUMOReal
leaveTime
;
350
SUMOReal
speedSum
;
352
unsigned
haltings
;
354
SUMOReal
haltingBegin
;
356
SUMOReal
intervalSpeedSum
;
358
unsigned
intervalHaltings
;
360
bool
hadUpdate
;
361
};
362
364
std::map<SUMOVehicle*, E3Values>
myEnteredContainer
;
365
367
std::map<SUMOVehicle*, E3Values>
myLeftContainer
;
368
369
372
374
SUMOReal
myCurrentMeanSpeed
;
375
377
SUMOReal
myCurrentHaltingsNumber
;
378
384
SUMOReal
myCurrentTouchedVehicles
;
386
387
389
SUMOTime
myLastResetTime
;
390
391
392
private
:
394
MSE3Collector
(
const
MSE3Collector
&);
395
397
MSE3Collector
&
operator=
(
const
MSE3Collector
&);
398
399
400
};
401
402
403
#endif
404
405
/****************************************************************************/
406
tmp
buildd
sumo-0.21.0+dfsg
src
microsim
output
MSE3Collector.h
Generated on Thu Nov 20 2014 19:49:55 for SUMO - Simulation of Urban MObility by
1.8.1.2