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