SUMO - Simulation of Urban MObility
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 {
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  const MSEdge::EdgeBasicFunction efun = (*e)->getPurpose();
282  myEdges.push_back(*e);
283  myMeasures.push_back(std::vector<MeanDataValues*>());
284  const std::vector<MSLane*>& lanes = (*e)->getLanes();
285 #ifdef HAVE_INTERNAL
287  MeanDataValues* data;
288  if (myTrackVehicles) {
289  data = new MeanDataValueTracker(0, lanes[0]->getLength(), &myVehicleTypes, this);
290  } else {
291  data = createValues(0, lanes[0]->getLength(), false);
292  }
293  data->setDescription("meandata_" + (*e)->getID());
294  myMeasures.back().push_back(data);
295  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(**e);
296  while (s != 0) {
297  s->addDetector(data);
298  s->prepareDetectorForWriting(*data);
299  s = s->getNextSegment();
300  }
301  data->reset();
302  data->reset(true);
303  continue;
304  }
305 #endif
307  myMeasures.back().push_back(new MeanDataValueTracker(0, lanes[0]->getLength(), &myVehicleTypes, this));
308  }
309  for (std::vector<MSLane*>::const_iterator lane = lanes.begin(); lane != lanes.end(); ++lane) {
310  if (myTrackVehicles) {
311  if (myAmEdgeBased) {
312  (*lane)->addMoveReminder(myMeasures.back().back());
313  } else {
314  myMeasures.back().push_back(new MeanDataValueTracker(*lane, (*lane)->getLength(), &myVehicleTypes, this));
315  }
316  } else {
317  myMeasures.back().push_back(createValues(*lane, (*lane)->getLength(), true));
318  }
319  }
320  }
321  }
322 }
323 
324 
326  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i) {
327  for (std::vector<MeanDataValues*>::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
328  delete *j;
329  }
330  }
331 }
332 
333 
334 void
336  UNUSED_PARAMETER(stopTime);
337 #ifdef HAVE_INTERNAL
339  MSEdgeVector::iterator edge = myEdges.begin();
340  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i, ++edge) {
341  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(**edge);
342  MeanDataValues* data = i->front();
343  while (s != 0) {
344  s->prepareDetectorForWriting(*data);
345  s = s->getNextSegment();
346  }
347  data->reset();
348  }
349  return;
350  }
351 #endif
352  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i) {
353  for (std::vector<MeanDataValues*>::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
354  (*j)->reset();
355  }
356  }
357 }
358 
359 
360 std::string
361 MSMeanData::getEdgeID(const MSEdge* const edge) {
362  return edge->getID();
363 }
364 
365 
366 void
368  const std::vector<MeanDataValues*>& edgeValues,
369  MSEdge* edge, SUMOTime startTime, SUMOTime stopTime) {
370 #ifdef HAVE_INTERNAL
372  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(*edge);
373  MeanDataValues* data = edgeValues.front();
374  while (s != 0) {
375  s->prepareDetectorForWriting(*data);
376  s = s->getNextSegment();
377  }
378  if (writePrefix(dev, *data, SUMO_TAG_EDGE, getEdgeID(edge))) {
379  data->write(dev, stopTime - startTime,
380  (SUMOReal)edge->getLanes().size(),
381  myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.);
382  }
383  data->reset(true);
384  return;
385  }
386 #endif
387  std::vector<MeanDataValues*>::const_iterator lane;
388  if (!myAmEdgeBased) {
389  bool writeCheck = myDumpEmpty;
390  if (!writeCheck) {
391  for (lane = edgeValues.begin(); lane != edgeValues.end(); ++lane) {
392  if (!(*lane)->isEmpty()) {
393  writeCheck = true;
394  break;
395  }
396  }
397  }
398  if (writeCheck) {
400  }
401  for (lane = edgeValues.begin(); lane != edgeValues.end(); ++lane) {
402  MeanDataValues& meanData = **lane;
403  if (writePrefix(dev, meanData, SUMO_TAG_LANE, meanData.getLane()->getID())) {
404  meanData.write(dev, stopTime - startTime, 1.f, myPrintDefaults ? meanData.getLane()->getLength() / meanData.getLane()->getSpeedLimit() : -1.);
405  }
406  meanData.reset(true);
407  }
408  if (writeCheck) {
409  dev.closeTag();
410  }
411  } else {
412  if (myTrackVehicles) {
413  MeanDataValues& meanData = **edgeValues.begin();
414  if (writePrefix(dev, meanData, SUMO_TAG_EDGE, edge->getID())) {
415  meanData.write(dev, stopTime - startTime, (SUMOReal)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.);
416  }
417  meanData.reset(true);
418  } else {
419  MeanDataValues* sumData = createValues(0, edge->getLength(), false);
420  for (lane = edgeValues.begin(); lane != edgeValues.end(); ++lane) {
421  MeanDataValues& meanData = **lane;
422  meanData.addTo(*sumData);
423  meanData.reset();
424  }
425  if (writePrefix(dev, *sumData, SUMO_TAG_EDGE, getEdgeID(edge))) {
426  sumData->write(dev, stopTime - startTime, (SUMOReal)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.);
427  }
428  delete sumData;
429  }
430  }
431 }
432 
433 
434 void
435 MSMeanData::openInterval(OutputDevice& dev, const SUMOTime startTime, const SUMOTime stopTime) {
438 }
439 
440 
441 bool
442 MSMeanData::writePrefix(OutputDevice& dev, const MeanDataValues& values, const SumoXMLTag tag, const std::string id) const {
443  if (myDumpEmpty || !values.isEmpty()) {
444  dev.openTag(tag).writeAttr(SUMO_ATTR_ID, id).writeAttr("sampledSeconds", values.getSamples());
445  return true;
446  }
447  return false;
448 }
449 
450 
451 void
453  SUMOTime startTime, SUMOTime stopTime) {
454  // check whether this dump shall be written for the current time
455  int numReady = myDumpBegin < stopTime && myDumpEnd - DELTA_T >= startTime ? 1 : 0;
456  if (myTrackVehicles && myDumpBegin < stopTime) {
457  myPendingIntervals.push_back(std::make_pair(startTime, stopTime));
458  numReady = (int)myPendingIntervals.size();
459  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i) {
460  for (std::vector<MeanDataValues*>::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
461  numReady = MIN2(numReady, ((MeanDataValueTracker*)*j)->getNumReady());
462  if (numReady == 0) {
463  break;
464  }
465  }
466  if (numReady == 0) {
467  break;
468  }
469  }
470  }
471  if (numReady == 0 || myTrackVehicles) {
472  resetOnly(stopTime);
473  }
474  while (numReady-- > 0) {
475  if (!myPendingIntervals.empty()) {
476  startTime = myPendingIntervals.front().first;
477  stopTime = myPendingIntervals.front().second;
478  myPendingIntervals.pop_front();
479  }
480  openInterval(dev, startTime, stopTime);
481  MSEdgeVector::iterator edge = myEdges.begin();
482  for (std::vector<std::vector<MeanDataValues*> >::const_iterator i = myMeasures.begin(); i != myMeasures.end(); ++i, ++edge) {
483  writeEdge(dev, (*i), *edge, startTime, stopTime);
484  }
485  dev.closeTag();
486  }
487 }
488 
489 
490 void
492  dev.writeXMLHeader("meandata", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/meandata_file.xsd\"");
493 }
494 
495 
496 void
498  if (step + DELTA_T == myDumpBegin) {
499  init();
500  }
501 }
502 
503 
504 /****************************************************************************/
505 
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.
const SUMOReal myLaneLength
The length of the lane / edge the data collector is on.
Definition: MSMeanData.h:173
long long int SUMOTime
Definition: SUMOTime.h:43
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&#39;s lanes.
Definition: MSEdge.h:186
const SUMOTime myDumpEnd
Definition: MSMeanData.h:448
const std::set< std::string > *const myVehicleTypes
The vehicle types to look for (0 or empty means all)
Definition: MSMeanData.h:186
The vehicle arrived at a junction.
SUMOReal getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:376
MSLane *const myLane
Lane on which the reminder works.
const SUMOReal myMaxTravelTime
the maximum travel time to write
Definition: MSMeanData.h:432
Notification
Definition of a vehicle state.
SUMOReal getLength() const
Get vehicle&#39;s length [m].
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:162
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:442
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:90
const MSMeanData * myParent
The meandata parent.
Definition: MSMeanData.h:300
#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:65
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&#39;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&#39;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:73
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
Definition: MSMeanData.cpp:491
SUMOReal getSpeedLimit() const
Returns the lane&#39;s maximum allowed speed.
Definition: MSLane.h:368
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 void notifyMoveInternal(SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
Internal notification about the vehicle moves.
virtual ~MSMeanData()
Destructor.
Definition: MSMeanData.cpp:325
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:682
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:435
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
The edge is a pedestrian walking area (a special type of internal edge)
Definition: MSEdge.h:104
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:133
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes collected values into the given stream.
Definition: MSMeanData.cpp:452
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:367
virtual void update()
Called if a per timestep update is needed. Default does nothing.
Definition: MSMeanData.cpp:137
The edge is a pedestrian crossing (a special type of internal edge)
Definition: MSEdge.h:102
const std::string & getID() const
Returns the name of the vehicle type.
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
std::map< SUMOVehicle *, TrackerEntry * > myTrackedData
The map of vehicles to data entries.
Definition: MSMeanData.h:294
virtual void detectorUpdate(const SUMOTime step)
Updates the detector.
Definition: MSMeanData.cpp:497
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:214
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:339
#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:335
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&#39;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:361
Base of value-generating classes (detectors)
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Called if the vehicle leaves the reminder&#39;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&#39;s type.
void reset(bool afterWrite)
Resets values so they may be used for the next interval.
Definition: MSMeanData.cpp:164