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 
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
Data collector for edges/lanes.
Definition: MSMeanData.h:60
SumoXMLTag
Numbers representing SUMO-XML - element names.
long long int SUMOTime
Definition: SUMOTime.h:35
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 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.
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.
std::map< const MSVehicleType *, double > typedSamples
The number of sampled vehicle movements by type (in s)
Data structure for mean (aggregated) edge/lane values.
A road/street connecting two junctions.
Definition: MSEdge.h:76
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
virtual ~MSMeanData_Amitran()
Destructor.
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:69
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.
Representation of a vehicle or person.
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:64
bool isEmpty() const
Returns whether any data was collected.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.