Exemplo n.º 1
0
float CMedObjFollowState::GetRealMovedDist()const
{
	uint64 uCurTime = m_pCoreObj->GetConnection()->GetConnTime();
	const uint32 uElapsedTime = uint32(uCurTime - m_uThisPathExpiredTime);
	const float fRealDist = m_fBeginDist + sqr::CalMoveStep( m_fSpeed, uElapsedTime );
	float fIdealMovedDist = limit2( fRealDist, GetMovedDist(), GetEndDist() );
	float fMaxMovedDist = GetEndDist();
	if(fIdealMovedDist > fMaxMovedDist)
		fIdealMovedDist  = fMaxMovedDist; 
	return fIdealMovedDist;
}
Exemplo n.º 2
0
double FlightGroundRouteDirectSegInSim::GetExitHoldDist() const
{
	if(m_dir == PositiveDirection)
	{
		return GetEndDist() + min(m_pSeg->GetUserHold2Offset(),m_pSeg->GetHold2Offset());
	}
	else
	{
		return GetEndDist() - max(m_pSeg->GetUserHold1Offset(),m_pSeg->GetHold1Offset());
	}
}
DistanceUnit TaxiToReleasePointRouteInSim::GetExitRouteDist( AirsideFlightInSim* pFlight )
{
 	if(mpResDest && mpResDest->GetType()==AirsideResource::ResType_StartPosition)
 	{
 		DistanceUnit dDefault = GetEndDist() -100;
//  		HoldInTaxiRoute* pLastEntry = GetlastEntryHold();
//  		if(pLastEntry)
//  		{
//  			dDefault = min(dDefault, pLastEntry->m_dDistInRoute-1);
//  		}
 		return dDefault;
 	}
	return TaxiRouteInSim::GetExitRouteDist(pFlight);
}
Exemplo n.º 4
0
boost::tuple<DistanceUnit,double, ARCMobileElement*, IntersectionInRoute*, RouteDirPath* > MobileRouteInSim::checkConflictWithNextHold(  DistanceUnit mCurDistInRoute )
{
	double dMoveSpd =  mpMobile->getMobilePerform().getNormalSpd();
	DistanceUnit dDecDistToStatic = mpMobile->getMobilePerform().getSpdChangeDist(dMoveSpd,0); //dist to stop

	std::vector<IntersectionInRoute*> vNodeHoldList= mIntersectionList.GetNextIntersetions(mCurDistInRoute);


	for(int idxHD=0;idxHD<(int)vNodeHoldList.size();++idxHD)
	{
		IntersectionInRoute* pNextHold = vNodeHoldList.at(idxHD);
		if(pNextHold)
		{
			DistanceUnit distCheckHold = pNextHold->m_dEntryDistInRoute - dDecDistToStatic;
			if( int(mCurDistInRoute) < int(distCheckHold) ) //flight can move to the checkpoint
			{
				if( !mIntersectionList.IsDistForbidParking(distCheckHold) )
					return boost::make_tuple(distCheckHold, dMoveSpd,(ARCMobileElement*)NULL, pNextHold, (RouteDirPath*)NULL);	
			}

			ARCMobileElement *pConflictMobile;
			RouteDirPath* pPath;
			boost::tie(pConflictMobile,pPath) = bCanCrossTheIntersection(pNextHold);
			if(pConflictMobile)
			{
				DistanceUnit nextDist = pNextHold->m_dEntryDistInRoute;
				IntersectionInRoute* pWaitHold = mIntersectionList.IsDistForbidParking(nextDist);
				if(pWaitHold)
					nextDist = pWaitHold->m_dEntryDistInRoute;
				if( int(mCurDistInRoute) < int(nextDist) )
				{
					return  boost::make_tuple(nextDist,0,pConflictMobile,pNextHold,pPath);
				}
				else
				{
					return boost::make_tuple(mCurDistInRoute,0,pConflictMobile,pNextHold,pPath);
				}
			}

		}
	}	

	return boost::make_tuple( GetEndDist(),dMoveSpd,(ARCMobileElement*)NULL,(IntersectionInRoute*)NULL,(RouteDirPath*)0);
}
Exemplo n.º 5
0
boost::tuple<DistanceUnit,ARCMobileElement*> MobileRouteInSim::checkConflictWithLeadMobile( DistanceUnit mCurDistInRoute,DistanceUnit dRadOfConcern )
{
	//find the lead mobile element
	ARCMobileElement* pLeadMobile=NULL;DistanceUnit leadMobDist;

	boost::tie(pLeadMobile,leadMobDist) = getLeadMobile(mCurDistInRoute);

	if(pLeadMobile ) //can see a flight ahead
	{		

		DistanceUnit dSeperation  = pLeadMobile->getCurSeparation() + pLeadMobile->GetLength()*0.5 + mpMobile->GetLength()*0.5;

		double dNormalSpd = mpMobile->getMobilePerform().getNormalSpd();
		DistanceUnit dSafeDist = leadMobDist - dSeperation;

		double dLeadSpd = min(pLeadMobile->getCurSpeed(),dNormalSpd );
		DistanceUnit dSpdChageDist = mpMobile->getCurSpdChangeDist(dLeadSpd);


		IntersectionInRoute* pHWaitHold = mIntersectionList.IsDistForbidParking(dSafeDist);
		if(pHWaitHold)
			dSafeDist = pHWaitHold->m_dEntryDistInRoute;

		if(mCurDistInRoute + dSpdChageDist < dSafeDist)
		{
			return boost::make_tuple( dSafeDist-dSpdChageDist, dLeadSpd , (ARCMobileElement*)NULL);
		}
		else if(mCurDistInRoute < dSafeDist)
		{
			return boost::make_tuple( dSafeDist, 0, (ARCMobileElement*)NULL );
		}
		else
		{
			return boost::make_tuple( mCurDistInRoute, 0, pLeadMobile);
		}			
	}

	//after all try to use normal speed
	return boost::make_tuple( GetEndDist(),mpMobile->getMobilePerform().getNormalSpd(),(ARCMobileElement*)NULL);
}