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-2017 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 double length, const bool doAdd,
79  const MSMeanData_Amitran* parent);
80 
82  virtual ~MSLaneMeanDataValues();
83 
86  void reset(bool afterWrite = false);
87 
92  void addTo(MSMeanData::MeanDataValues& val) const;
93 
96 
110  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
112 
113  bool isEmpty() const;
114 
122  void write(OutputDevice& dev, const SUMOTime period,
123  const double numLanes, const double defaultTravelTime,
124  const int numVehicles = -1) const;
125 
126  protected:
130  void notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane);
131 
132  private:
136  int amount;
137 
139  std::map<const MSVehicleType*, int> typedAmount;
140 
142  std::map<const MSVehicleType*, double> typedSamples;
143 
145  std::map<const MSVehicleType*, double> typedTravelDistance;
147 
148  };
149 
150 
151 public:
167  MSMeanData_Amitran(const std::string& id,
168  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
169  const bool useLanes, const bool withEmpty, const bool printDefaults,
170  const bool withInternal, const bool trackVehicles,
171  const double maxTravelTime, const double minSamples,
172  const double haltSpeed, const std::string& vTypes);
173 
174 
176  virtual ~MSMeanData_Amitran();
177 
180 
187  virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
189 
194  virtual std::string getEdgeID(const MSEdge* const edge);
195 
202  virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
203 
213  virtual bool writePrefix(OutputDevice& dev, const MeanDataValues& values,
214  const SumoXMLTag tag, const std::string id) const;
215 
216 protected:
222  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
223 
229  void resetOnly(SUMOTime stopTime);
230 
231 private:
233  const double myHaltSpeed;
234 
237 
240 
241 };
242 
243 
244 #endif
245 
246 /****************************************************************************/
247 
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.
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.
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:67
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:76
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.
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.
void notifyMoveInternal(const SUMOVehicle &veh, const double, const double timeOnLane, const double, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane)
Internal notification about the vehicle moves.
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:71
long long int SUMOTime
Definition: TraCIDefs.h:52
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:79
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.