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 /****************************************************************************/
17 /****************************************************************************/
18 #ifndef MSSOTLTrafficLightLogic_H
19 #define MSSOTLTrafficLightLogic_H
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 //#define SWARM_DEBUG
28 #include <vector>
29 #include "MSSOTLPolicy.h"
30 #include <stdlib.h>
31 #include <sstream>
32 
34 
45 public:
57  const std::string& id, const std::string& programID,
58  const TrafficLightType logicType, const Phases& phases,
59  int step, SUMOTime delay,
60  const std::map<std::string, std::string>& parameters);
61 
74  const std::string& id, const std::string& programID,
75  const TrafficLightType logicType, const Phases& phases,
76  int step, SUMOTime delay,
77  const std::map<std::string, std::string>& parameters,
78  MSSOTLSensors* sensors);
80 
84  std::vector<MSSOTLPolicy*>& getPolicies() {
85  return policies;
86  }
91  return currentPolicy;
92  }
93 
98  void init(NLDetectorBuilder& nb);
99 
100  /*
101  * \brief Adds a low-level policy to this high-level tll.
102  * \param[in] policy The low-level policy to be added.
103  */
104  void addPolicy(MSSOTLPolicy* policy);
105 
106  /*
107  * \brief Activates the given low-level policy.
108  * \param[in] policy The low-level policy to be activated.
109  */
110  void activate(MSSOTLPolicy* policy);
111 
112 protected:
113  virtual void decidePolicy() = 0;
114 
115 private:
116 
117  std::vector<MSSOTLPolicy*> policies;
119 
120 };
121 
122 #endif
MSSOTLTrafficLightLogic
A self-organizing traffic light logic.
Definition: MSSOTLTrafficLightLogic.h:58
MSSOTLPolicy
Class for a low-level policy.
Definition: MSSOTLPolicy.h:64
MSTrafficLightLogic::Phases
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Definition: MSTrafficLightLogic.h:61
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1197
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSSOTLHiLevelTrafficLightLogic
A self-organizing high-level traffic light logic.
Definition: MSSOTLHiLevelTrafficLightLogic.h:44
MSSOTLHiLevelTrafficLightLogic::~MSSOTLHiLevelTrafficLightLogic
~MSSOTLHiLevelTrafficLightLogic()
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:38
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:90
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:17
MSSOTLTrafficLightLogic.h
MSSOTLHiLevelTrafficLightLogic::currentPolicy
MSSOTLPolicy * currentPolicy
Definition: MSSOTLHiLevelTrafficLightLogic.h:118
MSSOTLHiLevelTrafficLightLogic::getPolicies
std::vector< MSSOTLPolicy * > & getPolicies()
Returns the vector of the low-level policies used by this high-level tll.
Definition: MSSOTLHiLevelTrafficLightLogic.h:84
MSSOTLHiLevelTrafficLightLogic::addPolicy
void addPolicy(MSSOTLPolicy *policy)
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:44
MSSOTLSensors
Definition: MSSOTLSensors.h:32
config.h
SwarmDebug.h
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:59
MSSOTLHiLevelTrafficLightLogic::init
void init(NLDetectorBuilder &nb)
Initialises the tls.
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:48
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:55
MSSOTLHiLevelTrafficLightLogic::activate
void activate(MSSOTLPolicy *policy)
Definition: MSSOTLHiLevelTrafficLightLogic.cpp:52
MSSOTLHiLevelTrafficLightLogic::policies
std::vector< MSSOTLPolicy * > policies
Definition: MSSOTLHiLevelTrafficLightLogic.h:117