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-2018 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(SUMOVehicle& 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 SUMOVehicle& 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:
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,
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 
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:36
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:75
virtual ~MSMeanData_Amitran()
Destructor.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:69
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:67
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:64
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:78
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.