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 
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.
Data collector for edges/lanes.
Definition: MSMeanData.h:60
double vehLengthSum
The sum of the lengths the vehicles had.
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
virtual ~MSLaneMeanDataValues()
Destructor.
long long int SUMOTime
Definition: SUMOTime.h:35
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.
int nVehVaporized
The number of vehicles that left this lane within the sample interval.
double frontSampleSeconds
The number of vehicle probes regarding the vehicle front.
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
Notification
Definition of a vehicle state.
const MSMeanData_Net * myParent
The meandata parent.
const double myHaltSpeed
the minimum sample seconds
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder&#39;s lane.
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Net *parent)
Constructor.
Data structure for mean (aggregated) edge/lane values.
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.
A road/street connecting two junctions.
Definition: MSEdge.h:76
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:69
virtual ~MSMeanData_Net()
Destructor.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
double waitSeconds
The number of vehicle probes with small speed.
int nVehLeft
The number of vehicles that left this lane within the sample interval.
int nVehArrived
The number of vehicles that finished on the lane.
Representation of a vehicle or person.
double frontTravelledDistance
The travelled distance regarding the vehicle front.
int nVehLaneChangeFrom
The number of vehicles that changed from this lane.
double occupationSum
The sum of the occupation of the lane.
MSMoveReminder & operator=(const MSMoveReminder &)
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
bool isEmpty() const
Returns whether any data was collected.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Network state mean data collector for edges/lanes.
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
double minimalVehicleLength
minimal vehicle length in the current interval (used to determine a maximal density, see #3265)
Representation of a lane in the micro simulation.
Definition: MSLane.h:83