Eclipse SUMO - Simulation of Urban MObility
MSMeanData_Net.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-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_Net_h
20 #define MSMeanData_Net_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 // ===========================================================================
57 class MSMeanData_Net : public MSMeanData {
58 public:
67  public:
71  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
72  const MSMeanData_Net* parent);
73 
75  virtual ~MSLaneMeanDataValues();
76 
79  void reset(bool afterWrite = false);
80 
85  void addTo(MSMeanData::MeanDataValues& val) const;
86 
89 
99  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
100 
101 
115  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
117 
118  bool isEmpty() const;
119 
127  void write(OutputDevice& dev, const SUMOTime period,
128  const double numLanes, const double defaultTravelTime,
129  const int numVehicles = -1) const;
130 
131  protected:
135  void notifyMoveInternal(const SUMOTrafficObject& veh,
136  const double frontOnLane, const double timeOnLane, const double,
137  const double meanSpeedVehicleOnLane,
138  const double travelledDistanceFrontOnLane,
139  const double travelledDistanceVehicleOnLane,
140  const double meanLengthOnLane);
141 
142  private:
143 // /// @brief Calculate the vehicle front's distance to myLane's end for a vehicle that called notifyMoveInternal()
144 // /// maxDist gives the maximal distance to search back from the vehicle's current lane to myLane
145 // /// returns INVALID_DOUBLE if myLane wasn't found in that range
146 // double getVehicleDistToMyLane(const SUMOVehicle& veh, double maxDist);
147 
148  public:
153 
156 
159 
161  int nVehLeft;
162 
165 
167  double waitSeconds;
168 
169  private:
172 
175 
178 
181 
183  double vehLengthSum;
184 
187 
190 
192 
195 
196  };
197 
198 
199 public:
216  MSMeanData_Net(const std::string& id,
217  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
218  const bool useLanes, const bool withEmpty, const bool printDefaults,
219  const bool withInternal, const bool trackVehicles, const int detectPersons,
220  const double maxTravelTime, const double minSamples,
221  const double haltSpeed, const std::string& vTypes);
222 
223 
225  virtual ~MSMeanData_Net();
226 
227 protected:
233  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
234 
240  void resetOnly(SUMOTime stopTime);
241 
242 private:
244  const double myHaltSpeed;
245 
248 
251 
252 };
253 
254 #endif
255 
256 /****************************************************************************/
257 
MSMeanData_Net::MSLaneMeanDataValues::~MSLaneMeanDataValues
virtual ~MSLaneMeanDataValues()
Destructor.
Definition: MSMeanData_Net.cpp:68
MSMeanData_Net::operator=
MSMeanData_Net & operator=(const MSMeanData_Net &)
Invalidated assignment operator.
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSMeanData_Net::MSLaneMeanDataValues::frontTravelledDistance
double frontTravelledDistance
The travelled distance regarding the vehicle front.
Definition: MSMeanData_Net.h:180
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSMeanData_Net::MSLaneMeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData_Net.h:66
MSMeanData_Net::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_Net.cpp:232
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSMeanData_Net::MSLaneMeanDataValues::nVehArrived
int nVehArrived
The number of vehicles that finished on the lane.
Definition: MSMeanData_Net.h:155
MSMeanData_Net::MSLaneMeanDataValues::waitSeconds
double waitSeconds
The number of vehicle probes with small speed.
Definition: MSMeanData_Net.h:167
MSMeanData_Net::MSLaneMeanDataValues::nVehLeft
int nVehLeft
The number of vehicles that left this lane within the sample interval.
Definition: MSMeanData_Net.h:161
MSMeanData_Net::MSLaneMeanDataValues::addTo
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
Definition: MSMeanData_Net.cpp:93
MSMeanData_Net::MSLaneMeanDataValues::reset
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
Definition: MSMeanData_Net.cpp:73
MSMeanData_Net::MSLaneMeanDataValues::notifyLeave
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder's lane.
Definition: MSMeanData_Net.cpp:171
MSMeanData_Net::MSLaneMeanDataValues::nVehLaneChangeFrom
int nVehLaneChangeFrom
The number of vehicles that changed from this lane.
Definition: MSMeanData_Net.h:171
MSMeanData_Net::MSLaneMeanDataValues::occupationSum
double occupationSum
The sum of the occupation of the lane.
Definition: MSMeanData_Net.h:186
MSMeanData
Data collector for edges/lanes.
Definition: MSMeanData.h:59
MSMeanData_Net::MSLaneMeanDataValues::nVehVaporized
int nVehVaporized
The number of vehicles that left this lane within the sample interval.
Definition: MSMeanData_Net.h:164
MSMeanData_Net::MSLaneMeanDataValues::isEmpty
bool isEmpty() const
Returns whether any data was collected.
Definition: MSMeanData_Net.cpp:225
MSMeanData_Net::MSLaneMeanDataValues::frontSampleSeconds
double frontSampleSeconds
The number of vehicle probes regarding the vehicle front.
Definition: MSMeanData_Net.h:177
MSMeanData_Net::createValues
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
Definition: MSMeanData_Net.cpp:318
MSMeanData_Net::MSLaneMeanDataValues::notifyMoveInternal
void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double meanLengthOnLane)
Internal notification about the vehicle moves.
Definition: MSMeanData_Net.cpp:118
MSMeanData_Net::MSLaneMeanDataValues::minimalVehicleLength
double minimalVehicleLength
minimal vehicle length in the current interval (used to determine a maximal density,...
Definition: MSMeanData_Net.h:189
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSMeanData_Net
Network state mean data collector for edges/lanes.
Definition: MSMeanData_Net.h:57
MSMeanData::MeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:68
MSDetectorFileOutput::detectPersons
bool detectPersons() const
Definition: MSDetectorFileOutput.h:166
MSMeanData_Net::MSLaneMeanDataValues::nVehLaneChangeTo
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
Definition: MSMeanData_Net.h:174
config.h
MSEdgeControl
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:74
MSMeanData_Net::myHaltSpeed
const double myHaltSpeed
the minimum sample seconds
Definition: MSMeanData_Net.h:244
MSMeanData.h
MSMeanData_Net::MSLaneMeanDataValues::MSLaneMeanDataValues
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Net *parent)
Constructor.
Definition: MSMeanData_Net.cpp:54
MSMeanData_Net::MSLaneMeanDataValues::nVehEntered
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
Definition: MSMeanData_Net.h:158
MSMeanData_Net::resetOnly
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
MSMeanData_Net::MSMeanData_Net
MSMeanData_Net(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_Net.cpp:297
MSMeanData_Net::MSLaneMeanDataValues::nVehDeparted
int nVehDeparted
Definition: MSMeanData_Net.h:152
MSMeanData_Net::MSLaneMeanDataValues::notifyEnter
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
Definition: MSMeanData_Net.cpp:199
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
MSMeanData_Net::~MSMeanData_Net
virtual ~MSMeanData_Net()
Destructor.
Definition: MSMeanData_Net.cpp:314
MSMeanData_Net::MSLaneMeanDataValues::myParent
const MSMeanData_Net * myParent
The meandata parent.
Definition: MSMeanData_Net.h:194
MSMeanData_Net::MSLaneMeanDataValues::vehLengthSum
double vehLengthSum
The sum of the lengths the vehicles had.
Definition: MSMeanData_Net.h:183