⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cnetworkdrive.cpp

📁 此程序为wcdma系统当中ftp/video业务模型的c++程序仿真 通过此程序 能得到此两种业务在多种条件下的吞吐量和无码率的性能
💻 CPP
📖 第 1 页 / 共 4 页
字号:
//			alpha = 1.1
//			k = 4.5e3
//			m = 2e6
//			Packet call的平均间隔时间 = 5 (s)
//			Packet size = 1500 (octets)
//			<end>
//
//			Notes:
//			1.The first line should contain the specific string, (Here is
//			"").
//			2.On the left of '=' there must be the parameter name, which
//			should be typed exactly regardless of blank and tab.
//			3.On the right of '=' there must be the value of the parameter.
//			And between '=' and the figure there should be no other characters
//			than blank and tab.
//			4.The order of parameters should not be changed. And none of
//			them can be omitted.
//			5.You can insert some lines without '=' for comments. You can
//			also add strings after the figures which indicate some information
//			like unit.
//
//	AUTHOR:	Ouyang Hui
//
//	DATE:	01/04/06
//
//	MODIFICTIONS SINCE 01/04/06
//			01/05/21	m_MsManager.Set...=>m_MsManager.m_...
//
/////////////////////////////////////////////////////////////////////////

void CNetworkDrive::ReadData_HttpMs()
{
	int NUM_VALUE;
	const char* cSpecificString;
	bool bFlag;
	char* pname[15];
		
	double pval[15];
	CStdioFile f1;		//定义一个I/O文件对象
	CString s1,s2,s3;		//定义三个字符串对象
	double x;
	int i,j,k,iEqualPos;
	char* q;
	char buf[100];	//定义一个数据缓冲区,用于存放一行字符串

	/* 打开数据文件准备读*/
	if(!f1.Open(ParameterFile,CFile::modeRead))
	{
	#ifdef _DEBUG
		afxDump<<"Unable to open file"<<"\n";	//异常处理
	#endif
	}

	pname[0]="HTTP用户的平均数据速率";
	pname[1]="alpha";
	pname[2]="k";
	pname[3]="m";
	pname[4]="Packet call的平均间隔时间";
	pname[5]="Packet size";

	i=0;NUM_VALUE=6;
	cSpecificString="HTTP移动台参数";
	bFlag=FALSE;

	while(f1.ReadString(buf,100)!=NULL)
	{
		s1=buf; //把这一行字符串内容赋给对象s1
		if (s1.Find(cSpecificString)>=0) 
		{
			bFlag=TRUE;
			break;
		}
	}

	if (!bFlag)
	{
		cerr<<"Cannot find the specific string "<<cSpecificString<<endl;
		f1.Close();
		exit(0);
	}

	/*从数据文件依次读入每一行字符串,对每一行字符串进行处理*/
	while(f1.ReadString(buf,100)!=NULL)
	{
		if (i>=NUM_VALUE)
			break;

		s1=buf; //把这一行字符串内容赋给对象s1

		iEqualPos=s1.Find("=");
		if (iEqualPos<0)
			continue;

		s2=s1.Left(iEqualPos);
		s3=s1.Right(s1.GetLength()-iEqualPos-1);

		j=0;
		k=iEqualPos-1;
		while ((s2[j]==' ')||(s2[j]=='\t')) j++;
		while ((s2[k]==' ')||(s2[k]=='\t')) k--;
		s2=s2.Mid(j,k-j+1);

		if (s2!=pname[i]) 
		{
			cerr<<"Unexpected parameter name  "<<s2<<"."<<endl
				<<"Should be "<<pname[i]<<endl;
			f1.Close();
			exit(0);
		}

		x=strtod(s3,&q);

		pval[i]=x;
		i++;
	}

  //m_MsManager.m_iHttpMeanPacketDataRate=(int)pval[0];
  //m_MsManager.m_fAlpha=(float)pval[1];
  //m_MsManager.m_fK=(float)pval[2];
  //m_MsManager.m_iMaxDataBitsNum=(int)pval[3];
  //m_MsManager.m_fMeanIntervalOfPacketCall=(float)pval[4];
  //m_MsManager.m_iHttpPacketSize=(int)pval[5];
	

	f1.Close();//关闭参数文件
}



//////////////////////////////////////////////////////////////////////////
//TITLE:      ReadData_Handoff(读软切换参数函数)				        
//
//PARAMETERS:NULL              
//
//PURPOSE AND ALGORITHMS:
//            Read softhandoff and cell switch parameters from the
//			  parameter file.     
//                                               
//AUTHOR:     Li Jing
//
//NOTES:      modify the softhandoff parameters read from the parameter file        
//                                                                
//////////////////////////////////////////////////////////////////////////
void CNetworkDrive::ReadData_Handoff()
{
	char* pname[10];
	int NUM_VALUE;
	const char* cSpecificString;
	bool bFlag;
		
	double pval[10];
	CStdioFile f1;		    //定义一个I/O文件对象
	CString s1,s2,s3;		//定义三个字符串对象
	double x;
	int i,j,k,iEqualPos;
	char* q;
	char buf[100];	        //定义一个数据缓冲区,用于存放一行字符串

	//open the parameter file to read
	if(!f1.Open(ParameterFile,CFile::modeRead))
	{
	#ifdef _DEBUG
		afxDump<<"Unable to open file"<<"\n";	//exception handling
	#endif
	}

	//the names of the parameters
	pname[0]="激活集最大数量";
	pname[1]="软切换门限值";
	pname[2]="软切换门限滞后";
	pname[3]="软切换替换滞后";
	pname[4]="软切换定时器";
	pname[5]="软切换事件时延";
	pname[6]="小区交换事件时延";

	i=0;NUM_VALUE=7;
	cSpecificString="软切换与小区交换参数";
	bFlag=FALSE;

	while(f1.ReadString(buf,100)!=NULL)
	{
		s1=buf; //把这一行字符串内容赋给对象s1
		if (s1.Find(cSpecificString)>=0) 
		{
			bFlag=TRUE;
			break;
		}
	}

	if (!bFlag)
	{
		cerr<<"Cannot find the specific string "<<cSpecificString<<endl;
		f1.Close();
		exit(0);
	}

	//从参数文件依次读入每一行字符串,对每一行字符串进行处理
	while(f1.ReadString(buf,100)!=NULL)
	{
		if (i>=NUM_VALUE)
			break;

		s1=buf; //把这一行字符串内容赋给对象s1

		iEqualPos=s1.Find("=");
		if (iEqualPos<0)
			continue;

		s2=s1.Left(iEqualPos);
		s3=s1.Right(s1.GetLength()-iEqualPos-1);

		j=0;
		k=iEqualPos-1;
		while ((s2[j]==' ')||(s2[j]=='\t')) j++;
		while ((s2[k]==' ')||(s2[k]=='\t')) k--;
		s2=s2.Mid(j,k-j+1);

		if (s2!=pname[i]) 
		{
			cerr<<"Unexpected parameter name  "<<s2<<"."<<endl
				<<"Should be "<<pname[i]<<endl;
			f1.Close();
			exit(0);
		}

		x=strtod(s3,&q);

		pval[i]=x;
		i++;
	}
    
	//write the parameters to the corresponding attributes
//slj	m_MsManager.m_iActiveSetMaxSize=(int)pval[0];
	m_MsManager.m_fSHOAs_Th=(float)pval[1];
	m_MsManager.m_fSHOAs_Th_Hyst=(float)pval[2];
	m_MsManager.m_fSHOAs_Rep_Hyst=(float)pval[3];
	m_MsManager.m_iSHOTimer=(int)(pval[4]*1500);
	m_MsManager.m_iSoftHandoffDelay=(int)(pval[5]*1500);
  //m_MsManager.m_iCellSwitchDelay=(int)(pval[6]/SlotSize);

	//close the parameter file
	f1.Close();
	
}

/////////////////////////////////////////////////////////////////////////
//
//	TITLE:  Funciton of reading parameters
//
//	PURPOSE:
//
//	CALLED BY FUNCTIONS:
//			CNetworkDrive::ReadData()
//
//	COMMENTS:
//			The format of this part of data in the file is:
//			<begin>
//			8.数据统计参数
//			/数据采集的drop号 = 1
//			数据采集的时隙号 = 2
//			数据统计用文件个数 = 9
//			数据文件的路径与文件名 = linkpredictionresult.txt
//									meanthroughput.txt
//									meanper.txt
//									voicemsstfrate.txt
//									btspowersuperscale.txt
//									mobilec2i.txt
//									throughputservice.txt
//									throughputpacketcall.txt
//									voice.txt
//			<end>
//
//			Notes:
//			1.The first line should contain the specific string, (Here is
//			"").
//			2.On the left of '=' there must be the parameter name, which
//			should be typed exactly regardless of blank and tab.
//			3.On the right of '=' there must be the value of the parameter.
//			Here in the case of "数据文件的路径与文件名", that should be a
//			string. And between '=' and the figure or the string there should 
//			be no other characters than blank and tab.
//			4.The order of parameters should not be changed. And none of
//			them can be omitted.
//			5.You can insert some lines without '=' for comments. You can
//			also add strings after the figures which indicate some information
//			like unit.
//			6.The number of inputs of "数据文件的路径与文件名" should be equal
//			to "数据统计用文件个数".
//
//	AUTHOR:
//
//	DATE:	01/04/06
//
//	MODIFICTIONS SINCE 01/04/06
//
/////////////////////////////////////////////////////////////////////////

void CNetworkDrive::ReadData_Statics()
{
//	cout<<"The function CNetworkDrive::ReadData_Statics() is being called!\n";

	int NUM_VALUE;
	const char* cSpecificString;
	bool bFlag;
	char* pname[15];
		
	double pval[15];
	CStdioFile f1;		//定义一个I/O文件对象
	CString s1,s2,s3;		//定义三个字符串对象
	double x;
	int i,j,k,iEqualPos;
	char* q;
	char buf[100];	//定义一个数据缓冲区,用于存放一行字符串

//	cout<<ParameterFile<<endl;

	pname[0]="数据采集的drop号";
	pname[1]="数据采集的时隙号";
	pname[2]="数据统计用文件个数";
	pname[3]="数据文件的路径与文件名";

	char datafilename[15][40];

	i=0;NUM_VALUE=4;
	cSpecificString="数据统计参数";
	bFlag=FALSE;

	/* 打开数据文件准备读*/
	if(!f1.Open(ParameterFile,CFile::modeRead))
	{
	#ifdef _DEBUG
		afxDump<<"Unable to open file"<<"\n";	//异常处理
	#endif
	}

	while(f1.ReadString(buf,100)!=NULL)
	{
		s1=buf; //把这一行字符串内容赋给对象s1
		if (s1.Find(cSpecificString)>=0) 
		{
			bFlag=TRUE;
			break;
		}
	}

	if (!bFlag)
	{
		cerr<<"Cannot find the specific string "<<cSpecificString<<endl;
		f1.Close();
		exit(1);
	}
	
	/*从数据文件依次读入每一行字符串,对每一行字符串进行处理*/
	while(f1.ReadString(buf,100)!=NULL)
	{
		if (i>=NUM_VALUE)
			break;

		s1=buf; //把这一行字符串内容赋给对象s1

		iEqualPos=s1.Find("=");
		if (iEqualPos<0)
			continue;

		s2=s1.Left(iEqualPos);
		s3=s1.Right(s1.GetLength()-iEqualPos-1);

		j=0;
		k=iEqualPos-1;
		while ((s2[j]==' ')||(s2[j]=='\t')) j++;
		while ((s2[k]==' ')||(s2[k]=='\t')) k--;
		s2=s2.Mid(j,k-j+1);

		if (s2!=pname[i]) 
		{
			cerr<<"Unexpected parameter name  "<<s2<<"."<<endl
				<<"Should be "<<pname[i]<<endl;
			f1.Close();
			exit(0);
		}

		if (i<3)
			x=strtod(s3,&q);
		int m;
		if (i==3)
		{
			k=0;
				m=s3.GetLength()-1;
				while ((s3[k]==' ')||(s3[k]=='\t')) k++;
				while ((s3[m]==' ')||(s3[m]=='\t')||(s3[m]=='\n')) m--;
				s3=s3.Mid(k,m-k+1);


			strcpy(datafilename[0],s3);
			for (j=1;j<pval[2];j++)
			{
				f1.ReadString(buf,100);
				s3=buf;
				k=0;
				m=s3.GetLength()-1;
				while ((s3[k]==' ')||(s3[k]=='\t')) k++;
				while ((s3[m]==' ')||(s3[m]=='\t')||(s3[m]=='\n')) m--;
				s3=s3.Mid(k,m-k+1);

				strcpy(datafilename[j],s3);
			}
		}

		pval[i]=x;
		i++;
	}


	m_iDataStaticsDropNum=(int)pval[0];
	m_iDataStaticsSlotNum=(int)pval[1];
	m_iStaticsFileNum=(int)pval[2];
	m_MsManager.SetSystemMeanThroughputFile(datafilename[0]);
	m_MsManager.SetSystemMeanPERFile(datafilename[1]);
	//m_ServiceArea.SetBsOutrageDataFileName(datafilename[2]);
	m_MsManager.SetMobileC2IFile(datafilename[3]);
	m_MsManager.SetMobileThroughputServiceFile(datafilename[4]);
	m_MsManager.SetMobileThroughputPacketCallFile(datafilename[5]);
	m_MsManager.SetVoiceFile(datafilename[6]);


	f1.Close();//关闭参数文件
}

//////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////
void CNetworkDrive::ReadData_FastFadingValue()
{
//	cout<<"The function CNetworkDrive::ReadData_FastFadingValue() is being called!\n";
	
	CStdioFile f1;		//定义一个I/O文件对象
	char buf[100];
	int ii;
	char* q;
	/* 打开数据文件准备读*/
	if(!f1.Open("wchannelmodel-resultA.txt",CFile::modeRead))
	{
	#ifdef _DEBUG
		afxDump<<"Unable to open file"<<"\n";	//异常处理
	#endif
	}

	for (ii=0;ii<SubslotNumber*FastFadingValueLength;ii++)
	{
		f1.ReadString(buf,100);
		fFastFadingValue_1[ii]=(float)strtod(buf,&q);
	}

	f1.Close();

	/* 打开数据文件准备读*/
	if(!f1.Open("wchannelmodel-resultB.txt",CFile::modeRead))
	{
	#ifdef _DEBUG
		afxDump<<"Unable to open file"<<"\n";	//异常处理
	#endif
	}

	for (ii=0;ii<SubslotNumber*FastFadingValueLength;ii++)
	{
		f1.ReadString(buf,100);
		fFastFadingValue_2[ii]=(float)strtod(buf,&q);
	}

	f1.Close();

	/* 打开数据文件准备读*/
	if(!f1.Open("wchannelmodel-resultC.txt",CFile::modeRead))
	{
	#ifdef _DEBUG
		afxDump<<"Unable to open file"<<"\n";	//异常处理
	#endif
	}

	for (ii=0;ii<SubslotNumber*FastFadingValueLength;ii++)
	{
		f1.ReadString(buf,100);
		fFastFadingValue_3[ii]=(float)strtod(buf,&q);
	}

	f1.Close();

	/* 打开数据文件准备读*/
	if(!f1.Open("wchannelmodel-resultD.txt",CFile::modeRead))
	{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -