SUMO - Simulation of Urban MObility
MSMeanData_Amitran.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // Network state mean data collector for edges/lanes
20 /****************************************************************************/
21 #ifndef MSMeanData_Amitran_h
22 #define MSMeanData_Amitran_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <set>
36 #include <limits>
37 #include "MSMeanData.h"
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class OutputDevice;
44 class MSEdgeControl;
45 class MSEdge;
46 class MSLane;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
64 public:
73  public:
77  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
78  const MSMeanData_Amitran* parent);
79 
81  virtual ~MSLaneMeanDataValues();
82 
85  void reset(bool afterWrite = false);
86 
91  void addTo(MSMeanData::MeanDataValues& val) const;
92 
95 
109  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
111 
112  bool isEmpty() const;
113 
121  void write(OutputDevice& dev, const SUMOTime period,
122  const double numLanes, const double defaultTravelTime,
123  const int numVehicles = -1) const;
124 
125  protected:
129  void notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double /* meanLengthOnLane */);
130 
131  private:
135  int amount;
136 
138  std::map<const MSVehicleType*, int> typedAmount;
139 
141  std::map<const MSVehicleType*, double> typedSamples;
142 
144  std::map<const MSVehicleType*, double> typedTravelDistance;
146 
147  };
148 
149 
150 public:
166  MSMeanData_Amitran(const std::string& id,
167  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
168  const bool useLanes, const bool withEmpty, const bool printDefaults,
169  const bool withInternal, const bool trackVehicles,
170  const double maxTravelTime, const double minSamples,
171  const double haltSpeed, const std::string& vTypes);
172 
173 
175  virtual ~MSMeanData_Amitran();
176 
179 
186  virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
188 
193  virtual std::string getEdgeID(const MSEdge* const edge);
194 
201  virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
202 
212  virtual bool writePrefix(OutputDevice& dev, const MeanDataValues& values,
213  const SumoXMLTag tag, const std::string id) const;
214 
215 protected:
221  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
222 
228  void resetOnly(SUMOTime stopTime);
229 
230 private:
232  const double myHaltSpeed;
233 
236 
239 
240 };
241 
242 
243 #endif
244 
245 /****************************************************************************/
246 
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
Data collector for edges/lanes.
Definition: MSMeanData.h:66
SumoXMLTag
Numbers representing SUMO-XML - element names.
Network state mean data collector for edges/lanes.
Notification
Definition of a vehicle state.
void write(OutputDevice &dev, const SUMOTime period, const double numLanes, const double defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
void notifyMoveInternal(const SUMOVehicle &veh, const double, const double timeOnLane, const double, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double)
Internal notification about the vehicle moves.
std::map< const MSVehicleType *, double > typedSamples
The number of sampled vehicle movements by type (in s)
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 double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes)
Constructor.
Data structure for mean (aggregated) edge/lane values.
A road/street connecting two junctions.
Definition: MSEdge.h:80
virtual ~MSMeanData_Amitran()
Destructor.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:75
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
const double myHaltSpeed
the minimum sample seconds
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.
std::map< const MSVehicleType *, int > typedAmount
The number of vehicles that entered this lane within the sample interval by type. ...
std::map< const MSVehicleType *, double > typedTravelDistance
The sum of the distances the vehicles travelled by type.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Amitran *parent)
Constructor.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
MSMoveReminder & operator=(const MSMoveReminder &)
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.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
long long int SUMOTime
Definition: TraCIDefs.h:51
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
bool isEmpty() const
Returns whether any data was collected.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.