SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBOwnTLDef.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A traffic light logics which must be computed (only nodes/edges are given)
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2013 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 NBOwnTLDef_h
23 #define NBOwnTLDef_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 <vector>
36 #include <set>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class NBNode;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
55 public:
62  NBOwnTLDef(const std::string& id,
63  const std::vector<NBNode*>& junctions,
64  SUMOTime offset,
65  TrafficLightType type);
66 
67 
74  NBOwnTLDef(const std::string& id, NBNode* junction, SUMOTime offset,
75  TrafficLightType type);
76 
77 
83  NBOwnTLDef(const std::string& id, SUMOTime offset, TrafficLightType type);
84 
85 
87  ~NBOwnTLDef();
88 
89 
94 
95 
98 
105  void remapRemoved(NBEdge* removed,
106  const EdgeVector& incoming, const EdgeVector& outgoing);
107 
108 
113  void setTLControllingInformation(const NBEdgeCont& ec) const;
115 
116 
119  void setSinglePhase() {
120  myHaveSinglePhase = true;
121  }
122 
123 protected:
126 
134  unsigned int brakingTimeSeconds);
135 
136 
140  void collectNodes();
141 
142 
147  void collectLinks();
148 
149 
157  void replaceRemoved(NBEdge* removed, int removedLane,
158  NBEdge* by, int byLane);
160 
161 
162 protected:
169 
170 
175  int getToPrio(const NBEdge* const e);
176 
177 
183  SUMOReal computeUnblockedWeightedStreamNumber(const NBEdge* const e1, const NBEdge* const e2);
184 
185 
190  std::pair<NBEdge*, NBEdge*> getBestCombination(const EdgeVector& edges);
191 
192 
200  std::pair<NBEdge*, NBEdge*> getBestPair(EdgeVector& incoming);
201 
202 
207  public:
212  int operator()(const NBEdge* const e1, const NBEdge* const e2) const {
213  if (e1->getJunctionPriority(e1->getToNode()) != e2->getJunctionPriority(e2->getToNode())) {
214  return e1->getJunctionPriority(e1->getToNode()) > e2->getJunctionPriority(e2->getToNode());
215  }
216  return e1->getID() > e2->getID();
217  }
218  };
219 
220 private:
223 
224 
225 };
226 
227 
228 #endif
229 
230 /****************************************************************************/
231