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.dev/sumo
3 // Copyright (C) 2002-2024 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:
57  const std::string& id, const std::string& programID,
58  const SUMOTime offset,
60  int step, SUMOTime delay,
61  const Parameterised::Map& parameter,
62  const std::string& basePath);
63 
64 
69  void init(NLDetectorBuilder& nb);
70 
71 
74 
75 
76 
79 
86 
87  bool showDetectors() const {
88  return myShowDetectors;
89  }
90 
91  void setShowDetectors(bool show);
92 
93 
94 protected:
97 
106 
115  SUMOTime proposeProlongation(const SUMOTime actDuration, const SUMOTime maxDuration, bool& othersEmpty);
116 
117 protected:
119  std::map<const MSLane*, MSE2Collector*> myLaneDetectors;
120 
123 
126  // (Idea: this might be adapted to the detector-length and the vehicle's maximal speed)
128 
131 
133  std::string myFile;
134 
137 
139  std::string myVehicleTypes;
140 
143 };
long long int SUMOTime
Definition: GUI.h:35
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.
bool myExtendMaxDur
Whether phases may be extended beyond maxDur in the absence of traffic.
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.
std::map< const MSLane *, MSE2Collector * > 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.
MSDelayBasedTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const SUMOTime offset, const MSSimpleTrafficLightLogic::Phases &phases, int step, SUMOTime delay, const Parameterised::Map &parameter, const std::string &basePath)
Constructor.
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 ...
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.
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45