SUMOReal MSInductLoop::getCurrentLength() const { std::vector<VehicleData> d = collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T); return d.size() != 0 ? accumulate(d.begin(), d.end(), (SUMOReal) 0.0, lengthSum) / (SUMOReal) d.size() : -1; }
std::vector<std::string> MSInductLoop::getCurrentVehicleIDs() const { std::vector<VehicleData> d = collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T); std::vector<std::string> ret; for (std::vector<VehicleData>::iterator i = d.begin(); i != d.end(); ++i) { ret.push_back((*i).idM); } return ret; }
SUMOReal MSInductLoop::getCurrentOccupancy() const { SUMOTime tbeg = MSNet::getInstance()->getCurrentTimeStep() - DELTA_T; std::vector<VehicleData> d = collectVehiclesOnDet(tbeg); if (d.size() == 0) { return -1; } SUMOReal occupancy = 0; for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) { SUMOReal timeOnDetDuringInterval = (*i).leaveTimeM - MAX2(STEPS2TIME(tbeg), (*i).entryTimeM); timeOnDetDuringInterval = MIN2(timeOnDetDuringInterval, TS); occupancy += timeOnDetDuringInterval; } return occupancy / TS * (SUMOReal) 100.; }
unsigned int MSInductLoop::getCurrentPassedNumber() const { std::vector<VehicleData> d = collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T); return (unsigned int) d.size(); }
unsigned MSInductLoop::getNVehContributed() const throw() { return (unsigned int) collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep()-DELTA_T).size(); }
SUMOReal MSInductLoop::getCurrentPassedNumber() const throw() { std::vector<VehicleData> d = collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep()-DELTA_T); return (SUMOReal) d.size(); }