SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // A traffic lights logic which represents a tls in an off-mode 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef MSOffTrafficLightLogic_h 00023 #define MSOffTrafficLightLogic_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <utility> 00036 #include <vector> 00037 #include <bitset> 00038 #include <microsim/MSEventControl.h> 00039 #include <microsim/MSNet.h> 00040 #include <utils/common/StdDefs.h> 00041 #include "MSTrafficLightLogic.h" 00042 #include "MSPhaseDefinition.h" 00043 #include "MSTLLogicControl.h" 00044 00045 00046 // =========================================================================== 00047 // class definitions 00048 // =========================================================================== 00053 class MSOffTrafficLightLogic : public MSTrafficLightLogic { 00054 public: 00060 MSOffTrafficLightLogic(MSTLLogicControl& tlcontrol, 00061 const std::string& id); 00062 00063 00068 virtual void init(NLDetectorBuilder& nb); 00069 00070 00072 ~MSOffTrafficLightLogic(); 00073 00074 00077 00082 void adaptLinkInformationFrom(const MSTrafficLightLogic& logic); 00084 00085 00086 00089 00095 SUMOTime trySwitch(bool isActive) { 00096 UNUSED_PARAMETER(isActive); 00097 return 120 * DELTA_T; 00098 } 00099 00101 00102 00105 00110 unsigned int getPhaseNumber() const; 00111 00112 00117 const Phases& getPhases() const; 00118 00119 00125 const MSPhaseDefinition& getPhase(unsigned int givenstep) const; 00127 00128 00129 00132 00137 unsigned int getCurrentPhaseIndex() const; 00138 00139 00144 const MSPhaseDefinition& getCurrentPhaseDef() const; 00146 00147 00148 00151 00156 SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const; 00157 00158 00164 SUMOTime getOffsetFromIndex(unsigned int index) const; 00165 00166 00172 unsigned int getIndexFromOffset(SUMOTime offset) const; 00174 00175 00176 00179 00187 void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration) { 00188 UNUSED_PARAMETER(tlcontrol); 00189 UNUSED_PARAMETER(simStep); 00190 UNUSED_PARAMETER(step); 00191 UNUSED_PARAMETER(stepDuration); 00192 } 00194 00195 00196 private: 00199 void rebuildPhase(); 00200 00201 00202 private: 00204 MSTrafficLightLogic::Phases myPhaseDefinition; 00205 00206 00207 }; 00208 00209 00210 #endif 00211 00212 /****************************************************************************/ 00213