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 /****************************************************************************/
18 // Network state mean data collector for edges/lanes
19 /****************************************************************************/
20 #ifndef MSMeanData_Net_h
21 #define MSMeanData_Net_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <set>
31 #include <limits>
32 #include "MSMeanData.h"
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class OutputDevice;
39 class MSEdgeControl;
40 class MSEdge;
41 class MSLane;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
58 class MSMeanData_Net : public MSMeanData {
59 public:
68  public:
72  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
73  const MSMeanData_Net* parent);
74 
76  virtual ~MSLaneMeanDataValues();
77 
80  void reset(bool afterWrite = false);
81 
86  void addTo(MSMeanData::MeanDataValues& val) const;
87 
90 
100  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
101 
102 
116  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
118 
119  bool isEmpty() const;
120 
128  void write(OutputDevice& dev, const SUMOTime period,
129  const double numLanes, const double defaultTravelTime,
130  const int numVehicles = -1) const;
131 
132  protected:
136  void notifyMoveInternal(const SUMOTrafficObject& veh,
137  const double frontOnLane, const double timeOnLane, const double,
138  const double meanSpeedVehicleOnLane,
139  const double travelledDistanceFrontOnLane,
140  const double travelledDistanceVehicleOnLane,
141  const double meanLengthOnLane);
142 
143  private:
144 // /// @brief Calculate the vehicle front's distance to myLane's end for a vehicle that called notifyMoveInternal()
145 // /// maxDist gives the maximal distance to search back from the vehicle's current lane to myLane
146 // /// returns INVALID_DOUBLE if myLane wasn't found in that range
147 // double getVehicleDistToMyLane(const SUMOVehicle& veh, double maxDist);
148 
149  public:
154 
157 
160 
162  int nVehLeft;
163 
166 
168  double waitSeconds;
169 
170  private:
173 
176 
179 
182 
184  double vehLengthSum;
185 
188 
191 
193 
196 
197  };
198 
199 
200 public:
217  MSMeanData_Net(const std::string& id,
218  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
219  const bool useLanes, const bool withEmpty, const bool printDefaults,
220  const bool withInternal, const bool trackVehicles, const int detectPersons,
221  const double maxTravelTime, const double minSamples,
222  const double haltSpeed, const std::string& vTypes);
223 
224 
226  virtual ~MSMeanData_Net();
227 
228 protected:
234  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
235 
241  void resetOnly(SUMOTime stopTime);
242 
243 private:
245  const double myHaltSpeed;
246 
249 
252 
253 };
254 
255 #endif
256 
257 /****************************************************************************/
258 
MSMeanData_Net::MSLaneMeanDataValues::~MSLaneMeanDataValues
virtual ~MSLaneMeanDataValues()
Destructor.
Definition: MSMeanData_Net.cpp:69
MSMeanData_Net::operator=
MSMeanData_Net & operator=(const MSMeanData_Net &)
Invalidated assignment operator.
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSMeanData_Net::MSLaneMeanDataValues::frontTravelledDistance
double frontTravelledDistance
The travelled distance regarding the vehicle front.
Definition: MSMeanData_Net.h:181
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSMeanData_Net::MSLaneMeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData_Net.h:67
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:227
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSMeanData_Net::MSLaneMeanDataValues::nVehArrived
int nVehArrived
The number of vehicles that finished on the lane.
Definition: MSMeanData_Net.h:156
MSMeanData_Net::MSLaneMeanDataValues::waitSeconds
double waitSeconds
The number of vehicle probes with small speed.
Definition: MSMeanData_Net.h:168
MSMeanData_Net::MSLaneMeanDataValues::nVehLeft
int nVehLeft
The number of vehicles that left this lane within the sample interval.
Definition: MSMeanData_Net.h:162
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:94
MSMeanData_Net::MSLaneMeanDataValues::reset
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
Definition: MSMeanData_Net.cpp:74
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:172
MSMeanData_Net::MSLaneMeanDataValues::nVehLaneChangeFrom
int nVehLaneChangeFrom
The number of vehicles that changed from this lane.
Definition: MSMeanData_Net.h:172
MSMeanData_Net::MSLaneMeanDataValues::occupationSum
double occupationSum
The sum of the occupation of the lane.
Definition: MSMeanData_Net.h:187
MSMeanData
Data collector for edges/lanes.
Definition: MSMeanData.h:60
MSMeanData_Net::MSLaneMeanDataValues::nVehVaporized
int nVehVaporized
The number of vehicles that left this lane within the sample interval.
Definition: MSMeanData_Net.h:165
MSMeanData_Net::MSLaneMeanDataValues::isEmpty
bool isEmpty() const
Returns whether any data was collected.
Definition: MSMeanData_Net.cpp:220
MSMeanData_Net::MSLaneMeanDataValues::frontSampleSeconds
double frontSampleSeconds
The number of vehicle probes regarding the vehicle front.
Definition: MSMeanData_Net.h:178
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:313
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:119
MSMeanData_Net::MSLaneMeanDataValues::minimalVehicleLength
double minimalVehicleLength
minimal vehicle length in the current interval (used to determine a maximal density,...
Definition: MSMeanData_Net.h:190
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
MSMeanData_Net
Network state mean data collector for edges/lanes.
Definition: MSMeanData_Net.h:58
MSMeanData::MeanDataValues
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:69
MSDetectorFileOutput::detectPersons
bool detectPersons() const
Definition: MSDetectorFileOutput.h:167
MSMeanData_Net::MSLaneMeanDataValues::nVehLaneChangeTo
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
Definition: MSMeanData_Net.h:175
config.h
MSEdgeControl
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
MSMeanData_Net::myHaltSpeed
const double myHaltSpeed
the minimum sample seconds
Definition: MSMeanData_Net.h:245
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:55
MSMeanData_Net::MSLaneMeanDataValues::nVehEntered
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
Definition: MSMeanData_Net.h:159
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:292
MSMeanData_Net::MSLaneMeanDataValues::nVehDeparted
int nVehDeparted
Definition: MSMeanData_Net.h:153
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:197
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
MSMeanData_Net::~MSMeanData_Net
virtual ~MSMeanData_Net()
Destructor.
Definition: MSMeanData_Net.cpp:309
MSMeanData_Net::MSLaneMeanDataValues::myParent
const MSMeanData_Net * myParent
The meandata parent.
Definition: MSMeanData_Net.h:195
MSMeanData_Net::MSLaneMeanDataValues::vehLengthSum
double vehLengthSum
The sum of the lengths the vehicles had.
Definition: MSMeanData_Net.h:184