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

📄 csector.cpp

📁 这是cdma2000的一个分组调度算法实例
💻 CPP
字号:
//CSector.h
//The implemetation of CSector class
///////////////////////////////////////////////////////////
#include "CCell.h"
#include "CSector.h"

#include "CDataMs.h"
///////////////////////////////////////////////////////////
//初始化函数	
//completed in 3.19,and reviced in 4.4
void CSector::Initialization(int SectorIndex, CELLID_TYPE CellID, 
							 CCell* pParentCell, int orient)
{
	m_iSectorIndex=SectorIndex;                //初始化扇区标号
	m_stParentCellID=CellID;                //初始化父小区标号 
	m_pParentCell=pParentCell;              //初始化父小区指针
	m_iSectorOrientation=orient%360;         //初始化扇区朝向,保证其值在0-359之间
	m_fTxPower=m_fMaxPower;    //初始化时,将实际发射功率置为最大功率,保证了所有小区最初以满功率发射
//wgt
	m_fTxPower1=m_fTxPower;

	m_fPilotPower=(float)FractionOfPilotChannel*m_fTxPower;  //导频功率=导频功率比例*实际发射功率
    m_fCommonPower=(float)FractionOfCommonChannel*m_fTxPower;//公共信道功率=其它公共信道功率比例*实际发射功率
	m_pCurrentDataMs=NULL;                     //将当前分组用户指针置空
    m_bIsTransmiting=false;                    //将正在传输标志置假
  	m_iNumOfSector=0;							//将每个扇区的用户数置零
  
	
/////////////////////////////////  wyf新增成员变量初始化   ////////////////////////////
	m_bIsExistHighestPriority=false;
	m_fPriorityFactor=0.0;                     //优先权指标初始化       
////////////////////////////////////////////////////////////////////////////////////////

	
/////////////////////////////////  oyh新增成员变量初始化   //////////////////////////////
	m_iTotalDataMsNum=0;                          //本扇区总的分组用户数置零
	m_lGoodBitNum=0;                             //本扇区到目前为止成功传输比特数置零
//////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////  zdy新增成员变量初始化   //////////////////////////////
	m_fTotalPacketDelay=0.0;					//本扇区所传分组的总的时延置零
	m_iTotalSuccessfulPacketNum=0;			//本扇区成功传输的分组数目置零
//////////////////////////////////////////////////////////////////////////////////////////


///Added by oyh on 20010508
	m_fTotalVoicePower=0.0;                     //总话音功率置零
	m_fPacketPower=0.0;                         //分组功率置零
//wgt	
//	m_fTotalVoicePower1=0.0;
}
//功率复位函数
//completed in 3.19, reviced in 3.20
//经杨光指点,功率复位将实际发射功率、话音业务总功率
//和分组数据信道功率置零。
void CSector::ResetPower()
{ 	
	m_fTotalVoicePower=0.0;               //实际的话音业务总功率置零 
	m_fPacketPower=0.0;                   //实际的分组数据信道功率置零 
}
//话音功率的累加函数	
//completed in 3.20
void CSector::VoicePowerCumulate(float SingleVoicePower)
{
	m_fTotalVoicePower+=SingleVoicePower;
}
//分组数据信道的功率计算函数 
//completed in 3.20
void CSector::PacketPowerCalculte()
{
    m_fPacketPower=m_fMaxPower-m_fPilotPower-m_fCommonPower-m_fTotalVoicePower;
	//分组信道可使用的功率=BTS最大发射功率-导频信道发射功率-
	//公共信道发射功率-话音业务总功率(不能大于分组数据信道的最大功率)
   if (m_fPacketPower>m_fMaxPacketPower)   //分组信道可使用的功率不能大于分组数据信道的最大功率
	   m_fPacketPower=m_fMaxPacketPower;   //若大于,则可用功率即为最大功率
   
   //added by oyh on 20010508
   if (m_fPacketPower<0)   //分组信道可使用的功率不能小于0
	   m_fPacketPower=0;
}
//实际发射功率计算函数,应oyh要求新增
void CSector::TxPowerCalculte()
{
    m_fTxPower=m_fTotalVoicePower+m_fPacketPower+m_fCommonPower+m_fPilotPower;
//wgt
	m_fTxPower1=m_fTxPower;
}
////////////////////////////////////////////////////////////////////////////////
//                          以下为接口函数
/////////////////////////////////////////////////////////////////////////////////
//返回扇区标号
int  CSector::GetSectorIndex()
{
	return m_iSectorIndex;
}

//返回父小区标号
CELLID_TYPE	CSector::GetParentCellID()
{
	return  m_stParentCellID;
}

//返回父小区指针
CCell* CSector::GetParentCell()
{
	return m_pParentCell;
}

//返回扇区朝向 取值范围0-359
int	CSector::GetSectorOrientation()
{
	return m_iSectorOrientation;
}
//设置最大发射功率
void CSector::SetMaxPower(float MaxPower)
{
	m_fMaxPower=MaxPower;
}
//返回最大发射功率
float CSector::GetMaxPower()
{
	return  m_fMaxPower;
}
//设置实际发射功率
void CSector::SetTxPower(float TxPower)
{
	m_fTxPower=TxPower;
}
//返回实际发射功率
float CSector::GetTxPower()
{
	return m_fTxPower;
}

//返回导频功率	
float CSector::GetPilotPower()
{
	return m_fPilotPower;
}
//返回公共信道功率
float CSector::GetCommonPower()
{
	return  m_fCommonPower;
}
//设置分组数据信道的最大功率
void CSector::SetMaxPacketPower(float MPPower)
{
	m_fMaxPacketPower=MPPower;
}

//返回实际的话音业务总功率  
float CSector::GetTotalVoicePower()
{
	return m_fTotalVoicePower;
}
//设置实际的分组数据信道功率
void  CSector::SetPacketPower(float PPower)
{
	m_fPacketPower=PPower;
}
//返回实际的分组数据信道功率
float CSector::GetPacketPower()
{
	return m_fPacketPower;
}
//设置当前时隙是否正在传送分组
void CSector::SetIsTransmiting(bool IsTrans)
{
	m_bIsTransmiting=IsTrans;
}
//返回当前时隙是否正在传送分组 
bool CSector::IsTransmiting()
{
	return m_bIsTransmiting;
}
//设置当前分组数据用户的指针
void CSector::SetCurrentDataMs(CDataMs* DataMs)
{
	m_pCurrentDataMs=DataMs;
}
//返回当前分组数据用户的指针
CDataMs* CSector::GetCurrentDataMs()
{
	return m_pCurrentDataMs;
}

//设置当前的最佳用户的优先级指标 
void CSector::SetPriorityFactor(float PFactor)
{
	m_fPriorityFactor=PFactor;
}
//返回当前的最佳用户的优先级指标
float CSector::GetPriorityFactor()
{
	return m_fPriorityFactor;
}

///////////////////////////////   wyf新增成员变量接口函数     //////////////////////////
//设置是否存在最高优先权分组用户
void CSector::SetIsExistHighestPriority(bool flag)
{
	m_bIsExistHighestPriority=flag;
}
//返回是否存在最高优先权分组用户
bool CSector::IsExistHighestPriority()
{
	return m_bIsExistHighestPriority;
}
///////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////   oyh新增成员变量接口函数    //////////////////////////
//设置本扇区到目前为止成功传输bit数
void CSector::SetGoodBitNum(long Num)
{
	m_lGoodBitNum=Num;
}
//返回本扇区到目前为止成功传输bit数
long CSector::GetGoodBitNum()
{
	return m_lGoodBitNum;
}
///////////////////////////////////////////////////////////////////////////////////////////  

////////////////////////////////   zdy新增成员变量接口函数    //////////////////////////
void	CSector::SetTotalPacketDelay(float fDelay)
//设置本扇区所传分组的总的时延
{
	m_fTotalPacketDelay=fDelay;
}
float	CSector::GetTotalPacketDelay()
//返回本扇区所传分组的总的时延
{
	return m_fTotalPacketDelay;
}
void	CSector::SetTotalSuccessfulPacketNum(int iNum)
//设置本扇区成功传输的分组数目	
{
	m_iTotalSuccessfulPacketNum=iNum;
}
int 	CSector::GetTotalSuccessfulPacketNum()
//返回本扇区成功传输的分组数目
{
	return m_iTotalSuccessfulPacketNum;
}

//wgt
void	CSector::SetTxPower1(float temppower)
{
	m_fTxPower1=temppower;
}
float	CSector::GetTxPower1()
{
	return m_fTxPower1;
}

⌨️ 快捷键说明

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