SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RODFNet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A DFROUTER-network
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2014 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 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <cassert>
33 #include <iostream>
34 #include <map>
35 #include <vector>
36 #include <iterator>
37 #include "RODFNet.h"
38 #include "RODFDetector.h"
39 #include "RODFRouteDesc.h"
40 #include "RODFDetectorFlow.h"
41 #include "RODFEdge.h"
42 #include <cmath>
44 #include <utils/common/ToString.h>
46 #include <utils/geom/GeomHelper.h>
47 
48 #ifdef CHECK_MEMORY_LEAKS
49 #include <foreign/nvwa/debug_new.h>
50 #endif // CHECK_MEMORY_LEAKS
51 
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
56 RODFNet::RODFNet(bool amInHighwayMode)
57  : RONet(), myAmInHighwayMode(amInHighwayMode),
58  mySourceNumber(0), mySinkNumber(0), myInBetweenNumber(0), myInvalidNumber(0) {
60  myKeepTurnarounds = OptionsCont::getOptions().getBool("keep-turnarounds");
61 }
62 
63 
65 }
66 
67 
68 void
70  const std::map<std::string, ROEdge*>& edges = getEdgeMap();
71  for (std::map<std::string, ROEdge*>::const_iterator rit = edges.begin(); rit != edges.end(); ++rit) {
72  ROEdge* ce = (*rit).second;
73  unsigned int i = 0;
74  unsigned int length_size = ce->getNoFollowing();
75  for (i = 0; i < length_size; i++) {
76  ROEdge* help = ce->getFollower(i);
77  if (find(myDisallowedEdges.begin(), myDisallowedEdges.end(), help->getID()) != myDisallowedEdges.end()) {
78  // edges in sinks will not be used
79  continue;
80  }
81  if (!myKeepTurnarounds && help->getToNode() == ce->getFromNode()) {
82  // do not use turnarounds
83  continue;
84  }
85  // add the connection help->ce to myApproachingEdges
86  if (myApproachingEdges.find(help) == myApproachingEdges.end()) {
87  myApproachingEdges[help] = std::vector<ROEdge*>();
88  }
89  myApproachingEdges[help].push_back(ce);
90  // add the connection ce->help to myApproachingEdges
91  if (myApproachedEdges.find(ce) == myApproachedEdges.end()) {
92  myApproachedEdges[ce] = std::vector<ROEdge*>();
93  }
94  myApproachedEdges[ce].push_back(help);
95  }
96  }
97 }
98 
99 
100 void
102  myDetectorsOnEdges.clear();
103  myDetectorEdges.clear();
104  const std::vector<RODFDetector*>& dets = detcont.getDetectors();
105  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
106  ROEdge* e = getDetectorEdge(**i);
107  myDetectorsOnEdges[e].push_back((*i)->getID());
108  myDetectorEdges[(*i)->getID()] = e;
109  }
110 }
111 
112 
113 void
115  bool sourcesStrict) const {
116  PROGRESS_BEGIN_MESSAGE("Computing detector types");
117  const std::vector< RODFDetector*>& dets = detcont.getDetectors();
118  // build needed information. first
120  // compute detector types then
121  for (std::vector< RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
122  if (isSource(**i, detcont, sourcesStrict)) {
123  (*i)->setType(SOURCE_DETECTOR);
124  mySourceNumber++;
125  }
126  if (isDestination(**i, detcont)) {
127  (*i)->setType(SINK_DETECTOR);
128  mySinkNumber++;
129  }
130  if ((*i)->getType() == TYPE_NOT_DEFINED) {
131  (*i)->setType(BETWEEN_DETECTOR);
133  }
134  }
135  // recheck sources
136  for (std::vector< RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
137  if ((*i)->getType() == SOURCE_DETECTOR && isFalseSource(**i, detcont)) {
138  (*i)->setType(DISCARDED_DETECTOR);
139  myInvalidNumber++;
140  mySourceNumber--;
141  }
142  }
143  // print results
145  WRITE_MESSAGE("Computed detector types:");
146  WRITE_MESSAGE(" " + toString(mySourceNumber) + " source detectors");
147  WRITE_MESSAGE(" " + toString(mySinkNumber) + " sink detectors");
148  WRITE_MESSAGE(" " + toString(myInBetweenNumber) + " in-between detectors");
149  WRITE_MESSAGE(" " + toString(myInvalidNumber) + " invalid detectors");
150 }
151 
152 
153 bool
155  const RODFDetectorCon& detectors) const {
156  assert(myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end());
157  const std::vector<std::string>& detIDs = myDetectorsOnEdges.find(edge)->second;
158  std::vector<std::string>::const_iterator i;
159  for (i = detIDs.begin(); i != detIDs.end(); ++i) {
160  const RODFDetector& det = detectors.getDetector(*i);
161  if (det.getType() != BETWEEN_DETECTOR) {
162  return false;
163  }
164  }
165  return true;
166 }
167 
168 
169 bool
171  const RODFDetectorCon& detectors) const {
172  assert(myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end());
173  const std::vector<std::string>& detIDs = myDetectorsOnEdges.find(edge)->second;
174  std::vector<std::string>::const_iterator i;
175  for (i = detIDs.begin(); i != detIDs.end(); ++i) {
176  const RODFDetector& det = detectors.getDetector(*i);
177  if (det.getType() == SOURCE_DETECTOR) {
178  return true;
179  }
180  }
181  return false;
182 }
183 
184 
185 
186 void
188  bool keepUnfoundEnds,
189  bool keepShortestOnly,
190  std::vector<ROEdge*>& /*visited*/,
191  const RODFDetector& det, RODFRouteCont& into,
192  const RODFDetectorCon& detectors,
193  int maxFollowingLength,
194  std::vector<ROEdge*>& seen) const {
195  std::vector<RODFRouteDesc> unfoundEnds;
196  std::priority_queue<RODFRouteDesc, std::vector<RODFRouteDesc>, DFRouteDescByTimeComperator> toSolve;
197  std::map<ROEdge*, std::vector<ROEdge*> > dets2Follow;
198  dets2Follow[edge] = std::vector<ROEdge*>();
199  base.passedNo = 0;
200  SUMOReal minDist = OptionsCont::getOptions().getFloat("min-route-length");
201  toSolve.push(base);
202  while (!toSolve.empty()) {
203  RODFRouteDesc current = toSolve.top();
204  toSolve.pop();
205  ROEdge* last = *(current.edges2Pass.end() - 1);
206  if (hasDetector(last)) {
207  if (dets2Follow.find(last) == dets2Follow.end()) {
208  dets2Follow[last] = std::vector<ROEdge*>();
209  }
210  for (std::vector<ROEdge*>::reverse_iterator i = current.edges2Pass.rbegin() + 1; i != current.edges2Pass.rend(); ++i) {
211  if (hasDetector(*i)) {
212  dets2Follow[*i].push_back(last);
213  break;
214  }
215  }
216  }
217 
218  // do not process an edge twice
219  if (find(seen.begin(), seen.end(), last) != seen.end() && keepShortestOnly) {
220  continue;
221  }
222  seen.push_back(last);
223  // end if the edge has no further connections
224  if (!hasApproached(last)) {
225  // ok, no further connections to follow
226  current.factor = 1.;
227  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->getPosition());
228  if (minDist < cdist) {
229  into.addRouteDesc(current);
230  }
231  continue;
232  }
233  // check for passing detectors:
234  // if the current last edge is not the one the detector is placed on ...
235  bool addNextNoFurther = false;
236  if (last != getDetectorEdge(det)) {
237  // ... if there is a detector ...
238  if (hasDetector(last)) {
239  if (!hasInBetweenDetectorsOnly(last, detectors)) {
240  // ... and it's not an in-between-detector
241  // -> let's add this edge and the following, but not any further
242  addNextNoFurther = true;
243  current.lastDetectorEdge = last;
244  current.duration2Last = (SUMOTime) current.duration_2;
245  current.distance2Last = current.distance;
246  current.endDetectorEdge = last;
247  if (hasSourceDetector(last, detectors)) {
249  }
250  current.factor = 1.;
251  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->getPosition());
252  if (minDist < cdist) {
253  into.addRouteDesc(current);
254  }
255  continue;
256  } else {
257  // ... if it's an in-between-detector
258  // -> mark the current route as to be continued
259  current.passedNo = 0;
260  current.duration2Last = (SUMOTime) current.duration_2;
261  current.distance2Last = current.distance;
262  current.lastDetectorEdge = last;
263  }
264  }
265  }
266  // check for highway off-ramps
267  if (myAmInHighwayMode) {
268  // if it's beside the highway...
269  if (last->getSpeed() < 19.4 && last != getDetectorEdge(det)) {
270  // ... and has more than one following edge
271  if (myApproachedEdges.find(last)->second.size() > 1) {
272  // -> let's add this edge and the following, but not any further
273  addNextNoFurther = true;
274  }
275 
276  }
277  }
278  // check for missing end connections
279  if (!addNextNoFurther) {
280  // ... if this one would be processed, but already too many edge
281  // without a detector occured
282  if (current.passedNo > maxFollowingLength) {
283  // mark not to process any further
284  WRITE_WARNING("Could not close route for '" + det.getID() + "'");
285  unfoundEnds.push_back(current);
286  current.factor = 1.;
287  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->getPosition());
288  if (minDist < cdist) {
289  into.addRouteDesc(current);
290  }
291  continue;
292  }
293  }
294  // ... else: loop over the next edges
295  const std::vector<ROEdge*>& appr = myApproachedEdges.find(last)->second;
296  bool hadOne = false;
297  for (size_t i = 0; i < appr.size(); i++) {
298  if (find(current.edges2Pass.begin(), current.edges2Pass.end(), appr[i]) != current.edges2Pass.end()) {
299  // do not append an edge twice (do not build loops)
300  continue;
301  }
302  RODFRouteDesc t(current);
303  t.duration_2 += (appr[i]->getLength() / appr[i]->getSpeed());
304  t.distance += appr[i]->getLength();
305  t.edges2Pass.push_back(appr[i]);
306  if (!addNextNoFurther) {
307  t.passedNo = t.passedNo + 1;
308  toSolve.push(t);
309  } else {
310  if (!hadOne) {
311  t.factor = (SUMOReal) 1. / (SUMOReal) appr.size();
312  SUMOReal cdist = current.edges2Pass[0]->getFromNode()->getPosition().distanceTo(current.edges2Pass.back()->getToNode()->getPosition());
313  if (minDist < cdist) {
314  into.addRouteDesc(t);
315  }
316  hadOne = true;
317  }
318  }
319  }
320  }
321  //
322  if (!keepUnfoundEnds) {
323  std::vector<RODFRouteDesc>::iterator i;
324  std::vector<const ROEdge*> lastDetEdges;
325  for (i = unfoundEnds.begin(); i != unfoundEnds.end(); ++i) {
326  if (find(lastDetEdges.begin(), lastDetEdges.end(), (*i).lastDetectorEdge) == lastDetEdges.end()) {
327  lastDetEdges.push_back((*i).lastDetectorEdge);
328  } else {
329  bool ok = into.removeRouteDesc(*i);
330  assert(ok);
331  UNUSED_PARAMETER(ok); // ony used for assertion
332  }
333  }
334  } else {
335  // !!! patch the factors
336  }
337  while (!toSolve.empty()) {
338 // RODFRouteDesc d = toSolve.top();
339  toSolve.pop();
340 // delete d;
341  }
342 }
343 
344 
345 void
346 RODFNet::buildRoutes(RODFDetectorCon& detcont, bool allEndFollower,
347  bool keepUnfoundEnds, bool includeInBetween,
348  bool keepShortestOnly, int maxFollowingLength) const {
349  // build needed information first
351  // then build the routes
352  std::map<ROEdge*, RODFRouteCont* > doneEdges;
353  const std::vector< RODFDetector*>& dets = detcont.getDetectors();
354  for (std::vector< RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
355  ROEdge* e = getDetectorEdge(**i);
356  if (doneEdges.find(e) != doneEdges.end()) {
357  // use previously build routes
358  (*i)->addRoutes(new RODFRouteCont(*doneEdges[e]));
359  continue;
360  }
361  std::vector<ROEdge*> seen;
362  RODFRouteCont* routes = new RODFRouteCont();
363  doneEdges[e] = routes;
364  RODFRouteDesc rd;
365  rd.edges2Pass.push_back(e);
366  rd.duration_2 = (e->getLength() / e->getSpeed());
367  rd.endDetectorEdge = 0;
368  rd.lastDetectorEdge = 0;
369  rd.distance = e->getLength();
370  rd.distance2Last = 0;
371  rd.duration2Last = 0;
372 
373  rd.overallProb = 0;
374 
375  std::vector<ROEdge*> visited;
376  visited.push_back(e);
377  computeRoutesFor(e, rd, 0, keepUnfoundEnds, keepShortestOnly,
378  visited, **i, *routes, detcont, maxFollowingLength, seen);
379  if (allEndFollower) {
380  routes->addAllEndFollower();
381  }
383  (*i)->addRoutes(routes);
384 
385  // add routes to in-between detectors if wished
386  if (includeInBetween) {
387  // go through the routes
388  const std::vector<RODFRouteDesc>& r = routes->get();
389  for (std::vector<RODFRouteDesc>::const_iterator j = r.begin(); j != r.end(); ++j) {
390  const RODFRouteDesc& mrd = *j;
391  SUMOReal duration = mrd.duration_2;
392  SUMOReal distance = mrd.distance;
393  // go through each route's edges
394  std::vector<ROEdge*>::const_iterator routeend = mrd.edges2Pass.end();
395  for (std::vector<ROEdge*>::const_iterator k = mrd.edges2Pass.begin(); k != routeend; ++k) {
396  // check whether any detectors lies on the current edge
397  if (myDetectorsOnEdges.find(*k) == myDetectorsOnEdges.end()) {
398  duration -= (*k)->getLength() / (*k)->getSpeed();
399  distance -= (*k)->getLength();
400  continue;
401  }
402  // get the detectors
403  const std::vector<std::string>& dets = myDetectorsOnEdges.find(*k)->second;
404  // go through the detectors
405  for (std::vector<std::string>::const_iterator l = dets.begin(); l != dets.end(); ++l) {
406  const RODFDetector& m = detcont.getDetector(*l);
407  if (m.getType() == BETWEEN_DETECTOR) {
408  RODFRouteDesc nrd;
409  copy(k, routeend, back_inserter(nrd.edges2Pass));
410  nrd.duration_2 = duration;
413  nrd.distance = distance;
414  nrd.distance2Last = mrd.distance2Last;
415  nrd.duration2Last = mrd.duration2Last;
416  nrd.overallProb = mrd.overallProb;
417  nrd.factor = mrd.factor;
418  ((RODFDetector&) m).addRoute(nrd);
419  }
420  }
421  duration -= (*k)->getLength() / (*k)->getSpeed();
422  distance -= (*k)->getLength();
423  }
424  }
425  }
426 
427  }
428 }
429 
430 
431 void
433  RODFDetectorFlows& flows,
434  SUMOTime startTime, SUMOTime endTime,
435  SUMOTime stepOffset) {
436  {
437  if (flows.knows(detector->getID())) {
438  const std::vector<FlowDef>& detFlows = flows.getFlowDefs(detector->getID());
439  for (std::vector<FlowDef>::const_iterator j = detFlows.begin(); j != detFlows.end(); ++j) {
440  if ((*j).qPKW > 0 || (*j).qLKW > 0) {
441  return;
442  }
443  }
444  }
445  }
446  // ok, there is no information for the whole time;
447  // lets find preceding detectors and rebuild the flows if possible
448  WRITE_WARNING("Detector '" + detector->getID() + "' has no flows.\n Trying to rebuild.");
449  // go back and collect flows
450  std::vector<ROEdge*> previous;
451  {
452  std::vector<IterationEdge> missing;
453  IterationEdge ie;
454  ie.depth = 0;
455  ie.edge = getDetectorEdge(*detector);
456  missing.push_back(ie);
457  bool maxDepthReached = false;
458  while (!missing.empty() && !maxDepthReached) {
459  IterationEdge last = missing.back();
460  missing.pop_back();
461  std::vector<ROEdge*> approaching = myApproachingEdges[last.edge];
462  for (std::vector<ROEdge*>::const_iterator j = approaching.begin(); j != approaching.end(); ++j) {
463  if (hasDetector(*j)) {
464  previous.push_back(*j);
465  } else {
466  ie.depth = last.depth + 1;
467  ie.edge = *j;
468  missing.push_back(ie);
469  if (ie.depth > 5) {
470  maxDepthReached = true;
471  }
472  }
473  }
474  }
475  if (maxDepthReached) {
476  WRITE_WARNING(" Could not build list of previous flows.");
477  }
478  }
479  // Edges with previous detectors are now in "previous";
480  // compute following
481  std::vector<ROEdge*> latter;
482  {
483  std::vector<IterationEdge> missing;
484  for (std::vector<ROEdge*>::const_iterator k = previous.begin(); k != previous.end(); ++k) {
485  IterationEdge ie;
486  ie.depth = 0;
487  ie.edge = *k;
488  missing.push_back(ie);
489  }
490  bool maxDepthReached = false;
491  while (!missing.empty() && !maxDepthReached) {
492  IterationEdge last = missing.back();
493  missing.pop_back();
494  std::vector<ROEdge*> approached = myApproachedEdges[last.edge];
495  for (std::vector<ROEdge*>::const_iterator j = approached.begin(); j != approached.end(); ++j) {
496  if (*j == getDetectorEdge(*detector)) {
497  continue;
498  }
499  if (hasDetector(*j)) {
500  latter.push_back(*j);
501  } else {
502  IterationEdge ie;
503  ie.depth = last.depth + 1;
504  ie.edge = *j;
505  missing.push_back(ie);
506  if (ie.depth > 5) {
507  maxDepthReached = true;
508  }
509  }
510  }
511  }
512  if (maxDepthReached) {
513  WRITE_WARNING(" Could not build list of latter flows.");
514  return;
515  }
516  }
517  // Edges with latter detectors are now in "latter";
518 
519  // lets not validate them by now - surely this should be done
520  // for each time step: collect incoming flows; collect outgoing;
521  std::vector<FlowDef> mflows;
522  int index = 0;
523  for (SUMOTime t = startTime; t < endTime; t += stepOffset, index++) {
524  FlowDef inFlow;
525  inFlow.qLKW = 0;
526  inFlow.qPKW = 0;
527  inFlow.vLKW = 0;
528  inFlow.vPKW = 0;
529  // collect incoming
530  {
531  // !! time difference is missing
532  for (std::vector<ROEdge*>::iterator i = previous.begin(); i != previous.end(); ++i) {
533  const std::vector<FlowDef>& flows = static_cast<const RODFEdge*>(*i)->getFlows();
534  if (flows.size() != 0) {
535  const FlowDef& srcFD = flows[index];
536  inFlow.qLKW += srcFD.qLKW;
537  inFlow.qPKW += srcFD.qPKW;
538  inFlow.vLKW += srcFD.vLKW;
539  inFlow.vPKW += srcFD.vPKW;
540  }
541  }
542  }
543  inFlow.vLKW /= (SUMOReal) previous.size();
544  inFlow.vPKW /= (SUMOReal) previous.size();
545  // collect outgoing
546  FlowDef outFlow;
547  outFlow.qLKW = 0;
548  outFlow.qPKW = 0;
549  outFlow.vLKW = 0;
550  outFlow.vPKW = 0;
551  {
552  // !! time difference is missing
553  for (std::vector<ROEdge*>::iterator i = latter.begin(); i != latter.end(); ++i) {
554  const std::vector<FlowDef>& flows = static_cast<const RODFEdge*>(*i)->getFlows();
555  if (flows.size() != 0) {
556  const FlowDef& srcFD = flows[index];
557  outFlow.qLKW += srcFD.qLKW;
558  outFlow.qPKW += srcFD.qPKW;
559  outFlow.vLKW += srcFD.vLKW;
560  outFlow.vPKW += srcFD.vPKW;
561  }
562  }
563  }
564  outFlow.vLKW /= (SUMOReal) latter.size();
565  outFlow.vPKW /= (SUMOReal) latter.size();
566  //
567  FlowDef mFlow;
568  mFlow.qLKW = inFlow.qLKW - outFlow.qLKW;
569  mFlow.qPKW = inFlow.qPKW - outFlow.qPKW;
570  mFlow.vLKW = (inFlow.vLKW + outFlow.vLKW) / (SUMOReal) 2.;
571  mFlow.vPKW = (inFlow.vPKW + outFlow.vPKW) / (SUMOReal) 2.;
572  mflows.push_back(mFlow);
573  }
574  static_cast<RODFEdge*>(getDetectorEdge(*detector))->setFlows(mflows);
575  flows.setFlows(detector->getID(), mflows);
576 }
577 
578 
579 void
581  RODFDetectorFlows& flows,
582  SUMOTime startTime, SUMOTime endTime,
583  SUMOTime stepOffset) {
584  const std::vector<RODFDetector*>& dets = detectors.getDetectors();
585  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
586  // check whether there is at least one entry with a flow larger than zero
587  revalidateFlows(*i, flows, startTime, endTime, stepOffset);
588  }
589 }
590 
591 
592 
593 void
595  RODFDetectorFlows& flows) {
596  const std::vector<RODFDetector*>& dets = detectors.getDetectors();
597  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end();) {
598  bool remove = true;
599  // check whether there is at least one entry with a flow larger than zero
600  if (flows.knows((*i)->getID())) {
601  remove = false;
602  }
603  if (remove) {
604  WRITE_MESSAGE("Removed detector '" + (*i)->getID() + "' because no flows for him exist.");
605  flows.removeFlow((*i)->getID());
606  detectors.removeDetector((*i)->getID());
607  i = dets.begin();
608  } else {
609  i++;
610  }
611  }
612 }
613 
614 
615 
616 void
618  RODFDetectorFlows& flows) {
619  const std::vector<RODFDetector*>& dets = detectors.getDetectors();
620  for (std::vector<RODFDetector*>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
621  bool remove = true;
622  // check whether there is at least one entry with a flow larger than zero
623  if (flows.knows((*i)->getID())) {
624  remove = false;
625  }
626  if (remove) {
627  WRITE_MESSAGE("Detector '" + (*i)->getID() + "' has no flow.");
628  }
629  }
630 }
631 
632 
633 
634 ROEdge*
636  std::string edgeName = det.getLaneID();
637  edgeName = edgeName.substr(0, edgeName.rfind('_'));
638  ROEdge* ret = getEdge(edgeName);
639  if (ret == 0) {
640  throw ProcessError("Edge '" + edgeName + "' used by detector '" + det.getID() + "' is not known.");
641  }
642  return ret;
643 }
644 
645 
646 bool
648  return
649  myApproachingEdges.find(edge) != myApproachingEdges.end()
650  &&
651  myApproachingEdges.find(edge)->second.size() != 0;
652 }
653 
654 
655 bool
657  return
658  myApproachedEdges.find(edge) != myApproachedEdges.end()
659  &&
660  myApproachedEdges.find(edge)->second.size() != 0;
661 }
662 
663 
664 bool
666  return
667  myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end()
668  &&
669  myDetectorsOnEdges.find(edge)->second.size() != 0;
670 }
671 
672 
673 const std::vector<std::string>&
675  return myDetectorsOnEdges.find(edge)->second;
676 }
677 
678 
679 SUMOReal
680 RODFNet::getAbsPos(const RODFDetector& det) const {
681  if (det.getPos() >= 0) {
682  return det.getPos();
683  }
684  return getDetectorEdge(det)->getLength() + det.getPos();
685 }
686 
687 bool
688 RODFNet::isSource(const RODFDetector& det, const RODFDetectorCon& detectors,
689  bool strict) const {
690  std::vector<ROEdge*> seen;
691  return
692  isSource(det, getDetectorEdge(det), seen, detectors, strict);
693 }
694 
695 bool
696 RODFNet::isFalseSource(const RODFDetector& det, const RODFDetectorCon& detectors) const {
697  std::vector<ROEdge*> seen;
698  return
699  isFalseSource(det, getDetectorEdge(det), seen, detectors);
700 }
701 
702 bool
703 RODFNet::isDestination(const RODFDetector& det, const RODFDetectorCon& detectors) const {
704  std::vector<ROEdge*> seen;
705  return isDestination(det, getDetectorEdge(det), seen, detectors);
706 }
707 
708 
709 bool
711  std::vector<ROEdge*>& seen,
712  const RODFDetectorCon& detectors,
713  bool strict) const {
714  if (seen.size() == 1000) { // !!!
715  WRITE_WARNING("Quitting checking for being a source for detector '" + det.getID() + "' due to seen edge limit.");
716  return false;
717  }
718  if (edge == getDetectorEdge(det)) {
719  // maybe there is another detector at the same edge
720  // get the list of this/these detector(s)
721  const std::vector<std::string>& detsOnEdge = myDetectorsOnEdges.find(edge)->second;
722  for (std::vector<std::string>::const_iterator i = detsOnEdge.begin(); i != detsOnEdge.end(); ++i) {
723  if ((*i) == det.getID()) {
724  continue;
725  }
726  const RODFDetector& sec = detectors.getDetector(*i);
727  if (getAbsPos(sec) < getAbsPos(det)) {
728  // ok, there is another detector on the same edge and it is
729  // before this one -> no source
730  return false;
731  }
732  }
733  }
734  // it's a source if no edges are approaching the edge
735  if (!hasApproaching(edge)) {
736  if (edge != getDetectorEdge(det)) {
737  if (hasDetector(edge)) {
738  return false;
739  }
740  }
741  return true;
742  }
743  if (edge != getDetectorEdge(det)) {
744  // ok, we are at one of the edges in front
745  if (myAmInHighwayMode) {
746  if (edge->getSpeed() >= 19.4) {
747  if (hasDetector(edge)) {
748  // we are still on the highway and there is another detector
749  return false;
750  }
751  // the next is a hack for the A100 scenario...
752  // We have to look into further edges herein edges
753  const std::vector<ROEdge*>& appr = myApproachingEdges.find(edge)->second;
754  size_t noOk = 0;
755  size_t noFalse = 0;
756  size_t noSkipped = 0;
757  for (size_t i = 0; i < appr.size(); i++) {
758  if (!hasDetector(appr[i])) {
759  noOk++;
760  } else {
761  noFalse++;
762  }
763  }
764  if ((noFalse + noSkipped) == appr.size()) {
765  return false;
766  }
767  }
768  }
769  }
770 
771  if (myAmInHighwayMode) {
772  if (edge->getSpeed() < 19.4 && edge != getDetectorEdge(det)) {
773  // we have left the highway already
774  // -> the detector will be a highway source
775  if (!hasDetector(edge)) {
776  return true;
777  }
778  }
779  }
780  if (myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end()
781  &&
782  myDetectorEdges.find(det.getID())->second != edge) {
783  return false;
784  }
785 
786  // let's check the edges in front
787  const std::vector<ROEdge*>& appr = myApproachingEdges.find(edge)->second;
788  size_t noOk = 0;
789  size_t noFalse = 0;
790  size_t noSkipped = 0;
791  seen.push_back(edge);
792  for (size_t i = 0; i < appr.size(); i++) {
793  bool had = std::find(seen.begin(), seen.end(), appr[i]) != seen.end();
794  if (!had) {
795  if (isSource(det, appr[i], seen, detectors, strict)) {
796  noOk++;
797  } else {
798  noFalse++;
799  }
800  } else {
801  noSkipped++;
802  }
803  }
804  if (!strict) {
805  return (noFalse + noSkipped) != appr.size();
806  } else {
807  return (noOk + noSkipped) == appr.size();
808  }
809 }
810 
811 
812 bool
813 RODFNet::isDestination(const RODFDetector& det, ROEdge* edge, std::vector<ROEdge*>& seen,
814  const RODFDetectorCon& detectors) const {
815  if (seen.size() == 1000) { // !!!
816  WRITE_WARNING("Quitting checking for being a destination for detector '" + det.getID() + "' due to seen edge limit.");
817  return false;
818  }
819  if (edge == getDetectorEdge(det)) {
820  // maybe there is another detector at the same edge
821  // get the list of this/these detector(s)
822  const std::vector<std::string>& detsOnEdge = myDetectorsOnEdges.find(edge)->second;
823  for (std::vector<std::string>::const_iterator i = detsOnEdge.begin(); i != detsOnEdge.end(); ++i) {
824  if ((*i) == det.getID()) {
825  continue;
826  }
827  const RODFDetector& sec = detectors.getDetector(*i);
828  if (getAbsPos(sec) > getAbsPos(det)) {
829  // ok, there is another detector on the same edge and it is
830  // after this one -> no destination
831  return false;
832  }
833  }
834  }
835  if (!hasApproached(edge)) {
836  if (edge != getDetectorEdge(det)) {
837  if (hasDetector(edge)) {
838  return false;
839  }
840  }
841  return true;
842  }
843  if (edge != getDetectorEdge(det)) {
844  // ok, we are at one of the edges coming behind
845  if (myAmInHighwayMode) {
846  if (edge->getSpeed() >= 19.4) {
847  if (hasDetector(edge)) {
848  // we are still on the highway and there is another detector
849  return false;
850  }
851  }
852  }
853  }
854 
855  if (myAmInHighwayMode) {
856  if (edge->getSpeed() < 19.4 && edge != getDetectorEdge(det)) {
857  if (hasDetector(edge)) {
858  return true;
859  }
860  if (myApproachedEdges.find(edge)->second.size() > 1) {
861  return true;
862  }
863 
864  }
865  }
866 
867  if (myDetectorsOnEdges.find(edge) != myDetectorsOnEdges.end()
868  &&
869  myDetectorEdges.find(det.getID())->second != edge) {
870  return false;
871  }
872  const std::vector<ROEdge*>& appr = myApproachedEdges.find(edge)->second;
873  bool isall = true;
874  size_t no = 0;
875  seen.push_back(edge);
876  for (size_t i = 0; i < appr.size() && isall; i++) {
877  bool had = std::find(seen.begin(), seen.end(), appr[i]) != seen.end();
878  if (!had) {
879  if (!isDestination(det, appr[i], seen, detectors)) {
880  no++;
881  isall = false;
882  }
883  }
884  }
885  return isall;
886 }
887 
888 bool
889 RODFNet::isFalseSource(const RODFDetector& det, ROEdge* edge, std::vector<ROEdge*>& seen,
890  const RODFDetectorCon& detectors) const {
891  if (seen.size() == 1000) { // !!!
892  WRITE_WARNING("Quitting checking for being a false source for detector '" + det.getID() + "' due to seen edge limit.");
893  return false;
894  }
895  seen.push_back(edge);
896  if (edge != getDetectorEdge(det)) {
897  // ok, we are at one of the edges coming behind
898  if (hasDetector(edge)) {
899  const std::vector<std::string>& dets = myDetectorsOnEdges.find(edge)->second;
900  for (std::vector<std::string>::const_iterator i = dets.begin(); i != dets.end(); ++i) {
901  if (detectors.getDetector(*i).getType() == SINK_DETECTOR) {
902  return false;
903  }
904  if (detectors.getDetector(*i).getType() == BETWEEN_DETECTOR) {
905  return false;
906  }
907  if (detectors.getDetector(*i).getType() == SOURCE_DETECTOR) {
908  return true;
909  }
910  }
911  } else {
912  if (myAmInHighwayMode && edge->getSpeed() < 19.) {
913  return false;
914  }
915  }
916  }
917 
918  if (myApproachedEdges.find(edge) == myApproachedEdges.end()) {
919  return false;
920  }
921 
922  const std::vector<ROEdge*>& appr = myApproachedEdges.find(edge)->second;
923  bool isall = false;
924  for (size_t i = 0; i < appr.size() && !isall; i++) {
925  //printf("checking %s->\n", appr[i].c_str());
926  bool had = std::find(seen.begin(), seen.end(), appr[i]) != seen.end();
927  if (!had) {
928  if (isFalseSource(det, appr[i], seen, detectors)) {
929  isall = true;
930  }
931  }
932  }
933  return isall;
934 }
935 
936 
937 void
939  const RODFDetectorCon& detectors,
940  SUMOTime startTime, SUMOTime endTime,
941  SUMOTime stepOffset) {
942  std::map<ROEdge*, std::vector<std::string>, idComp>::iterator i;
943  for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) {
944  ROEdge* into = (*i).first;
945  const std::vector<std::string>& dets = (*i).second;
946  std::map<SUMOReal, std::vector<std::string> > cliques;
947  std::vector<std::string>* maxClique = 0;
948  for (std::vector<std::string>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
949  if (!flows.knows(*j)) {
950  continue;
951  }
952  const RODFDetector& det = detectors.getDetector(*j);
953  bool found = false;
954  for (std::map<SUMOReal, std::vector<std::string> >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) {
955  if (fabs((*k).first - det.getPos()) < 1) {
956  (*k).second.push_back(*j);
957  if ((*k).second.size() > maxClique->size()) {
958  maxClique = &(*k).second;
959  }
960  found = true;
961  }
962  }
963  if (!found) {
964  cliques[det.getPos()].push_back(*j);
965  maxClique = &cliques[det.getPos()];
966  }
967  }
968  if (maxClique == 0) {
969  continue;
970  }
971  std::vector<FlowDef> mflows; // !!! reserve
972  for (SUMOTime t = startTime; t < endTime; t += stepOffset) {
973  FlowDef fd;
974  fd.qPKW = 0;
975  fd.qLKW = 0;
976  fd.vLKW = 0;
977  fd.vPKW = 0;
978  fd.fLKW = 0;
979  fd.isLKW = 0;
980  mflows.push_back(fd);
981  }
982  for (std::vector<std::string>::iterator l = maxClique->begin(); l != maxClique->end(); ++l) {
983  bool didWarn = false;
984  const std::vector<FlowDef>& dflows = flows.getFlowDefs(*l);
985  int index = 0;
986  for (SUMOTime t = startTime; t < endTime; t += stepOffset, index++) {
987  const FlowDef& srcFD = dflows[index];
988  FlowDef& fd = mflows[index];
989  fd.qPKW += srcFD.qPKW;
990  fd.qLKW += srcFD.qLKW;
991  fd.vLKW += (srcFD.vLKW / (SUMOReal) maxClique->size());
992  fd.vPKW += (srcFD.vPKW / (SUMOReal) maxClique->size());
993  fd.fLKW += (srcFD.fLKW / (SUMOReal) maxClique->size());
994  fd.isLKW += (srcFD.isLKW / (SUMOReal) maxClique->size());
995  if (!didWarn && srcFD.vPKW > 0 && srcFD.vPKW < 255 && srcFD.vPKW / 3.6 > into->getSpeed()) {
996  WRITE_MESSAGE("Detected PKW speed higher than allowed speed at '" + (*l) + "' on '" + into->getID() + "'.");
997  didWarn = true;
998  }
999  if (!didWarn && srcFD.vLKW > 0 && srcFD.vLKW < 255 && srcFD.vLKW / 3.6 > into->getSpeed()) {
1000  WRITE_MESSAGE("Detected LKW speed higher than allowed speed at '" + (*l) + "' on '" + into->getID() + "'.");
1001  didWarn = true;
1002  }
1003  }
1004  }
1005  static_cast<RODFEdge*>(into)->setFlows(mflows);
1006  }
1007 }
1008 
1009 
1010 void
1012  // !!! this will not work when several detectors are lying on the same edge on different positions
1013 
1014 
1015  buildDetectorEdgeDependencies(detectors);
1016  // for each detector, compute the lists of predecessor and following detectors
1017  std::map<std::string, ROEdge*>::const_iterator i;
1018  for (i = myDetectorEdges.begin(); i != myDetectorEdges.end(); ++i) {
1019  const RODFDetector& det = detectors.getDetector((*i).first);
1020  if (!det.hasRoutes()) {
1021  continue;
1022  }
1023  // mark current detectors
1024  std::vector<RODFDetector*> last;
1025  {
1026  const std::vector<std::string>& detNames = myDetectorsOnEdges.find((*i).second)->second;
1027  for (std::vector<std::string>::const_iterator j = detNames.begin(); j != detNames.end(); ++j) {
1028  last.push_back(&detectors.getModifiableDetector(*j));
1029  }
1030  }
1031  // iterate over the current detector's routes
1032  const std::vector<RODFRouteDesc>& routes = det.getRouteVector();
1033  for (std::vector<RODFRouteDesc>::const_iterator j = routes.begin(); j != routes.end(); ++j) {
1034  const std::vector<ROEdge*>& edges2Pass = (*j).edges2Pass;
1035  for (std::vector<ROEdge*>::const_iterator k = edges2Pass.begin() + 1; k != edges2Pass.end(); ++k) {
1036  if (myDetectorsOnEdges.find(*k) != myDetectorsOnEdges.end()) {
1037  const std::vector<std::string>& detNames = myDetectorsOnEdges.find(*k)->second;
1038  // ok, consecutive detector found
1039  for (std::vector<RODFDetector*>::iterator l = last.begin(); l != last.end(); ++l) {
1040  // mark as follower of current
1041  for (std::vector<std::string>::const_iterator m = detNames.begin(); m != detNames.end(); ++m) {
1042  detectors.getModifiableDetector(*m).addPriorDetector(*l);
1043  (*l)->addFollowingDetector(&detectors.getDetector(*m));
1044  }
1045  }
1046  last.clear();
1047  for (std::vector<std::string>::const_iterator m = detNames.begin(); m != detNames.end(); ++m) {
1048  last.push_back(&detectors.getModifiableDetector(*m));
1049  }
1050  }
1051  }
1052  }
1053  }
1054 }
1055 
1056 
1057 void
1059  buildDetectorEdgeDependencies(detectors);
1060  std::map<ROEdge*, std::vector<std::string>, idComp>::iterator i;
1061  for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) {
1062  const std::vector<std::string>& dets = (*i).second;
1063  std::map<SUMOReal, std::vector<std::string> > cliques;
1064  // compute detector cliques
1065  for (std::vector<std::string>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
1066  const RODFDetector& det = detectors.getDetector(*j);
1067  bool found = false;
1068  for (std::map<SUMOReal, std::vector<std::string> >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) {
1069  if (fabs((*k).first - det.getPos()) < 10.) {
1070  (*k).second.push_back(*j);
1071  found = true;
1072  }
1073  }
1074  if (!found) {
1075  cliques[det.getPos()] = std::vector<std::string>();
1076  cliques[det.getPos()].push_back(*j);
1077  }
1078  }
1079  // join detector cliques
1080  for (std::map<SUMOReal, std::vector<std::string> >::iterator m = cliques.begin(); m != cliques.end(); ++m) {
1081  std::vector<std::string> clique = (*m).second;
1082  // do not join if only one
1083  if (clique.size() == 1) {
1084  continue;
1085  }
1086  std::string nid;
1087  for (std::vector<std::string>::iterator n = clique.begin(); n != clique.end(); ++n) {
1088  std::cout << *n << " ";
1089  if (n != clique.begin()) {
1090  nid = nid + "_";
1091  }
1092  nid = nid + *n;
1093  }
1094  std::cout << ":" << nid << std::endl;
1095  flows.mesoJoin(nid, (*m).second);
1096  detectors.mesoJoin(nid, (*m).second);
1097  }
1098  }
1099 }
1100 
1101 
1102 
1103 /****************************************************************************/
1104 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1058
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:580
RODFDetector & getModifiableDetector(const std::string &id) const
SUMOReal factor
Definition: RODFRouteDesc.h:67
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:174
~RODFNet()
Destructor.
Definition: RODFNet.cpp:64
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
RONode * getToNode() const
Returns the node this edge ends at.
Definition: ROEdge.h:199
std::map< ROEdge *, std::vector< ROEdge * > > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:162
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:154
ROEdge * getFollower(unsigned int pos) const
Returns the edge at the given position from the list of reachable edges.
Definition: ROEdge.h:272
size_t mySourceNumber
Definition: RODFNet.h:171
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:635
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:696
void removeDetector(const std::string &id)
std::vector< ROEdge * > edges2Pass
The edges the route is made of.
Definition: RODFRouteDesc.h:55
A source detector.
Definition: RODFDetector.h:76
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:688
bool myKeepTurnarounds
Definition: RODFNet.h:177
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:100
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
SUMOReal distance
Definition: RODFRouteDesc.h:59
const std::vector< FlowDef > & getFlows() const
Definition: RODFEdge.cpp:58
void removeFlow(const std::string &detector_id)
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:617
const std::vector< RODFRouteDesc > & getRouteVector() const
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:114
void addPriorDetector(const RODFDetector *det)
const std::vector< RODFDetector * > & getDetectors() const
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
SUMOReal distance2Last
Definition: RODFRouteDesc.h:63
SUMOReal isLKW
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:170
void computeRoutesFor(ROEdge *edge, RODFRouteDesc &base, int no, bool keepUnfoundEnds, bool keepShortestOnly, std::vector< ROEdge * > &visited, const RODFDetector &det, RODFRouteCont &into, const RODFDetectorCon &detectors, int maxFollowingLength, std::vector< ROEdge * > &seen) const
Definition: RODFNet.cpp:187
std::vector< RODFRouteDesc > & get()
Returns the container of stored routes.
void buildRoutes(RODFDetectorCon &det, bool allEndFollower, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:346
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:227
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:665
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:196
SUMOReal getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:680
const std::map< std::string, ROEdge * > & getEdgeMap() const
Definition: RONet.cpp:409
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
RONode * getFromNode() const
Returns the node this edge starts at.
Definition: ROEdge.h:191
RODFDetectorType getType() const
Returns the type of the detector.
Definition: RODFDetector.h:150
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:155
A not yet defined detector.
Definition: RODFDetector.h:67
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:703
const std::string & getID() const
Returns the id.
Definition: Named.h:60
size_t myInvalidNumber
Definition: RODFNet.h:171
SUMOReal fLKW
bool removeRouteDesc(RODFRouteDesc &desc)
Removes the given route description from the container.
An in-between detector.
Definition: RODFDetector.h:73
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:647
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:56
A detector which had to be discarded (!!!)
Definition: RODFDetector.h:70
SUMOReal overallProb
Definition: RODFRouteDesc.h:66
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:198
void setFlows(const std::string &detector_id, std::vector< FlowDef > &)
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:674
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:101
void buildApproachList()
Definition: RODFNet.cpp:69
bool knows(const std::string &det_id) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:52
Definition of the traffic during a certain time containing the flows and speeds.
A route within the DFROUTER.
Definition: RODFRouteDesc.h:53
A basic edge for routing applications.
Definition: ROEdge.h:67
void addAllEndFollower()
All routes are replaced by their versions extended by follower edges.
unsigned int getNoFollowing() const
Returns the number of edges this edge is connected to.
Definition: ROEdge.cpp:290
SUMOReal vPKW
SUMOTime duration2Last
Definition: RODFRouteDesc.h:64
The router's network representation.
Definition: RONet.h:65
SUMOReal getLength() const
Returns the length of the edge.
Definition: ROEdge.h:160
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:938
const RODFDetector & getDetector(const std::string &id) const
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1011
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:88
size_t mySinkNumber
Definition: RODFNet.h:171
const ROEdge * endDetectorEdge
Definition: RODFRouteDesc.h:61
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:168
SUMOReal duration_2
Definition: RODFRouteDesc.h:58
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:656
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
int SUMOTime
Definition: SUMOTime.h:43
SUMOReal qPKW
SUMOReal getPos() const
Returns the position at which the detector lies.
Definition: RODFDetector.h:141
const std::vector< FlowDef > & getFlowDefs(const std::string &id) const
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:167
#define SUMOReal
Definition: config.h:215
void mesoJoin(const std::string &nid, const std::vector< std::string > &oldids)
bool myAmInHighwayMode
Definition: RODFNet.h:170
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:594
void mesoJoin(const std::string &nid, const std::vector< std::string > &oldids)
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:199
const ROEdge * lastDetectorEdge
Definition: RODFRouteDesc.h:62
void addRouteDesc(RODFRouteDesc &desc)
Adds a route to the container.
SUMOReal vLKW
SUMOReal qLKW
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:197
std::map< ROEdge *, std::vector< ROEdge * > > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:165
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:175
size_t myInBetweenNumber
Definition: RODFNet.h:171
bool hasRoutes() const
const std::string & getLaneID() const
Returns the id of the lane this detector is placed on.
Definition: RODFDetector.h:125