Ejemplo n.º 1
0
void
MSInductLoop::leaveDetectorByMove(MSVehicle& veh,
                                  SUMOReal leaveTimestep) throw() {
	int mainStripNum = 0;int flag = 0;
	for( MSLane::StripContIter it = myLane->myStrips.begin(); it!=myLane->myStrips.end(); it ++){
		if(veh.isMainStrip(**it)){
			flag = 1;
			break;
		}
		mainStripNum++;
	}

    VehicleMap::iterator it = myVehiclesOnDet[mainStripNum].find(&veh);
    //uncommnet following for extra check
   // assert(it != myVehiclesOnDet[mainStripNum].end());
    if(it!= myVehiclesOnDet[mainStripNum].end()){
		SUMOReal entryTimestep = it->second;
		myVehiclesOnDet[mainStripNum].erase(it);
		myCurrentVehicle[mainStripNum] = 0;
		//uncomment following for extra check
		//assert(entryTimestep < leaveTimestep);
		myVehicleDataCont[mainStripNum].push_back(VehicleData(veh.getID(), veh.getVehicleType().getLength(), entryTimestep, leaveTimestep));
		myLastOccupancy[mainStripNum] = 0;
		veh.quitRemindedLeft(this);
    }
    else {
    	//exit(0);
    	}
}
void
MSMsgInductLoop::leaveDetectorByLaneChange(MSVehicle& veh) throw() {
    // Discard entry data
    myVehiclesOnDet.erase(&veh);
    myDismissedVehicleNumber++;
    myCurrentID = myCurrentVehicle->getID();
    myCurrentVehicle = 0;
    veh.quitRemindedLeft(this);
}
void
MSMsgInductLoop::leaveDetectorByMove(MSVehicle& veh,
                                     SUMOReal leaveTimestep) throw() {
    VehicleMap::iterator it = myVehiclesOnDet.find(&veh);
    assert(it != myVehiclesOnDet.end());
    SUMOReal entryTimestep = it->second;
    myVehiclesOnDet.erase(it);
    assert(entryTimestep < leaveTimestep);
    myVehicleDataCont.push_back(VehicleData(veh.getVehicleType().getLength(), entryTimestep, leaveTimestep));
    myLastOccupancy = leaveTimestep - entryTimestep;
    myLastLeaveTime = leaveTimestep;
    myCurrentID = myCurrentVehicle->getID();
    myCurrentVehicle = 0;
    veh.quitRemindedLeft(this);
}
Ejemplo n.º 4
0
void
MSInductLoop::leaveDetectorByLaneChange(MSVehicle& veh) throw() {

	// Discard entry data
	int mainStripNum = 0;
	int flag = 0;
	for( MSLane::StripContIter it = myLane->myStrips.begin(); it!=myLane->myStrips.end(); it ++){
		if(veh.isMainStrip(**it)){
			flag = 1;
			break;
		}
		mainStripNum++;
	}

	if(flag){
		VehicleMap::iterator it = myVehiclesOnDet[mainStripNum].find(&veh);
		myVehiclesOnDet[mainStripNum].erase(it);
		myDismissedVehicleNumber++;
		myCurrentVehicle[mainStripNum] = 0;
		veh.quitRemindedLeft(this);
	}
}