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:
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 
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSTrafficLightLogic::Phases
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Definition: MSTrafficLightLogic.h:62
MSActuatedTrafficLightLogic::myShowDetectors
bool myShowDetectors
Whether the detectors shall be shown in the GUI.
Definition: MSActuatedTrafficLightLogic.h:140
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSActuatedTrafficLightLogic::~MSActuatedTrafficLightLogic
~MSActuatedTrafficLightLogic()
Destructor.
Definition: MSActuatedTrafficLightLogic.cpp:77
MSSimpleTrafficLightLogic.h
MSActuatedTrafficLightLogic::trySwitch
SUMOTime trySwitch()
Switches to the next phase.
Definition: MSActuatedTrafficLightLogic.cpp:363
MSTrafficLightLogic.h
MSActuatedTrafficLightLogic::duration
SUMOTime duration(const double detectionGap) const
Returns the minimum duration of the current phase.
Definition: MSActuatedTrafficLightLogic.cpp:393
LaneVector
std::vector< int > LaneVector
container for (sorted) lanes. The lanes are sorted from rightmost (id=0) to leftmost (id=nolanes-1)
Definition: NBCont.h:53
MSActuatedTrafficLightLogic::myFile
std::string myFile
The output file for generated detectors.
Definition: MSActuatedTrafficLightLogic.h:143
MSActuatedTrafficLightLogic::myVehicleTypes
std::string myVehicleTypes
Whether detector output separates by vType.
Definition: MSActuatedTrafficLightLogic.h:149
MSActuatedTrafficLightLogic::getMinimumMinDuration
SUMOTime getMinimumMinDuration(MSLane *lane) const
get the minimum min duration for all stretchable phases that affect the given lane
Definition: MSActuatedTrafficLightLogic.cpp:325
MSSimpleTrafficLightLogic
A fixed traffic light logic.
Definition: MSSimpleTrafficLightLogic.h:55
MSActuatedTrafficLightLogic::myInductLoops
std::vector< MSInductLoop * > myInductLoops
Definition: MSActuatedTrafficLightLogic.h:128
MSActuatedTrafficLightLogic
An actuated (adaptive) traffic light logic.
Definition: MSActuatedTrafficLightLogic.h:51
MSActuatedTrafficLightLogic::myFreq
SUMOTime myFreq
The frequency for aggregating detector output.
Definition: MSActuatedTrafficLightLogic.h:146
MSActuatedTrafficLightLogic::showDetectors
bool showDetectors() const
Definition: MSActuatedTrafficLightLogic.h:96
MSActuatedTrafficLightLogic::InductLoopMap
std::vector< std::vector< MSInductLoop * > > InductLoopMap
Definition of a map from phases to induct loops controlling them.
Definition: MSActuatedTrafficLightLogic.h:54
MSActuatedTrafficLightLogic::setShowDetectors
void setShowDetectors(bool show)
Definition: MSActuatedTrafficLightLogic.cpp:449
MSActuatedTrafficLightLogic::hasMajor
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
Definition: MSActuatedTrafficLightLogic.cpp:345
MSActuatedTrafficLightLogic::myDetectorGap
double myDetectorGap
The detector distance in seconds.
Definition: MSActuatedTrafficLightLogic.h:137
MSActuatedTrafficLightLogic::init
void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
Definition: MSActuatedTrafficLightLogic.cpp:80
MSActuatedTrafficLightLogic::gapControl
double gapControl()
Return the minimum detection gap of all detectors if the current phase should be extended and double:...
Definition: MSActuatedTrafficLightLogic.cpp:413
config.h
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:60
MSActuatedTrafficLightLogic::myInductLoopsForPhase
InductLoopMap myInductLoopsForPhase
A map from phase to induction loops to be used for gap control.
Definition: MSActuatedTrafficLightLogic.h:127
MSActuatedTrafficLightLogic::MSActuatedTrafficLightLogic
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.
Definition: MSActuatedTrafficLightLogic.cpp:60
MSEventControl.h
MSActuatedTrafficLightLogic::myPassingTime
double myPassingTime
The passing time used in seconds.
Definition: MSActuatedTrafficLightLogic.h:134
MSInductLoop.h
MSActuatedTrafficLightLogic::myMaxGap
double myMaxGap
The maximum gap to check in seconds.
Definition: MSActuatedTrafficLightLogic.h:131
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:56