51 #ifdef CHECK_MEMORY_LEAKS
53 #endif // CHECK_MEMORY_LEAKS
60 SUMOReal positionInMeters,
bool splitByType) :
63 myPosition(positionInMeters), mySplitByType(splitByType),
64 myLastLeaveTime(
STEPS2TIME(
MSNet::getInstance()->getCurrentTimeStep())),
67 assert(
myPosition >= 0 && myPosition <= myLane->getLength());
153 for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) {
155 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval,
TS);
156 occupancy += timeOnDetDuringInterval;
165 return (
unsigned int) d.size();
169 std::vector<std::string>
172 std::vector<std::string> ret;
173 for (std::vector<VehicleData>::iterator i = d.begin(); i != d.end(); ++i) {
174 ret.push_back((*i).idM);
192 dev.
writeXMLHeader(
"detector",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/det_e1_file.xsd\"");
202 std::map<std::string, std::pair<VehicleDataCont, VehicleMap> > types;
205 if (types.find((*i).typeIDM) == types.end()) {
208 types[(*i).typeIDM].first.push_back(*i);
211 const std::string& type = (*i).first->getVehicleType().getID();
212 if (types.find(type) == types.end()) {
215 types[type].second[(*i).first] = (*i).second;
218 for (std::map<std::string, std::pair<VehicleDataCont, VehicleMap> >::const_iterator i = types.begin(); i != types.end(); ++i) {
219 writeTypedXMLOutput(dev, startTime, stopTime, (*i).first, (*i).second.first, (*i).second.second);
222 dev <<
" </interval>\n";
233 unsigned nVehCrossed = (unsigned) vdc.size();
239 for (std::deque< VehicleData >::const_iterator i = vdc.begin(); i != vdc.end(); ++i) {
241 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval, t);
242 occupancy += timeOnDetDuringInterval;
244 for (std::map< SUMOVehicle*, SUMOReal >::const_iterator i = vm.begin(); i != vm.end(); ++i) {
246 occupancy += timeOnDetDuringInterval;
248 occupancy = occupancy / t * (
SUMOReal) 100.;
249 SUMOReal meanSpeed = vdc.size() != 0
252 SUMOReal meanLength = vdc.size() != 0
256 dev <<
" <typedInterval type=\"" + type +
"\" ";
258 dev <<
" <interval ";
260 dev <<
"begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
262 dev <<
"nVehContrib=\"" << vdc.size() <<
"\" flow=\"" << flow <<
263 "\" occupancy=\"" << occupancy <<
"\" speed=\"" << meanSpeed <<
264 "\" length=\"" << meanLength <<
265 "\" nVehEntered=\"" << nVehCrossed <<
"\"";
281 SUMOReal entryTimestep = it->second;
283 assert(entryTimestep < leaveTimestep);
302 std::vector<MSInductLoop::VehicleData>
305 std::vector<VehicleData> ret;
307 if ((*i).leaveTimeM >= t) {
312 if ((*i).leaveTimeM >= t) {