Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2010-2025 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 : /****************************************************************************/
14 : /// @file MSSOTLPhaseTrafficLightLogic.cpp
15 : /// @author Gianfilippo Slager
16 : /// @date Feb 2010
17 : ///
18 : // The class for SOTL Phase logics
19 : /****************************************************************************/
20 :
21 : #include "MSSOTLPhaseTrafficLightLogic.h"
22 :
23 0 : MSSOTLPhaseTrafficLightLogic::MSSOTLPhaseTrafficLightLogic(
24 : MSTLLogicControl& tlcontrol, const std::string& id,
25 : const std::string& programID, const Phases& phases, int step,
26 : SUMOTime delay,
27 0 : const Parameterised::Map& parameters) :
28 : MSSOTLTrafficLightLogic(tlcontrol, id, programID, TrafficLightType::SOTL_PHASE, phases, step, delay,
29 0 : parameters) {
30 0 : MsgHandler::getMessageInstance()->inform(
31 0 : "*** Intersection " + id
32 0 : + " will run using MSSOTLPhaseTrafficLightLogic ***");
33 0 : }
34 :
35 0 : MSSOTLPhaseTrafficLightLogic::MSSOTLPhaseTrafficLightLogic(
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 0 : MSSOTLSensors* sensors) :
40 : MSSOTLTrafficLightLogic(tlcontrol, id, programID, TrafficLightType::SOTL_PHASE, phases, step, delay,
41 0 : parameters, sensors) {
42 0 : }
43 :
44 0 : bool MSSOTLPhaseTrafficLightLogic::canRelease() {
45 0 : if (getCurrentPhaseElapsed() >= getCurrentPhaseDef().minDuration) {
46 0 : return isThresholdPassed();
47 : }
48 : return false;
49 : }
|