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 /****************************************************************************/
17 // Network state mean data collector for edges/lanes
18 /****************************************************************************/
19 #ifndef MSMeanData_Amitran_h
20 #define MSMeanData_Amitran_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <set>
30 #include <limits>
31 #include "MSMeanData.h"
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class OutputDevice;
38 class MSEdgeControl;
39 class MSEdge;
40 class MSLane;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
58 public:
67  public:
71  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
72  const MSMeanData_Amitran* parent);
73 
75  virtual ~MSLaneMeanDataValues();
76 
79  void reset(bool afterWrite = false);
80 
85  void addTo(MSMeanData::MeanDataValues& val) const;
86 
89 
103  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
105 
106  bool isEmpty() const;
107 
115  void write(OutputDevice& dev, const SUMOTime period,
116  const double numLanes, const double defaultTravelTime,
117  const int numVehicles = -1) const;
118 
119  protected:
123  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 */);
124 
125  private:
129  int amount;
130 
132  std::map<const MSVehicleType*, int> typedAmount;
133 
135  std::map<const MSVehicleType*, double> typedSamples;
136 
138  std::map<const MSVehicleType*, double> typedTravelDistance;
140 
141  };
142 
143 
144 public:
161  MSMeanData_Amitran(const std::string& id,
162  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
163  const bool useLanes, const bool withEmpty, const bool printDefaults,
164  const bool withInternal, const bool trackVehicles, const int detectPersons,
165  const double maxTravelTime, const double minSamples,
166  const double haltSpeed, const std::string& vTypes);
167 
168 
170  virtual ~MSMeanData_Amitran();
171 
174 
181  virtual void writeXMLDetectorProlog(OutputDevice& dev) const;
183 
188  virtual std::string getEdgeID(const MSEdge* const edge);
189 
196  virtual void openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime);
197 
207  virtual bool writePrefix(OutputDevice& dev, const MeanDataValues& values,
208  const SumoXMLTag tag, const std::string id) const;
209 
210 protected:
216  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
217 
223  void resetOnly(SUMOTime stopTime);
224 
225 private:
227  const double myHaltSpeed;
228 
231 
234 
235 };
236 
237 
238 #endif
239 
240 /****************************************************************************/
241 
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:183
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
MSMeanData_Amitran::openInterval
virtual void openInterval(OutputDevice &dev, const SUMOTime startTime, const SUMOTime stopTime)
Writes the interval opener.
Definition: MSMeanData_Amitran.cpp:166
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
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:81
MSMeanData_Amitran::MSLaneMeanDataValues::reset
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
Definition: MSMeanData_Amitran.cpp:54
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
MSMeanData_Amitran::~MSMeanData_Amitran
virtual ~MSMeanData_Amitran()
Destructor.
Definition: MSMeanData_Amitran.cpp:150
MSMeanData
Data collector for edges/lanes.
Definition: MSMeanData.h:60
MSMeanData_Amitran
Network state mean data collector for edges/lanes.
Definition: MSMeanData_Amitran.h:57
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:133
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:111
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
MSMeanData_Amitran::MSLaneMeanDataValues::amount
int amount
Definition: MSMeanData_Amitran.h:129
MSMeanData_Amitran::MSLaneMeanDataValues::MSLaneMeanDataValues
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Amitran *parent)
Constructor.
Definition: MSMeanData_Amitran.cpp:42
MSMeanData_Amitran::MSLaneMeanDataValues::~MSLaneMeanDataValues
virtual ~MSLaneMeanDataValues()
Destructor.
Definition: MSMeanData_Amitran.cpp:49
MSMeanData::MeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:69
MSMeanData_Amitran::MSLaneMeanDataValues::typedSamples
std::map< const MSVehicleType *, double > typedSamples
The number of sampled vehicle movements by type (in s)
Definition: MSMeanData_Amitran.h:135
MSDetectorFileOutput::detectPersons
bool detectPersons() const
Definition: MSDetectorFileOutput.h:167
MSMeanData_Amitran::MSLaneMeanDataValues::typedTravelDistance
std::map< const MSVehicleType *, double > typedTravelDistance
The sum of the distances the vehicles travelled by type.
Definition: MSMeanData_Amitran.h:138
MSMeanData_Amitran::myHaltSpeed
const double myHaltSpeed
the minimum sample seconds
Definition: MSMeanData_Amitran.h:227
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:132
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:63
MSMeanData_Amitran::MSLaneMeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData_Amitran.h:66
MSMeanData_Amitran::writeXMLDetectorProlog
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
Definition: MSMeanData_Amitran.cpp:154
MSMeanData_Amitran::MSLaneMeanDataValues::isEmpty
bool isEmpty() const
Returns whether any data was collected.
Definition: MSMeanData_Amitran.cpp:105
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:173
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:90
MSEdgeControl
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
MSMeanData.h
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:89
MSMeanData_Amitran::getEdgeID
virtual std::string getEdgeID(const MSEdge *const edge)
Return the relevant edge id.
Definition: MSMeanData_Amitran.cpp:160