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());
156 for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) {
158 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval,
TS);
159 occupancy += timeOnDetDuringInterval;
168 return (
unsigned int) d.size();
172 std::vector<std::string>
175 std::vector<std::string> ret;
176 for (std::vector<VehicleData>::iterator i = d.begin(); i != d.end(); ++i) {
177 ret.push_back((*i).idM);
195 dev.
writeXMLHeader(
"detector",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.sf.net/xsd/det_e1_file.xsd\"");
205 std::map<std::string, std::pair<VehicleDataCont, VehicleMap> > types;
208 if (types.find((*i).typeIDM) == types.end()) {
211 types[(*i).typeIDM].first.push_back(*i);
214 const std::string& type = (*i).first->getVehicleType().getID();
215 if (types.find(type) == types.end()) {
218 types[type].second[(*i).first] = (*i).second;
221 for (std::map<std::string, std::pair<VehicleDataCont, VehicleMap> >::const_iterator i = types.begin(); i != types.end(); ++i) {
222 writeTypedXMLOutput(dev, startTime, stopTime, (*i).first, (*i).second.first, (*i).second.second);
225 dev <<
" </interval>\n";
236 unsigned nVehCrossed = (unsigned) vdc.size();
242 for (std::deque< VehicleData >::const_iterator i = vdc.begin(); i != vdc.end(); ++i) {
244 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval, t);
245 occupancy += timeOnDetDuringInterval;
247 for (std::map< SUMOVehicle*, SUMOReal >::const_iterator i = vm.begin(); i != vm.end(); ++i) {
249 occupancy += timeOnDetDuringInterval;
251 occupancy = occupancy / t * (
SUMOReal) 100.;
252 SUMOReal meanSpeed = vdc.size() != 0
255 SUMOReal meanLength = vdc.size() != 0
259 dev <<
" <typedInterval type=\"" + type +
"\" ";
261 dev <<
" <interval ";
263 dev <<
"begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
265 dev <<
"nVehContrib=\"" << vdc.size() <<
"\" flow=\"" << flow <<
266 "\" occupancy=\"" << occupancy <<
"\" speed=\"" << meanSpeed <<
267 "\" length=\"" << meanLength <<
268 "\" nVehEntered=\"" << nVehCrossed <<
"\"";
284 SUMOReal entryTimestep = it->second;
286 assert(entryTimestep < leaveTimestep);
302 std::vector<MSInductLoop::VehicleData>
305 std::vector<VehicleData> ret;
307 if ((*i).leaveTimeM >= t) {
312 if ((*i).leaveTimeM >= t) {