Eclipse SUMO - Simulation of Urban MObility
MSDelayBasedTrafficLightLogic.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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // An actuated traffic light logic based on time delay of approaching vehicles
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include <map>
25 
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 class NLDetectorBuilder;
31 class MSE2Collector;
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
46 public:
48 // typedef std::map<MSLane*, MSE2Collector*> LaneDetectorMap;
49  typedef std::map<MSLane*, MSE2Collector*> LaneDetectorMap;
50 
51 public:
62  const std::string& id, const std::string& programID,
64  int step, SUMOTime delay,
65  const std::map<std::string, std::string>& parameter,
66  const std::string& basePath);
67 
68 
73  void init(NLDetectorBuilder& nb);
74 
75 
78 
79 
80 
83 
90 
91  bool showDetectors() const {
92  return myShowDetectors;
93  }
94 
95  void setShowDetectors(bool show);
96 
97 
98 protected:
101 
110 
119  SUMOTime proposeProlongation(const SUMOTime actDuration, const SUMOTime maxDuration, bool& othersEmpty);
120 
121 protected:
124 
127 
130  // (Idea: this might be adapted to the detector-length and the vehicle's maximal speed)
132 
135 
137  std::string myFile;
138 
141 
143  std::string myVehicleTypes;
144 };
long long int SUMOTime
Definition: SUMOTime.h:31
An actuated traffic light logic based on time delay of approaching vehicles.
double myDetectionRange
Range of the connected detector, which provides the information on approaching vehicles.
MSDelayBasedTrafficLightLogic(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::string myVehicleTypes
Whether detector output separates by vType.
void init(NLDetectorBuilder &nb)
Initializes the tls with information about incoming lanes.
SUMOTime myFreq
The frequency for aggregating detector output.
LaneDetectorMap myLaneDetectors
A map from lanes to the corresponding lane detectors.
bool myShowDetectors
Whether the detectors shall be shown in the GUI.
std::string myFile
The output file for generated detectors.
SUMOTime proposeProlongation(const SUMOTime actDuration, const SUMOTime maxDuration, bool &othersEmpty)
The returned, proposed prolongation for the green phase is oriented on the largest estimated passing ...
std::map< MSLane *, MSE2Collector * > LaneDetectorMap
Definition of a map from lanes to corresponding areal detectors.
SUMOTime trySwitch()
Switches to the next phase, if possible.
SUMOTime checkForWaitingTime()
Checks for approaching vehicles on the lanes associated with green signals and returns the minimal ti...
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:79
A fixed traffic light logic.
A class that stores and controls tls and switching of their programs.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Builds detectors for microsim.