#include <RODFDetector.h>
Definition at line 234 of file RODFDetector.h.
Public Member Functions | |
| bool | addDetector (RODFDetector *dfd) |
| bool | detectorsHaveCompleteTypes () const |
| bool | detectorsHaveRoutes () const |
| int | getAggFlowFor (const ROEdge *edge, SUMOTime time, SUMOTime period, const RODFDetectorFlows &flows) const |
| const RODFDetector & | getAnyDetectorForEdge (const RODFEdge *const edge) const |
| const RODFDetector & | getDetector (const std::string &id) const |
| const std::vector < RODFDetector * > & | getDetectors () const |
| int | getFlowFor (const ROEdge *edge, SUMOTime time, const RODFDetectorFlows &flows) const |
| void | guessEmptyFlows (RODFDetectorFlows &flows) |
| bool | knows (const std::string &id) const |
| void | mesoJoin (const std::string &nid, const std::vector< std::string > &oldids) |
| void | removeDetector (const std::string &id) |
| RODFDetectorCon () | |
| void | save (const std::string &file) const |
| void | saveAsPOIs (const std::string &file) const |
| void | saveRoutes (const std::string &file) const |
| void | writeEmitterPOIs (const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset) |
| void | writeEmitters (const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, const RODFNet &net, bool writeCalibrators, bool includeUnusedRoutes, SUMOReal scale, int maxFollower, bool emissionsOnly) |
| void | writeEndRerouterDetectors (const std::string &file) |
| void | writeSpeedTrigger (const RODFNet *const net, const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset) |
| void | writeValidationDetectors (const std::string &file, bool includeSources, bool singleFile, bool friendly) |
| ~RODFDetectorCon () | |
Protected Member Functions | |
| void | clearDists (std::map< size_t, RandomDistributor< size_t > * > &dists) const throw () |
| Clears the given distributions map, deleting the timed distributions. | |
Protected Attributes | |
| std::map< std::string, std::vector< RODFDetector * > > | myDetectorEdgeMap |
| std::map< std::string, RODFDetector * > | myDetectorMap |
| std::vector< RODFDetector * > | myDetectors |
Private Member Functions | |
| RODFDetectorCon & | operator= (const RODFDetectorCon &src) |
| Invalidated assignment operator. | |
| RODFDetectorCon (const RODFDetectorCon &src) | |
| Invalidated copy constructor. | |
| RODFDetectorCon::RODFDetectorCon | ( | ) |
| RODFDetectorCon::~RODFDetectorCon | ( | ) |
Definition at line 396 of file RODFDetector.cpp.
References myDetectors.
00396 { 00397 for (std::vector<RODFDetector*>::iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00398 delete *i; 00399 } 00400 }
| RODFDetectorCon::RODFDetectorCon | ( | const RODFDetectorCon & | src | ) | [private] |
Invalidated copy constructor.
| bool RODFDetectorCon::addDetector | ( | RODFDetector * | dfd | ) |
Definition at line 404 of file RODFDetector.cpp.
References RODFDetector::getID(), RODFDetector::getLaneID(), myDetectorEdgeMap, myDetectorMap, and myDetectors.
Referenced by mesoJoin(), and RODFDetectorHandler::myStartElement().
00404 { 00405 if (myDetectorMap.find(dfd->getID())!=myDetectorMap.end()) { 00406 return false; 00407 } 00408 myDetectorMap[dfd->getID()] = dfd; 00409 myDetectors.push_back(dfd); 00410 std::string edgeid = dfd->getLaneID().substr(0, dfd->getLaneID().rfind('_')); 00411 if (myDetectorEdgeMap.find(edgeid)==myDetectorEdgeMap.end()) { 00412 myDetectorEdgeMap[edgeid] = std::vector<RODFDetector*>(); 00413 } 00414 myDetectorEdgeMap[edgeid].push_back(dfd); 00415 return true; // !!! 00416 }
| void RODFDetectorCon::clearDists | ( | std::map< size_t, RandomDistributor< size_t > * > & | dists | ) | const throw () [protected] |
Clears the given distributions map, deleting the timed distributions.
| [in] | dists | The distribution map to clear |
Definition at line 871 of file RODFDetector.cpp.
Referenced by writeEmitters().
00871 { 00872 for (std::map<size_t, RandomDistributor<size_t>* >::iterator i=dists.begin(); i!=dists.end(); ++i) { 00873 delete(*i).second; 00874 } 00875 }
| bool RODFDetectorCon::detectorsHaveCompleteTypes | ( | ) | const |
Definition at line 420 of file RODFDetector.cpp.
References myDetectors, and TYPE_NOT_DEFINED.
Referenced by startComputation().
00420 { 00421 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00422 if ((*i)->getType()==TYPE_NOT_DEFINED) { 00423 return false; 00424 } 00425 } 00426 return true; 00427 }
| bool RODFDetectorCon::detectorsHaveRoutes | ( | ) | const |
Definition at line 431 of file RODFDetector.cpp.
References myDetectors.
Referenced by startComputation().
00431 { 00432 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00433 if ((*i)->hasRoutes()) { 00434 return true; 00435 } 00436 } 00437 return false; 00438 }
| int RODFDetectorCon::getAggFlowFor | ( | const ROEdge * | edge, | |
| SUMOTime | time, | |||
| SUMOTime | period, | |||
| const RODFDetectorFlows & | flows | |||
| ) | const |
Definition at line 673 of file RODFDetector.cpp.
References ROEdge::getID(), myDetectorEdgeMap, FlowDef::qLKW, FlowDef::qPKW, and SUMOReal.
Referenced by RODFDetector::computeSplitProbabilities().
00674 { 00675 if (edge==0) { 00676 return 0; 00677 } 00678 SUMOReal stepOffset = 60; // !!! 00679 SUMOReal startTime = 0; // !!! 00680 // cout << edge->getID() << endl; 00681 assert(myDetectorEdgeMap.find(edge->getID())!=myDetectorEdgeMap.end()); 00682 const std::vector<FlowDef> &flows = static_cast<const RODFEdge*>(edge)->getFlows(); 00683 SUMOReal agg = 0; 00684 for (std::vector<FlowDef>::const_iterator i=flows.begin(); i!=flows.end(); ++i) { 00685 const FlowDef &srcFD = *i; 00686 if (srcFD.qLKW>=0) { 00687 agg += srcFD.qLKW; 00688 } 00689 if (srcFD.qPKW>=0) { 00690 agg += srcFD.qPKW; 00691 } 00692 } 00693 return (int) agg; 00694 /* !!! make this time variable 00695 if (flows.size()!=0) { 00696 SUMOReal agg = 0; 00697 size_t beginIndex = (int)((time/stepOffset) - startTime); // !!! falsch!!! 00698 for (SUMOTime t=0; t<period&&beginIndex<flows.size(); t+=(SUMOTime) stepOffset) { 00699 const FlowDef &srcFD = flows[beginIndex++]; 00700 if (srcFD.qLKW>=0) { 00701 agg += srcFD.qLKW; 00702 } 00703 if (srcFD.qPKW>=0) { 00704 agg += srcFD.qPKW; 00705 } 00706 } 00707 return (int) agg; 00708 } 00709 */ 00710 return -1; 00711 }
| const RODFDetector & RODFDetectorCon::getAnyDetectorForEdge | ( | const RODFEdge *const | edge | ) | const |
Definition at line 860 of file RODFDetector.cpp.
References ROEdge::getID(), and myDetectors.
Referenced by RODFDetector::buildDestinationDistribution().
00860 { 00861 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00862 if ((*i)->getEdgeID()==edge->getID()) { 00863 return **i; 00864 } 00865 } 00866 throw 1; 00867 }
| const RODFDetector & RODFDetectorCon::getDetector | ( | const std::string & | id | ) | const |
Definition at line 529 of file RODFDetector.cpp.
References myDetectorMap.
Referenced by RODFNet::buildDetectorDependencies(), RODFNet::buildEdgeFlowMap(), RODFNet::buildRoutes(), RODFNet::hasInBetweenDetectorsOnly(), RODFNet::hasSourceDetector(), RODFNet::isDestination(), RODFNet::isFalseSource(), RODFNet::isSource(), RODFNet::mesoJoin(), and mesoJoin().
00529 { 00530 return *(myDetectorMap.find(id)->second); 00531 }
| const std::vector< RODFDetector * > & RODFDetectorCon::getDetectors | ( | ) | const |
Definition at line 442 of file RODFDetector.cpp.
References myDetectors.
Referenced by RODFNet::buildDetectorEdgeDependencies(), RODFNet::buildRoutes(), RODFNet::computeTypes(), RODFNet::removeEmptyDetectors(), RODFNet::reportEmptyDetectors(), and RODFNet::revalidateFlows().
00442 { 00443 return myDetectors; 00444 }
| int RODFDetectorCon::getFlowFor | ( | const ROEdge * | edge, | |
| SUMOTime | time, | |||
| const RODFDetectorFlows & | flows | |||
| ) | const |
Definition at line 641 of file RODFDetector.cpp.
References ROEdge::getID(), MAX2(), myDetectorEdgeMap, FlowDef::qLKW, FlowDef::qPKW, and SUMOReal.
00642 { 00643 SUMOReal stepOffset = 60; // !!! 00644 SUMOReal startTime = 0; // !!! 00645 assert(myDetectorEdgeMap.find(edge->getID())!=myDetectorEdgeMap.end()); 00646 const std::vector<FlowDef> &flows = static_cast<const RODFEdge*>(edge)->getFlows(); 00647 if (flows.size()!=0) { 00648 const FlowDef &srcFD = flows[(int)((time/stepOffset) - startTime)]; 00649 return (int)(MAX2(srcFD.qLKW, (SUMOReal) 0.) + MAX2(srcFD.qPKW, (SUMOReal) 0.)); 00650 } 00651 /* 00652 const std::vector<RODFDetector*> &detsOnEdge = myDetectorEdgeMap.find(edge->getID())->second; 00653 std::vector<RODFDetector*>::const_iterator i; 00654 SUMOReal ret = 0; 00655 int counted = 0; 00656 for(i=detsOnEdge.begin(); i!=detsOnEdge.end(); ++i) { 00657 if(flows.knows((*i)->getID())) { 00658 const std::vector<FlowDef> &mflows = flows.getFlowDefs((*i)->getID()); 00659 const FlowDef &srcFD = mflows[(int) (time/stepOffset) - startTime]; // !!! check stepOffset 00660 counted++; // !!! make a difference between pkws and lkws 00661 ret += (srcFD.qLKW + srcFD.qPKW); 00662 } 00663 } 00664 if(counted!=0) { 00665 return (int) (ret / (SUMOReal) counted); 00666 } 00667 */ 00668 return -1; 00669 }
| void RODFDetectorCon::guessEmptyFlows | ( | RODFDetectorFlows & | flows | ) |
Definition at line 816 of file RODFDetector.cpp.
References RODFDetector::getFollowerDetectors(), RODFDetector::getID(), RODFDetector::getPriorDetectors(), RODFDetectorFlows::knows(), and myDetectors.
Referenced by startComputation().
00816 { 00817 // routes must be built (we have ensured this in main) 00818 // detector followers/prior must be build (we have ensured this in main) 00819 // 00820 bool changed = true; 00821 while (changed) { 00822 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00823 RODFDetector *det = *i; 00824 const std::vector<RODFDetector*> &prior = det->getPriorDetectors(); 00825 const std::vector<RODFDetector*> &follower = det->getFollowerDetectors(); 00826 size_t noFollowerWithRoutes = 0; 00827 size_t noPriorWithRoutes = 0; 00828 // count occurences of detectors with/without routes 00829 std::vector<RODFDetector*>::const_iterator j; 00830 for (j=prior.begin(); j!=prior.end(); ++j) { 00831 if (flows.knows((*j)->getID())) { 00832 ++noPriorWithRoutes; 00833 } 00834 } 00835 assert(noPriorWithRoutes<=prior.size()); 00836 for (j=follower.begin(); j!=follower.end(); ++j) { 00837 if (flows.knows((*j)->getID())) { 00838 ++noFollowerWithRoutes; 00839 } 00840 } 00841 assert(noFollowerWithRoutes<=follower.size()); 00842 00843 // do not process detectors which have no routes 00844 if (!flows.knows(det->getID())) { 00845 continue; 00846 } 00847 00848 // plain case: some of the following detectors have no routes 00849 if (noFollowerWithRoutes==follower.size()) { 00850 // the number of vehicles is the sum of all vehicles on prior 00851 continue; 00852 } 00853 00854 } 00855 } 00856 }
| bool RODFDetectorCon::knows | ( | const std::string & | id | ) | const |
Definition at line 535 of file RODFDetector.cpp.
References myDetectorMap.
Referenced by RODFDetFlowLoader::read().
00535 { 00536 return myDetectorMap.find(id)!=myDetectorMap.end(); 00537 }
| void RODFDetectorCon::mesoJoin | ( | const std::string & | nid, | |
| const std::vector< std::string > & | oldids | |||
| ) |
Definition at line 879 of file RODFDetector.cpp.
References addDetector(), getDetector(), and removeDetector().
Referenced by RODFNet::mesoJoin().
00880 { 00881 // build the new detector 00882 const RODFDetector &first = getDetector(*(oldids.begin())); 00883 RODFDetector *newDet = new RODFDetector(nid, first); 00884 addDetector(newDet); 00885 // delete previous 00886 for (std::vector<std::string>::const_iterator i=oldids.begin(); i!=oldids.end(); ++i) { 00887 removeDetector(*i); 00888 } 00889 }
| RODFDetectorCon& RODFDetectorCon::operator= | ( | const RODFDetectorCon & | src | ) | [private] |
Invalidated assignment operator.
| void RODFDetectorCon::removeDetector | ( | const std::string & | id | ) |
Definition at line 789 of file RODFDetector.cpp.
References myDetectorEdgeMap, myDetectorMap, and myDetectors.
Referenced by mesoJoin(), and RODFNet::removeEmptyDetectors().
00789 { 00790 // 00791 std::map<std::string, RODFDetector*>::iterator ri1 = myDetectorMap.find(id); 00792 RODFDetector *oldDet = (*ri1).second; 00793 myDetectorMap.erase(ri1); 00794 // 00795 std::vector<RODFDetector*>::iterator ri2 = 00796 find(myDetectors.begin(), myDetectors.end(), oldDet); 00797 myDetectors.erase(ri2); 00798 // 00799 bool found = false; 00800 for (std::map<std::string, std::vector<RODFDetector*> >::iterator rr3=myDetectorEdgeMap.begin(); !found&&rr3!=myDetectorEdgeMap.end(); ++rr3) { 00801 std::vector<RODFDetector*> &dets = (*rr3).second; 00802 for (std::vector<RODFDetector*>::iterator ri3=dets.begin(); !found&&ri3!=dets.end();) { 00803 if (*ri3==oldDet) { 00804 found = true; 00805 ri3 = dets.erase(ri3); 00806 } else { 00807 ++ri3; 00808 } 00809 } 00810 } 00811 delete oldDet; 00812 }
| void RODFDetectorCon::save | ( | const std::string & | file | ) | const |
Definition at line 448 of file RODFDetector.cpp.
References BETWEEN_DETECTOR, OutputDevice::close(), DISCARDED_DETECTOR, StringUtils::escapeXML(), OutputDevice::getDevice(), myDetectors, SINK_DETECTOR, SOURCE_DETECTOR, and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00448 { 00449 OutputDevice& out = OutputDevice::getDevice(file); 00450 out.writeXMLHeader("detectors"); 00451 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00452 out << " <detector_definition id=\"" << StringUtils::escapeXML((*i)->getID()) 00453 << "\" lane=\"" << (*i)->getLaneID() 00454 << "\" pos=\"" << (*i)->getPos(); 00455 switch ((*i)->getType()) { 00456 case BETWEEN_DETECTOR: 00457 out << "\" type=\"between\""; 00458 break; 00459 case SOURCE_DETECTOR: 00460 out << "\" type=\"source\""; 00461 break; 00462 case SINK_DETECTOR: 00463 out << "\" type=\"sink\""; 00464 break; 00465 case DISCARDED_DETECTOR: 00466 out << "\" type=\"discarded\""; 00467 break; 00468 default: 00469 throw 1; 00470 } 00471 out << "/>\n"; 00472 } 00473 out.close(); 00474 }
| void RODFDetectorCon::saveAsPOIs | ( | const std::string & | file | ) | const |
Definition at line 478 of file RODFDetector.cpp.
References BETWEEN_DETECTOR, OutputDevice::close(), DISCARDED_DETECTOR, StringUtils::escapeXML(), OutputDevice::getDevice(), myDetectors, SINK_DETECTOR, SOURCE_DETECTOR, and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00478 { 00479 OutputDevice& out = OutputDevice::getDevice(file); 00480 out.writeXMLHeader("pois"); 00481 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00482 out << " <poi id=\"" << StringUtils::escapeXML((*i)->getID()); 00483 switch ((*i)->getType()) { 00484 case BETWEEN_DETECTOR: 00485 out << "\" type=\"between_detector_position\" color=\"0,0,1\""; 00486 break; 00487 case SOURCE_DETECTOR: 00488 out << "\" type=\"source_detector_position\" color=\"0,1,0\""; 00489 break; 00490 case SINK_DETECTOR: 00491 out << "\" type=\"sink_detector_position\" color=\"1,0,0\""; 00492 break; 00493 case DISCARDED_DETECTOR: 00494 out << "\" type=\"discarded_detector_position\" color=\".2,.2,.2\""; 00495 break; 00496 default: 00497 throw 1; 00498 } 00499 out << " lane=\"" << (*i)->getLaneID()<< "\" pos=\"" 00500 << (*i)->getPos() << "\"/>\n"; 00501 } 00502 out.close(); 00503 }
| void RODFDetectorCon::saveRoutes | ( | const std::string & | file | ) | const |
Definition at line 507 of file RODFDetector.cpp.
References OutputDevice::close(), OutputDevice::getDevice(), myDetectors, SOURCE_DETECTOR, and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00507 { 00508 OutputDevice& out = OutputDevice::getDevice(file); 00509 out.writeXMLHeader("routes"); 00510 std::vector<std::string> saved; 00511 // write for source detectors 00512 bool lastWasSaved = true; 00513 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00514 if ((*i)->getType()!=SOURCE_DETECTOR) { 00515 // do not build routes for other than sources 00516 continue; 00517 } 00518 if (lastWasSaved) { 00519 out << "\n"; 00520 } 00521 lastWasSaved = (*i)->writeRoutes(saved, out); 00522 } 00523 out << "\n"; 00524 out.close(); 00525 }
| void RODFDetectorCon::writeEmitterPOIs | ( | const std::string & | file, | |
| const RODFDetectorFlows & | flows, | |||
| SUMOTime | startTime, | |||
| SUMOTime | endTime, | |||
| SUMOTime | stepOffset | |||
| ) |
Definition at line 604 of file RODFDetector.cpp.
References BETWEEN_DETECTOR, OutputDevice::close(), DISCARDED_DETECTOR, StringUtils::escapeXML(), OutputDevice::getDevice(), RODFDetectorFlows::getFlowSumSecure(), RODFDetector::getID(), RODFDetectorFlows::getMaxDetectorFlow(), myDetectors, SINK_DETECTOR, SOURCE_DETECTOR, SUMOReal, and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00607 { 00608 OutputDevice& out = OutputDevice::getDevice(file); 00609 out.writeXMLHeader("additional"); 00610 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00611 RODFDetector *det = *i; 00612 SUMOReal flow = flows.getFlowSumSecure(det->getID()); 00613 SUMOReal col = flow / flows.getMaxDetectorFlow(); 00614 col = (SUMOReal)(col / 2. + .5); 00615 SUMOReal r, g, b; 00616 r = g = b = 0; 00617 out << " <poi id=\"" << StringUtils::escapeXML((*i)->getID()) << ":" << flow; 00618 switch ((*i)->getType()) { 00619 case BETWEEN_DETECTOR: 00620 out << "\" type=\"between_detector_position\" color=\"0,0," << col << "\""; 00621 break; 00622 case SOURCE_DETECTOR: 00623 out << "\" type=\"source_detector_position\" color=\"0," << col << ",0\""; 00624 break; 00625 case SINK_DETECTOR: 00626 out << "\" type=\"sink_detector_position\" color=\"" << col << ",0,0\""; 00627 break; 00628 case DISCARDED_DETECTOR: 00629 out << "\" type=\"discarded_detector_position\" color=\".2,.2,.2\""; 00630 break; 00631 default: 00632 throw 1; 00633 } 00634 out << " lane=\"" << (*i)->getLaneID()<< "\" pos=\"" << (*i)->getPos() << "\"/>\n"; 00635 } 00636 out.close(); 00637 }
| void RODFDetectorCon::writeEmitters | ( | const std::string & | file, | |
| const RODFDetectorFlows & | flows, | |||
| SUMOTime | startTime, | |||
| SUMOTime | endTime, | |||
| SUMOTime | stepOffset, | |||
| const RODFNet & | net, | |||
| bool | writeCalibrators, | |||
| bool | includeUnusedRoutes, | |||
| SUMOReal | scale, | |||
| int | maxFollower, | |||
| bool | emissionsOnly | |||
| ) |
Definition at line 541 of file RODFDetector.cpp.
References BETWEEN_DETECTOR, RODFDetector::buildDestinationDistribution(), clearDists(), OutputDevice::close(), StringUtils::escapeXML(), OutputDevice::getDevice(), RONet::getEdge(), RODFDetector::getEdgeID(), FileHelpers::getFilePath(), RODFDetector::getID(), RODFDetector::getLaneID(), RODFDetector::getPos(), RODFDetector::getType(), RODFDetectorFlows::knows(), myDetectors, SOURCE_DETECTOR, SUMOReal, RODFDetector::writeEmitterDefinition(), and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00549 { 00550 // compute turn probabilities at detector 00551 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00552 (*i)->computeSplitProbabilities(&net, *this, flows, startTime, endTime, stepOffset); 00553 } 00554 // 00555 OutputDevice& out = OutputDevice::getDevice(file); 00556 out.writeXMLHeader("additional"); 00557 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00558 RODFDetector *det = *i; 00559 // get file name for values (emitter/calibrator definition) 00560 std::string escapedID = StringUtils::escapeXML(det->getID()); 00561 std::string defFileName; 00562 if (det->getType()==SOURCE_DETECTOR) { 00563 defFileName = FileHelpers::getFilePath(file) + "emitter_" + escapedID + ".def.xml"; 00564 } else if (writeCalibrators&&det->getType()==BETWEEN_DETECTOR) { 00565 defFileName = FileHelpers::getFilePath(file) + "calibrator_" + escapedID + ".def.xml"; 00566 } else { 00567 defFileName = FileHelpers::getFilePath(file) + "other_" + escapedID + ".def.xml"; 00568 continue; 00569 } 00570 // try to write the definition 00571 SUMOReal defaultSpeed = net.getEdge(det->getEdgeID())->getSpeed(); 00572 // ... compute routes' distribution over time 00573 std::map<size_t, RandomDistributor<size_t>* > dists; 00574 if (!emissionsOnly&&flows.knows(det->getID())) { 00575 det->buildDestinationDistribution(*this, flows, startTime, endTime, stepOffset, net, dists, maxFollower); 00576 } 00577 // ... write the definition 00578 if (!det->writeEmitterDefinition(defFileName, dists, flows, startTime, endTime, stepOffset, includeUnusedRoutes, scale, emissionsOnly, defaultSpeed)) { 00579 // skip if something failed... (!!!) 00580 continue; 00581 } 00582 // ... clear temporary values 00583 clearDists(dists); 00584 // write the declaration into the file 00585 if (det->getType()==SOURCE_DETECTOR) { 00586 out << " <emitter id=\"source_" << escapedID 00587 << "\" pos=\"" << det->getPos() << "\" " 00588 << "lane=\"" << det->getLaneID() << "\" " 00589 << "friendly_pos=\"x\" " // !!! 00590 << "file=\"" << defFileName << "\"/>\n"; 00591 } else if (writeCalibrators&&det->getType()==BETWEEN_DETECTOR) { 00592 out << " <calibrator id=\"calibrator_" << escapedID 00593 << "\" pos=\"" << det->getPos() << "\" " 00594 << "lane=\"" << det->getLaneID() << "\" " 00595 << "friendly_pos=\"x\" " // !!! 00596 << "file=\"" << defFileName << "\"/>\n"; 00597 } 00598 } 00599 out.close(); 00600 }
| void RODFDetectorCon::writeEndRerouterDetectors | ( | const std::string & | file | ) |
Definition at line 739 of file RODFDetector.cpp.
References OutputDevice::close(), StringUtils::escapeXML(), OutputDevice::getDevice(), RODFDetector::getID(), RODFDetector::getLaneID(), RODFDetector::getType(), myDetectors, SINK_DETECTOR, and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00739 { 00740 OutputDevice& out = OutputDevice::getDevice(file); 00741 out.writeXMLHeader("additional"); 00742 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00743 RODFDetector *det = *i; 00744 // write the declaration into the file 00745 if (det->getType()==SINK_DETECTOR) { 00746 out << " <rerouter id=\"endrerouter_" << StringUtils::escapeXML(det->getID()) 00747 << "\" edges=\"" << 00748 det->getLaneID() << "\" attr=\"reroute\" pos=\"0\" file=\"endrerouter_" 00749 << det->getID() << ".def.xml\"/>\n"; 00750 } 00751 } 00752 out.close(); 00753 }
| void RODFDetectorCon::writeSpeedTrigger | ( | const RODFNet *const | net, | |
| const std::string & | file, | |||
| const RODFDetectorFlows & | flows, | |||
| SUMOTime | startTime, | |||
| SUMOTime | endTime, | |||
| SUMOTime | stepOffset | |||
| ) |
Definition at line 715 of file RODFDetector.cpp.
References OutputDevice::close(), StringUtils::escapeXML(), OutputDevice::getDevice(), RONet::getEdge(), RODFDetector::getEdgeID(), FileHelpers::getFilePath(), RODFDetector::getID(), RODFDetector::getLaneID(), RODFDetector::getType(), RODFDetectorFlows::knows(), myDetectors, SINK_DETECTOR, SUMOReal, RODFDetector::writeSingleSpeedTrigger(), and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00719 { 00720 OutputDevice& out = OutputDevice::getDevice(file); 00721 out.writeXMLHeader("additional"); 00722 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00723 RODFDetector *det = *i; 00724 // write the declaration into the file 00725 if (det->getType()==SINK_DETECTOR&&flows.knows(det->getID())) { 00726 std::string filename = FileHelpers::getFilePath(file) + "vss_" + det->getID() + ".def.xml"; 00727 out << " <variableSpeedSign id=\"vss_" << StringUtils::escapeXML(det->getID()) << '\"' 00728 << " lanes=\"" << det->getLaneID() << '\"' 00729 << " file=\"" << filename << "\"/>\n"; 00730 SUMOReal defaultSpeed = net!=0 ? net->getEdge(det->getEdgeID())->getSpeed() : (SUMOReal) 200.; 00731 det->writeSingleSpeedTrigger(filename, flows, startTime, endTime, stepOffset, defaultSpeed); 00732 } 00733 } 00734 out.close(); 00735 }
| void RODFDetectorCon::writeValidationDetectors | ( | const std::string & | file, | |
| bool | includeSources, | |||
| bool | singleFile, | |||
| bool | friendly | |||
| ) |
!!
Definition at line 757 of file RODFDetector.cpp.
References OutputDevice::close(), StringUtils::escapeXML(), OutputDevice::getDevice(), RODFDetector::getID(), RODFDetector::getLaneID(), RODFDetector::getPos(), RODFDetector::getType(), myDetectors, SOURCE_DETECTOR, SUMOReal, and OutputDevice::writeXMLHeader().
Referenced by startComputation().
00759 { 00760 OutputDevice& out = OutputDevice::getDevice(file); 00761 out.writeXMLHeader("additional"); 00762 for (std::vector<RODFDetector*>::const_iterator i=myDetectors.begin(); i!=myDetectors.end(); ++i) { 00763 RODFDetector *det = *i; 00764 // write the declaration into the file 00765 if (det->getType()!=SOURCE_DETECTOR||includeSources) { 00766 SUMOReal pos = det->getPos(); 00767 if (det->getType()==SOURCE_DETECTOR) { 00768 pos += 1; 00769 } 00770 out << " <detector id=\"validation_" << StringUtils::escapeXML(det->getID()) << "\" " 00771 << "lane=\"" << det->getLaneID() << "\" " 00772 << "pos=\"" << pos << "\" " 00773 << "freq=\"60\" "; 00774 if (friendly) { 00775 out << "friendly_pos=\"x\" "; 00776 } 00777 if (!singleFile) { 00778 out << "file=\"validation_det_" << StringUtils::escapeXML(det->getID()) << ".xml\"/>\n"; 00779 } else { 00780 out << "file=\"validation_dets.xml\"/>\n"; 00781 } 00782 } 00783 } 00784 out.close(); 00785 }
std::map<std::string, std::vector<RODFDetector*> > RODFDetectorCon::myDetectorEdgeMap [protected] |
Definition at line 292 of file RODFDetector.h.
Referenced by addDetector(), getAggFlowFor(), getFlowFor(), and removeDetector().
std::map<std::string, RODFDetector*> RODFDetectorCon::myDetectorMap [protected] |
Definition at line 291 of file RODFDetector.h.
Referenced by addDetector(), getDetector(), knows(), and removeDetector().
std::vector<RODFDetector*> RODFDetectorCon::myDetectors [protected] |
Definition at line 290 of file RODFDetector.h.
Referenced by addDetector(), detectorsHaveCompleteTypes(), detectorsHaveRoutes(), getAnyDetectorForEdge(), getDetectors(), guessEmptyFlows(), removeDetector(), save(), saveAsPOIs(), saveRoutes(), writeEmitterPOIs(), writeEmitters(), writeEndRerouterDetectors(), writeSpeedTrigger(), writeValidationDetectors(), and ~RODFDetectorCon().
1.5.6