MSMeanData_Net.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MSMeanData_Net_h
00020 #define MSMeanData_Net_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 <vector>
00033 #include <set>
00034 #include <cassert>
00035 #include <limits>
00036 #include "MSMeanData.h"
00037
00038
00039
00040
00041
00042 class OutputDevice;
00043 class MSEdgeControl;
00044 class MSEdge;
00045 class MSLane;
00046 #ifdef HAVE_MESOSIM
00047 class MEVehicle;
00048 #endif
00049
00050
00051
00052
00053
00066 class MSMeanData_Net : public MSMeanData {
00067 public:
00075 class MSLaneMeanDataValues : public MSMeanData::MeanDataValues {
00076 public:
00078 MSLaneMeanDataValues(MSLane * const lane, const bool doAdd,
00079 const std::set<std::string>* const vTypes=0,
00080 const MSMeanData_Net *parent=0) throw();
00081
00083 virtual ~MSLaneMeanDataValues() throw();
00084
00087 void reset() throw();
00088
00093 void addTo(MSMeanData::MeanDataValues& val) const throw();
00094
00097
00114 bool isStillActive(MSVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) throw();
00115
00116
00123 void notifyLeave(MSVehicle& veh, bool isArrival, bool isLaneChange) throw();
00124
00125
00138 bool notifyEnter(MSVehicle& veh, bool isEmit, bool isLaneChange) throw();
00140
00141 bool isEmpty() const throw();
00142
00151 void write(OutputDevice &dev, const SUMOTime period,
00152 const SUMOReal numLanes, const SUMOReal length,
00153 const int numVehicles=-1) const throw(IOError);
00154
00155 #ifdef HAVE_MESOSIM
00156 void addData(const MEVehicle& veh, const SUMOReal timeOnLane, const SUMOReal dist) throw();
00157 void getLastReported(MEVehicle *v, SUMOTime &lastReportedTime, SUMOReal &lastReportedPos) throw();
00158 void setLastReported(MEVehicle *v, SUMOTime lastReportedTime, SUMOReal lastReportedPos) throw();
00159 #endif
00160
00164 unsigned nVehDeparted;
00165
00167 unsigned nVehArrived;
00168
00170 unsigned nVehEntered;
00171
00173 unsigned nVehLeft;
00174
00175 private:
00177 unsigned nVehLaneChangeFrom;
00178
00180 unsigned nVehLaneChangeTo;
00181
00183 SUMOReal waitSeconds;
00184
00186 SUMOReal vehLengthSum;
00188
00190 const MSMeanData_Net* myParent;
00191
00192 #ifdef HAVE_MESOSIM
00193 std::map<MEVehicle*, std::pair<SUMOTime, SUMOReal> > myLastVehicleUpdateValues;
00194 #endif
00195
00196 };
00197
00198
00199 public:
00213 MSMeanData_Net(const std::string &id,
00214 const SUMOTime dumpBegin, const SUMOTime dumpEnd,
00215 const bool useLanes, const bool withEmpty,
00216 const bool trackVehicles,
00217 const SUMOReal maxTravelTime, const SUMOReal minSamples,
00218 const SUMOReal haltSpeed, const std::set<std::string> vTypes) throw();
00219
00220
00222 virtual ~MSMeanData_Net() throw();
00223
00224 protected:
00230 MSMeanData::MeanDataValues* createValues(MSLane * const lane, const bool doAdd) const throw(IOError);
00231
00246 void writeEdge(OutputDevice &dev, const std::vector<MSMeanData::MeanDataValues*> &edgeValues,
00247 MSEdge *edge, SUMOTime startTime, SUMOTime stopTime) throw(IOError);
00248
00249
00255 void resetOnly(SUMOTime stopTime) throw();
00256
00257 private:
00259 const SUMOReal myHaltSpeed;
00260
00262 MSMeanData_Net(const MSMeanData_Net&);
00263
00265 MSMeanData_Net& operator=(const MSMeanData_Net&);
00266
00267 };
00268
00269
00270 #endif
00271
00272
00273