SUMO - Simulation of Urban MObility
MSSOTLPolicyBasedTrafficLightLogic.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // The class for SOTL Congestion logics
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
23 
25  MSTLLogicControl& tlcontrol, const std::string& id,
26  const std::string& subid, const Phases& phases, unsigned int step,
27  SUMOTime delay, const std::map<std::string, std::string>& parameters,
28  MSSOTLPolicy* policy) throw() :
29  MSSOTLTrafficLightLogic(tlcontrol, id, subid, phases, step, delay,
30  parameters), myPolicy(policy) {
31 
33  "*** Intersection " + id + " will run using MSSOTL"
34  + policy->getName() + "TrafficLightLogic ***");
35 
36 }
37 
39  MSTLLogicControl& tlcontrol, const std::string& id,
40  const std::string& subid, const Phases& phases, unsigned int step,
41  SUMOTime delay, const std::map<std::string, std::string>& parameters,
42  MSSOTLPolicy* policy, MSSOTLSensors* sensors) throw() :
43  MSSOTLTrafficLightLogic(tlcontrol, id, subid, phases, step, delay,
44  parameters, sensors), myPolicy(policy) {
45 }
46 
48 
49 }
50 
52 
53  DBG(
54  std::ostringstream str; str << "\n" << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " " << getID() << "invoked MSSOTLPolicyBasedTrafficLightLogic::decideNextPhase()"; WRITE_MESSAGE(str.str());)
55 
60 }
61 
63 
64  DBG(
65  std::ostringstream str; str << "\n" << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " " << getID() << "invoked MSSOTLPolicyBasedTrafficLightLogic::canRelease()"; WRITE_MESSAGE(str.str());)
66 
69 }
long long int SUMOTime
Definition: SUMOTime.h:43
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:160
virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition *stage, int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed, int vehicleCount)
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.
const std::string & getID() const
Returns the id.
Definition: Named.h:65
A self-organizing traffic light logic.
int getCurrentPhaseIndex() const
Returns the current index within the program.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Definition: MsgHandler.cpp:62
#define DBG(X)
Definition: SwarmDebug.h:30
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:89
MSSOTLPolicyBasedTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &subid, const Phases &phases, unsigned int step, SUMOTime delay, const std::map< std::string, std::string > &parameters, MSSOTLPolicy *policy)
Constructor without sensors passed.
Class for a low-level policy.
Definition: MSSOTLPolicy.h:72
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
int countVehicles(MSPhaseDefinition phase)