void AirsideRunwayUtilizationReport::CDetailRunwayUtilizationChart::Draw3DChart( CARC3DChart& chartWnd, CParameters *pParameter )
{
	if(pParameter == NULL)
		return;

	ElapsedTime eTimeInterval = ElapsedTime(pParameter->getInterval());//interval is 10 seconds

	//min, max occupancy time
	ElapsedTime eStartTime = pParameter->getStartTime();
	ElapsedTime eEndTime = pParameter->getEndTime();



	CString strLabel = _T("");
	C2DChartData c2dGraphData;

	c2dGraphData.m_strChartTitle = _T(" Runway Utilization Report");
	c2dGraphData.m_strYtitle = _T("Time(min)");
	c2dGraphData.m_strXtitle = _T("Time of day");
	if(m_bParameterIsDefault)
		c2dGraphData.m_strXtitle += _T("(Based on partial data only)");


	//get all legends
	std::vector<CString> vLegends; 
	vLegends.push_back(_T("Occupied"));
	vLegends.push_back(_T("Idle"));
	c2dGraphData.m_vrLegend = vLegends;


	c2dGraphData.m_vr2DChartData.resize(vLegends.size()) ;


	int nActiveRunwayCount = GetActiveRunwayCount();
	ElapsedTime nTotalIntTime = ElapsedTime( nActiveRunwayCount * eTimeInterval.asSeconds() * 1L);
	//x tick, runway
	for (;eStartTime < eEndTime + eTimeInterval; eStartTime += eTimeInterval)
	{

		CString strTick;
		strTick.Format(_T("%s - %s"),eStartTime.PrintDateTime(),(eStartTime + eTimeInterval).PrintDateTime());
		c2dGraphData.m_vrXTickTitle.push_back(strTick);

		//get the chart data
		ElapsedTime eTimeOccupied = ElapsedTime(0L);
		GetOccupyTimeBetween(eStartTime,eStartTime + eTimeInterval, eTimeOccupied);

		c2dGraphData.m_vr2DChartData[0].push_back(eTimeOccupied.asMinutes());
		
		c2dGraphData.m_vr2DChartData[1].push_back((nTotalIntTime  - eTimeOccupied).asMinutes());

	}

	//set footer
	CString strFooter(_T(""));
	strFooter.Format(_T("%s %s,%s "), c2dGraphData.m_strChartTitle,
		pParameter->getStartTime().printTime(), 
		pParameter->getEndTime().printTime());


	bool bCommaFlag = true;
	CAirsideRunwayUtilizationReportParam* pParam = (CAirsideRunwayUtilizationReportParam*)pParameter;
	//for (int i=0; i<(int)pParam->getFlightConstraintCount(); i++)
	//{
	//	FlightConstraint fltCons = pParam->getFlightConstraint(i);

	//	CString strFlight(_T(""));
	//	fltCons.screenPrint(strFlight.GetBuffer(1024));

	//	if (bCommaFlag)
	//	{
	//		bCommaFlag = false;
	//		strFooter.AppendFormat("%s", strFlight);
	//	}
	//	else
	//	{
	//		strFooter.AppendFormat(",%s", strFlight);
	//	}
	//}
	c2dGraphData.m_strFooter = strFooter;


	//std::vector<CString> vLegends;
	////get the legend
	//int nLegendCount = m_vRunwayOperationDetail->at(0)->m_vWakeVortexDetailValue.size();
	//for (int nLegend = 0; nLegend < nLegendCount; ++nLegend)
	//{
	//	CString strLegend;
	//	strLegend.Format(_T("%s-%s"),
	//		m_vRunwayOperationDetail->at(0)->m_vWakeVortexDetailValue[nLegend].m_strClassLeadName,
	//		m_vRunwayOperationDetail->at(0)->m_vWakeVortexDetailValue[nLegend].m_strClassTrailName);
	//	vLegends.push_back(strLegend);

	//}


	chartWnd.DrawChart(c2dGraphData);
}
コード例 #2
0
bool VisitorTerminalBehavior::StickNonPaxDestProcsOverload( const ElapsedTime& _curTime )
{
	m_pPerson->regetAttatchedNopax();
	ProcessorDistribution* pNextProcDistribution = m_pProcessor->getNextDestinations ( m_pPerson->getType(), m_nInGateDetailMode );
	if(pNextProcDistribution ==NULL ) return false;
	CSinglePaxTypeFlow* pProcessSingleFlow=NULL;
	ProcessorID* pProcessCurID=NULL;

	pNextProcDistribution->getDestinationGroup( RANDOM);


	ASSERT( pNextProcDistribution!=NULL);

	CFlowChannel* pInChannel=NULL;
	ProcessorArray aryOverloadDestProcs;
	ProcessorArray aryDestProcs;

	//defined for function FindDestProcessors,
	//if can not find the destination processor for 1:1 reason
	//or 1*1 reason, remember it.
	//throw exception after test every processor in distribution.
	bool bOneToOneReason = false;
	bool bOneXOneReason = false;

	do
	{
		pInChannel=NULL;
		if( static_cast<CProcessorDistributionWithPipe*>(pNextProcDistribution)->GetOneXOneState()==ChannelEnd)
		{
			pInChannel=m_FlowChannelList.PopChannel();
			m_FlowChannelList.PushChannel(pInChannel);//restore channel info for next time to use.
		}
		m_pProcessor->FindDestProcessors( m_pPerson, pNextProcDistribution, 
			pInChannel, _curTime, pProcessSingleFlow, pProcessCurID,
			aryDestProcs, bOneToOneReason, bOneXOneReason);
		Processor::PruneInvalidDestProcs(getTerminal(), m_pPerson, &aryDestProcs, NULL, &aryOverloadDestProcs );

		if(aryDestProcs.getCount()>0 && noExceptions (&aryDestProcs) && IfBaggageProcAllowed( &aryDestProcs, pNextProcDistribution ))
			return false;


	}while( pNextProcDistribution->getDestinationGroup( SEQUENTIAL) ) ;

	//check zeropercent dest group.
	if(aryDestProcs.getCount()==0)
	{
		while(pNextProcDistribution->getZeropercentDestGroup())
		{
			pInChannel=NULL;
			if( static_cast<CProcessorDistributionWithPipe*>(pNextProcDistribution)->GetOneXOneState()==ChannelEnd)
			{	
				pInChannel=m_FlowChannelList.PopChannel();
				m_FlowChannelList.PushChannel(pInChannel);//restore channel info for next time to use.
			}
			m_pProcessor->FindDestProcessors( m_pPerson, pNextProcDistribution, 
				pInChannel, _curTime, pProcessSingleFlow, pProcessCurID, 
				aryDestProcs, bOneToOneReason, bOneXOneReason);
			ASSERT( aryDestProcs.getCount()>0);

			Processor::PruneInvalidDestProcs(getTerminal(), m_pPerson, &aryDestProcs, NULL, &aryOverloadDestProcs );

			if(aryDestProcs.getCount()>0 && noExceptions (&aryDestProcs) && IfBaggageProcAllowed( &aryDestProcs, pNextProcDistribution ))
				return false;

		}
	}

	if(bOneToOneReason)
	{
		CString str = "Can't find processor to correspond to "+ m_pProcessor->getID()->GetIDString()+ " by 1:1";
		throw new ARCDestProcessorUnavailableError( getPersonErrorMsg(), 
			m_pProcessor->getID()->GetIDString(), str, _curTime.PrintDateTime());
	}
	if(bOneXOneReason)
	{
		CString str = "Cannot find processor to correspond to "+ pInChannel->GetInChannelProc()->getID()->GetIDString()+ " by 1:x:1";
		throw new ARCDestProcessorUnavailableError( getPersonErrorMsg(),
			m_pProcessor->getID()->GetIDString(), str, _curTime.PrintDateTime());
	}

	//if(aryDestProcs.getCount()>0) return false;//not need to stick.
	if(aryOverloadDestProcs.getCount()>0)
	{
		Processor* pAnOverloadProc=NULL;
		WaitingPair waitPair;
		Passenger* pOwner = GetOwner();
		if (pOwner)
		{
			waitPair.first= pOwner->getID();
			waitPair.second =m_pProcessor->getIndex();

			for( int i=0; i<aryOverloadDestProcs.getCount(); i++)
			{
				pAnOverloadProc= aryOverloadDestProcs.getItem( i );
				pAnOverloadProc->AddWaitingPair( waitPair );	// add pax id and processor idx to the dest processor.
			}
			return true;
		}
		
	}
	return false;

}