Eclipse SUMO - Simulation of Urban MObility
MSSOTLPhaseTrafficLightLogic.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-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 /****************************************************************************/
14 // The class for SOTL Phase logics
15 /****************************************************************************/
16 
18 
20  MSTLLogicControl& tlcontrol, const std::string& id,
21  const std::string& programID, const Phases& phases, int step,
22  SUMOTime delay,
23  const std::map<std::string, std::string>& parameters) :
24  MSSOTLTrafficLightLogic(tlcontrol, id, programID, TLTYPE_SOTL_PHASE, phases, step, delay,
25  parameters) {
27  "*** Intersection " + id
28  + " will run using MSSOTLPhaseTrafficLightLogic ***");
29 }
30 
32  MSTLLogicControl& tlcontrol, const std::string& id,
33  const std::string& programID, const Phases& phases, int step,
34  SUMOTime delay, const std::map<std::string, std::string>& parameters,
35  MSSOTLSensors* sensors) :
36  MSSOTLTrafficLightLogic(tlcontrol, id, programID, TLTYPE_SOTL_PHASE, phases, step, delay,
37  parameters, sensors) {
38 }
39 
41  if (getCurrentPhaseElapsed() >= getCurrentPhaseDef().minDuration) {
42  return isThresholdPassed();
43  }
44  return false;
45 }
MSSOTLTrafficLightLogic
A self-organizing traffic light logic.
Definition: MSSOTLTrafficLightLogic.h:58
MSSOTLPhaseTrafficLightLogic::canRelease
bool canRelease()
Definition: MSSOTLPhaseTrafficLightLogic.cpp:40
MSSOTLTrafficLightLogic::isThresholdPassed
bool isThresholdPassed()
Definition: MSSOTLTrafficLightLogic.cpp:305
MSPhasedTrafficLightLogic::getCurrentPhaseDef
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
Definition: MSPhasedTrafficLightLogic.cpp:131
MSTrafficLightLogic::Phases
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Definition: MSTrafficLightLogic.h:61
MsgHandler::inform
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:118
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSSOTLPhaseTrafficLightLogic::MSSOTLPhaseTrafficLightLogic
MSSOTLPhaseTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor without sensors passed.
Definition: MSSOTLPhaseTrafficLightLogic.cpp:19
TLTYPE_SOTL_PHASE
@ TLTYPE_SOTL_PHASE
Definition: SUMOXMLDefinitions.h:1203
MSSOTLPhaseTrafficLightLogic.h
MSSOTLSensors
Definition: MSSOTLSensors.h:32
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:59
MSSOTLTrafficLightLogic::getCurrentPhaseElapsed
SUMOTime getCurrentPhaseElapsed()
Definition: MSSOTLTrafficLightLogic.cpp:358
MsgHandler::getMessageInstance
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Definition: MsgHandler.cpp:55