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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Network state mean data collector for edges/lanes
21 /****************************************************************************/
22 #ifndef MSMeanData_Net_h
23 #define MSMeanData_Net_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <set>
37 #include <limits>
38 #include "MSMeanData.h"
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class OutputDevice;
45 class MSEdgeControl;
46 class MSEdge;
47 class MSLane;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
64 class MSMeanData_Net : public MSMeanData {
65 public:
74  public:
78  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
79  const MSMeanData_Net* parent);
80 
82  virtual ~MSLaneMeanDataValues();
83 
86  void reset(bool afterWrite = false);
87 
92  void addTo(MSMeanData::MeanDataValues& val) const;
93 
96 
106  bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
107 
108 
122  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
124 
125  bool isEmpty() const;
126 
134  void write(OutputDevice& dev, const SUMOTime period,
135  const double numLanes, const double defaultTravelTime,
136  const int numVehicles = -1) const;
137 
138  protected:
142  void notifyMoveInternal(const SUMOVehicle& veh,
143  const double frontOnLane, const double timeOnLane, const double,
144  const double meanSpeedVehicleOnLane,
145  const double travelledDistanceFrontOnLane,
146  const double travelledDistanceVehicleOnLane,
147  const double meanLengthOnLane);
148 
149  private:
150 // /// @brief Calculate the vehicle front's distance to myLane's end for a vehicle that called notifyMoveInternal()
151 // /// maxDist gives the maximal distance to search back from the vehicle's current lane to myLane
152 // /// returns INVALID_DOUBLE if myLane wasn't found in that range
153 // double getVehicleDistToMyLane(const SUMOVehicle& veh, double maxDist);
154 
155  public:
160 
163 
166 
168  int nVehLeft;
169 
172 
174  double waitSeconds;
175 
176  private:
179 
182 
185 
188 
190  double vehLengthSum;
191 
194 
197 
199 
202 
203  };
204 
205 
206 public:
222  MSMeanData_Net(const std::string& id,
223  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
224  const bool useLanes, const bool withEmpty, const bool printDefaults,
225  const bool withInternal, const bool trackVehicles,
226  const double maxTravelTime, const double minSamples,
227  const double haltSpeed, const std::string& vTypes);
228 
229 
231  virtual ~MSMeanData_Net();
232 
233 protected:
239  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
240 
246  void resetOnly(SUMOTime stopTime);
247 
248 private:
250  const double myHaltSpeed;
251 
254 
257 
258 };
259 
260 #endif
261 
262 /****************************************************************************/
263 
Data collector for edges/lanes.
Definition: MSMeanData.h:66
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.
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder&#39;s lane.
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.
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:80
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:75
virtual ~MSMeanData_Net()
Destructor.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:73
void notifyMoveInternal(const SUMOVehicle &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.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
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 double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes)
Constructor.
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.
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:70
Network state mean data collector for edges/lanes.
long long int SUMOTime
Definition: TraCIDefs.h:51
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:77