SUMO - Simulation of Urban MObility
MSSOTLPlatoonTrafficLightLogic.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 /****************************************************************************/
17 // The class for SOTL Platoon logics
18 /****************************************************************************/
19 
21 
23  MSTLLogicControl& tlcontrol, const std::string& id,
24  const std::string& subid, const Phases& phases, int step,
25  SUMOTime delay,
26  const std::map<std::string, std::string>& parameters) throw() :
27  MSSOTLTrafficLightLogic(tlcontrol, id, subid, phases, step, delay,
28  parameters) {
30  "*** Intersection " + id
31  + " will run using MSSOTLPlatoonTrafficLightLogic ***");
32 }
33 
35  MSTLLogicControl& tlcontrol, const std::string& id,
36  const std::string& subid, const Phases& phases, int step,
37  SUMOTime delay, const std::map<std::string, std::string>& parameters,
38  MSSOTLSensors* sensors) throw() :
39  MSSOTLTrafficLightLogic(tlcontrol, id, subid, phases, step, delay,
40  parameters, sensors) {
41 }
42 
44  if (getCurrentPhaseElapsed() >= getCurrentPhaseDef().minDuration) {
45  if (isThresholdPassed()) {
46  //If there are no other vehicles approaching green lights
47  //or the declared maximum duration has been reached
48  return ((countVehicles(getCurrentPhaseDef()) == 0)
50  >= getCurrentPhaseDef().maxDuration));
51  }
52  }
53  return false;
54 }
A class that stores and controls tls and switching of their programs.
MSSOTLPlatoonTrafficLightLogic(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)
Constructor without sensors passed.
A self-organizing traffic light logic.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Definition: MsgHandler.cpp:57
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.
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:84
long long int SUMOTime
Definition: TraCIDefs.h:51
int countVehicles(MSPhaseDefinition phase)