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());
149 for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) {
151 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval,
TS);
152 occupancy += timeOnDetDuringInterval;
161 return (
unsigned int) d.size();
165 std::vector<std::string>
168 std::vector<std::string> ret;
169 for (std::vector<VehicleData>::iterator i = d.begin(); i != d.end(); ++i) {
170 ret.push_back((*i).idM);
188 dev.
writeXMLHeader(
"detector",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/det_e1_file.xsd\"");
198 std::map<std::string, std::pair<VehicleDataCont, VehicleMap> > types;
201 if (types.find((*i).typeIDM) == types.end()) {
204 types[(*i).typeIDM].first.push_back(*i);
207 const std::string& type = (*i).first->getVehicleType().getID();
208 if (types.find(type) == types.end()) {
211 types[type].second[(*i).first] = (*i).second;
214 for (std::map<std::string, std::pair<VehicleDataCont, VehicleMap> >::const_iterator i = types.begin(); i != types.end(); ++i) {
215 writeTypedXMLOutput(dev, startTime, stopTime, (*i).first, (*i).second.first, (*i).second.second);
218 dev <<
" </interval>\n";
229 unsigned nVehCrossed = (unsigned) vdc.size();
235 for (std::deque< VehicleData >::const_iterator i = vdc.begin(); i != vdc.end(); ++i) {
237 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval, t);
238 occupancy += timeOnDetDuringInterval;
240 for (std::map< SUMOVehicle*, SUMOReal >::const_iterator i = vm.begin(); i != vm.end(); ++i) {
242 occupancy += timeOnDetDuringInterval;
244 occupancy = occupancy / t * (
SUMOReal) 100.;
245 SUMOReal meanSpeed = vdc.size() != 0
248 SUMOReal meanLength = vdc.size() != 0
252 dev <<
" <typedInterval type=\"" + type +
"\" ";
254 dev <<
" <interval ";
256 dev <<
"begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
258 dev <<
"nVehContrib=\"" << vdc.size() <<
"\" flow=\"" << flow <<
259 "\" occupancy=\"" << occupancy <<
"\" speed=\"" << meanSpeed <<
260 "\" length=\"" << meanLength <<
261 "\" nVehEntered=\"" << nVehCrossed <<
"\"";
277 SUMOReal entryTimestep = it->second;
279 assert(entryTimestep < leaveTimestep);
298 std::vector<MSInductLoop::VehicleData>
301 std::vector<VehicleData> ret;
303 if ((*i).leaveTimeM >= t) {
308 if ((*i).leaveTimeM >= t) {