LCOV - code coverage report
Current view: top level - src/microsim/traffic_lights - MSSOTLCongestionPolicy.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 5 22 22.7 %
Date: 2024-05-19 15:37:39 Functions: 1 5 20.0 %

          Line data    Source code
       1             : /****************************************************************************/
       2             : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3             : // Copyright (C) 2014-2024 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    MSSOTLCongestionPolicy.cpp
      15             : /// @author  Alessio Bonfietti
      16             : /// @author  Riccardo Belletti
      17             : /// @date    Feb 2014
      18             : ///
      19             : // The class for SOTL Congestion logics
      20             : /****************************************************************************/
      21             : 
      22             : #include "MSSOTLCongestionPolicy.h"
      23             : 
      24           0 : MSSOTLCongestionPolicy::MSSOTLCongestionPolicy(
      25           0 :     const Parameterised::Map& parameters) :
      26           0 :     MSSOTLPolicy("Congestion", parameters) {
      27           0 : }
      28             : 
      29           0 : MSSOTLCongestionPolicy::MSSOTLCongestionPolicy(
      30           0 :     MSSOTLPolicyDesirability* desirabilityAlgorithm) :
      31           0 :     MSSOTLPolicy("Congestion", desirabilityAlgorithm) {
      32           0 :     getDesirabilityAlgorithm()->setKeyPrefix("CONGESTION");
      33           0 : }
      34             : 
      35          32 : MSSOTLCongestionPolicy::MSSOTLCongestionPolicy(
      36             :     MSSOTLPolicyDesirability* desirabilityAlgorithm,
      37          32 :     const Parameterised::Map& parameters) :
      38          64 :     MSSOTLPolicy("Congestion", desirabilityAlgorithm, parameters) {
      39          32 :     getDesirabilityAlgorithm()->setKeyPrefix("CONGESTION");
      40             : 
      41          32 : }
      42             : 
      43           0 : int MSSOTLCongestionPolicy::decideNextPhase(SUMOTime elapsed,
      44             :         const MSPhaseDefinition* stage, int currentPhaseIndex,
      45             :         int /* phaseMaxCTS */, bool thresholdPassed, bool pushButtonPressed, int vehicleCount) {
      46           0 :     if (stage->isCommit()) {
      47             :         // decide which chain to activate. Gotta work on this
      48             :         return currentPhaseIndex;
      49             :     }
      50           0 :     if (stage->isTransient()) {
      51             :         //If the junction was in a transient step
      52             :         //=> go to the next step and return computeReturnTime()
      53           0 :         return currentPhaseIndex + 1;
      54             :     }
      55             : 
      56             :     if (stage->isDecisional()) {
      57           0 :         if (canRelease(elapsed, thresholdPassed, pushButtonPressed, stage, vehicleCount)) {
      58           0 :             return currentPhaseIndex + 1;
      59             :         }
      60             :     }
      61             : 
      62             :     return currentPhaseIndex;
      63             : }
      64             : 
      65           0 : bool MSSOTLCongestionPolicy::canRelease(SUMOTime elapsed, bool /* thresholdPassed */, bool /* pushButtonPressed */,
      66             :                                         const MSPhaseDefinition* stage, int /* vehicleCount */) {
      67           0 :     return (elapsed >= stage->minDuration);
      68             : }

Generated by: LCOV version 1.14