SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00011 // Builds detectors for microsim 00012 /****************************************************************************/ 00013 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00014 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00015 /****************************************************************************/ 00016 // 00017 // This file is part of SUMO. 00018 // SUMO is free software: you can redistribute it and/or modify 00019 // it under the terms of the GNU General Public License as published by 00020 // the Free Software Foundation, either version 3 of the License, or 00021 // (at your option) any later version. 00022 // 00023 /****************************************************************************/ 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <string> 00036 #include <iostream> 00037 #include <microsim/MSNet.h> 00038 #include <microsim/MSLane.h> 00039 #include <microsim/MSEdge.h> 00040 #include <microsim/output/MSInductLoop.h> 00041 #include <microsim/output/MSE2Collector.h> 00042 #include <microsim/output/MS_E2_ZS_CollectorOverLanes.h> 00043 #include <microsim/output/MSVTypeProbe.h> 00044 #include <microsim/output/MSRouteProbe.h> 00045 #include <microsim/output/MSMeanData_Net.h> 00046 #include <microsim/output/MSMeanData_HBEFA.h> 00047 #include <microsim/output/MSMeanData_Harmonoise.h> 00048 #include <microsim/output/MSInstantInductLoop.h> 00049 #include <microsim/MSGlobals.h> 00050 #include <microsim/actions/Command_SaveTLCoupledDet.h> 00051 #include <microsim/actions/Command_SaveTLCoupledLaneDet.h> 00052 #include <utils/common/UtilExceptions.h> 00053 #include <utils/common/FileHelpers.h> 00054 #include <utils/common/StringUtils.h> 00055 #include <utils/common/StringTokenizer.h> 00056 #include <utils/common/TplConvert.h> 00057 #include "NLDetectorBuilder.h" 00058 #include <microsim/output/MSDetectorControl.h> 00059 00060 #ifdef HAVE_MESOSIM 00061 #include <mesosim/MEInductLoop.h> 00062 #include <mesosim/MELoop.h> 00063 #include <mesosim/MESegment.h> 00064 #endif 00065 00066 #ifdef CHECK_MEMORY_LEAKS 00067 #include <foreign/nvwa/debug_new.h> 00068 #endif // CHECK_MEMORY_LEAKS 00069 00070 00071 // =========================================================================== 00072 // method definitions 00073 // =========================================================================== 00074 /* ------------------------------------------------------------------------- 00075 * NLDetectorBuilder::E3DetectorDefinition-methods 00076 * ----------------------------------------------------------------------- */ 00077 NLDetectorBuilder::E3DetectorDefinition::E3DetectorDefinition(const std::string& id, 00078 OutputDevice& device, SUMOReal haltingSpeedThreshold, 00079 SUMOTime haltingTimeThreshold, int splInterval) 00080 : myID(id), myDevice(device), 00081 myHaltingSpeedThreshold(haltingSpeedThreshold), 00082 myHaltingTimeThreshold(haltingTimeThreshold), 00083 mySampleInterval(splInterval) {} 00084 00085 00086 NLDetectorBuilder::E3DetectorDefinition::~E3DetectorDefinition() {} 00087 00088 00089 /* ------------------------------------------------------------------------- 00090 * NLDetectorBuilder-methods 00091 * ----------------------------------------------------------------------- */ 00092 NLDetectorBuilder::NLDetectorBuilder(MSNet& net) 00093 : myNet(net), myE3Definition(0) {} 00094 00095 00096 NLDetectorBuilder::~NLDetectorBuilder() {} 00097 00098 00099 void 00100 NLDetectorBuilder::buildInductLoop(const std::string& id, 00101 const std::string& lane, SUMOReal pos, int splInterval, 00102 OutputDevice& device, bool friendlyPos, bool splitByType) throw(InvalidArgument) { 00103 checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id); 00104 // get and check the lane 00105 MSLane* clane = getLaneChecking(lane, SUMO_TAG_E1DETECTOR, id); 00106 if (!MSGlobals::gUseMesoSim) { 00107 // get and check the position 00108 pos = getPositionChecking(pos, clane, friendlyPos, id); 00109 // build the loop 00110 MSDetectorFileOutput* loop = createInductLoop(id, clane, pos, splitByType); 00111 // add the file output 00112 myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval); 00113 } else { 00114 #ifdef HAVE_MESOSIM 00115 if (pos < 0) { 00116 pos = clane->getLength() + pos; 00117 } 00118 MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(clane->getEdge()); 00119 MESegment* prev = s; 00120 SUMOReal cpos = 0; 00121 while (cpos + prev->getLength() < pos && s != 0) { 00122 prev = s; 00123 cpos += s->getLength(); 00124 s = s->getNextSegment(); 00125 } 00126 SUMOReal rpos = pos - cpos; //-prev->getLength(); 00127 if (rpos > prev->getLength() || rpos < 0) { 00128 if (friendlyPos) { 00129 rpos = prev->getLength() - (SUMOReal) 0.1; 00130 } else { 00131 throw InvalidArgument("The position of detector '" + id + "' lies beyond the lane's '" + lane + "' length."); 00132 } 00133 } 00134 MEInductLoop* loop = 00135 createMEInductLoop(id, prev, rpos); 00136 myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval); 00137 #endif 00138 } 00139 } 00140 00141 00142 void 00143 NLDetectorBuilder::buildInstantInductLoop(const std::string& id, 00144 const std::string& lane, SUMOReal pos, 00145 OutputDevice& device, bool friendlyPos) throw(InvalidArgument) { 00146 // get and check the lane 00147 MSLane* clane = getLaneChecking(lane, SUMO_TAG_INSTANT_INDUCTION_LOOP, id); 00148 // get and check the position 00149 pos = getPositionChecking(pos, clane, friendlyPos, id); 00150 // build the loop 00151 MSDetectorFileOutput* loop = createInstantInductLoop(id, clane, pos, device); 00152 // add the file output 00153 myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop); 00154 } 00155 00156 00157 void 00158 NLDetectorBuilder::buildE2Detector(const std::string& id, 00159 const std::string& lane, SUMOReal pos, SUMOReal length, 00160 bool cont, int splInterval, 00161 OutputDevice& device, 00162 SUMOTime haltingTimeThreshold, 00163 SUMOReal haltingSpeedThreshold, 00164 SUMOReal jamDistThreshold, bool friendlyPos) throw(InvalidArgument) { 00165 checkSampleInterval(splInterval, SUMO_TAG_E2DETECTOR, id); 00166 MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); 00167 // check whether the detector may lie over more than one lane 00168 MSDetectorFileOutput* det = 0; 00169 if (!cont) { 00170 convUncontE2PosLength(id, clane, pos, length, friendlyPos); 00171 det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00172 myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval); 00173 } else { 00174 convContE2PosLength(id, clane, pos, length, friendlyPos); 00175 det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00176 myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval); 00177 } 00178 } 00179 00180 00181 void 00182 NLDetectorBuilder::buildE2Detector(const std::string& id, 00183 const std::string& lane, SUMOReal pos, SUMOReal length, 00184 bool cont, 00185 MSTLLogicControl::TLSLogicVariants& tlls, 00186 OutputDevice& device, 00187 SUMOTime haltingTimeThreshold, 00188 SUMOReal haltingSpeedThreshold, 00189 SUMOReal jamDistThreshold, bool friendlyPos) throw(InvalidArgument) { 00190 if (tlls.getActive() == 0) { 00191 throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa."); 00192 } 00193 MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); 00194 // check whether the detector may lie over more than one lane 00195 MSDetectorFileOutput* det = 0; 00196 if (!cont) { 00197 convUncontE2PosLength(id, clane, pos, length, friendlyPos); 00198 det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00199 myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); 00200 } else { 00201 convContE2PosLength(id, clane, pos, length, friendlyPos); 00202 det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00203 myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); 00204 } 00205 // add the file output 00206 new Command_SaveTLCoupledDet(tlls, det, myNet.getCurrentTimeStep(), device); 00207 } 00208 00209 00210 void 00211 NLDetectorBuilder::buildE2Detector(const std::string& id, 00212 const std::string& lane, SUMOReal pos, SUMOReal length, 00213 bool cont, 00214 MSTLLogicControl::TLSLogicVariants& tlls, 00215 const std::string& tolane, 00216 OutputDevice& device, 00217 SUMOTime haltingTimeThreshold, 00218 SUMOReal haltingSpeedThreshold, 00219 SUMOReal jamDistThreshold, bool friendlyPos) throw(InvalidArgument) { 00220 if (tlls.getActive() == 0) { 00221 throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa."); 00222 } 00223 MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); 00224 MSLane* ctoLane = getLaneChecking(tolane, SUMO_TAG_E2DETECTOR, id); 00225 MSLink* link = MSLinkContHelper::getConnectingLink(*clane, *ctoLane); 00226 if (link == 0) { 00227 throw InvalidArgument( 00228 "The detector output can not be build as no connection between lanes '" 00229 + lane + "' and '" + tolane + "' exists."); 00230 } 00231 if (pos < 0) { 00232 pos = -pos; 00233 } 00234 // check whether the detector may lie over more than one lane 00235 MSDetectorFileOutput* det = 0; 00236 if (!cont) { 00237 convUncontE2PosLength(id, clane, pos, length, friendlyPos); 00238 det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00239 myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); 00240 } else { 00241 convContE2PosLength(id, clane, pos, length, friendlyPos); 00242 det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00243 myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); 00244 } 00245 // add the file output 00246 new Command_SaveTLCoupledLaneDet(tlls, det, myNet.getCurrentTimeStep(), device, link); 00247 } 00248 00249 00250 void 00251 NLDetectorBuilder::convUncontE2PosLength(const std::string& id, MSLane* clane, 00252 SUMOReal& pos, SUMOReal& length, 00253 bool friendlyPos) throw(InvalidArgument) { 00254 // get and check the position 00255 pos = getPositionChecking(pos, clane, friendlyPos, id); 00256 // check length 00257 if (length < 0) { 00258 length = clane->getLength() + length; 00259 } 00260 if (length + pos > clane->getLength()) { 00261 if (friendlyPos) { 00262 length = clane->getLength() - pos - (SUMOReal) 0.1; 00263 } else { 00264 throw InvalidArgument("The length of detector '" + id + "' lies beyond the lane's '" + clane->getID() + "' length."); 00265 } 00266 } 00267 if (length < 0) { 00268 if (friendlyPos) { 00269 length = (SUMOReal) 0.1; 00270 } else { 00271 throw InvalidArgument("The length of detector '" + id + "' is almost 0."); 00272 } 00273 } 00274 } 00275 00276 00277 void 00278 NLDetectorBuilder::convContE2PosLength(const std::string& id, MSLane* clane, 00279 SUMOReal& pos, SUMOReal& /*length*/, 00280 bool friendlyPos) throw(InvalidArgument) { 00281 // get and check the position 00282 pos = getPositionChecking(pos, clane, friendlyPos, id); 00283 // length will be kept as is 00284 } 00285 00286 00287 void 00288 NLDetectorBuilder::beginE3Detector(const std::string& id, 00289 OutputDevice& device, int splInterval, 00290 SUMOReal haltingSpeedThreshold, 00291 SUMOTime haltingTimeThreshold) throw(InvalidArgument) { 00292 checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id); 00293 myE3Definition = new E3DetectorDefinition(id, device, haltingSpeedThreshold, haltingTimeThreshold, splInterval); 00294 } 00295 00296 00297 void 00298 NLDetectorBuilder::addE3Entry(const std::string& lane, 00299 SUMOReal pos, bool friendlyPos) throw(InvalidArgument) { 00300 if (myE3Definition == 0) { 00301 return; 00302 } 00303 MSLane* clane = getLaneChecking(lane, SUMO_TAG_E3DETECTOR, myE3Definition->myID); 00304 // get and check the position 00305 pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID); 00306 // build and save the entry 00307 myE3Definition->myEntries.push_back(MSCrossSection(clane, pos)); 00308 } 00309 00310 00311 void 00312 NLDetectorBuilder::addE3Exit(const std::string& lane, 00313 SUMOReal pos, bool friendlyPos) throw(InvalidArgument) { 00314 if (myE3Definition == 0) { 00315 return; 00316 } 00317 MSLane* clane = getLaneChecking(lane, SUMO_TAG_E3DETECTOR, myE3Definition->myID); 00318 // get and check the position 00319 pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID); 00320 // build and save the exit 00321 myE3Definition->myExits.push_back(MSCrossSection(clane, pos)); 00322 } 00323 00324 00325 std::string 00326 NLDetectorBuilder::getCurrentE3ID() const { 00327 if (myE3Definition == 0) { 00328 return "<unknown>"; 00329 } 00330 return myE3Definition->myID; 00331 } 00332 00333 00334 void 00335 NLDetectorBuilder::endE3Detector() throw(InvalidArgument) { 00336 if (myE3Definition == 0) { 00337 return; 00338 } 00339 MSDetectorFileOutput* det = createE3Detector(myE3Definition->myID, 00340 myE3Definition->myEntries, myE3Definition->myExits, 00341 myE3Definition->myHaltingSpeedThreshold, myE3Definition->myHaltingTimeThreshold); 00342 // add to net 00343 myNet.getDetectorControl().add(SUMO_TAG_ENTRY_EXIT_DETECTOR, det, myE3Definition->myDevice, myE3Definition->mySampleInterval); 00344 // clean up 00345 delete myE3Definition; 00346 myE3Definition = 0; 00347 } 00348 00349 00350 void 00351 NLDetectorBuilder::buildVTypeProbe(const std::string& id, 00352 const std::string& vtype, SUMOTime frequency, 00353 OutputDevice& device) throw(InvalidArgument) { 00354 checkSampleInterval(frequency, SUMO_TAG_VTYPEPROBE, id); 00355 new MSVTypeProbe(id, vtype, device, frequency); 00356 } 00357 00358 00359 void 00360 NLDetectorBuilder::buildRouteProbe(const std::string& id, const std::string& edge, 00361 SUMOTime frequency, SUMOTime begin, 00362 OutputDevice& device) throw(InvalidArgument) { 00363 checkSampleInterval(frequency, SUMO_TAG_ROUTEPROBE, id); 00364 MSEdge* e = getEdgeChecking(edge, SUMO_TAG_ROUTEPROBE, id); 00365 MSRouteProbe* probe = new MSRouteProbe(id, e, begin); 00366 // add the file output 00367 myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin); 00368 } 00369 00370 00371 // ------------------- 00372 MSDetectorFileOutput* 00373 NLDetectorBuilder::buildSingleLaneE2Det(const std::string& id, 00374 DetectorUsage usage, 00375 MSLane* lane, SUMOReal pos, SUMOReal length, 00376 SUMOTime haltingTimeThreshold, 00377 SUMOReal haltingSpeedThreshold, 00378 SUMOReal jamDistThreshold) { 00379 return createSingleLaneE2Detector(id, usage, lane, pos, 00380 length, haltingTimeThreshold, haltingSpeedThreshold, 00381 jamDistThreshold); 00382 } 00383 00384 00385 MSDetectorFileOutput* 00386 NLDetectorBuilder::buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, 00387 MSLane* lane, SUMOReal pos, SUMOReal length, 00388 SUMOTime haltingTimeThreshold, 00389 SUMOReal haltingSpeedThreshold, 00390 SUMOReal jamDistThreshold) { 00391 MSDetectorFileOutput* ret = createMultiLaneE2Detector(id, usage, 00392 lane, pos, haltingTimeThreshold, haltingSpeedThreshold, 00393 jamDistThreshold); 00394 static_cast<MS_E2_ZS_CollectorOverLanes*>(ret)->init(lane, length); 00395 return ret; 00396 } 00397 00398 00399 MSDetectorFileOutput* 00400 NLDetectorBuilder::createInductLoop(const std::string& id, 00401 MSLane* lane, SUMOReal pos, bool splitByType) { 00402 return new MSInductLoop(id, lane, pos, splitByType); 00403 } 00404 00405 00406 MSDetectorFileOutput* 00407 NLDetectorBuilder::createInstantInductLoop(const std::string& id, 00408 MSLane* lane, SUMOReal pos, OutputDevice& od) { 00409 return new MSInstantInductLoop(id, od, lane, pos); 00410 } 00411 00412 00413 #ifdef HAVE_MESOSIM 00414 MEInductLoop* 00415 NLDetectorBuilder::createMEInductLoop(const std::string& id, 00416 MESegment* s, SUMOReal pos) { 00417 return new MEInductLoop(id, s, pos); 00418 } 00419 #endif 00420 00421 00422 MSDetectorFileOutput* 00423 NLDetectorBuilder::createSingleLaneE2Detector(const std::string& id, 00424 DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, 00425 SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold) { 00426 return new MSE2Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00427 } 00428 00429 00430 MSDetectorFileOutput* 00431 NLDetectorBuilder::createMultiLaneE2Detector(const std::string& id, 00432 DetectorUsage usage, MSLane* lane, SUMOReal pos, 00433 SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold) { 00434 return new MS_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); 00435 } 00436 00437 00438 MSDetectorFileOutput* 00439 NLDetectorBuilder::createE3Detector(const std::string& id, 00440 const CrossSectionVector& entries, 00441 const CrossSectionVector& exits, 00442 SUMOReal haltingSpeedThreshold, 00443 SUMOTime haltingTimeThreshold) { 00444 return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold); 00445 } 00446 00447 00448 SUMOReal 00449 NLDetectorBuilder::getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos, 00450 const std::string& detid) throw(InvalidArgument) { 00451 // check whether it is given from the end 00452 if (pos < 0) { 00453 pos = lane->getLength() + pos; 00454 } 00455 // check whether it is on the lane 00456 if (pos > lane->getLength()) { 00457 if (friendlyPos) { 00458 pos = lane->getLength() - (SUMOReal) 0.1; 00459 } else { 00460 throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' length."); 00461 } 00462 } 00463 if (pos < 0) { 00464 if (friendlyPos) { 00465 pos = (SUMOReal) 0.1; 00466 } else { 00467 throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' length."); 00468 } 00469 } 00470 return pos; 00471 } 00472 00473 00474 void 00475 NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency, 00476 SUMOTime begin, SUMOTime end, const std::string& type, 00477 const bool useLanes, const bool withEmpty, const bool printDefaults, 00478 const bool withInternal, const bool trackVehicles, 00479 const SUMOReal maxTravelTime, const SUMOReal minSamples, 00480 const SUMOReal haltSpeed, const std::string& vTypes, 00481 OutputDevice& device) throw(InvalidArgument) { 00482 if (begin < 0) { 00483 throw InvalidArgument("Negative begin time for meandata dump '" + id + "'."); 00484 } 00485 if (end < 0) { 00486 end = SUMOTime_MAX; 00487 } 00488 if (end <= begin) { 00489 throw InvalidArgument("End before or at begin for meandata dump '" + id + "'."); 00490 } 00491 std::set<std::string> vt; 00492 StringTokenizer st(vTypes); 00493 while (st.hasNext()) { 00494 vt.insert(st.next()); 00495 } 00496 MSMeanData* det = 0; 00497 if (type == "" || type == "performance" || type == "traffic") { 00498 det = new MSMeanData_Net(id, begin, end, useLanes, withEmpty, 00499 printDefaults, withInternal, trackVehicles, 00500 maxTravelTime, minSamples, haltSpeed, vt); 00501 } else if (type == "hbefa") { 00502 det = new MSMeanData_HBEFA(id, begin, end, useLanes, withEmpty, 00503 printDefaults, withInternal, trackVehicles, 00504 maxTravelTime, minSamples, vt); 00505 } else if (type == "harmonoise") { 00506 det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty, 00507 printDefaults, withInternal, trackVehicles, 00508 maxTravelTime, minSamples, vt); 00509 } else { 00510 throw InvalidArgument("Invalid type '" + type + "' for meandata dump '" + id + "'."); 00511 } 00512 if (det != 0) { 00513 if (frequency < 0) { 00514 frequency = end - begin; 00515 } 00516 MSNet::getInstance()->getDetectorControl().add(det, device, frequency, begin); 00517 } 00518 } 00519 00520 00521 00522 00523 // ------ Value checking/adapting methods ------ 00524 MSEdge* 00525 NLDetectorBuilder::getEdgeChecking(const std::string& edgeID, SumoXMLTag type, 00526 const std::string& detid) throw(InvalidArgument) { 00527 // get and check the lane 00528 MSEdge* edge = MSEdge::dictionary(edgeID); 00529 if (edge == 0) { 00530 throw InvalidArgument("The lane with the id '" + edgeID + "' is not known (while building " + toString(type) + " '" + detid + "')."); 00531 } 00532 return edge; 00533 } 00534 00535 00536 MSLane* 00537 NLDetectorBuilder::getLaneChecking(const std::string& laneID, SumoXMLTag type, 00538 const std::string& detid) throw(InvalidArgument) { 00539 // get and check the lane 00540 MSLane* lane = MSLane::dictionary(laneID); 00541 if (lane == 0) { 00542 throw InvalidArgument("The lane with the id '" + laneID + "' is not known (while building " + toString(type) + " '" + detid + "')."); 00543 } 00544 return lane; 00545 } 00546 00547 00548 void 00549 NLDetectorBuilder::checkSampleInterval(int splInterval, SumoXMLTag type, const std::string& id) throw(InvalidArgument) { 00550 if (splInterval < 0) { 00551 throw InvalidArgument("Negative sampling frequency (in " + toString(type) + " '" + id + "')."); 00552 } 00553 if (splInterval == 0) { 00554 throw InvalidArgument("Sampling frequency must not be zero (in " + toString(type) + " '" + id + "')."); 00555 } 00556 } 00557 00558 00559 /****************************************************************************/ 00560