datou198431 2015-08-04 04:08 采纳率: 0%
浏览 2163

C++仿真编程过程中遇到的inaccessible问题

在LTE同频干扰仿真C++编写过程中遇到的一个问题,烦请C++编程达人帮我解答。谢谢。
第一个文件:Bs.h
/*这个文件声明三个类,Sector BS 和BS_V,其中BS和Sector表示干扰方的基站和扇区,BS_V和SECTOR_V表示*/
#ifndef BS_H
#define BS_H
#include"Ue.h"
#include"Random.h"
#include"Basic.h"
#include"Radio.h"
#include
#include
#include
using namespace std;
class Ue;
//Sector表示干扰方的扇区
class Sector
{
public:
int id;
Pos pos;
double theta;//中心角度,用于计算角度损耗
double TX_Power;
friend class BS; //友元类,便于BS和BS_V调用Sector内部的各个变量和函数
friend class BS_v;
const int& GetID();
const Pos& GetPos();
const double& GetPower();
//void SectorInitial(int id,Pos postemp);
};
class Sector_v :public Sector
{
public:
list UeList;
double rate;
double ThroughPutAll;
bool RbUsed[RB_Numb_Per_Sector];
friend void ResourceUpdate();
friend void CellAccess();
friend class BS;
friend class BS_v;
void ScheduleRR();
void Accept(Ue* uetemp);
void Kick(Ue* uetemp);
void StateClear();
void DropClear();//撒点之后的信息清零
};
class BS
{
public:
int id;//干扰方只需要知道ID,位置和发射功率就可以了
Pos pos;
double TX_Power;
const int& GetID();
const Pos& GetPos();
const double& GetPower();
void BSInitial(int idtemp,Pos postemp);
Sector sector[Sector_Num_Per_Cell];
};
class BS_v :public BS
{
//bool RB_Used[RB_Numb_Per_Sector];
//list UeList;
Sector_v sectorV[Sector_Num_Per_Cell];
Radio* radio;
void BSInitial(int idtemp, Pos postemp, Radio* radiotemp);
double rate;
double ThroughputAll;
void StateClear();//调度之后的信息清零
void DropClear();//撒点之后的信息清零
friend void ResourceUpdate();
friend void CellAccess();
};
#endif
第二个文件:radio.h
#ifndef RADIO_H
#define RADIO_H
#include"BS.h"
#include"Ue.h"
#include"Basic.h"
class Ue;
class BS;
class BS_v;
class Radio
{
public:
BS* BBs;//干扰方
BS_v* Bss;
Ue* ues;
void RadioInitial(BS_v BSstemp[Cell_Num],BS BBstemp[Cell_Num],Ue UesTemp[Ue_Num]);
};
#endif
第3个文件:radio.cpp
#include"Radio.h"
void Radio::RadioInitial(BS_v BSstemp[Cell_Num], BS BBstemp[Cell_Num], Ue UesTemp[Ue_Num])
{
BBs = BBstemp;
Bss = BSstemp;
ues = UesTemp;
}
第4个文件:Ue.h
#ifndef UE_H
#define UE_H
#include"Basic.h"
#include"Radio.h"
#include"BS.h"
#include"Random.h"
#include
#include
#include
using namespace std;
class Ue
{
public:
/*成员变量*/
Pos pos;
Speed speed;
int id;
list Rblist[RB_Numb_Per_Sector];//UE的RB列表,表示哪些RB分配给这个UE
double AngleLoss[Cell_Num][Sector_Num_Per_Cell];//UE到各Sector的角度衰落
double AngleLossI[Cell_Num][Sector_Num_Per_Cell];
double PathLoss[Cell_Num][Sector_Num_Per_Cell];//UE到各Sector的路径损耗
double PathLossI[Cell_Num][Sector_Num_Per_Cell];
double ShadowLoss[Cell_Num][Sector_Num_Per_Cell];//UE到各Sector的阴影衰落
double ShadowLossI[Cell_Num][Sector_Num_Per_Cell];
double Dis[Cell_Num][Sector_Num_Per_Cell];//UE到各Sector的距离
double DisI[Cell_Num][Sector_Num_Per_Cell];
double RSRP[Cell_Num][Sector_Num_Per_Cell];//UE接收到各Sector的信号能量
double RSRPI[Cell_Num][Sector_Num_Per_Cell];
CQI cqi;
double Rate;//UE在此调度时刻的实际速率
Radio* radio;//整个无线环境,包括两个全局变量数组的首元素地址
BS_v* BSV;//正在服务此UE的基站指针
int BSID;//表示对应基站的ID信息
/*成员函数*/
const int& GetId()const;
const Pos& GetPos()const;
const Speed& GetSpeed()const;
void UpdateLocation();//更新地址
friend void ResourceUpdate();//撒点初期要重新对相关变量赋值
void UpdateDistance();//计算UE到各BS的距离
void UpdatePathLoss();//路径损耗
void UpdateAngleLoss();//角度损耗
void UpdateShadowLoss();//阴影衰落
void UpdateLoss();//总损耗
void UpdateRxPower();//更新接收信号强度
void UpdateSINR();//更新信干比
void UeInitial(int idtemp,BS_v* bstemp, Radio* radiotemp);//初始化所有的UE
bool IsNotInsideCell(Pos postemp,BS_v* bs);//判断UE是否在对应的Cell中
void UeRelocation(BS_v* bs);
void SelectCell();
void CQIUpdate();
void UeStateClear();
};
#endif
出现问题的文件中的函数:
Ue.cpp
void Ue::UpdateDistance()
{
//从UE到服务系统各基站的距离
for (int i = 0; i < Cell_Num; i++)
{
for (int j = 0; j < Sector_Num_Per_Cell; j++)
{
DisI[i][j] = sqrt((pos.x - radio->BBs[i].sector[j].GetPos().x)*(pos.x - radio->BBs[i].sector[j].GetPos().x) + (pos.y - radio->BBs[i].sector[j].GetPos().y)*(pos.y - radio->BBs[i].sector[j].GetPos().y));
Dis[i][j] = (pos.x - radio->Bss[i].sectorV[j].GetPos().x);
}
}
}
问题:
(pos.x - radio->Bss[i].sectorV[j].GetPos().x)报错,SectorV[j] is inaccessible.
为什么radio->BBs[i].sector[j]是没有问题的。而 radio->Bss[i].sectorV[j]就会出现inaccessible的问题?如何解决这个问题?

  • 写回答

1条回答 默认 最新

  • wafstudio 2015-08-05 03:43
    关注

    class BS_v :public BS
    {
    public:
    };

    加个public,否则默认是private。

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?