Commit 39d367a7 authored by wangdong's avatar wangdong

worked dynamic

parent c2ce0467
......@@ -212,17 +212,13 @@ if(dl->typeid==2){
int index = _exists_slice(si->num, si->s, id);
if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
for (int s = 0; s < si->num; ++s) {
scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
for (int i = sd->posLow; i <= sd->posHigh; ++i) {
if (rbgMap[i])
RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
rbgMap[i] = 1;
}
}
/* no problem, can allocate */
slice_t *s = si->s[index];
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->weight = 0;
dl->dloss = 0;
dl->eff = (dl->kpsReference );
if (label) {
if (s->label) free(s->label);
s->label = label;
......@@ -258,7 +254,9 @@ if(dl->typeid==2){
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->eff = (dl->kpsReference / RB_NUMS);
dl->weight = 0;
dl->dloss = 0;
dl->eff = (dl->kpsReference );
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
......@@ -1067,7 +1065,48 @@ if(dl->typeid==2){
return si->num - 1;
}
}
/**
* 获取给定UE_list的所有的prb
*/
uint16_t get_slice_rbs(module_id_t mod_id, UE_list_t *UE_list,int CC_id ){
uint16_t slice_rbs=0;
for (int UE_id =UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
slice_rbs+=RC.mac[mod_id]->UE_info.eNB_UE_stats[CC_id][UE_id].rbs_used==2?0:RC.mac[mod_id]->UE_info.eNB_UE_stats[CC_id][UE_id].rbs_used;
}
/* only calculate the DRBs */
return slice_rbs;
}
/**
获取给定UE_list的所有的PDCP的吞吐量bit/s
模拟OAI-LTE之中的下行速率计算函数
1 frame = 10ms
1 subframe = 1ms
1 subframe = 2 slots = (0.5ms)*2
1 RB = 180kHz(frequency domain,被12个Subcarrier平分) * 0.5ms(time domain,总共有7个OFDMA符号)
一个RB中共有 12*7 = 84 个RE(无无线承载元素)
最小调度时间TTI = 1ms = 2 slots,最小调度单位有两个RB构成的(RB Pair)
1 PRB(物理) 一个TTI 内的调度(调度PDSCH 和PUSCH 资源)的最小单位实际上由同一子帧上时间上相连的2 个RB(每个slot 对应一个RB)组成,并被称为RB pair
一个PRB实际上有 84 * 2 = 168 个RE
时频分布:180kHZ*1ms(TTI)
现做如下假设:
1. 采用 band7 5 MHz 25PRB 的LTE制式,即每个TTI内传输25个PRB
2. 每个PRB在一个TTI内只能被分配到一个UE上
3. 现假设信道为理想信道(rf-sim),下行MCS-index均为最大28,调制指数6(64QAM)
4. 每次调度计算个UE的速率,仅由 State_n=[R1,R2,R3,R4] {∑R<=100},以及各个R_n对应查表得出TBS计算速率
5. 2x2 MIMO 双流传输
计算公式:
子帧 n:
UE_n计算速率 = (UE_n占用子频带数目SC_n*调制指数(6)*OFDMA符号数(7)*2)/ TTI ==>单位(bps)
SC_n = R_n*12 (每个PRB占用了12个子频带)
TTI = 1 ms = 0.001 s
故:
V_n = ((R_n*12*6*7*2*2)/0.001)*0.75, 有0.25的估计下行系统开销
*/
uint16_t get_slice_thrpt(module_id_t mod_id, UE_list_t *UE_list ){
uint16_t slice_thrpt=0;
......@@ -1086,7 +1125,11 @@ uint16_t get_slice_thrpt(module_id_t mod_id, UE_list_t *UE_list ){
return slice_thrpt;
}
#define randomss(x) (rand()%x)
/**
* 返回数组最大值的下标(如果最大值有多个,则会随机输出)
*/
int arr_max(const float arr[],int n,int con)
{
const float ESP= 10e-4;
......@@ -1257,16 +1300,30 @@ void scn19_dl(module_id_t mod_id,
scn19_slice_param_t *p = s->s[i]->algo_data;
if(p->typeid==2) {
dynamic_ues = true;
uint16_t inst = 0;
if(p->rbs > 0){//was scheduled last time
inst = get_slice_thrpt(mod_id,&s->s[i]->UEs)/8000;
p->eff=(1-BETA)*p->eff+BETA*inst/(p->rbs);
uint16_t inst = get_slice_thrpt(mod_id,&s->s[i]->UEs)/8000;
if(p->rbs > 0){
if(inst>0){
p->eff=cmax(0.01,(1-BETA)*p->eff+BETA*inst);
}
}
p->fexp=(1-BETA)*p->fexp+BETA*inst;
float_t rsv = p->kpsRequired* cmin(1,p->eff*RB_NUMS/p->kpsReference);
p->weight =1+ rsv / p->fexp;
aweight[i]=p->weight;
p->rbs=0;
float_t rsv = p->kpsRequired* cmin(1,p->eff/p->kpsReference);
aweight[i]=cmin(25,rsv / p->fexp);
if(aweight[i]==p->weight){
if(aweight[i]-p->dloss>0){
p->dloss += 0.5;
}
if(aweight[i] - p->dloss<=0.5){
p->dloss -= 0.5;
}
aweight[i] = cmax(aweight[i] - p->dloss,0.5);
}
p->weight = cmin(25,rsv / p->fexp);
p->rbs = 0;
}
}
......@@ -1292,7 +1349,7 @@ void scn19_dl(module_id_t mod_id,
dynamic_n_rbg_sched,
remain_mask,
s->s[max_index]->dl_algo.data);
p->rbs = dynamic_n_rbg_sched;
p->rbs = dynamic_n_rbg_sched*RBGsize;
}
}
......
......@@ -66,7 +66,7 @@ int slicing_get_UE_slice_idx(slice_info_t *si, int UE_id);
#define MAX_STATIC_SLICES 4
#define MAX_DYNAMIC_SLICES 10
#define RB_NUMS 25
#define BETA 0.01
#define BETA 0.1
typedef struct {
uint16_t posLow;
uint16_t posHigh;
......@@ -101,6 +101,7 @@ typedef struct {
float eff;
float weight;
float dweight;
float dloss;
} scn19_slice_param_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment