Eclipse 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-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 /****************************************************************************/
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
MSSOTLTrafficLightLogic
A self-organizing traffic light logic.
Definition: MSSOTLTrafficLightLogic.h:59
MSSOTLPolicy
Class for a low-level policy.
Definition: MSSOTLPolicy.h:65
MSTrafficLightLogic::Phases
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Definition: MSTrafficLightLogic.h:62
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1192
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSSOTLHiLevelTrafficLightLogic
A self-organizing high-level traffic light logic.
Definition: MSSOTLHiLevelTrafficLightLogic.h:45
MSSOTLHiLevelTrafficLightLogic::~MSSOTLHiLevelTrafficLightLogic
~MSSOTLHiLevelTrafficLightLogic()
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:39
MSSOTLPolicy.h
MSSOTLHiLevelTrafficLightLogic::decidePolicy
virtual void decidePolicy()=0
MSSOTLHiLevelTrafficLightLogic::getCurrentPolicy
MSSOTLPolicy * getCurrentPolicy()
Returns the low-level policy currently selected by this high-level tll.
Definition: MSSOTLHiLevelTrafficLightLogic.h:91
MSSOTLHiLevelTrafficLightLogic::MSSOTLHiLevelTrafficLightLogic
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.
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:18
MSSOTLTrafficLightLogic.h
MSSOTLHiLevelTrafficLightLogic::currentPolicy
MSSOTLPolicy * currentPolicy
Definition: MSSOTLHiLevelTrafficLightLogic.h:119
MSSOTLHiLevelTrafficLightLogic::getPolicies
std::vector< MSSOTLPolicy * > & getPolicies()
Returns the vector of the low-level policies used by this high-level tll.
Definition: MSSOTLHiLevelTrafficLightLogic.h:85
MSSOTLHiLevelTrafficLightLogic::addPolicy
void addPolicy(MSSOTLPolicy *policy)
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:45
MSSOTLSensors
Definition: MSSOTLSensors.h:33
config.h
SwarmDebug.h
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:60
MSSOTLHiLevelTrafficLightLogic::init
void init(NLDetectorBuilder &nb)
Initialises the tls.
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:49
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:56
MSSOTLHiLevelTrafficLightLogic::activate
void activate(MSSOTLPolicy *policy)
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:53
MSSOTLHiLevelTrafficLightLogic::policies
std::vector< MSSOTLPolicy * > policies
Definition: MSSOTLHiLevelTrafficLightLogic.h:118