void NLDetectorBuilder::buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length, bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos, const std::string& vTypes) { if (tlls.getActive() == 0) { throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa."); } MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); // check whether the detector may lie over more than one lane MSDetectorFileOutput* det = 0; if (!cont) { convUncontE2PosLength(id, clane, pos, length, friendlyPos); det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); } else { convContE2PosLength(id, clane, pos, length, friendlyPos); det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); } // add the file output new Command_SaveTLCoupledDet(tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device)); }
void NLDetectorBuilder::buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, MSTLLogicControl::TLSLogicVariants &tlls, const std::string &tolane, OutputDevice& device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos) throw(InvalidArgument) { if (tlls.getActive()==0) { throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa."); } MSLane *clane = getLaneChecking(lane, id); MSLane *ctoLane = getLaneChecking(tolane, id); MSLink *link = MSLinkContHelper::getConnectingLink(*clane, *ctoLane); if (link==0) { throw InvalidArgument( "The detector output can not be build as no connection between lanes '" + lane + "' and '" + tolane + "' exists."); } if (pos<0) { pos = -pos; } // check whether the detector may lie over more than one lane MSDetectorFileOutput *det = 0; if (!cont) { convUncontE2PosLength(id, clane, pos, length, friendlyPos); det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); myNet.getDetectorControl().add(static_cast<MSE2Collector*>(det)); } else { convContE2PosLength(id, clane, pos, length, friendlyPos); det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold); myNet.getDetectorControl().add(static_cast<MS_E2_ZS_CollectorOverLanes*>(det)); } // add the file output new Command_SaveTLCoupledLaneDet(tlls, det, myNet.getCurrentTimeStep(), device, link); }