00001 /****************************************************************************/ 00007 // An actuated (adaptive) traffic light logic 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 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: 00073 MSActuatedTrafficLightLogic(MSTLLogicControl &tlcontrol, 00074 const std::string &id, const std::string &subid, 00075 const MSSimpleTrafficLightLogic::Phases &phases, 00076 unsigned int step, SUMOTime delay, 00077 SUMOReal maxGap, SUMOReal passingTime, SUMOReal detectorGap) throw(); 00078 00079 00084 void init(NLDetectorBuilder &nb) throw(ProcessError); 00085 00086 00088 ~MSActuatedTrafficLightLogic() throw(); 00089 00090 00091 00094 00100 SUMOTime trySwitch(bool isActive) throw(); 00102 00103 00104 protected: 00107 00111 SUMOTime duration() const throw(); 00112 00113 00116 void gapControl() throw(); 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
1.5.6