SUMO - Simulation of Urban MObility
MSSOTLPolicyBasedTrafficLightLogic.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2010-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // The class for SOTL Congestion logics
19 /****************************************************************************/
20 
22 
24  MSTLLogicControl& tlcontrol, const std::string& id,
25  const std::string& subid, const Phases& phases, int step,
26  SUMOTime delay, const std::map<std::string, std::string>& parameters,
27  MSSOTLPolicy* policy) throw() :
28  MSSOTLTrafficLightLogic(tlcontrol, id, subid, phases, step, delay,
29  parameters), myPolicy(policy) {
30 
32  "*** Intersection " + id + " will run using MSSOTL"
33  + policy->getName() + "TrafficLightLogic ***");
34 
35 }
36 
38  MSTLLogicControl& tlcontrol, const std::string& id,
39  const std::string& subid, const Phases& phases, int step,
40  SUMOTime delay, const std::map<std::string, std::string>& parameters,
41  MSSOTLPolicy* policy, MSSOTLSensors* sensors) throw() :
42  MSSOTLTrafficLightLogic(tlcontrol, id, subid, phases, step, delay,
43  parameters, sensors), myPolicy(policy) {
44 }
45 
47 
48 }
49 
51 
52  DBG(
53  std::ostringstream str; str << "\n" << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " " << getID() << "invoked MSSOTLPolicyBasedTrafficLightLogic::decideNextPhase()"; WRITE_MESSAGE(str.str());)
54 
59 }
60 
62 
63  DBG(
64  std::ostringstream str; str << "\n" << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " " << getID() << "invoked MSSOTLPolicyBasedTrafficLightLogic::canRelease()"; WRITE_MESSAGE(str.str());)
65 
68 }
MSSOTLPolicyBasedTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &subid, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameters, MSSOTLPolicy *policy)
Constructor without sensors passed.
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:59
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition *stage, int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed, int vehicleCount)
const std::string & getID() const
Returns the id.
Definition: Named.h:65
virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)=0
A class that stores and controls tls and switching of their programs.
A self-organizing traffic light logic.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Definition: MsgHandler.cpp:57
#define DBG(X)
Definition: SwarmDebug.h:29
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
int getCurrentPhaseIndex() const
Returns the current index within the program.
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:84
Class for a low-level policy.
Definition: MSSOTLPolicy.h:71
long long int SUMOTime
Definition: TraCIDefs.h:51
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:200
int countVehicles(MSPhaseDefinition phase)