51 #ifdef CHECK_MEMORY_LEAKS
53 #endif // CHECK_MEMORY_LEAKS
60 SUMOReal positionInMeters,
bool splitByType) :
63 myPosition(positionInMeters),
66 myVehiclesOnDet(), mySplitByType(splitByType) {
67 assert(
myPosition >= 0 && myPosition <= myLane->getLength());
162 for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) {
164 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval,
TS);
165 occupancy += timeOnDetDuringInterval;
174 return (
unsigned int) d.size();
178 std::vector<std::string>
181 std::vector<std::string> ret;
182 for (std::vector<VehicleData>::iterator i = d.begin(); i != d.end(); ++i) {
183 ret.push_back((*i).idM);
211 std::map<std::string, std::pair<VehicleDataCont, VehicleMap> > types;
214 if (types.find((*i).typeIDM) == types.end()) {
217 types[(*i).typeIDM].first.push_back(*i);
220 const std::string& type = (*i).first->getVehicleType().getID();
221 if (types.find(type) == types.end()) {
224 types[type].second[(*i).first] = (*i).second;
227 for (std::map<std::string, std::pair<VehicleDataCont, VehicleMap> >::const_iterator i = types.begin(); i != types.end(); ++i) {
228 writeTypedXMLOutput(dev, startTime, stopTime, (*i).first, (*i).second.first, (*i).second.second);
231 dev <<
" </interval>\n";
242 unsigned nVehCrossed = (unsigned) vdc.size();
248 for (std::deque< VehicleData >::const_iterator i = vdc.begin(); i != vdc.end(); ++i) {
250 timeOnDetDuringInterval =
MIN2(timeOnDetDuringInterval, t);
251 occupancy += timeOnDetDuringInterval;
253 for (std::map< SUMOVehicle*, SUMOReal >::const_iterator i = vm.begin(); i != vm.end(); ++i) {
255 occupancy += timeOnDetDuringInterval;
257 occupancy = occupancy / t * (
SUMOReal) 100.;
258 SUMOReal meanSpeed = vdc.size() != 0
261 SUMOReal meanLength = vdc.size() != 0
265 dev <<
" <typedInterval type=\"" + type +
"\" ";
267 dev <<
" <interval ";
269 dev <<
"begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
271 dev <<
"nVehContrib=\"" << vdc.size() <<
"\" flow=\"" << flow <<
272 "\" occupancy=\"" << occupancy <<
"\" speed=\"" << meanSpeed <<
273 "\" length=\"" << meanLength <<
274 "\" nVehEntered=\"" << nVehCrossed <<
"\"";
290 SUMOReal entryTimestep = it->second;
292 assert(entryTimestep < leaveTimestep);
308 std::vector<MSInductLoop::VehicleData>
311 std::vector<VehicleData> ret;
313 if ((*i).leaveTimeM >= t) {
318 if ((*i).leaveTimeM >= t) {