📄 cmobile.cpp
字号:
/* if(m_iMsID==266)
{
f.Close();
}*/
/*ObtainBestSector(); //更新最佳扇区 */ //应cmy要求将此去掉
}
//////////////////////////////////////////////////////////////////////////
//TITLE: UpdateActiveSet(激活集更新函数)
//
//PARAMETERS:NULL
//
//PURPOSE AND ALGORITHMS:
// 根据监测集更新的情况,更新激活集中的每一个激活扇区的发射功率
// 及其在MS处的业务信道的信噪比
// 在每个时隙中均需调用该函数
//
//AUTHOR: Li Jing
//
//CALLING FUNCTIONS:
//
//////////////////////////////////////////////////////////////////////////
void CMobile::UpdateActiveSet()
{
/* CString sp;
sp="153.txt";
CStdioFile f;
char buf[50];
char FileName[40];
strcpy(FileName,sp);*/
int iTempIndex; //临时下标
float fOtherSectorInterference; //从别的扇区来的干扰
float fOtherChannelInterference; //从别的信道来的干扰
float fTrafficPower; //业务信道功率
//float fMaxTrafficPower; //最大业务信道功率,单位:mw
//float fMinTrafficPower; //业务信道功率动态范围(最小值)
float fOrthogonalFactor; //正交因子
float fFastFading;
POSITION posTemp; //临时位置指针
ACTIVESECTOR_TYPE* pTempActiveSector=NULL; //临时激活扇区
posTemp=m_ActiveSetList.GetHeadPosition();
//取得链表头,并令临时指针指向链表头
/*if(m_eUsertype==voice)
SetVoiceActivity();*/
//这里将设置话音激活因子去掉,而改在CMsManager::VoiceProcess()中
while(posTemp!=NULL) //到达链表尾则结束循环
{
pTempActiveSector=m_ActiveSetList.GetAt(posTemp);
//获得当前的激活扇区
iTempIndex=pTempActiveSector->iIndexInMonitor;
//获得该扇区在监测集中的下标
fOtherSectorInterference=
m_aMonitorSector[iTempIndex].fInterferenceFromOtherSector;
//获得从其他扇区来的干扰
fOrthogonalFactor=m_pServiceArea->GetOrthogonalFactor();
//获得正交因子
fOtherChannelInterference=m_pServiceArea->GetSector(pTempActiveSector->stSectorID)->GetTxPower()
-pTempActiveSector->fTrafficPower;
//获得从本扇区其它信道来的干扰
fFastFading=(m_aMonitorSector[iTempIndex].fFastFading[0]
+m_aMonitorSector[iTempIndex].fFastFading[1]
+m_aMonitorSector[iTempIndex].fFastFading[2]
+m_aMonitorSector[iTempIndex].fFastFading[3])/(float)4;
/*
if(m_eUsertype==voice)
{
pTempActiveSector->fTrafficPower=pTempActiveSector->fTrafficPower
*m_fFwdCurrentActiveFactor/m_fFwdLastActiveFactor;
//对于话音用户,每一时隙更新后的扇区发射功率=原先的发射功率*此时隙的激活因子/上一时隙的激活因子
fMaxTrafficPower=m_pMsManager->m_fMaxFractionOfTrafficPower
*m_pServiceArea->GetSector(m_stBestSector)->
GetMaxPower();
//计算业务信道最大功率(为最大发射功率乘以最大业务信道所占的最大比例)
fMinTrafficPower=(float)(fMaxTrafficPower
/pow(10,(m_pMsManager->m_fDynamicRangeOfTrafficPower/10)));
if(pTempActiveSector->fTrafficPower>fMaxTrafficPower)
pTempActiveSector->fTrafficPower=fMaxTrafficPower;
if(pTempActiveSector->fTrafficPower<fMinTrafficPower)
pTempActiveSector->fTrafficPower=fMinTrafficPower;
//根据最大话音业务功率及其动态范围对发射功率进行调整
}
else
pTempActiveSector->fTrafficPower=pTempActiveSector->fTrafficPower;
//对于DCH用户,由于在传输过程中,传输速率是固定不变的(即扩频因子不变),所以其发射功率也是不变的(除了功控的调节)
*/
fTrafficPower=pTempActiveSector->fTrafficPower
*m_aMonitorSector[iTempIndex].fPropagationLoss*fFastFading;
//计算MS接收到的业务信道功率
fOtherChannelInterference*=
m_aMonitorSector[iTempIndex].fPropagationLoss*fFastFading;
//计算从本扇区到达移动台的从其他信道来的干扰值
pTempActiveSector->fTrafficC2I=
(float)(10*log10(fTrafficPower
/(fOtherChannelInterference*fOrthogonalFactor
+fOtherSectorInterference+NoisePower)));
//计算实际的从本扇区到达移动台的C/I
//(本扇区的业务信道接受功率
//(本扇区其他信道的干扰值*正交因子+其他扇区的干扰值+热噪声))
//并转化为dB
m_ActiveSetList.GetNext(posTemp); //获得链表中的下一个激活扇区
}
}
//////////////////////////////////////////////////////////////////////////
//TITLE: ObtainC2I(C/I计算函数)
//
//PARAMETERS:NULL
//
//PURPOSE AND ALGORITHMS:
// 根据激活集中的导频情况,计算用户最终的C/I
//
//AUTHOR: Li Jing
//
//CALLING FUNCTIONS:
//
//NOTES:
//
//////////////////////////////////////////////////////////////////////////
void CMobile::ObtainC2I()
{
float fTempC2I; //单个业务信道C/I(倍数)
float fSumofC2I=0.0; //C/I总和(倍数,初值为0)
POSITION posTemp; //用于链表循环的位置指针
ACTIVESECTOR_TYPE* pTempActiveSector=NULL; //临时激活扇区指针
if(m_ActiveSetList.IsEmpty()) //如果队列为空
return; //函数返回
else //否则,计算激活集中用户总的C/I
{
posTemp=m_ActiveSetList.GetHeadPosition();
//取得链表头,并令临时指针指向链表头
while(posTemp!=NULL) //到达链表尾则结束循环
{
pTempActiveSector=m_ActiveSetList.GetAt(posTemp);
//获得链表中的一个扇区
fTempC2I=(float)pow(10,(pTempActiveSector->fTrafficC2I/10));
//转换为倍数
fSumofC2I+=fTempC2I; //累加每一个扇区的C/I
m_ActiveSetList.GetNext(posTemp);//指向链表中下一个扇区
}
m_fC2I=(float)(10*log10(fSumofC2I)); //将属性中的C/I值赋值,即当前时隙的C/I
}
}
//////////////////////////////////////////////////////////////////////////
//TITLE: ObtainBestSector(最佳扇区计算函数)
//
//PARAMETERS:NULL
//
//PURPOSE AND ALGORITHMS:
// 根据监测集信息(fPilotSNR)找出最佳扇区,并确定标号和下标等
//
//AUTHOR: Li Jing
//
//CALLING FUNCTIONS:
// NULL
//
//////////////////////////////////////////////////////////////////////////
void CMobile::ObtainBestSector()
{
float fMaxPilotSNR=-1000.; //先将最大导频设的很小
int iBestSectorIndex;
int i,j;
SECTORID_TYPE stBestSector; //记录最佳扇区的标号
LOCATION_TYPE stBsCor; //最佳小区的基站坐标
for(i=0;i<19;i++)
for(j=0;j<SectorNumber;j++)
if(m_aMonitorSector[i*SectorNumber+j].fPilotSNR>fMaxPilotSNR)
{
fMaxPilotSNR=m_aMonitorSector[i*SectorNumber+j].fPilotSNR;
//记录循环到当前时刻的最大fPilotSNR
iBestSectorIndex=i*SectorNumber+j;
//此扇区在移动台监测数组中的标号
stBestSector=m_aMonitorSector[i*SectorNumber+j].stSectorID;
}
m_aMonitorSector[iBestSectorIndex].bIsBestSector=true;
//是最佳扇区
m_aMonitorSector[iBestSectorIndex].bIsInActive=false;
//在对激活激活集操作中在修改bIsInActive标志
m_iBestSectorIndex=iBestSectorIndex;
//最佳扇区在监测集中的下标
m_stBestSector=stBestSector;
//最佳扇区的扇区标号
m_fBestPilotSNR=fMaxPilotSNR;
//最佳扇区的PilotSNR
//Added by Li Jing,20040820
stBsCor=m_pServiceArea->GetCor(m_stBestSector.stCellID);
//最佳扇区的基站坐标
m_fMsBsDistance=(float)(sqrt(pow((m_stMsLocation.x
-stBsCor.x),2)+pow((m_stMsLocation.y
-stBsCor.y),2)));
//计算移动台与最佳扇区基站的距离,单位公里
}
//////////////////////////////////////////////////////////////////////////
//TITLE: CumulateIor2Ioc(累加Ior/Ioc函数)
//
//PARAMETERS:NULL
//
//PURPOSE AND ALGORITHMS:
// 用于计算移动台的地形因子
//
//AUTHOR: Li Jing
//
//CALLING FUNCTIONS:
// NULL
//
//////////////////////////////////////////////////////////////////////////
//revised by zl 20050511
void CMobile::CumulateIor2Ioc()
{
float fFastFading; //快衰值
float fOtherChannelPower; //本扇区其他信道的干扰,单位:mw
float fOtherSectorInterference; //从别的扇区来的干扰
float fSum=0.0;
float fOI;
float fOC;
if(m_eUsertype == DCHData)
{
fFastFading=(m_aMonitorSector[m_iBestSectorIndex].fFastFading[0]
+m_aMonitorSector[m_iBestSectorIndex].fFastFading[1]
+m_aMonitorSector[m_iBestSectorIndex].fFastFading[2]
+m_aMonitorSector[m_iBestSectorIndex].fFastFading[3])/(float)4;
fOtherChannelPower=m_pServiceArea->GetSector(m_stBestSector)->
GetTxPower()*m_aMonitorSector[m_iBestSectorIndex].fPropagationLoss*fFastFading;
fOtherSectorInterference=m_aMonitorSector[m_iBestSectorIndex].fInterferenceFromOtherSector;
}
else if(m_eUsertype == HSDSCHData)
{
GetLocationSectorIndex();
float fFastFading = (m_aMonitorSector[m_iLocationSectorIndex].fFastFading[0]
+m_aMonitorSector[m_iLocationSectorIndex].fFastFading[1]
+m_aMonitorSector[m_iLocationSectorIndex].fFastFading[2]
+m_aMonitorSector[m_iLocationSectorIndex].fFastFading[3])/(float)4;
CSector* pCurrentSector=m_pServiceArea->GetSector(m_stLocationSector);
fOtherChannelPower=(pCurrentSector->GetPilotPower()+pCurrentSector->GetCommonPower()+pCurrentSector->GetTotalVoicePower()+pCurrentSector->GetTotalDCHPower())*m_aMonitorSector[m_iLocationSectorIndex].fPropagationLoss*fFastFading;
fOtherSectorInterference=m_aMonitorSector[m_iLocationSectorIndex].fInterferenceFromOtherSector;
//by zl 230050527
for(int i=0;i<19;i++)
{
for(int j=0;j<SectorNumber;j++)
{
fSum += m_pServiceArea
->GetSector(m_aMonitorSector[i*SectorNumber+j].stSectorID)
->GetTxPower()*m_aMonitorSector[i*SectorNumber+j].fPathLoss;
}
}
fOI=fSum - m_pServiceArea
->GetSector(m_aMonitorSector[m_iLocationSectorIndex].stSectorID)
->GetTxPower()*m_aMonitorSector[m_iLocationSectorIndex].fPathLoss*3;
fOC=(pCurrentSector->GetPilotPower()+pCurrentSector->GetCommonPower()+pCurrentSector->GetTotalVoicePower()+pCurrentSector->GetTotalDCHPower())
*m_aMonitorSector[m_iLocationSectorIndex].fPathLoss;
float fgem=fOC/fOI;
m_fgem=float(10*log10(fgem));
}
m_fIor2Ioc+=fOtherChannelPower/fOtherSectorInterference;
m_fIor+=fOtherChannelPower;
m_fIoc+=fOtherSectorInterference;
}
//////////////////////////////////////////////////////////////////////////
//TITLE: SHOMsgGenerator(软切换消息生成函数)
//
//PARAMETERS:NULL
//
//PURPOSE AND ALGORITHMS:
// 根据监测集更新情况,生成加入、去掉或替换消息
// (替换体现为去掉和加入各一个消息)
//
//AUTHOR: Li Jing
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -