MSAgentbasedTrafficLightLogic.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MSAgentbasedTrafficLightLogic_h
00020 #define MSAgentbasedTrafficLightLogic_h
00021
00022
00023
00024
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 "MSTrafficLightLogic.h"
00038 #include "MSSimpleTrafficLightLogic.h"
00039 #include <microsim/output/MS_E2_ZS_CollectorOverLanes.h>
00040 #include "MSSimpleTrafficLightLogic.h"
00041
00042
00043
00044
00045
00046 class MSLane;
00047 class MSAgentbasedPhaseDefinition;
00048 class NLDetectorBuilder;
00049
00050
00051
00052
00053
00058 class MSAgentbasedTrafficLightLogic :
00059 public MSSimpleTrafficLightLogic {
00060 public:
00062 typedef std::map<MSLane*, MS_E2_ZS_CollectorOverLanes*> E2DetectorMap;
00063
00065 typedef std::deque<SUMOReal> ValueType;
00066
00068 typedef std::map<unsigned int, ValueType> PhaseValueMap;
00069
00071 typedef std::map<unsigned int, SUMOReal> MeanDataMap;
00072
00073 public:
00086 MSAgentbasedTrafficLightLogic(MSTLLogicControl &tlcontrol,
00087 const std::string &id, const std::string &subid,
00088 const MSSimpleTrafficLightLogic::Phases &phases,
00089 unsigned int step, SUMOTime delay, int learnHorizon, int decHorizon,
00090 SUMOReal minDiff, int tcycle) throw();
00091
00092
00098 void init(NLDetectorBuilder &nb) throw(ProcessError);
00099
00100
00102 ~MSAgentbasedTrafficLightLogic() throw();
00103
00104
00105
00108
00114 SUMOTime trySwitch(bool isActive) throw();
00116
00117
00118 protected:
00121
00128 unsigned int nextStep() throw();
00129
00130
00133 void collectData() throw();
00134
00135
00138 void aggregateRawData() throw();
00139
00140
00143 void calculateDuration() throw();
00144
00145
00149 void lengthenCycleTime(unsigned int toLenghten) throw();
00150
00151
00155 void cutCycleTime(unsigned int toCut) throw();
00156
00157
00161 unsigned int findStepOfMaxValue() const throw();
00162
00163
00167 unsigned int findStepOfMinValue() const throw();
00169
00170
00171 protected:
00173 E2DetectorMap myE2Detectors;
00174
00176 PhaseValueMap myRawDetectorData;
00177
00179 MeanDataMap myMeanDetectorData;
00180
00184 unsigned int tDecide;
00185
00187 unsigned int tSinceLastDecision;
00188
00190 unsigned int stepOfLastDecision;
00191
00195 unsigned int numberOfValues;
00196
00198 unsigned int tCycle;
00199
00200
00201
00202
00203
00204
00205 SUMOReal deltaLimit;
00206
00207 };
00208
00209
00210 #endif
00211
00212
00213