SUMO - Simulation of Urban MObility
MSMeanData_Amitran.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Network state mean data collector for edges/lanes
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSMeanData_Amitran_h
23 #define MSMeanData_Amitran_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <set>
37 #include <limits>
38 #include "MSMeanData.h"
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class OutputDevice;
45 class MSEdgeControl;
46 class MSEdge;
47 class MSLane;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
65 public:
74  public:
78  MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd,
79  const std::set<std::string>* const vTypes = 0,
80  const MSMeanData_Amitran* parent = 0);
81 
83  virtual ~MSLaneMeanDataValues();
84 
87  void reset(bool afterWrite = false);
88 
93  void addTo(MSMeanData::MeanDataValues& val) const;
94 
97 
113 
114  bool isEmpty() const;
115 
123  void write(OutputDevice& dev, const SUMOTime period,
124  const SUMOReal numLanes, const SUMOReal defaultTravelTime,
125  const int numVehicles = -1) const;
126 
127  protected:
138  void notifyMoveInternal(SUMOVehicle& veh, SUMOReal timeOnLane,
139  SUMOReal speed);
140 
141  private:
145  unsigned amount;
146 
148  std::map<const MSVehicleType*, unsigned> typedAmount;
149 
151  std::map<const MSVehicleType*, SUMOReal> typedSamples;
152 
154  std::map<const MSVehicleType*, SUMOReal> typedTravelDistance;
156 
157  };
158 
159 
160 public:
176  MSMeanData_Amitran(const std::string& id,
177  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
178  const bool useLanes, const bool withEmpty, const bool printDefaults,
179  const bool withInternal, const bool trackVehicles,
180  const SUMOReal maxTravelTime, const SUMOReal minSamples,
181  const SUMOReal haltSpeed, const std::set<std::string> vTypes);
182 
183 
185  virtual ~MSMeanData_Amitran();
186 
189 
196  virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
198 
203  virtual std::string getEdgeID(const MSEdge* const edge);
204 
211  virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
212 
222  virtual bool writePrefix(OutputDevice& dev, const MeanDataValues& values,
223  const SumoXMLTag tag, const std::string id) const;
224 
225 protected:
231  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const;
232 
238  void resetOnly(SUMOTime stopTime);
239 
240 private:
243 
246 
249 
250 };
251 
252 
253 #endif
254 
255 /****************************************************************************/
256 
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Computes current values and adds them to their sums.
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
Data collector for edges/lanes.
Definition: MSMeanData.h:67
SumoXMLTag
Numbers representing SUMO-XML - element names.
long long int SUMOTime
Definition: SUMOTime.h:43
Network state mean data collector for edges/lanes.
void notifyMoveInternal(SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
Internal notification about the vehicle moves.
Notification
Definition of a vehicle state.
MSLaneMeanDataValues(MSLane *const lane, const SUMOReal length, const bool doAdd, const std::set< std::string > *const vTypes=0, const MSMeanData_Amitran *parent=0)
Constructor.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
std::map< const MSVehicleType *, SUMOReal > typedSamples
The number of sampled vehicle movements by type (in s)
bool isEmpty() const
Returns whether any data was collected.
Data structure for mean (aggregated) edge/lane values.
std::map< const MSVehicleType *, unsigned > typedAmount
The number of vehicles that entered this lane within the sample interval by type. ...
const SUMOReal myHaltSpeed
the minimum sample seconds
A road/street connecting two junctions.
Definition: MSEdge.h:81
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const SUMOReal length, const bool doAdd) const
Create an instance of MeanDataValues.
virtual ~MSMeanData_Amitran()
Destructor.
Representation of a vehicle.
Definition: SUMOVehicle.h:65
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:76
void write(OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:74
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
MSMeanData_Amitran(const std::string &id, const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::set< std::string > vTypes)
Constructor.
virtual bool writePrefix(OutputDevice &dev, const MeanDataValues &values, const SumoXMLTag tag, const std::string id) const
Checks for emptiness and writes prefix into the given stream.
virtual void openInterval(OutputDevice &dev, const SUMOTime startTime, const SUMOTime stopTime)
Writes the interval opener.
virtual std::string getEdgeID(const MSEdge *const edge)
Return the relevant edge id.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
MSMoveReminder & operator=(const MSMoveReminder &)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:214
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
std::map< const MSVehicleType *, SUMOReal > typedTravelDistance
The sum of the distances the vehicles travelled by type.