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-sim.org/
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 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
144
145
146
149
157
SUMOReal
getCurrentSpeed
()
const
;
158
159
167
SUMOReal
getCurrentLength
()
const
;
168
169
179
SUMOReal
getCurrentOccupancy
()
const
;
180
181
191
unsigned
int
getCurrentPassedNumber
()
const
;
192
193
199
std::vector<std::string>
getCurrentVehicleIDs
()
const
;
200
201
206
SUMOReal
getTimestepsSinceLastDetection
()
const
;
208
209
210
213
222
void
writeXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime);
223
224
231
void
writeXMLDetectorProlog
(
OutputDevice
& dev)
const
;
233
234
235
242
struct
VehicleData
{
251
VehicleData
(
const
std::string&
id
,
SUMOReal
vehLength,
SUMOReal
entryTimestep,
SUMOReal
leaveTimestep,
252
const
std::string& typeID)
253
:
idM
(id),
lengthM
(vehLength),
entryTimeM
(entryTimestep),
leaveTimeM
(leaveTimestep),
254
speedM
(
lengthM
/ ((
leaveTimeM
-
entryTimeM
))),
typeIDM
(typeID) {}
255
257
std::string
idM
;
259
SUMOReal
lengthM
;
261
SUMOReal
entryTimeM
;
263
SUMOReal
leaveTimeM
;
265
SUMOReal
speedM
;
267
std::string
typeIDM
;
268
};
269
270
276
virtual
std::vector<VehicleData>
collectVehiclesOnDet
(
SUMOTime
t)
const
;
277
278
279
protected
:
282
287
virtual
void
enterDetectorByMove
(
SUMOVehicle
& veh,
SUMOReal
entryTimestep);
288
289
298
virtual
void
leaveDetectorByMove
(
SUMOVehicle
& veh,
SUMOReal
leaveTimestep);
299
300
305
virtual
void
leaveDetectorByLaneChange
(
SUMOVehicle
& veh,
SUMOReal
lastPos);
307
308
309
protected
:
312
314
static
inline
SUMOReal
speedSum
(
SUMOReal
sumSoFar,
const
MSInductLoop::VehicleData
& data) {
315
return
sumSoFar + data.
speedM
;
316
}
317
319
static
inline
SUMOReal
lengthSum
(
SUMOReal
sumSoFar,
const
MSInductLoop::VehicleData
& data) {
320
return
sumSoFar + data.
lengthM
;
321
}
323
324
325
protected
:
327
const
SUMOReal
myPosition
;
328
330
bool
mySplitByType
;
331
333
SUMOReal
myLastLeaveTime
;
334
336
SUMOReal
myLastOccupancy
;
337
339
unsigned
myDismissedVehicleNumber
;
340
341
343
typedef
std::deque< VehicleData >
VehicleDataCont
;
344
346
VehicleDataCont
myVehicleDataCont
;
347
349
VehicleDataCont
myLastVehicleDataCont
;
350
351
353
typedef
std::map< SUMOVehicle*, SUMOReal >
VehicleMap
;
354
356
VehicleMap
myVehiclesOnDet
;
357
358
void
writeTypedXMLOutput
(
OutputDevice
& dev,
SUMOTime
startTime,
SUMOTime
stopTime,
359
const
std::string& type,
const
VehicleDataCont
& vdc,
const
VehicleMap
& vm);
360
361
private
:
363
MSInductLoop
(
const
MSInductLoop
&);
364
366
MSInductLoop
&
operator=
(
const
MSInductLoop
&);
367
368
369
};
370
371
372
#endif
373
374
/****************************************************************************/
375
home
delphi
sumo
src
microsim
output
MSInductLoop.h
Generated by
1.8.2