Commit 336452a7 authored by Luis Ariza's avatar Luis Ariza 💬
Browse files

Static coordinated scheduling working (multiple RRUs - multiple CCs)

parent e313b050
......@@ -1228,7 +1228,6 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
}
......
......@@ -478,6 +478,7 @@ schedule_ue_spec(
num_UEs+=UE_list->num_UEs[k];
//printf("num_UEs[%d]=%d\n",k,UE_list->num_UEs[k]);
}
printf("CC_idx_last %d, CC_id %d, CC_total %d, subframe %d\n",CC_idx_last,CC_id,CC_total,subframeP);
#endif
#if 0
......@@ -501,7 +502,7 @@ schedule_ue_spec(
frame_parms[CC_id] = mac_xface->get_lte_frame_parms(module_idP,CC_id);
// get number of PRBs less those used by common channels
#ifdef COORDINATED_SCHEDULING
if (subframeP==0 || subframeP==5 || CC_total==1)
if (subframeP==0 || subframeP==5 || CC_total<2)
{
total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL;
for (i=0;i<frame_parms[CC_id]->N_RB_DL;i++)
......@@ -509,28 +510,29 @@ schedule_ue_spec(
total_nb_available_rb[CC_id]--;
//printf("Common channels: PRB %d\n",i);
}
printf("CC_idx_last %d, CC_id %d, N_RB_DL %d, total_nb_available_rb [CC%d] %d, CC_total %d, subframe %d\n",CC_idx_last,CC_id,frame_parms[CC_id]->N_RB_DL,CC_id,total_nb_available_rb[CC_id],CC_total,subframeP);
}
else
{
if ((uint16_t)(CC_idx_last==CC_id)&&(uint16_t)(frame_parms[CC_id]->N_RB_DL%CC_total!=0))
if ((CC_idx_last==CC_id)&&((uint16_t) frame_parms[CC_id]->N_RB_DL%CC_total!=0))
{
printf("CC_idx_last %d, CC_id %d, CC_idx_last==CC_id %d, N_RB_DLmodCC_total %d, total_nb_available_rb %d, CC_total %d\n",CC_idx_last,CC_id,CC_idx_last==CC_id,(uint16_t)(frame_parms[CC_id]->N_RB_DL%CC_total!=0),(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total)+1,CC_total);
total_nb_available_rb[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total)+1;
for (i=0;i<(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total)+1;i++)
total_nb_available_rb[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total+1);
for (i=0;i<(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total+1);i++)
if (eNB->common_channels[CC_id].vrb_map[i]!=0){
total_nb_available_rb[CC_id]--;
//printf("Common channels: PRB %d\n",i);
}
printf("CC_idx_last %d, CC_id %d, N_RB_DL %d, (N_RB_DL/CC_total+1)total_nb_available_rb [CC%d] %d, CC_total %d, subframe %d\n",CC_idx_last,CC_id,frame_parms[CC_id]->N_RB_DL,CC_id,total_nb_available_rb[CC_id],CC_total,subframeP);
}
else
{
printf("CC_idx_last %d, CC_id %d, CC_idx_last==CC_id %d, N_RB_DLmodCC_total %d, total_nb_available_rb %d, CC_total %d\n",CC_idx_last,CC_id,CC_idx_last==CC_id,(uint16_t)(frame_parms[CC_id]->N_RB_DL%CC_total!=0),(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total),CC_total);
total_nb_available_rb[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total);
for (i=0;i<(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total);i++)
if (eNB->common_channels[CC_id].vrb_map[i]!=0){
total_nb_available_rb[CC_id]--;
//printf("Common channels: PRB %d\n",i);
}
printf("CC_idx_last %d, CC_id %d, N_RB_DL %d, (N_RB_DL/CC_total)total_nb_available_rb [CC%d] %d, CC_total %d, subframe %d\n",CC_idx_last,CC_id,frame_parms[CC_id]->N_RB_DL,CC_id,total_nb_available_rb[CC_id],CC_total,subframeP);
}
}
#else
......@@ -550,6 +552,7 @@ schedule_ue_spec(
eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id];
eNB->eNB_stats[CC_id].dlsch_bytes_tx=0;
eNB->eNB_stats[CC_id].dlsch_pdus_tx=0;
//printf("store stats: CC_id %d, total_nb_available_rb %d, UE_list->num_UEs[CC_id] %d, subframe %d, eNB->eNB_stats[CC_id].total_available_prbs %d\n", CC_id,total_nb_available_rb[CC_id],UE_list->num_UEs[CC_id],subframeP,eNB->eNB_stats[CC_id].total_available_prbs);
//}
/// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band)
......@@ -652,8 +655,8 @@ schedule_ue_spec(
1,
format1,
0);
#ifdef COORDINATED_SCHEDULING
if (subframeP==0 || subframeP==5 || num_UEs==UE_list->num_UEs[CC_id])
/*#ifdef COORDINATED_SCHEDULING
if (subframeP==0 || subframeP==5 || CC_total==1)
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
else
{
......@@ -669,9 +672,9 @@ schedule_ue_spec(
}
}
#else
#else*/
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
#endif
//#endif
harq_pid = ue_sched_ctl->harq_pid[CC_id];
round = ue_sched_ctl->round[CC_id];
UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
......@@ -709,14 +712,12 @@ schedule_ue_spec(
/* process retransmission */
if (round > 0) {
// get freq_allocation
nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
//printf("round>0 get freq_allocation (nb_rb <= nb_available_rb): CC_id %d, nb_available_rb %d, pre_nb_available_rbs %d, nb_rb %d, subframe %d\n", CC_id,nb_available_rb,ue_sched_ctl->pre_nb_available_rbs[CC_id],nb_rb,subframeP);
if (nb_rb <= nb_available_rb) {
printf("round>0: CC_id %d, nb_available_rb %d, nb_rb %d, subframe %d\n", CC_id,nb_available_rb,nb_rb,subframeP);
if (frame_parms[CC_id]->frame_type == TDD) {
UE_list->UE_template[CC_id][UE_id].DAI++;
update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI);
......@@ -748,15 +749,14 @@ schedule_ue_spec(
j = j+1;
}
}
nb_available_rb -= nb_rb;
PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
//printf("round>0 (else): CC_id %d, nb_available_rb %d, nb_rb %d, subframe %d\n", CC_id,nb_available_rb,nb_rb,subframeP);
for(j=0; j<frame_parms[CC_id]->N_RBG; j++) {
PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
}
switch (mac_xface->get_transmission_mode(module_idP,CC_id,rnti)) {
case 1:
case 2:
......@@ -886,7 +886,6 @@ schedule_ue_spec(
break;
*/
}
add_ue_dlsch_info(module_idP,
CC_id,
UE_id,
......@@ -899,6 +898,7 @@ schedule_ue_spec(
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1;
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1;
printf("retransmission: nb_rb %d, subframe %d\n",nb_rb,subframeP);
} else {
LOG_E(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n",
module_idP, frameP, CC_id, UE_id);
......@@ -1019,7 +1019,6 @@ schedule_ue_spec(
}
}
// assume the max dtch header size, and adjust it later
header_len_dtch=0;
header_len_dtch_last=0; // the header length of the last mac sdu
......@@ -1108,7 +1107,7 @@ schedule_ue_spec(
}
TBS = mac_xface->get_TBS_DL(mcs,nb_rb);
printf("schedule_ue_spec (before while): nb_rb %d\n", nb_rb);
//printf("schedule_ue_spec (before while): nb_rb %d, UE_id %d\n", nb_rb, UE_id);
while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) {
nb_rb += min_rb_unit[CC_id]; //
......@@ -1120,9 +1119,9 @@ schedule_ue_spec(
}
TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rb);
printf("schedule_ue_spec (inside while): nb_rb %d\n", nb_rb);
//printf("schedule_ue_spec (inside while): nb_rb %d, UE_id %d, nb_available_rb %d, nb_rb %d\n", nb_rb,UE_id,nb_available_rb, nb_rb);
}
printf("schedule_ue_spec (after while): nb_rb %d\n", nb_rb);
//printf("schedule_ue_spec (after while): nb_rb %d, UE_id %d, nb_available_rb %d\n", nb_rb,UE_id,nb_available_rb);
if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
for(j=0; j<frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band
UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
......@@ -1147,7 +1146,7 @@ schedule_ue_spec(
j = j+1;
}
}
printf("schedule_ue_spec ue_sched_ctl: nb_rb %d, UE_id %d, ue_sched_ctl->pre_nb_available_rbs[CC%d] %d\n", nb_rb,UE_id,CC_id,ue_sched_ctl->pre_nb_available_rbs[CC_id]);
PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
......@@ -1747,7 +1746,6 @@ schedule_ue_spec(
} // UE_id loop
//} // CC_id loop
/* restore DCI_pdu size */
//for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
eNB->common_channels[CC_id].DCI_pdu.Num_dci = saved_DCI_pdu[CC_id].Num_dci;
......@@ -1816,7 +1814,7 @@ fill_DLSCH_dci(
// mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0);
harq_pid = UE_list->UE_sched_ctrl[UE_id].harq_pid[CC_id];
nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
printf("fill_DLSCH_dci: UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]: nb_rb %d, subframe %d\n", nb_rb,subframeP);
DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid];
eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
......
......@@ -145,7 +145,7 @@ void store_dlsch_buffer (module_id_t Mod_id,
*/
if (UE_template->dl_buffer_info[i]>0)
LOG_D(MAC,
"[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n",
"[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmented %d \n",
Mod_id, frameP, subframeP, UE_id,
i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i],
UE_template->dl_buffer_head_sdu_creation_time[i],
......@@ -288,7 +288,7 @@ void assign_rbs_required (module_id_t Mod_id,
while (TBS < UE_list->UE_template[pCCid][UE_id].dl_buffer_total) {
nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id];
#ifdef COORDINATED_SCHEDULING
if (subframe==0 || subframe==5 || CC_total==1)//Subframes 0 and 5 are common signals that allow UEs to synchronize with the eNb.
if (subframe==0 || subframe==5 || CC_total<2)//Subframes 0 and 5 are common signals that allow UEs to synchronize with the eNb.
{
if (nb_rbs_required[CC_id][UE_id] > frame_parms[CC_id]->N_RB_DL)
{
......@@ -300,7 +300,7 @@ void assign_rbs_required (module_id_t Mod_id,
}
else
{
if ((uint16_t)(CC_idx_last==CC_id)&&(uint16_t)(frame_parms[CC_id]->N_RB_DL%CC_total!=0))
if ((CC_idx_last==CC_id)&&((uint16_t) frame_parms[CC_id]->N_RB_DL%CC_total!=0))
{
//printf("CC_idx_last %d, CC_id %d, CC_idx_last==CC_id %d\n",CC_idx_last,CC_id,CC_idx_last==CC_id);
if (nb_rbs_required[CC_id][UE_id] > ((uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total)+1))
......@@ -481,7 +481,8 @@ static int ue_dl_compare(const void *_a, const void *_b, void *_params)
// This fuction sorts the UE in order their dlsch buffer and CQI
void sort_UEs (module_id_t Mod_idP,
int frameP,
sub_frame_t subframeP)
sub_frame_t subframeP,
uint8_t CC_id)
{
int i;
int list[NUMBER_OF_UE_MAX];
......@@ -492,6 +493,7 @@ void sort_UEs (module_id_t Mod_idP,
UE_list_t *UE_list = &eNB_mac_inst[Mod_idP].UE_list;
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
if (CC_id!=UE_PCCID(Mod_idP,i)) continue;
rnti = UE_RNTI(Mod_idP, i);
if (rnti == NOT_A_RNTI)
continue;
......@@ -633,7 +635,7 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
min_rb_unit[CC_id]=get_min_rb_unit(Mod_id,CC_id);
//printf("dlsch_scheduler_pre_processor: min_rb_unit[%d] = %d, CC_id %d\n",CC_id,min_rb_unit[CC_id],CC_id);The value is 2
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
if (UE_list->active[i] != TRUE) continue;
if (UE_list->active[i] != TRUE || CC_id!=UE_PCCID(Mod_id,i)) continue;
UE_id = i;
// Initialize scheduling information for all active UEs
......@@ -653,7 +655,15 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
}
//}
/*#ifdef COORDINATED_SCHEDULING
for (i=0; i<2;i++) {
printf("COORDINATED_SCHEDULING: nb_rb [UE%d][CC%d][harq_pid%d] = %d, subframe %d\n",i,CC_id,UE_list->UE_sched_ctrl[i].harq_pid[CC_id],UE_list->UE_template[CC_id][i].nb_rb[UE_list->UE_sched_ctrl[i].harq_pid[CC_id]],subframeP);
}
#else
for (i=0; i<2;i++) {
printf("nb_rb [UE%d][CC%d][harq_pid%d] = %d, subframe %d\n",i,CC_id,UE_list->UE_sched_ctrl[i].harq_pid[CC_id],UE_list->UE_template[CC_id][i].nb_rb[UE_list->UE_sched_ctrl[i].harq_pid[CC_id]],subframeP);
}
#endif*/
// Store the DLSCH buffer for each logical channel
store_dlsch_buffer (Mod_id,frameP,subframeP,CC_id);
......@@ -665,7 +675,7 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
//The value of CC_total is updated in the assign_rbs_required function. CC_total gives us the number of active CCs
// Sorts the user on the basis of dlsch logical channel buffer and CQI
sort_UEs (Mod_id,frameP,subframeP);
sort_UEs (Mod_id,frameP,subframeP,CC_id);
......@@ -701,14 +711,38 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
// mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0);
if(round>0) {
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
#ifdef COORDINATED_SCHEDULING
printf("COORDINATED_SCHEDULING: nb_rb [UE%d][CC%d][harq_pid%d][round%d] = %d\n",UE_id,CC_id,harq_pid,round,UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]);
if (subframeP==0 || subframeP==5 || CC_total<2)
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
else
{
if ((CC_idx_last==CC_id)&&((uint16_t) frame_parms[CC_id]->N_RB_DL%CC_total!=0))
{
if (UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]>(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total+1))
{
UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]=(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total+1);
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
}
else
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
}
else
{
if (UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]>(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total))
{
UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]=(uint16_t) floor(frame_parms[CC_id]->N_RB_DL/CC_total);
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
}
else
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
}
}
printf("COORDINATED_SCHEDULING: nb_rb [UE%d][CC%d][harq_pid%d][round%d] = %d, subframe %d\n",UE_id,CC_id,harq_pid,round,UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid],subframeP);
#else
nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
printf("nb_rb [UE%d][CC%d][harq_pid%d][round%d] = %d\n",UE_id,CC_id,harq_pid,round,UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]);
#endif
}
//nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id];
if (nb_rbs_required[CC_id][UE_id] > 0) {
total_ue_count = total_ue_count + 1;
......@@ -740,6 +774,7 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
else {
average_rbs_per_user[CC_id] = min_rb_unit[CC_id]; // consider the total number of use that can be scheduled UE
}
//printf("COORDINATED_SCHEDULING: [UE%d][CC%d] total_ue_count %d\n",UE_id,CC_id,total_ue_count);
}
}
......@@ -778,7 +813,7 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
for(r1=0; r1<2; r1++) {
for(i=UE_list->head; i>=0; i=UE_list->next[i]) {
if (CC_id!=UE_PCCID(Mod_id,i)) continue;
if (CC_id!=UE_PCCID(Mod_id,i)) continue;
for (ii=0; ii<UE_num_active_CC(UE_list,i); ii++) {
if (CC_id != UE_list->ordered_CCids[ii][i]) continue;
......
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