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
NBLoadedTLDef.h
Go to the documentation of this file.
1
/****************************************************************************/
8
// A loaded (complete) traffic light logic
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
#ifndef NBLoadedTLDef_h
22
#define NBLoadedTLDef_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include <vector>
35
#include <string>
36
#include <set>
37
#include "
NBTrafficLightDefinition.h
"
38
#include "
NBNode.h
"
39
#include <
utils/common/SUMOTime.h
>
40
41
42
// ===========================================================================
43
// class definitions
44
// ===========================================================================
49
class
NBLoadedTLDef
:
public
NBTrafficLightDefinition
{
50
public
:
54
class
SignalGroup
:
public
Named
{
55
public
:
59
SignalGroup
(
const
std::string&
id
) ;
60
62
~SignalGroup
() ;
63
67
void
addConnection
(
const
NBConnection
& c) ;
68
73
void
addPhaseBegin
(
SUMOTime
time,
TLColor
color) ;
74
79
void
setYellowTimes
(
SUMOTime
tRedYellowe,
SUMOTime
tYellow) ;
80
85
std::vector<SUMOReal>
getTimes
(
SUMOTime
cycleDuration)
const
;
86
88
void
sortPhases
() ;
89
93
unsigned
int
getLinkNo
()
const
;
94
99
bool
mayDrive
(
SUMOTime
time)
const
;
100
105
bool
hasYellow
(
SUMOTime
time)
const
;
106
112
bool
containsConnection
(
NBEdge
* from,
NBEdge
* to)
const
;
113
118
bool
containsIncoming
(
NBEdge
* from)
const
;
119
124
void
remapIncoming
(
NBEdge
* which,
const
EdgeVector
& by) ;
125
130
bool
containsOutgoing
(
NBEdge
* to)
const
;
131
136
void
remapOutgoing
(
NBEdge
* which,
const
EdgeVector
& by) ;
137
142
const
NBConnection
&
getConnection
(
unsigned
int
pos)
const
;
143
147
void
patchTYellow
(
SUMOTime
tyellow) ;
148
155
void
remap
(
NBEdge
* removed,
int
removedLane,
NBEdge
* by,
int
byLane) ;
156
160
class
PhaseDef
{
161
public
:
166
PhaseDef
(
SUMOTime
time,
TLColor
color)
167
:
myTime
(time),
myColor
(color) { }
168
170
SUMOTime
myTime
;
172
TLColor
myColor
;
173
};
174
178
class
phase_by_time_sorter
{
179
public
:
181
explicit
phase_by_time_sorter
() { }
182
187
int
operator()
(
const
PhaseDef
& p1,
const
PhaseDef
& p2) {
188
return
p1.
myTime
< p2.
myTime
;
189
}
190
};
191
192
private
:
194
NBConnectionVector
myConnections
;
196
std::vector<PhaseDef>
myPhases
;
198
SUMOTime
myTRedYellow
,
myTYellow
;
199
};
200
201
202
204
typedef
std::map<std::string, SignalGroup*>
SignalGroupCont
;
205
206
211
NBLoadedTLDef
(
const
std::string&
id
,
212
const
std::vector<NBNode*> &junctions) ;
213
214
219
NBLoadedTLDef
(
const
std::string&
id
,
NBNode
* junction) ;
220
221
225
NBLoadedTLDef
(
const
std::string&
id
) ;
226
227
229
~NBLoadedTLDef
() ;
230
231
237
SignalGroup
*
findGroup
(
NBEdge
* from,
NBEdge
* to)
const
;
238
239
243
void
setCycleDuration
(
unsigned
int
cycleDur) ;
244
245
249
void
addSignalGroup
(
const
std::string&
id
) ;
250
251
256
bool
addToSignalGroup
(
const
std::string& groupid,
257
const
NBConnection
& connection) ;
258
259
264
bool
addToSignalGroup
(
const
std::string& groupid,
265
const
NBConnectionVector
& connections) ;
266
267
273
void
addSignalGroupPhaseBegin
(
const
std::string& groupid,
274
SUMOTime
time,
TLColor
color) ;
275
276
282
void
setSignalYellowTimes
(
const
std::string& groupid,
283
SUMOTime
tRedYellow,
SUMOTime
tYellow) ;
284
285
288
293
void
setTLControllingInformation
(
const
NBEdgeCont
& ec)
const
;
294
295
302
void
remapRemoved
(
NBEdge
* removed,
303
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing) ;
305
306
307
protected
:
310
317
NBTrafficLightLogic
*
myCompute
(
const
NBEdgeCont
& ec,
318
unsigned
int
brakingTime) ;
319
320
324
void
collectNodes
() ;
325
326
331
void
collectLinks
() ;
332
333
341
bool
mustBrake
(
const
NBEdgeCont
& ec,
342
const
NBConnection
& possProhibited,
343
const
std::string& state,
344
unsigned
int
strmpos)
const
;
345
346
354
void
replaceRemoved
(
NBEdge
* removed,
int
removedLane,
355
NBEdge
* by,
int
byLane) ;
357
358
private
:
364
std::string
buildPhaseState
(
const
NBEdgeCont
& ec,
unsigned
int
time)
const
;
365
366
367
private
:
369
SignalGroupCont
mySignalGroups
;
370
372
unsigned
int
myCycleDuration
;
373
374
375
};
376
377
378
#endif
379
380
/****************************************************************************/
381
var
build
temp
tmp.znCyBrHNjL
4.0-0-0
sumo
sumo-0.15.0~dfsg
src
netbuild
NBLoadedTLDef.h
Generated on Mon Mar 24 2014 09:53:12 for SUMO - Simulation of Urban MObility by
1.8.1.2