Eclipse SUMO - Simulation of Urban MObility
MSDeterministicHiLevelTrafficLightLogic.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2010-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 // The class for deterministic high level traffic light logic
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #define SWARM_DEBUG
26 #include "MSSOTLPhasePolicy.h"
27 #include "MSSOTLPlatoonPolicy.h"
28 #include "MSSOTLMarchingPolicy.h"
29 #include "MSSOTLCongestionPolicy.h"
30 #include "MSSOTLPolicy3DStimulus.h"
31 
33 public:
34 
35 
36  //****************************************************
37 
48  MSDeterministicHiLevelTrafficLightLogic(MSTLLogicControl& tlcontrol, const std::string& id,
49  const std::string& programID, const Phases& phases, int step,
50  SUMOTime delay,
51  const std::map<std::string, std::string>& parameters);
52 
54 
61  void init(NLDetectorBuilder& nb);
62 
66  const std::string getLogicType() const {
67  return "DeterministicHighLevelTrafficLightLogic";
68  }
70 
71 protected:
72 
80 
88 
89  /*
90  * This member has to contain the switching logic for SOTL policies
91  */
92  int decideNextPhase();
93 
94  bool canRelease();
95 
96 
97  /*
98  * @return The average pheromone level regarding congestion on input lanes
99  */
100  double getMeanSpeedForInputLanes();
101 
102  /*
103  * @return The average pheromone level regarding congestion on output lanes
104  */
106 
107 
108 
113  void decidePolicy();
114 
115  void choosePolicy(double mean_vSpeed_in, double mean_vSpeed_out);
116 
117 
118 };
std::set< std::string > MSLaneID_set
long long int SUMOTime
Definition: SUMOTime.h:31
MSDeterministicHiLevelTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor without sensors passed.
void choosePolicy(double mean_vSpeed_in, double mean_vSpeed_out)
const std::string getLogicType() const
Returns the type of the logic as a string.
void init(NLDetectorBuilder &nb)
Initialises the tls with sensors on incoming and outgoing lanes Sensors are built in the simulation a...
MSLaneID_set inputLanes
This pheronome is an indicator of congestion on input lanes. Its levels refer to the average speed of...
void decidePolicy()
Decide the current policy according to pheromone levels The decision reflects on currentPolicy value.
MSLaneID_set outputLanes
This pheromone is an indicator of congestion on output lanes. Its levels refer to the average speed o...
A self-organizing high-level 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.