SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSMeanData.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // Data collector for edges/lanes
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 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 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <limits>
35 #include <microsim/MSEdgeControl.h>
36 #include <microsim/MSEdge.h>
37 #include <microsim/MSLane.h>
38 #include <microsim/MSVehicle.h>
39 #include <microsim/MSNet.h>
40 #include <utils/common/SUMOTime.h>
41 #include <utils/common/ToString.h>
43 #include "MSMeanData_Amitran.h"
44 #include "MSMeanData.h"
45 
46 #ifdef HAVE_INTERNAL
47 #include <microsim/MSGlobals.h>
48 #include <mesosim/MELoop.h>
49 #include <mesosim/MESegment.h>
50 #endif
51 
52 #ifdef CHECK_MEMORY_LEAKS
53 #include <foreign/nvwa/debug_new.h>
54 #endif // CHECK_MEMORY_LEAKS
55 
56 
57 // ===========================================================================
58 // method definitions
59 // ===========================================================================
60 // ---------------------------------------------------------------------------
61 // MSMeanData::MeanDataValues - methods
62 // ---------------------------------------------------------------------------
64  MSLane* const lane, const SUMOReal length, const bool doAdd,
65  const std::set<std::string>* const vTypes) :
66  MSMoveReminder("meandata_" + (lane == 0 ? "NULL" : lane->getID()), lane, doAdd),
67  myLaneLength(length),
68  sampleSeconds(0),
69  travelledDistance(0),
70  myVehicleTypes(vTypes) {}
71 
72 
74 }
75 
76 
77 bool
79  UNUSED_PARAMETER(reason);
80  return vehicleApplies(veh);
81 }
82 
83 
84 bool
86  // if the vehicle has arrived, the reminder must be kept so it can be
87  // notified of the arrival subsequently
88  SUMOReal timeOnLane = TS;
89  bool ret = true;
90  if (oldPos < 0 && newSpeed != 0) {
91  timeOnLane = newPos / newSpeed;
92  }
93  if (newPos - veh.getVehicleType().getLength() > myLaneLength && newSpeed != 0) {
94  timeOnLane -= (newPos - veh.getVehicleType().getLength() - myLaneLength) / newSpeed;
95  if (fabs(timeOnLane) < 0.001) { // reduce rounding errors
96  timeOnLane = 0.;
97  }
98  ret = veh.hasArrived();
99  }
100  if (timeOnLane < 0) {
101  WRITE_ERROR("Negative vehicle step fraction for '" + veh.getID() + "' on lane '" + getLane()->getID() + "'.");
102  return veh.hasArrived();
103  }
104  if (timeOnLane == 0) {
105  return veh.hasArrived();
106  }
107  notifyMoveInternal(veh, timeOnLane, newSpeed);
108  return ret;
109 }
110 
111 
112 bool
114 #ifdef HAVE_INTERNAL
116  return false; // reminder is re-added on every segment (@recheck for performance)
117  }
118 #endif
119  return reason == MSMoveReminder::NOTIFICATION_JUNCTION;
120 }
121 
122 
123 bool
125  return myVehicleTypes == 0 || myVehicleTypes->empty() ||
126  myVehicleTypes->find(veh.getVehicleType().getID()) != myVehicleTypes->end();
127 }
128 
129 
130 bool
132  return sampleSeconds == 0;
133 }
134 
135 
136 void
138 }
139 
140 
141 SUMOReal
143  return sampleSeconds;
144 }
145 
146 
147 // ---------------------------------------------------------------------------
148 // MSMeanData::MeanDataValueTracker - methods
149 // ---------------------------------------------------------------------------
151  const SUMOReal length,
152  const std::set<std::string>* const vTypes,
153  const MSMeanData* const parent)
154  : MSMeanData::MeanDataValues(lane, length, true, vTypes), myParent(parent) {
155  myCurrentData.push_back(new TrackerEntry(parent->createValues(lane, length, false)));
156 }
157 
158 
160 }
161 
162 
163 void
165  if (afterWrite) {
166  myCurrentData.pop_front();
167  } else {
168  myCurrentData.push_back(new TrackerEntry(myParent->createValues(myLane, myLaneLength, false)));
169  }
170 }
171 
172 
173 void
175  myCurrentData.front()->myValues->addTo(val);
176 }
177 
178 
179 void
181  myTrackedData[&veh]->myValues->notifyMoveInternal(veh, timeOnLane, speed);
182 }
183 
184 
185 bool
187  if (myParent == 0 || reason != MSMoveReminder::NOTIFICATION_SEGMENT) {
188  myTrackedData[&veh]->myNumVehicleLeft++;
189  }
190  return myTrackedData[&veh]->myValues->notifyLeave(veh, lastPos, reason);
191 }
192 
193 
194 bool
196  if (reason == MSMoveReminder::NOTIFICATION_SEGMENT) {
197  return true;
198  }
199  if (vehicleApplies(veh) && myTrackedData.find(&veh) == myTrackedData.end()) {
200  myTrackedData[&veh] = myCurrentData.back();
201  myTrackedData[&veh]->myNumVehicleEntered++;
202  if (!myTrackedData[&veh]->myValues->notifyEnter(veh, reason)) {
203  myTrackedData[&veh]->myNumVehicleLeft++;
204  myTrackedData.erase(&veh);
205  return false;
206  }
207  return true;
208  }
209  return false;
210 }
211 
212 
213 bool
215  return myCurrentData.front()->myValues->isEmpty();
216 }
217 
218 
219 void
221  const SUMOTime period,
222  const SUMOReal numLanes,
223  const SUMOReal defaultTravelTime,
224  const int /*numVehicles*/) const {
225  myCurrentData.front()->myValues->write(dev, period, numLanes,
226  defaultTravelTime,
227  myCurrentData.front()->myNumVehicleEntered);
228 }
229 
230 
231 int
233  int result = 0;
234  for (std::list<TrackerEntry*>::const_iterator it = myCurrentData.begin(); it != myCurrentData.end(); ++it) {
235  if ((*it)->myNumVehicleEntered == (*it)->myNumVehicleLeft) {
236  result++;
237  } else {
238  break;
239  }
240  }
241  return result;
242 }
243 
244 
245 SUMOReal
247  return myCurrentData.front()->myValues->getSamples();
248 }
249 
250 
251 // ---------------------------------------------------------------------------
252 // MSMeanData - methods
253 // ---------------------------------------------------------------------------
254 MSMeanData::MSMeanData(const std::string& id,
255  const SUMOTime dumpBegin, const SUMOTime dumpEnd,
256  const bool useLanes, const bool withEmpty,
257  const bool printDefaults, const bool withInternal, const bool trackVehicles,
258  const SUMOReal maxTravelTime,
259  const SUMOReal minSamples,
260  const std::set<std::string> vTypes) :
262  myMinSamples(minSamples),
263  myMaxTravelTime(maxTravelTime),
264  myVehicleTypes(vTypes),
265  myDumpEmpty(withEmpty),
266  myAmEdgeBased(!useLanes),
267  myDumpBegin(dumpBegin),
268  myDumpEnd(dumpEnd),
269  myPrintDefaults(printDefaults),
270  myDumpInternal(withInternal),
271  myTrackVehicles(trackVehicles) {
272 }
273 
274 
275 void
278  for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) {
279  if (myDumpInternal || (*e)->getPurpose() != MSEdge::EDGEFUNCTION_INTERNAL) {
280  myEdges.push_back(*e);
281  myMeasures.push_back(std::vector<MeanDataValues*>());
282  const std::vector<MSLane*>& lanes = (*e)->getLanes();
283 #ifdef HAVE_INTERNAL
285  MeanDataValues* data;
286  if (myTrackVehicles) {
287  data = new MeanDataValueTracker(0, lanes[0]->getLength(), &myVehicleTypes, this);
288  } else {
289  data = createValues(0, lanes[0]->getLength(), false);
290  }
291  data->setDescription("meandata_" + (*e)->getID());
292  myMeasures.back().push_back(data);
293  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(**e);
294  while (s != 0) {
295  s->addDetector(data);
296  s->prepareDetectorForWriting(*data);
297  s = s->getNextSegment();
298  }
299  data->reset();
300  data->reset(true);
301  continue;
302  }
303 #endif
305  myMeasures.back().push_back(new MeanDataValueTracker(0, lanes[0]->getLength(), &myVehicleTypes, this));
306  }
307  for (std::vector<MSLane*>::const_iterator lane = lanes.begin(); lane != lanes.end(); ++lane) {
308  if (myTrackVehicles) {
309  if (myAmEdgeBased) {
310  (*lane)->addMoveReminder(myMeasures.back().back());
311  } else {
312  myMeasures.back().push_back(new MeanDataValueTracker(*lane, (*lane)->getLength(), &myVehicleTypes, this));
313  }
314  } else {
315  myMeasures.back().push_back(createValues(*lane, (*lane)->getLength(), true));
316  }
317  }
318  }
319  }
320 }
321 
322 
324  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i) {
325  for (std::vector<MeanDataValues*>::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
326  delete *j;
327  }
328  }
329 }
330 
331 
332 void
334  UNUSED_PARAMETER(stopTime);
335 #ifdef HAVE_INTERNAL
337  MSEdgeVector::iterator edge = myEdges.begin();
338  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i, ++edge) {
339  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(**edge);
340  MeanDataValues* data = i->front();
341  while (s != 0) {
342  s->prepareDetectorForWriting(*data);
343  s = s->getNextSegment();
344  }
345  data->reset();
346  }
347  return;
348  }
349 #endif
350  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i) {
351  for (std::vector<MeanDataValues*>::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
352  (*j)->reset();
353  }
354  }
355 }
356 
357 
358 std::string
359 MSMeanData::getEdgeID(const MSEdge* const edge) {
360  return edge->getID();
361 }
362 
363 
364 void
366  const std::vector<MeanDataValues*>& edgeValues,
367  MSEdge* edge, SUMOTime startTime, SUMOTime stopTime) {
368 #ifdef HAVE_INTERNAL
370  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(*edge);
371  MeanDataValues* data = edgeValues.front();
372  while (s != 0) {
373  s->prepareDetectorForWriting(*data);
374  s = s->getNextSegment();
375  }
376  if (writePrefix(dev, *data, SUMO_TAG_EDGE, getEdgeID(edge))) {
377  data->write(dev, stopTime - startTime,
378  (SUMOReal)edge->getLanes().size(),
379  myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.);
380  }
381  data->reset(true);
382  return;
383  }
384 #endif
385  std::vector<MeanDataValues*>::const_iterator lane;
386  if (!myAmEdgeBased) {
387  bool writeCheck = myDumpEmpty;
388  if (!writeCheck) {
389  for (lane = edgeValues.begin(); lane != edgeValues.end(); ++lane) {
390  if (!(*lane)->isEmpty()) {
391  writeCheck = true;
392  break;
393  }
394  }
395  }
396  if (writeCheck) {
398  }
399  for (lane = edgeValues.begin(); lane != edgeValues.end(); ++lane) {
400  MeanDataValues& meanData = **lane;
401  if (writePrefix(dev, meanData, SUMO_TAG_LANE, meanData.getLane()->getID())) {
402  meanData.write(dev, stopTime - startTime, 1.f, myPrintDefaults ? meanData.getLane()->getLength() / meanData.getLane()->getSpeedLimit() : -1.);
403  }
404  meanData.reset(true);
405  }
406  if (writeCheck) {
407  dev.closeTag();
408  }
409  } else {
410  if (myTrackVehicles) {
411  MeanDataValues& meanData = **edgeValues.begin();
412  if (writePrefix(dev, meanData, SUMO_TAG_EDGE, edge->getID())) {
413  meanData.write(dev, stopTime - startTime, (SUMOReal)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.);
414  }
415  meanData.reset(true);
416  } else {
417  MeanDataValues* sumData = createValues(0, edge->getLength(), false);
418  for (lane = edgeValues.begin(); lane != edgeValues.end(); ++lane) {
419  MeanDataValues& meanData = **lane;
420  meanData.addTo(*sumData);
421  meanData.reset();
422  }
423  if (writePrefix(dev, *sumData, SUMO_TAG_EDGE, getEdgeID(edge))) {
424  sumData->write(dev, stopTime - startTime, (SUMOReal)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.);
425  }
426  delete sumData;
427  }
428  }
429 }
430 
431 
432 void
433 MSMeanData::openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime) {
436 }
437 
438 
439 bool
440 MSMeanData::writePrefix(OutputDevice& dev, const MeanDataValues& values, const SumoXMLTag tag, const std::string id) const {
441  if (myDumpEmpty || !values.isEmpty()) {
442  dev.openTag(tag).writeAttr(SUMO_ATTR_ID, id).writeAttr("sampledSeconds", values.getSamples());
443  return true;
444  }
445  return false;
446 }
447 
448 
449 void
451  SUMOTime startTime, SUMOTime stopTime) {
452  // check whether this dump shall be written for the current time
453  int numReady = myDumpBegin < stopTime && myDumpEnd - DELTA_T >= startTime ? 1 : 0;
454  if (myTrackVehicles && myDumpBegin < stopTime) {
455  myPendingIntervals.push_back(std::make_pair(startTime, stopTime));
456  numReady = (int)myPendingIntervals.size();
457  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i) {
458  for (std::vector<MeanDataValues*>::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
459  numReady = MIN2(numReady, ((MeanDataValueTracker*)*j)->getNumReady());
460  if (numReady == 0) {
461  break;
462  }
463  }
464  if (numReady == 0) {
465  break;
466  }
467  }
468  }
469  if (numReady == 0 || myTrackVehicles) {
470  resetOnly(stopTime);
471  }
472  while (numReady-- > 0) {
473  if (!myPendingIntervals.empty()) {
474  startTime = myPendingIntervals.front().first;
475  stopTime = myPendingIntervals.front().second;
476  myPendingIntervals.pop_front();
477  }
478  openInterval(dev, startTime, stopTime);
479  MSEdgeVector::iterator edge = myEdges.begin();
480  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i, ++edge) {
481  writeEdge(dev, (*i), *edge, startTime, stopTime);
482  }
483  dev.closeTag();
484  }
485 }
486 
487 
488 void
490  dev.writeXMLHeader("meandata", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/meandata_file.xsd\"");
491 }
492 
493 
494 void
496  if (step + DELTA_T == myDumpBegin) {
497  init();
498  }
499 }
500 
501 
502 /****************************************************************************/
503 
Data collector for edges/lanes.
Definition: MSMeanData.h:67
virtual ~MeanDataValueTracker()
Destructor.
Definition: MSMeanData.cpp:159
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:257
virtual MSMeanData::MeanDataValues * createValues(MSLane *const lane, const SUMOReal length, const bool doAdd) const =0
Create an instance of MeanDataValues.
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::vector< std::vector< MeanDataValues * > > myMeasures
Value collectors; sorted by edge, then by lane.
Definition: MSMeanData.h:438
MeanDataValues(MSLane *const lane, const SUMOReal length, const bool doAdd, const std::set< std::string > *const vTypes=0)
Constructor.
Definition: MSMeanData.cpp:63
const bool myDumpInternal
Whether internal lanes/edges shall be written.
Definition: MSMeanData.h:457
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:186
const SUMOTime myDumpEnd
Definition: MSMeanData.h:448
The vehicle arrived at a junction.
SUMOReal getLength() const
Returns the lane's length.
Definition: MSLane.h:370
const SUMOReal myMaxTravelTime
the maximum travel time to write
Definition: MSMeanData.h:432
Notification
Definition of a vehicle state.
SUMOReal getLength() const
Get vehicle's length [m].
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
The vehicle changes the segment (meso only)
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Computes current values and adds them to their sums.
Definition: MSMeanData.cpp:195
const std::set< std::string > myVehicleTypes
The vehicle types to look for (empty means all)
Definition: MSMeanData.h:435
#define TS
Definition: SUMOTime.h:52
virtual bool writePrefix(OutputDevice &dev, const MeanDataValues &values, const SumoXMLTag tag, const std::string id) const
Checks for emptiness and writes prefix into the given stream.
Definition: MSMeanData.cpp:440
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
const MSLane * getLane() const
Returns the lane the reminder works on.
std::list< TrackerEntry * > myCurrentData
The currently active meandata "intervals".
Definition: MSMeanData.h:297
bool writeXMLHeader(const std::string &rootElement, const std::string &attrs="", const std::string &comment="")
Writes an XML header with optional configuration.
const std::string & getID() const
Returns the id.
Definition: Named.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:81
const bool myPrintDefaults
Whether empty lanes/edges shall be written.
Definition: MSMeanData.h:454
MeanDataValueTracker(MSLane *const lane, const SUMOReal length, const std::set< std::string > *const vTypes=0, const MSMeanData *const parent=0)
Constructor.
Definition: MSMeanData.cpp:150
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:535
virtual bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Called if the vehicle leaves the reminder's lane.
Definition: MSMeanData.cpp:113
Representation of a vehicle.
Definition: SUMOVehicle.h:65
Data structure for mean (aggregated) edge/lane values.
Definition: MSMeanData.h:76
Definition: MSMeanData.h:277
MSEdgeVector myEdges
The corresponding first edges.
Definition: MSMeanData.h:451
const bool myAmEdgeBased
Information whether the output shall be edge-based (not lane-based)
Definition: MSMeanData.h:445
virtual bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Called if the vehicle enters the reminder's lane.
Definition: MSMeanData.cpp:78
virtual bool isEmpty() const
Returns whether any data was collected.
Definition: MSMeanData.cpp:131
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
T MIN2(T a, T b)
Definition: StdDefs.h:68
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
Definition: MSMeanData.cpp:489
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:362
virtual void write(OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles=-1) const =0
Writes output values into the given stream.
Something on a lane to be noticed about vehicle movement.
const SUMOTime myDumpBegin
The first and the last time step to write information (-1 indicates always)
Definition: MSMeanData.h:448
virtual ~MSMeanData()
Destructor.
Definition: MSMeanData.cpp:323
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:634
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Checks whether the reminder still has to be notified about the vehicle moves.
Definition: MSMeanData.cpp:85
const SUMOReal myMinSamples
the minimum sample seconds
Definition: MSMeanData.h:429
void notifyMoveInternal(SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
Internal notification about the vehicle moves.
Definition: MSMeanData.cpp:180
bool isEmpty() const
Returns whether any data was collected.
Definition: MSMeanData.cpp:214
virtual void addTo(MeanDataValues &val) const =0
Add the values of this to the given one and store them there.
virtual void openInterval(OutputDevice &dev, const SUMOTime startTime, const SUMOTime stopTime)
Writes the interval opener.
Definition: MSMeanData.cpp:433
void setDescription(const std::string &description)
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
MSMeanData(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 SUMOReal minSamples, const SUMOReal maxTravelTime, const std::set< std::string > vTypes)
Constructor.
Definition: MSMeanData.cpp:254
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
Definition: MSMeanData.cpp:174
virtual ~MeanDataValues()
Destructor.
Definition: MSMeanData.cpp:73
std::string myID
The name of the object.
Definition: Named.h:128
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes collected values into the given stream.
Definition: MSMeanData.cpp:450
virtual void reset(bool afterWrite=false)=0
Resets values so they may be used for the next interval.
std::list< std::pair< SUMOTime, SUMOTime > > myPendingIntervals
The intervals for which output still has to be generated (only in the tracking case) ...
Definition: MSMeanData.h:463
virtual bool hasArrived() const =0
Returns whether this vehicle has arrived.
void writeEdge(OutputDevice &dev, const std::vector< MeanDataValues * > &edgeValues, MSEdge *edge, SUMOTime startTime, SUMOTime stopTime)
Writes edge values into the given stream.
Definition: MSMeanData.cpp:365
virtual void update()
Called if a per timestep update is needed. Default does nothing.
Definition: MSMeanData.cpp:137
const std::string & getID() const
Returns the name of the vehicle type.
int SUMOTime
Definition: SUMOTime.h:43
void write(OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
Definition: MSMeanData.cpp:220
virtual void detectorUpdate(const SUMOTime step)
Updates the detector.
Definition: MSMeanData.cpp:495
SUMOReal getSamples() const
Returns the number of collected sample seconds.
Definition: MSMeanData.cpp:246
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:218
static const bool gUseMesoSim
Definition: MSGlobals.h:102
virtual SUMOReal getSamples() const
Returns the number of collected sample seconds.
Definition: MSMeanData.cpp:142
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition: MSNet.h:319
#define DELTA_T
Definition: SUMOTime.h:50
bool vehicleApplies(const SUMOVehicle &veh) const
Tests whether the vehicles type is to be regarded.
Definition: MSMeanData.cpp:124
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:78
void resetOnly(SUMOTime stopTime)
Resets network value in order to allow processing of the next interval.
Definition: MSMeanData.cpp:333
const bool myDumpEmpty
Whether empty lanes/edges shall be written.
Definition: MSMeanData.h:441
The edge is an internal edge.
Definition: MSEdge.h:98
Data structure for mean (aggregated) edge/lane values for tracked vehicles.
Definition: MSMeanData.h:195
const bool myTrackVehicles
Whether vehicles are tracked.
Definition: MSMeanData.h:460
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
virtual const std::string & getID() const =0
Get the vehicle's ID.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
virtual std::string getEdgeID(const MSEdge *const edge)
Return the relevant edge id.
Definition: MSMeanData.cpp:359
Base of value-generating classes (detectors)
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Called if the vehicle leaves the reminder's lane.
Definition: MSMeanData.cpp:186
const MSEdgeVector & getEdges() const
Returns loaded edges.
void init()
Adds the value collectors to all relevant edges.
Definition: MSMeanData.cpp:276
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
void reset(bool afterWrite)
Resets values so they may be used for the next interval.
Definition: MSMeanData.cpp:164