Commit f309fd17 authored by wangdong's avatar wangdong

Three Types Done!

parent 3e0361dd
...@@ -1363,22 +1363,27 @@ void scn19_dl(module_id_t mod_id, ...@@ -1363,22 +1363,27 @@ void scn19_dl(module_id_t mod_id,
if(p->typeid==3) { if(p->typeid==3) {
ondemand_ues = true; ondemand_ues = true;
uint16_t inst = 0; uint16_t inst = 0;
uint16_t RATE = get_slice_RATE(mod_id,&s->s[i]->UEs,CC_id); uint16_t RATE = get_slice_RATE(mod_id,&s->s[i]->UEs,CC_id)==0?1:get_slice_RATE(mod_id,&s->s[i]->UEs,CC_id);
uint16_t DELAY = get_slice_DELAY(mod_id,&s->s[i]->UEs,CC_id, frame,subframe)==0?1:get_slice_DELAY(mod_id,&s->s[i]->UEs,CC_id, frame,subframe); uint16_t DELAY = get_slice_DELAY(mod_id,&s->s[i]->UEs,CC_id, frame,subframe)==0?1:get_slice_DELAY(mod_id,&s->s[i]->UEs,CC_id, frame,subframe);
if(p->rbs > 0){ if(p->rbs > 0){
inst = get_slice_thrpt(mod_id,&s->s[i]->UEs)/8000; inst = get_slice_thrpt(mod_id,&s->s[i]->UEs);
} }
p->fexp=(1-BETA)*p->fexp+BETA*inst; p->fexp=(1-BETA)*p->fexp+BETA*inst;
p->weight=RATE/ p->fexp; // printf("p->fexp %f \n",p->fexp);
// printf("p->RATE %f \n",RATE);
// printf("p->weight %f \n",(float)RATE/ p->fexp);
p->weight=(float)RATE/ p->fexp;
p->dweight=p->logdelta/p->tau*DELAY*p->weight; p->dweight=p->logdelta/p->tau*DELAY*p->weight;
p->texp=(1 -1/p->tau)*p->texp+1/p->tau*p->rbs/RB_NUMS; p->texp=(1 -1/p->tau)*p->texp+1/p->tau*p->rbs/RB_NUMS;
float tmax=p->tau*p->tmax+(1-p->tau)*p->texp; float tmax=p->tau*p->tmax+(1-p->tau)*p->texp;
if(p->weight>tmax){ if(p->weight>tmax){
p->weight=tmax; p->weight=tmax;
} }
printf("p->weight %d \n",p->weight); // printf("p->RATE %d p->DELAY %d p->inst %d \n",RATE,DELAY,inst);
// printf("p->weight %f \n",p->weight);
aweight[i]=0; aweight[i]=0;
adweight[i]=p->dweight; adweight[i]=p->dweight;
p->rbs = 0; p->rbs = 0;
...@@ -1388,7 +1393,6 @@ void scn19_dl(module_id_t mod_id, ...@@ -1388,7 +1393,6 @@ void scn19_dl(module_id_t mod_id,
for(int i=0;i<s->num;i++){ for(int i=0;i<s->num;i++){
index[i]=i; index[i]=i;
} }
int ondemand_buffer[RB_NUMS]={0};
sortA1(adweight,s->num,index); sortA1(adweight,s->num,index);
// for(int i=0;i<s->num;i++){ // for(int i=0;i<s->num;i++){
...@@ -1400,6 +1404,8 @@ void scn19_dl(module_id_t mod_id, ...@@ -1400,6 +1404,8 @@ void scn19_dl(module_id_t mod_id,
// } // }
for(int i=0;i<s->num;i++){ for(int i=0;i<s->num;i++){
int ondemand_buffer[N_RBG_MAX]={0};
int ondemand_n_rbg_sched=0; int ondemand_n_rbg_sched=0;
if (s->s[i]->UEs.head < 0) if (s->s[i]->UEs.head < 0)
...@@ -1412,18 +1418,18 @@ void scn19_dl(module_id_t mod_id, ...@@ -1412,18 +1418,18 @@ void scn19_dl(module_id_t mod_id,
} }
int slen = (int)(p->weight*RB_NUMS+0.5); int slen = (int)(p->weight*RB_NUMS+0.5);
printf("Slen %d\n",slen); // printf("Slen %d\n",slen);
for(int i=0;i<N_RBG;i++){ // for(int i=0;i<N_RBG;i++){
printf("_%d_",remain_mask_ondemand[i]); // printf("_%d_",remain_mask_ondemand[i]);
if(i==N_RBG-1){ // if(i==N_RBG-1){
printf("\n"); // printf("\n");
} // }
} // }
while(slen>0&&ri < N_RBG){ while(slen>0&&ri < N_RBG){
if(remain_mask_ondemand[ri]==1){ if(remain_mask_ondemand[ri]==1){
ondemand_buffer[ri]=1; ondemand_buffer[ri]=1;
remain_mask_ondemand[ri]==0; remain_mask_ondemand[ri]=0;
slen -=1; slen -=1;
ondemand_n_rbg_sched+=1; ondemand_n_rbg_sched+=1;
} }
...@@ -1431,9 +1437,15 @@ void scn19_dl(module_id_t mod_id, ...@@ -1431,9 +1437,15 @@ void scn19_dl(module_id_t mod_id,
} }
if(ondemand_n_rbg_sched>0){ if(ondemand_n_rbg_sched>0){
// for(int i=0;i<N_RBG;i++){
// printf("_%d_",ondemand_buffer[i]);
// if(i==N_RBG-1){
// printf("\n");
// }
// }
p->weight=0; p->weight=0;
p->rbs=ondemand_n_rbg_sched*RBGsize; p->rbs=ondemand_n_rbg_sched*RBGsize;
s->s[index[i]]->dl_algo.run(mod_id, s->s[index[i]]->dl_algo.run(mod_id,
CC_id, CC_id,
frame, frame,
subframe, subframe,
...@@ -1445,7 +1457,7 @@ void scn19_dl(module_id_t mod_id, ...@@ -1445,7 +1457,7 @@ void scn19_dl(module_id_t mod_id,
s->s[index[i]]->dl_algo.data); s->s[index[i]]->dl_algo.data);
} }
} }
...@@ -1469,8 +1481,8 @@ void scn19_dl(module_id_t mod_id, ...@@ -1469,8 +1481,8 @@ void scn19_dl(module_id_t mod_id,
srbgalloc_mask[i] = 1; srbgalloc_mask[i] = 1;
for (int j = 0; j < RBGsize; j++) for (int j = 0; j < RBGsize; j++)
srbgalloc_mask[i] &= !vrb_map[RBGsize * i + j]; srbgalloc_mask[i] &= !vrb_map[RBGsize * i + j];
if(static_rbgalloc_slice_mask[i]==0){ if(static_rbgalloc_slice_mask[i]==0&&remain_mask_ondemand[i]==1){
remain_mask[i]=srbgalloc_mask[i]-ondemand_buffer[i]; remain_mask[i]=srbgalloc_mask[i];
} }
} }
for(int i=0;i<N_RBG_MAX;i++){ for(int i=0;i<N_RBG_MAX;i++){
...@@ -1527,6 +1539,15 @@ void scn19_dl(module_id_t mod_id, ...@@ -1527,6 +1539,15 @@ void scn19_dl(module_id_t mod_id,
//LOG_I(FLEXRAN_AGENT, " ---%.2f ---%.2f ---%.2f ---%.2f \n",aweight[0],aweight[1],aweight[2],aweight[3]); //LOG_I(FLEXRAN_AGENT, " ---%.2f ---%.2f ---%.2f ---%.2f \n",aweight[0],aweight[1],aweight[2],aweight[3]);
if(p->typeid == 2 && dynamic_ues){ if(p->typeid == 2 && dynamic_ues){
// for(int i=0;i<N_RBG;i++){
// if(i==0){
// printf("Rest for dynamic");
// }
// printf("_%d_",remain_mask[i]);
// if(i==N_RBG-1){
// printf("\n");
// }
// }
//LOG_I(FLEXRAN_AGENT, "1254 %d static_n_rbg_sched %d dynamic_n_rbg_sched %.2f weight of slice %d \n",static_n_rbg_sched,dynamic_n_rbg_sched,aweight[max_index],max_index); //LOG_I(FLEXRAN_AGENT, "1254 %d static_n_rbg_sched %d dynamic_n_rbg_sched %.2f weight of slice %d \n",static_n_rbg_sched,dynamic_n_rbg_sched,aweight[max_index],max_index);
//LOG_I(FLEXRAN_AGENT, "1257 %d static_n_rbg_sched %d dynamic_n_rbg_sched \n",static_n_rbg_sched,dynamic_n_rbg_sched); //LOG_I(FLEXRAN_AGENT, "1257 %d static_n_rbg_sched %d dynamic_n_rbg_sched \n",static_n_rbg_sched,dynamic_n_rbg_sched);
......
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