SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // An actuated (adaptive) traffic light logic 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef MSActuatedTrafficLightLogic_h 00022 #define MSActuatedTrafficLightLogic_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <utility> 00035 #include <vector> 00036 #include <bitset> 00037 #include <map> 00038 #include <microsim/MSEventControl.h> 00039 #include <microsim/traffic_lights/MSTrafficLightLogic.h> 00040 #include "MSSimpleTrafficLightLogic.h" 00041 #include <microsim/output/MSInductLoop.h> 00042 00043 00044 // =========================================================================== 00045 // class declarations 00046 // =========================================================================== 00047 class NLDetectorBuilder; 00048 00049 00050 // =========================================================================== 00051 // class definitions 00052 // =========================================================================== 00057 class MSActuatedTrafficLightLogic : 00058 public MSSimpleTrafficLightLogic { 00059 public: 00061 typedef std::map<MSLane*, MSInductLoop*> InductLoopMap; 00062 00063 public: 00073 MSActuatedTrafficLightLogic(MSTLLogicControl& tlcontrol, 00074 const std::string& id, const std::string& programID, 00075 const MSSimpleTrafficLightLogic::Phases& phases, 00076 unsigned int step, SUMOTime delay, 00077 const std::map<std::string, std::string> ¶meter); 00078 00079 00084 void init(NLDetectorBuilder& nb); 00085 00086 00088 ~MSActuatedTrafficLightLogic(); 00089 00090 00091 00094 00100 SUMOTime trySwitch(bool isActive); 00102 00103 00104 protected: 00107 00111 SUMOTime duration() const; 00112 00113 00116 void gapControl(); 00118 00119 00120 protected: 00122 InductLoopMap myInductLoops; 00123 00125 bool myContinue; 00126 00128 SUMOReal myMaxGap; 00129 00131 SUMOReal myPassingTime; 00132 00134 SUMOReal myDetectorGap; 00135 00136 }; 00137 00138 00139 #endif 00140 00141 /****************************************************************************/ 00142