Exemplo n.º 1
0
MEPTR DefineCmdLineMacro(       // DEFINE A MACRO FROM THE COMMAND LINE
                                // (assumes position is one char after "-D")
    bool many_tokes )           // - true ==> scan multiple tokens
{
    MEPTR mptr;
    int (*old_scanner)( void );
    ppctl_t old_ppctl;

    old_scanner = NextChar;
    old_ppctl = PPControl;
    NextChar = &SrcFileCmdLnGetChar;
    PPCTL_ENABLE_EOL();
    PPCTL_DISABLE_MACROS();
    SrcFileCmdLnDummyOpen();
    CurrChar = NextChar();
    if( many_tokes ) {
        mptr = MacroScan( MSCAN_CMDLN_PLUS );
    } else {
        mptr = MacroScan( MSCAN_CMDLN_NORMAL );
    }
    SrcFileCmdLnDummyClose();
    NextChar = old_scanner;
    PPControl = old_ppctl;
    return( mptr );
}
Exemplo n.º 2
0
void
MSwithLevelFP::UpdateMSINFO( MSNODE* msnode_, double numticktime, double ticktime){

    msnode = msnode_;
/**************************************************/
    POLAXIS  temp_polar = msnode->msdata.cart2pol((*BSOxy_)[0], msnode->msdata.position);
    double angle = temp_polar.th;
    if(angle>=PI/3)
        angle = temp_polar.th - floor(temp_polar.th / (PI/3) )*(PI/3);
    else if (angle < 0)
        angle = temp_polar.th + (floor(fabs(temp_polar.th) / (PI/3))+1) * (PI/3);

    if(temp_polar.r <= R * sin(PI/3) / sin((2 * PI / 3)-angle))
        //check if the position is inside the cell;
        //use the triangle proportion rule: sin(theta) is propotional
        //to the length of facing side
        msnode->msdata.temp_test = 1;
    else
        msnode->msdata.temp_test = 0;
/**************************************************/
    if( IsOnStreet(msnode->msdata.position) ){
        msnode->msdata.on_street = 1;
    }else if( IsOnStreet(msnode->msdata.position) ){
        msnode->msdata.on_street = 0;
    }
/*********************check sector*****************************/


/*********************加快程式運作*****************************/
	if(msnode->msdata.femto_mode==0)			RSSI_ServingBS=MacroRSSI(msnode->msdata.ssector,msnode->msdata.scell,1);
	else if(msnode->msdata.femto_mode==1)	RSSI_ServingBS=FemtoRSSI(msnode->msdata.sFS,2);

/***********************掃描&換手決策***************************/
	BSINFO optimumFemtoTarget;
	//Serving is macro & Period scan
	if( ( (int)(numticktime - msnode->msdata.ScanStartTickTime)%((int)(msnode->msdata.ScanPeriod/ticktime))==0&&msnode->msdata.femto_mode==0 ))
	{

		//printf("Serving:Macro\tPeriod Scan\n");
		MacroScan();

		UpdateFP();

		extern double MeanNumInList;
		extern long int countList;
		extern double ListMissRateTotal;
		getNeighborFemtoList();
		vector<int> NeighborListBySys;
		vector<int> intersectionResult;
		for(int i=0; i < msnode->msdata.fs_near_num; i++)
		{
			NeighborListBySys.push_back(msnode->msdata.FS_NEAR[i]);
		}
		sort(NeighborListBySys.begin(),NeighborListBySys.end());
		MeanNumInList+= getFemtoListByFP();
		sort(FemtoListByFP.begin(),FemtoListByFP.end());
		set_intersection(FemtoListByFP.begin(),FemtoListByFP.end(),NeighborListBySys.begin(),NeighborListBySys.end(),inserter(intersectionResult,intersectionResult.begin()));
		if(FemtoListByFP.size()!=0){
			extern Record ReMissRate;
			ReMissRate.InsertData(100*(FemtoListByFP.size()-intersectionResult.size())/FemtoListByFP.size());
			ListMissRateTotal += ((FemtoListByFP.size()-intersectionResult.size())/FemtoListByFP.size());
			countList++;
		}

		optimumFemtoScan();
		optimumFemtoTarget = DecideTargetCell(2);
		Femtolist.clear();


		//printf("getNeighborFemtoList:%d\n",getFemtoListByFP());

		FemtoScan();

		HandoverDecision();

		extern double OptimumTargetmissCount;
		if(FemtoListByFP.size()!=0)
		if(optimumFemtoTarget.BSTYPE!=0)
		if(find_if( Femtolist.begin(), Femtolist.end(),findBSID(optimumFemtoTarget.BSID) ) == Femtolist.end())
		{OptimumTargetmissCount++;}

	//Serving is macro && treigger scan
	}else if ( (msnode->msdata.femto_mode==0) && (RSSI_ServingBS < -100) ){

		//printf("Serving:macro\ttrigger Scan\tRSSI:%f\n",MacroRSSI(msnode->msdata.ssector,msnode->msdata.scell,1));
		MacroScan();

		UpdateFP();

		extern double MeanNumInList;
		extern long int countList;
		extern double ListMissRateTotal;
		getNeighborFemtoList();
		vector<int> NeighborListBySys;
		vector<int> intersectionResult;
		for(int i=0; i < msnode->msdata.fs_near_num; i++)
		{
			NeighborListBySys.push_back(msnode->msdata.FS_NEAR[i]);
		}
		sort(NeighborListBySys.begin(),NeighborListBySys.end());
		MeanNumInList+= getFemtoListByFP();
		sort(FemtoListByFP.begin(),FemtoListByFP.end());
		set_intersection(FemtoListByFP.begin(),FemtoListByFP.end(),NeighborListBySys.begin(),NeighborListBySys.end(),inserter(intersectionResult,intersectionResult.begin()));
		if(FemtoListByFP.size()!=0){
			extern Record ReMissRate;
			ReMissRate.InsertData(100*(FemtoListByFP.size()-intersectionResult.size())/FemtoListByFP.size());
			ListMissRateTotal += ((FemtoListByFP.size()-intersectionResult.size())/FemtoListByFP.size());
			countList++;
		}

		optimumFemtoScan();
		optimumFemtoTarget = DecideTargetCell(2);
		Femtolist.clear();


		//printf("getNeighborFemtoList:%d\n",getFemtoListByFP());

		FemtoScan();

		HandoverDecision();

		extern double OptimumTargetmissCount;
		if(FemtoListByFP.size()!=0)
		if(optimumFemtoTarget.BSTYPE!=0)
		if(find_if( Femtolist.begin(), Femtolist.end(),findBSID(optimumFemtoTarget.BSID) ) == Femtolist.end())
		{OptimumTargetmissCount++;}

	//Serving is femto && trigger scan
	}else if( (msnode->msdata.femto_mode==1) && (RSSI_ServingBS < -95)){


		//printf("Serving:femto\ttrigger Scan\tRSSI:%f\n",FemtoRSSI(msnode->msdata.sFS,2));
		MacroScan();

		UpdateFP();


		extern double MeanNumInList;
		extern long int countList;
		extern double ListMissRateTotal;
		getNeighborFemtoList();
		vector<int> NeighborListBySys;
		vector<int> intersectionResult;
		for(int i=0; i < msnode->msdata.fs_near_num; i++)
		{
			NeighborListBySys.push_back(msnode->msdata.FS_NEAR[i]);
		}
		sort(NeighborListBySys.begin(),NeighborListBySys.end());
		MeanNumInList+= getFemtoListByFP();
		sort(FemtoListByFP.begin(),FemtoListByFP.end());
		set_intersection(FemtoListByFP.begin(),FemtoListByFP.end(),NeighborListBySys.begin(),NeighborListBySys.end(),inserter(intersectionResult,intersectionResult.begin()));
		if(FemtoListByFP.size()!=0){
			extern Record ReMissRate;
			ReMissRate.InsertData(100*(FemtoListByFP.size()-intersectionResult.size())/FemtoListByFP.size());
			ListMissRateTotal += ((FemtoListByFP.size()-intersectionResult.size())/FemtoListByFP.size());
			countList++;
		}


		optimumFemtoScan();
		optimumFemtoTarget = DecideTargetCell(2);
		Femtolist.clear();


		//printf("getNeighborFemtoList:%d\n",getFemtoListByFP());

		FemtoScan();

		HandoverDecision();

		extern double OptimumTargetmissCount;
		if(FemtoListByFP.size()!=0)
		if(optimumFemtoTarget.BSTYPE!=0)
		if(find_if( Femtolist.begin(), Femtolist.end(),findBSID(optimumFemtoTarget.BSID) ) == Femtolist.end())
		{OptimumTargetmissCount++;}


	}

	extern double outage;

	if((msnode->msdata.femto_mode==0) && (RSSI_ServingBS < -100))
	{
		printf("MS%d\tBlocking!!Position:(%f,%f)\t%s\tBlock %d\n",msnode->msdata.ID,msnode->msdata.position.x,msnode->msdata.position.y,IsOnStreet(msnode->msdata.position)?"街道":"房子",WhichBlock(msnode->msdata.position));
		extern int outNum;
		outNum++;
		//printf("Outage!!!!!%f\n",outage);
		outage++;
	}
	else if( (msnode->msdata.femto_mode==1) && (RSSI_ServingBS < -100))
	{
		printf("MS%d\tBlocking!!Position:(%f,%f)\t%s\tBlock %d\n",msnode->msdata.ID,msnode->msdata.position.x,msnode->msdata.position.y,IsOnStreet(msnode->msdata.position)?"街道":"房子",WhichBlock(msnode->msdata.position));
		extern int outNum;
		outNum++;
		//printf("Outage!!!!!%f\n",outage);
		outage++;
	}
	if((msnode->msdata.femto_mode==0) && (RSSI_ServingBS >= -100))
	{
		extern int macroNum;
		macroNum++;
	}
	if( (msnode->msdata.femto_mode==1) && (RSSI_ServingBS >= -100))
	{
		extern int femtoNum;
		femtoNum++;
	}


    //msdata




    //Macrolist.clear();
	//Femtolist.clear();




}