SUMO - Simulation of Urban MObility
MSMeanData_Net.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Network state mean data collector for edges/lanes
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSMeanData_Net_h
24 #define MSMeanData_Net_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <set>
38 #include <limits>
39 #include "MSMeanData.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class OutputDevice;
46 class MSEdgeControl;
47 class MSEdge;
48 class MSLane;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
65 class MSMeanData_Net : public MSMeanData {
66 public:
75  public:
79  MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd,
80  const MSMeanData_Net* parent);
81 
83  virtual ~MSLaneMeanDataValues();
84 
87  void reset(bool afterWrite = false);
88 
93  void addTo(MSMeanData::MeanDataValues& val) const;
94 
97 
107  bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
108 
109 
123  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
125 
126  bool isEmpty() const;
127 
135  void write(OutputDevice& dev, const SUMOTime period,
136  const double numLanes, const double defaultTravelTime,
137  const int numVehicles = -1) const;
138 
139  protected:
143  void notifyMoveInternal(const SUMOVehicle& veh,
144  const double frontOnLane, const double timeOnLane, const double,
145  const double meanSpeedVehicleOnLane,
146  const double travelledDistanceFrontOnLane,
147  const double travelledDistanceVehicleOnLane,
148  const double meanLengthOnLane);
149 
150  private:
151 // /// @brief Calculate the vehicle front's distance to myLane's end for a vehicle that called notifyMoveInternal()
152 // /// maxDist gives the maximal distance to search back from the vehicle's current lane to myLane
153 // /// returns INVALID_DOUBLE if myLane wasn't found in that range
154 // double getVehicleDistToMyLane(const SUMOVehicle& veh, double maxDist);
155 
156  public:
161 
164 
167 
169  int nVehLeft;
170 
173 
175  double waitSeconds;
176 
177  private:
180 
183 
186 
189 
191  double vehLengthSum;
192 
195 
198 
200 
203 
204  };
205 
206 
207 public:
223  MSMeanData_Net(const std::string& id,
224  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
225  const bool useLanes, const bool withEmpty, const bool printDefaults,
226  const bool withInternal, const bool trackVehicles,
227  const double maxTravelTime, const double minSamples,
228  const double haltSpeed, const std::string& vTypes);
229 
230 
232  virtual ~MSMeanData_Net();
233 
234 protected:
240  MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const;
241 
247  void resetOnly(SUMOTime stopTime);
248 
249 private:
251  const double myHaltSpeed;
252 
255 
258 
259 };
260 
261 #endif
262 
263 /****************************************************************************/
264 
Data collector for edges/lanes.
Definition: MSMeanData.h:67
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.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
Notification
Definition of a vehicle state.
const MSMeanData_Net * myParent
The meandata parent.
const double myHaltSpeed
the minimum sample seconds
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Net *parent)
Constructor.
Data structure for mean (aggregated) edge/lane values.
A road/street connecting two junctions.
Definition: MSEdge.h:81
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
Representation of a vehicle.
Definition: SUMOVehicle.h:67
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.
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:76
virtual ~MSMeanData_Net()
Destructor.
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:74
bool isEmpty() const
Returns whether any data was collected.
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 &)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
Network state mean data collector for edges/lanes.
long long int SUMOTime
Definition: TraCIDefs.h:52
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:79