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
MSInductLoop.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// An unextended detector measuring at a fixed position on a fixed lane.
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 MSInductLoop_h
24
#define MSInductLoop_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 <deque>
38
#include <map>
39
#include <functional>
40
#include <
microsim/MSMoveReminder.h
>
41
#include <
microsim/output/MSDetectorFileOutput.h
>
42
43
44
// ===========================================================================
45
// class declarations
46
// ===========================================================================
47
class
MSLane
;
48
class
MSVehicle
;
49
class
OutputDevice
;
50
51
52
// ===========================================================================
53
// class definitions
54
// ===========================================================================
70
class
MSInductLoop
71
:
public
MSMoveReminder
,
public
MSDetectorFileOutput
{
72
public
:
83
MSInductLoop
(
const
std::string&
id
,
MSLane
*
const
lane,
84
SUMOReal
positionInMeters,
bool
splitByType);
85
86
88
~MSInductLoop
();
89
90
93
virtual
void
reset
();
94
95
99
SUMOReal
getPosition
()
const
{
100
return
myPosition
;
101
}
102
103
106
123
bool
notifyMove
(
SUMOVehicle
& veh,
SUMOReal
oldPos,
SUMOReal
newPos,
SUMOReal
newSpeed);
124
125
140
bool
notifyLeave
(
SUMOVehicle
& veh,
SUMOReal
lastPos,
MSMoveReminder::Notification
reason);
141
142
156
bool
notifyEnter
(
SUMOVehicle
& veh,
MSMoveReminder::Notification
reason);
158
159
160
163
171
SUMOReal
getCurrentSpeed
()
const
;
172
173
181
SUMOReal
getCurrentLength
()
const
;
182
183
193
SUMOReal
getCurrentOccupancy
()
const
;
194
195
205
unsigned
int
getCurrentPassedNumber
()
const
;
206
207
213
std::vector<std::string>
getCurrentVehicleIDs
()
const
;
214
215
220
SUMOReal
getTimestepsSinceLastDetection
()
const
;
222
223
224
227
236
void
writeXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime);
237
238
245
void
writeXMLDetectorProlog
(
OutputDevice
& dev)
const
;
247
248
249
256
struct
VehicleData
{
265
VehicleData
(
const
std::string&
id
,
SUMOReal
vehLength,
SUMOReal
entryTimestep,
SUMOReal
leaveTimestep,
266
const
std::string& typeID)
267
:
idM
(id),
lengthM
(vehLength),
entryTimeM
(entryTimestep),
leaveTimeM
(leaveTimestep),
268
speedM
(
lengthM
/ ((
leaveTimeM
-
entryTimeM
))),
typeIDM
(typeID) {}
269
271
std::string
idM
;
273
SUMOReal
lengthM
;
275
SUMOReal
entryTimeM
;
277
SUMOReal
leaveTimeM
;
279
SUMOReal
speedM
;
281
std::string
typeIDM
;
282
};
283
284
290
virtual
std::vector<VehicleData>
collectVehiclesOnDet
(
SUMOTime
t)
const
;
291
292
293
protected
:
296
301
virtual
void
enterDetectorByMove
(
SUMOVehicle
& veh,
SUMOReal
entryTimestep);
302
303
312
virtual
void
leaveDetectorByMove
(
SUMOVehicle
& veh,
SUMOReal
leaveTimestep);
313
314
318
virtual
void
leaveDetectorByLaneChange
(
SUMOVehicle
& veh);
320
321
322
protected
:
325
327
static
inline
SUMOReal
speedSum
(
SUMOReal
sumSoFar,
const
MSInductLoop::VehicleData
& data) {
328
return
sumSoFar + data.
speedM
;
329
}
330
332
static
inline
SUMOReal
lengthSum
(
SUMOReal
sumSoFar,
const
MSInductLoop::VehicleData
& data) {
333
return
sumSoFar + data.
lengthM
;
334
}
336
337
338
protected
:
340
const
SUMOReal
myPosition
;
341
343
bool
mySplitByType
;
344
346
SUMOReal
myLastLeaveTime
;
347
349
SUMOReal
myLastOccupancy
;
350
352
unsigned
myDismissedVehicleNumber
;
353
354
356
typedef
std::deque< VehicleData >
VehicleDataCont
;
357
359
VehicleDataCont
myVehicleDataCont
;
360
362
VehicleDataCont
myLastVehicleDataCont
;
363
364
366
typedef
std::map< SUMOVehicle*, SUMOReal >
VehicleMap
;
367
369
VehicleMap
myVehiclesOnDet
;
370
371
void
writeTypedXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime,
372
const
std::string& type,
const
VehicleDataCont
& vdc,
const
VehicleMap
& vm);
373
374
private
:
376
MSInductLoop
(
const
MSInductLoop
&);
377
379
MSInductLoop
&
operator=
(
const
MSInductLoop
&);
380
381
382
};
383
384
385
#endif
386
387
/****************************************************************************/
388
build
buildd
sumo-0.16.0~dfsg
src
microsim
output
MSInductLoop.h
Generated on Tue Apr 16 2013 01:32:17 for SUMO - Simulation of Urban MObility by
1.8.3.1