SUMO - Simulation of Urban MObility
MSSOTLHiLevelTrafficLightLogic.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-2018 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 /****************************************************************************/
18 /****************************************************************************/
19 #ifndef MSSOTLTrafficLightLogic_H
20 #define MSSOTLTrafficLightLogic_H
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 //#define SWARM_DEBUG
29 #include <vector>
30 #include "MSSOTLPolicy.h"
31 #include <stdlib.h>
32 #include <sstream>
33 
35 
46 public:
58  const std::string& id, const std::string& programID,
59  const TrafficLightType logicType, const Phases& phases,
60  int step, SUMOTime delay,
61  const std::map<std::string, std::string>& parameters);
62 
75  const std::string& id, const std::string& programID,
76  const TrafficLightType logicType, const Phases& phases,
77  int step, SUMOTime delay,
78  const std::map<std::string, std::string>& parameters,
79  MSSOTLSensors* sensors);
81 
85  std::vector<MSSOTLPolicy*>& getPolicies() {
86  return policies;
87  }
92  return currentPolicy;
93  }
94 
99  void init(NLDetectorBuilder& nb);
100 
101  /*
102  * \brief Adds a low-level policy to this high-level tll.
103  * \param[in] policy The low-level policy to be added.
104  */
105  void addPolicy(MSSOTLPolicy* policy);
106 
107  /*
108  * \brief Activates the given low-level policy.
109  * \param[in] policy The low-level policy to be activated.
110  */
111  void activate(MSSOTLPolicy* policy);
112 
113 protected:
114  virtual void decidePolicy() = 0;
115 
116 private:
117 
118  std::vector<MSSOTLPolicy*> policies;
120 
121 };
122 
123 #endif
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:36
void init(NLDetectorBuilder &nb)
Initialises the tls.
A self-organizing high-level traffic light logic.
A class that stores and controls tls and switching of their programs.
A self-organizing traffic light logic.
std::vector< MSSOTLPolicy * > & getPolicies()
Returns the vector of the low-level policies used by this high-level tll.
MSSOTLPolicy * getCurrentPolicy()
Returns the low-level policy currently selected by this high-level tll.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
MSSOTLHiLevelTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const TrafficLightType logicType, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor without sensors passed.
Class for a low-level policy.
Definition: MSSOTLPolicy.h:65
TrafficLightType