Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Network state mean data collector for edges/lanes
17 /****************************************************************************/
18 #ifndef MSMeanData_Amitran_h
19 #define MSMeanData_Amitran_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 #include <set>
29 #include <limits>
30 #include "MSMeanData.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OutputDevice;
37 class MSEdgeControl;
38 class MSEdge;
39 class MSLane;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
57 public:
66  public:
70  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
71  const MSMeanData_Amitran* parent);
72 
74  virtual ~MSLaneMeanDataValues();
75 
78  void reset(bool afterWrite = false);
79 
84  void addTo(MSMeanData::MeanDataValues& val) const;
85 
88 
102  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
104 
105  bool isEmpty() const;
106 
114  void write(OutputDevice& dev, const SUMOTime period,
115  const double numLanes, const double defaultTravelTime,
116  const int numVehicles = -1) const;
117 
118  protected:
122  void notifyMoveInternal(const SUMOTrafficObject& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double /* meanLengthOnLane */);
123 
124  private:
128  int amount;
129 
131  std::map<const MSVehicleType*, int> typedAmount;
132 
134  std::map<const MSVehicleType*, double> typedSamples;
135 
137  std::map<const MSVehicleType*, double> typedTravelDistance;
139 
140  };
141 
142 
143 public:
160  MSMeanData_Amitran(const std::string& id,
161  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
162  const bool useLanes, const bool withEmpty, const bool printDefaults,
163  const bool withInternal, const bool trackVehicles, const int detectPersons,
164  const double maxTravelTime, const double minSamples,
165  const double haltSpeed, const std::string& vTypes);
166 
167 
169  virtual ~MSMeanData_Amitran();
170 
173 
180  virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
182 
187  virtual std::string getEdgeID(const MSEdge* const edge);
188 
195  virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
196 
206  virtual bool writePrefix(OutputDevice& dev, const MeanDataValues& values,
207  const SumoXMLTag tag, const std::string id) const;
208 
209 protected:
215  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
216 
222  void resetOnly(SUMOTime stopTime);
223 
224 private:
226  const double myHaltSpeed;
227 
230 
233 
234 };
235 
236 
237 #endif
238 
239 /****************************************************************************/
240 
MSMeanData_Amitran::createValues
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
Definition: MSMeanData_Amitran.cpp:182
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
MSMeanData_Amitran::openInterval
virtual void openInterval(OutputDevice &dev, const SUMOTime startTime, const SUMOTime stopTime)
Writes the interval opener.
Definition: MSMeanData_Amitran.cpp:165
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSMeanData_Amitran::MSLaneMeanDataValues::notifyMoveInternal
void notifyMoveInternal(const SUMOTrafficObject &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.
Definition: MSMeanData_Amitran.cpp:80
MSMeanData_Amitran::MSLaneMeanDataValues::reset
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
Definition: MSMeanData_Amitran.cpp:53
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
MSMeanData_Amitran::~MSMeanData_Amitran
virtual ~MSMeanData_Amitran()
Destructor.
Definition: MSMeanData_Amitran.cpp:149
MSMeanData
Data collector for edges/lanes.
Definition: MSMeanData.h:59
MSMeanData_Amitran
Network state mean data collector for edges/lanes.
Definition: MSMeanData_Amitran.h:56
MSMeanData_Amitran::MSMeanData_Amitran
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 int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes)
Constructor.
Definition: MSMeanData_Amitran.cpp:132
MSMeanData_Amitran::operator=
MSMeanData_Amitran & operator=(const MSMeanData_Amitran &)
Invalidated assignment operator.
MSMeanData_Amitran::MSLaneMeanDataValues::write
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.
Definition: MSMeanData_Amitran.cpp:110
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSMeanData_Amitran::MSLaneMeanDataValues::amount
int amount
Definition: MSMeanData_Amitran.h:128
MSMeanData_Amitran::MSLaneMeanDataValues::MSLaneMeanDataValues
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Amitran *parent)
Constructor.
Definition: MSMeanData_Amitran.cpp:41
MSMeanData_Amitran::MSLaneMeanDataValues::~MSLaneMeanDataValues
virtual ~MSLaneMeanDataValues()
Destructor.
Definition: MSMeanData_Amitran.cpp:48
MSMeanData::MeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:68
MSMeanData_Amitran::MSLaneMeanDataValues::typedSamples
std::map< const MSVehicleType *, double > typedSamples
The number of sampled vehicle movements by type (in s)
Definition: MSMeanData_Amitran.h:134
MSDetectorFileOutput::detectPersons
bool detectPersons() const
Definition: MSDetectorFileOutput.h:166
MSMeanData_Amitran::MSLaneMeanDataValues::typedTravelDistance
std::map< const MSVehicleType *, double > typedTravelDistance
The sum of the distances the vehicles travelled by type.
Definition: MSMeanData_Amitran.h:137
MSMeanData_Amitran::myHaltSpeed
const double myHaltSpeed
the minimum sample seconds
Definition: MSMeanData_Amitran.h:226
MSMeanData_Amitran::MSLaneMeanDataValues::typedAmount
std::map< const MSVehicleType *, int > typedAmount
The number of vehicles that entered this lane within the sample interval by type.
Definition: MSMeanData_Amitran.h:131
MSMeanData_Amitran::MSLaneMeanDataValues::addTo
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
Definition: MSMeanData_Amitran.cpp:62
MSMeanData_Amitran::MSLaneMeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData_Amitran.h:65
MSMeanData_Amitran::writeXMLDetectorProlog
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
Definition: MSMeanData_Amitran.cpp:153
MSMeanData_Amitran::MSLaneMeanDataValues::isEmpty
bool isEmpty() const
Returns whether any data was collected.
Definition: MSMeanData_Amitran.cpp:104
MSMeanData_Amitran::writePrefix
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.
Definition: MSMeanData_Amitran.cpp:172
config.h
MSMeanData_Amitran::MSLaneMeanDataValues::notifyEnter
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
Definition: MSMeanData_Amitran.cpp:89
MSEdgeControl
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:74
MSMeanData.h
MSMeanData_Amitran::MSMeanData_Amitran
MSMeanData_Amitran(const MSMeanData_Amitran &)
Invalidated copy constructor.
MSMeanData_Amitran::resetOnly
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
MSMeanData_Amitran::getEdgeID
virtual std::string getEdgeID(const MSEdge *const edge)
Return the relevant edge id.
Definition: MSMeanData_Amitran.cpp:159