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 /****************************************************************************/
10 /// @file    MSSOTLWaveTrafficLightLogic.h
11 /// @author  Riccardo Belletti
12 /// @author  Anna Chiara Bellini
13 /// @date    2013-10-26
14 /// @version $Id$
15 ///
16 // The class for SOTL Platoon logics
17 /****************************************************************************/
18 #ifndef MSSOTLWaveTrafficLightLogic_h
19 #define MSSOTLWaveTrafficLightLogic_h
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MSSOTLTrafficLightLogic.h"
27 class MSSOTLWaveTrafficLightLogic: public MSSOTLTrafficLightLogic {
28 public:
29     /**
30      * @brief Constructor without sensors passed
31      * @param[in] tlcontrol The tls control responsible for this tls
32      * @param[in] id This tls' id
33      * @param[in] programID This tls' sub-id (program id)
34      * @param[in] phases Definitions of the phases
35      * @param[in] step The initial phase index
36      * @param[in] delay The time to wait before the first switch
37      */
38     MSSOTLWaveTrafficLightLogic(MSTLLogicControl& tlcontrol,
39                                 const std::string& id, const std::string& programID,
40                                 const Phases& phases, int step, SUMOTime delay,
41                                 const std::map<std::string, std::string>& parameters);
42 
43     /**
44      * @brief Constructor with sensors passed
45      * @param[in] tlcontrol The tls control responsible for this tls
46      * @param[in] id This tls' id
47      * @param[in] programID This tls' sub-id (program id)
48      * @param[in] phases Definitions of the phases
49      * @param[in] step The initial phase index
50      * @param[in] delay The time to wait before the first switch
51      */
52     MSSOTLWaveTrafficLightLogic(MSTLLogicControl& tlcontrol,
53                                 const std::string& id, const std::string& programID,
54                                 const Phases& phases, int step, SUMOTime delay,
55                                 const std::map<std::string, std::string>& parameters,
56                                 MSSOTLSensors* sensors);
57 
58     /** @brief Returns the type of the logic as a string
59      * @return The type of the logic
60      */
getLogicType()61     const std::string getLogicType() const {
62         return "waveTrafficLightLogic";
63     }
64     /// @}
65 
66 protected:
67 
68     /*
69      * @brief Contains the logic to decide whether to release the green light
70      */
71     bool canRelease();
72 
73 private:
74 
75     /*
76      * @brief Counts the vehicles on the green lanes of this phase
77      */
78     int countVehicles();
79 
80 };
81 
82 #endif
83 /****************************************************************************/
84