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