51 #ifdef CHECK_MEMORY_LEAKS
53 #endif // CHECK_MEMORY_LEAKS
60 SUMOReal positionInMeters,
bool splitByType) :
62 myPosition(positionInMeters), mySplitByType(splitByType),
63 myLastLeaveTime(
STEPS2TIME(
MSNet::getInstance()->getCurrentTimeStep())),
66 assert(
myPosition >= 0 && myPosition <= myLane->getLength());
155 for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) {
157 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval,
TS);
158 occupancy += timeOnDetDuringInterval;
167 return (
unsigned int) d.size();
171 std::vector<std::string>
174 std::vector<std::string> ret;
175 for (std::vector<VehicleData>::iterator i = d.begin(); i != d.end(); ++i) {
176 ret.push_back((*i).idM);
194 dev.
writeXMLHeader(
"detector",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.sf.net/xsd/det_e1_file.xsd\"");
204 std::map<std::string, std::pair<VehicleDataCont, VehicleMap> > types;
207 if (types.find((*i).typeIDM) == types.end()) {
210 types[(*i).typeIDM].first.push_back(*i);
213 const std::string& type = (*i).first->getVehicleType().getID();
214 if (types.find(type) == types.end()) {
217 types[type].second[(*i).first] = (*i).second;
220 for (std::map<std::string, std::pair<VehicleDataCont, VehicleMap> >::const_iterator i = types.begin(); i != types.end(); ++i) {
221 writeTypedXMLOutput(dev, startTime, stopTime, (*i).first, (*i).second.first, (*i).second.second);
224 dev <<
" </interval>\n";
235 unsigned nVehCrossed = (unsigned) vdc.size();
241 for (std::deque< VehicleData >::const_iterator i = vdc.begin(); i != vdc.end(); ++i) {
243 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval, t);
244 occupancy += timeOnDetDuringInterval;
246 for (std::map< SUMOVehicle*, SUMOReal >::const_iterator i = vm.begin(); i != vm.end(); ++i) {
248 occupancy += timeOnDetDuringInterval;
250 occupancy = occupancy / t * (
SUMOReal) 100.;
251 SUMOReal meanSpeed = vdc.size() != 0
254 SUMOReal meanLength = vdc.size() != 0
258 dev <<
" <typedInterval type=\"" + type +
"\" ";
260 dev <<
" <interval ";
262 dev <<
"begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
264 dev <<
"nVehContrib=\"" << vdc.size() <<
"\" flow=\"" << flow <<
265 "\" occupancy=\"" << occupancy <<
"\" speed=\"" << meanSpeed <<
266 "\" length=\"" << meanLength <<
267 "\" nVehEntered=\"" << nVehCrossed <<
"\"";
283 SUMOReal entryTimestep = it->second;
285 assert(entryTimestep < leaveTimestep);
301 std::vector<MSInductLoop::VehicleData>
304 std::vector<VehicleData> ret;
306 if ((*i).leaveTimeM >= t) {
311 if ((*i).leaveTimeM >= t) {