Eclipse SUMO - Simulation of Urban MObility
MSActuatedTrafficLightLogic.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // An actuated (adaptive) traffic light logic
18 /****************************************************************************/
19 #ifndef MSActuatedTrafficLightLogic_h
20 #define MSActuatedTrafficLightLogic_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <utility>
29 #include <vector>
30 #include <bitset>
31 #include <map>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class NLDetectorBuilder;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
52 public:
54  typedef std::vector<std::vector<MSInductLoop*> > InductLoopMap;
55 
56 public:
67  const std::string& id, const std::string& programID,
69  int step, SUMOTime delay,
70  const std::map<std::string, std::string>& parameter,
71  const std::string& basePath);
72 
73 
78  void init(NLDetectorBuilder& nb);
79 
80 
83 
84 
85 
88 
95 
96  bool showDetectors() const {
97  return myShowDetectors;
98  }
99 
100  void setShowDetectors(bool show);
101 
102 protected:
105 
110  SUMOTime duration(const double detectionGap) const;
111 
114 
117  double gapControl();
118 
119 
121  bool hasMajor(const std::string& state, const LaneVector& lanes) const;
123 
124 
125 protected:
127  InductLoopMap myInductLoopsForPhase;
128  std::vector<MSInductLoop*> myInductLoops;
129 
131  double myMaxGap;
132 
135 
138 
141 
143  std::string myFile;
144 
147 
149  std::string myVehicleTypes;
150 
151 };
152 
153 
154 #endif
155 
156 /****************************************************************************/
157 
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:35
void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
std::string myFile
The output file for generated detectors.
SUMOTime duration(const double detectionGap) const
Returns the minimum duration of the current phase.
A fixed traffic light logic.
InductLoopMap myInductLoopsForPhase
A map from phase to induction loops to be used for gap control.
An actuated (adaptive) traffic light logic.
A class that stores and controls tls and switching of their programs.
std::string myVehicleTypes
Whether detector output separates by vType.
bool hasMajor(const std::string &state, const LaneVector &lanes) const
return whether there is a major link from the given lane in the given phase
SUMOTime getMinimumMinDuration(MSLane *lane) const
get the minimum min duration for all stretchable phases that affect the given lane ...
double myMaxGap
The maximum gap to check in seconds.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
double gapControl()
Return the minimum detection gap of all detectors if the current phase should be extended and double:...
std::vector< std::vector< MSInductLoop * > > InductLoopMap
Definition of a map from phases to induct loops controlling them.
double myDetectorGap
The detector distance in seconds.
double myPassingTime
The passing time used in seconds.
MSActuatedTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const MSSimpleTrafficLightLogic::Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameter, const std::string &basePath)
Constructor.
std::vector< MSInductLoop * > myInductLoops
SUMOTime myFreq
The frequency for aggregating detector output.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
bool myShowDetectors
Whether the detectors shall be shown in the GUI.
SUMOTime trySwitch()
Switches to the next phase.