|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // The basic traffic light logic 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This file is part of SUMO. 00014 // SUMO is free software: you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation, either version 3 of the License, or 00017 // (at your option) any later version. 00018 // 00019 /****************************************************************************/ 00020 #ifndef MSUnboundActuatedTrafficLightLogic_h 00021 #define MSUnboundActuatedTrafficLightLogic_h 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #include <utility> 00034 #include <vector> 00035 #include <bitset> 00036 #include <map> 00037 #include <microsim/MSEventControl.h> 00038 #include <microsim/traffic_lights/MSTrafficLightLogic.h> 00039 #include "MSActuatedPhaseDefinition.h" 00040 #include "MSSimpleTrafficLightLogic.h" 00041 #include <microsim/output/MSInductLoop.h> 00042 #include <microsim/MSLaneState.h> 00043 00044 00045 // =========================================================================== 00046 // class declarations 00047 // =========================================================================== 00048 class NLDetectorBuilder; 00049 00050 00051 // =========================================================================== 00052 // class definitions 00053 // =========================================================================== 00062 class MSUnboundActuatedTrafficLightLogic : 00063 public MSSimpleTrafficLightLogic { 00064 public: 00066 typedef std::map<MSLane*, MSInductLoop*> InductLoopMap; 00067 00069 typedef std::map<MSLane*, MSLaneState*> LaneStateMap; 00070 00071 public: 00073 MSUnboundActuatedTrafficLightLogic(const std::string& id, 00074 const MSSimpleTrafficLightLogic::Phases& phases, 00075 size_t step, size_t delay, 00076 SUMOReal maxGap, SUMOReal passingTime, SUMOReal detectorGap); 00077 00079 void init(NLDetectorBuilder& nb, 00080 const std::vector<MSLane*> &lanes, 00081 std::map<std::string, std::vector<std::string> > &edgeContinuations, 00082 SUMOReal det_offset); 00083 00085 ~MSUnboundActuatedTrafficLightLogic(); 00086 00089 SUMOTime trySwitch(bool isActive); 00090 00092 SUMOTime duration() const; 00093 00095 bool gapControl(); 00096 00097 // Checkes wheter the tested phase is a neither a yellow nor a allred phase 00098 bool isGreenPhase() const ; 00099 00100 protected: 00102 MSActuatedPhaseDefinition* currentPhaseDef() const; 00103 00104 protected: 00106 InductLoopMap myInductLoops; 00107 00109 LaneStateMap myLaneStates; 00110 00112 bool myContinue; 00113 00115 SUMOReal myMaxGap; 00116 00118 SUMOReal myPassingTime; 00119 00121 SUMOReal myDetectorGap; 00122 00123 }; 00124 00125 00126 #endif 00127 00128 /****************************************************************************/ 00129