Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSSOTLPhaseTrafficLightLogic.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2010-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// The class for SOTL Phase logics
19/****************************************************************************/
20
22
24 MSTLLogicControl& tlcontrol, const std::string& id,
25 const std::string& programID, const Phases& phases, int step,
26 SUMOTime delay,
27 const Parameterised::Map& parameters) :
28 MSSOTLTrafficLightLogic(tlcontrol, id, programID, TrafficLightType::SOTL_PHASE, phases, step, delay,
29 parameters) {
31 "*** Intersection " + id
32 + " will run using MSSOTLPhaseTrafficLightLogic ***");
33}
34
36 MSTLLogicControl& tlcontrol, const std::string& id,
37 const std::string& programID, const Phases& phases, int step,
38 SUMOTime delay, const Parameterised::Map& parameters,
39 MSSOTLSensors* sensors) :
40 MSSOTLTrafficLightLogic(tlcontrol, id, programID, TrafficLightType::SOTL_PHASE, phases, step, delay,
41 parameters, sensors) {
42}
43
45 if (getCurrentPhaseElapsed() >= getCurrentPhaseDef().minDuration) {
46 return isThresholdPassed();
47 }
48 return false;
49}
long long int SUMOTime
Definition GUI.h:36
MSSOTLPhaseTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const Phases &phases, int step, SUMOTime delay, const Parameterised::Map &parameters)
Constructor without sensors passed.
A self-organizing traffic light logic.
const MSPhaseDefinition & getCurrentPhaseDef() const override
Returns the definition of the current phase.
A class that stores and controls tls and switching of their programs.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
std::map< std::string, std::string > Map
parameters map