SUMO - Simulation of Urban MObility
MSSOTLMarchingPolicy.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2014-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 /****************************************************************************/
19 // The class for SOTL Marching logics
20 /****************************************************************************/
21 
22 #include "MSSOTLMarchingPolicy.h"
23 
25  const std::map<std::string, std::string>& parameters) :
26  MSSOTLPolicy("Marching", parameters) {
27  init();
28 }
29 
31  MSSOTLPolicyDesirability* desirabilityAlgorithm) :
32  MSSOTLPolicy("Marching", desirabilityAlgorithm) {
34  init();
35 }
36 
38  MSSOTLPolicyDesirability* desirabilityAlgorithm,
39  const std::map<std::string, std::string>& parameters) :
40  MSSOTLPolicy("Marching", desirabilityAlgorithm, parameters) {
42  init();
43 }
44 
45 bool MSSOTLMarchingPolicy::canRelease(SUMOTime elapsed, bool /* thresholdPassed */, bool pushButtonPressed,
46  const MSPhaseDefinition* stage, int /* vehicleCount */) {
47  if (elapsed >= stage->minDuration && pushButtonLogic(elapsed, pushButtonPressed, stage)) {
48  return true;
49  }
50  return (elapsed >= stage->duration);
51 }
52 
54  PushButtonLogic::init("MSSOTLMarchingPolicy", this);
55 }
bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition *stage)
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
Definition: MSSOTLPolicy.h:127
SUMOTime duration
The duration of the phase.
void setKeyPrefix(std::string val)
void init(std::string prefix, const Parameterised *parameterised)
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
MSSOTLMarchingPolicy(const std::map< std::string, std::string > &parameters)
Class for a low-level policy.
Definition: MSSOTLPolicy.h:71
SUMOTime minDuration
The minimum duration of the phase.
long long int SUMOTime
Definition: TraCIDefs.h:51
The definition of a single phase of a tls logic.
bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)