Commit 75f0c3a8 authored by Nick Ho's avatar Nick Ho

fixed scheduling timing offered by scheduler

parent cc243196
...@@ -301,10 +301,10 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -301,10 +301,10 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
ndlcch->active[ncce_index] = 1; //will be activated by the corresponding NDSLCH pdu ndlcch->active[ncce_index] = 1; //will be activated by the corresponding NDSLCH pdu
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
ndlcch->scheduling_delay[ncce_index] = Idelay_to_K0(Sched_delay,32); ndlcch->scheduling_delay[ncce_index] = Idelay_to_K0(Sched_delay,4);
ndlcch->resource_assignment[ncce_index] = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe ndlcch->resource_assignment[ncce_index] = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlcch->repetition_number[ncce_index] = Irep_to_Nrep[RepNum]; // repetition number for NPDSCH ndlcch->repetition_number[ncce_index] = Irep_to_Nrep[RepNum]; // repetition number for NPDSCH
ndlcch->dci_repetitions[ncce_index] = DCIrep_to_real_rep(DCIRep,32); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax ndlcch->dci_repetitions[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
printf("dci_repetitions: %d\n",ndlcch->dci_repetitions[ncce_index]); printf("dci_repetitions: %d\n",ndlcch->dci_repetitions[ncce_index]);
...@@ -329,7 +329,7 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -329,7 +329,7 @@ int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
ndlcch->TBS[ncce_index] = TBStable_NB_IoT[mcs][ResAssign]; ndlcch->TBS[ncce_index] = TBStable_NB_IoT[mcs][ResAssign];
//ndlcch->subframe[ncce_index] = subframe; //ndlcch->subframe[ncce_index] = subframe;
ndlcch->counter_repetition_number[ncce_index] = DCIrep_to_real_rep(DCIRep,32); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax ndlcch->counter_repetition_number[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data //ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data
//ndlsch->error_treshold //ndlsch->error_treshold
//ndlsch->G?? //ndlsch->G??
......
...@@ -92,6 +92,7 @@ uint16_t find_suit_i_delay(uint32_t rmax, uint32_t r, uint32_t dci_candidate){ ...@@ -92,6 +92,7 @@ uint16_t find_suit_i_delay(uint32_t rmax, uint32_t r, uint32_t dci_candidate){
void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
RA_TEMPLATE_NB_IoT *msg2_nodes = mac_inst->RA_msg2_list.head; RA_TEMPLATE_NB_IoT *msg2_nodes = mac_inst->RA_msg2_list.head;
//RA_TEMPLATE_NB_IoT *msg3_list_tail = mac_inst->RA_msg3_list.tail; //RA_TEMPLATE_NB_IoT *msg3_list_tail = mac_inst->RA_msg3_list.tail;
RA_TEMPLATE_NB_IoT *migrate_node; RA_TEMPLATE_NB_IoT *migrate_node;
...@@ -117,12 +118,12 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -117,12 +118,12 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
fail=0; fail=0;
rmax = mac_inst->rrc_config.mac_NPRACH_ConfigSIB[msg2_nodes->ce_level].mac_npdcch_NumRepetitions_RA_NB_IoT;//32; rmax = mac_inst->rrc_config.mac_NPRACH_ConfigSIB[msg2_nodes->ce_level].mac_npdcch_NumRepetitions_RA_NB_IoT;//32;
num_candidate = 8;//rmax / r; num_candidate = 1;//rmax / r;
r = rmax/num_candidate; r = rmax/num_candidate;
num_dci_subframe = r; num_dci_subframe = r;
dci_subframe = abs_subframe;//mac_inst->current_subframe; dci_subframe = abs_subframe;//mac_inst->current_subframe;
//LOG_I(MAC,"rmax : %d, num_dci_subframe : %d, dci_subframe: %d\n",rmax,r,dci_subframe); LOG_D(MAC,"rmax : %d, num_dci_subframe : %d, dci_subframe: %d\n",rmax,r,dci_subframe);
//print_available_resource_DL(mac_inst); //print_available_resource_DL(mac_inst);
......
...@@ -77,7 +77,7 @@ void schedule_sibs(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start ...@@ -77,7 +77,7 @@ void schedule_sibs(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start
num_subframe_per_SIB = 8; num_subframe_per_SIB = 8;
else else
LOG_E(MAC,"Invalid SIB size\n"); LOG_E(MAC,"Invalid SIB size\n");
num_subframe = num_subframe_per_SIB *8; num_subframe = num_subframe_per_SIB *4;
int rmax = mac_inst->rrc_config.mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT; int rmax = mac_inst->rrc_config.mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT;
rmax = (rmax * 10) >> 3; // x1.25 rmax = (rmax * 10) >> 3; // x1.25
......
...@@ -980,11 +980,11 @@ uint32_t get_I_mcs(int CE_level) ...@@ -980,11 +980,11 @@ uint32_t get_I_mcs(int CE_level)
} }
else if(CE_level==1) else if(CE_level==1)
{ {
return 8; return 12;
} }
else else
{ {
return 2; return 11;
} }
} }
......
...@@ -35,6 +35,70 @@ ...@@ -35,6 +35,70 @@
#include "openair2/RRC/LITE/proto_NB_IoT.h" #include "openair2/RRC/LITE/proto_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#define fixed_scheduling 1
int fixed_scheduler(uint32_t frame, uint32_t subframe, Sched_Rsp_NB_IoT_t *SCHED_info)
{
nfapi_dl_config_request_pdu_t *dl_config_pdu;
if(frame==529&&subframe==8)
{
//DCI
LOG_I(MAC,"[frame:%2d][subframe:%2d]NB-IoT fill DL_DCI\n",frame,subframe);
dl_config_pdu = SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list;
SCHED_info->DL_req->dl_config_request_body.number_dci = 1;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
// not consider the case transmitting 2 DCIs for the moment also not consider N2 now
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE;
dl_config_pdu->pdu_size = 2+sizeof(nfapi_dl_config_npdcch_pdu_rel13_t);
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.length = 7;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.pdu_index = 1;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.ncce_index = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level = 1;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti_type = 1; // 1 =
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti = 133; // RA-RNTI = 1+floor(SFN/4)
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_format = 0; // N1
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.scheduling_delay = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.repetition_number = 2;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.mcs = 4;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.new_data_indicator = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = 0;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = 2;
return 1;
}
if(frame==530 && subframe==7)
{
LOG_I(MAC,"[frame:%2d][subframe:%2d]NB-IoT fill DL Data\n",frame,subframe);
uint8_t *rar_pdu;
rar_pdu = (uint8_t *)malloc(7*sizeof(uint8_t));
rar_pdu[0] = 64; // + preamble index
rar_pdu[1] = 0;
rar_pdu[2] = 9;
rar_pdu[3] = 96;
rar_pdu[4] = 64;
rar_pdu[5] = 255;
rar_pdu[6] = 242;
dl_config_pdu = SCHED_info->DL_req->dl_config_request_body.dl_config_pdu_list;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE;
dl_config_pdu->pdu_size = 2+sizeof(nfapi_dl_config_ndlsch_pdu_rel13_t);
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length = 7;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index = 1;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti_type = 1;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti = 133; // C-RNTI
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment = 0;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = 2;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = get_num_sf(dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment);
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = rar_pdu;
return 1;
}
return 0;
}
int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_id, uint32_t hypersfn, uint32_t frame, uint32_t subframe, uint8_t MIB_flag, uint8_t SIB1_flag, uint32_t current_time){ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_id, uint32_t hypersfn, uint32_t frame, uint32_t subframe, uint8_t MIB_flag, uint8_t SIB1_flag, uint32_t current_time){
uint8_t MIB_size = 0; uint8_t MIB_size = 0;
uint8_t SIB1_size = 0, i = 0; uint8_t SIB1_size = 0, i = 0;
...@@ -83,7 +147,11 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -83,7 +147,11 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
SCHED_info->DL_req->dl_config_request_body.number_pdu = 0; SCHED_info->DL_req->dl_config_request_body.number_pdu = 0;
SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0; SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0;
SCHED_info->HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0; SCHED_info->HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0;
#if (fixed_scheduling == 1)
if(fixed_scheduler(frame,subframe,SCHED_info))
return 0;
#endif
// process downlink data transmission, there will only be single DL_REQ in one subframe (e.g. 1ms), check common signal first // process downlink data transmission, there will only be single DL_REQ in one subframe (e.g. 1ms), check common signal first
if(subframe == 0 /*MIB_flag == 1*/) // TODO back to MIB_flag if(subframe == 0 /*MIB_flag == 1*/) // TODO back to MIB_flag
{ {
...@@ -141,7 +209,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -141,7 +209,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
//LOG_D(MAC,"A NB-IoT SIB1 pdu : %d \n",SIB1_pdu); //LOG_D(MAC,"A NB-IoT SIB1 pdu : %d \n",SIB1_pdu);
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = SIB1_pdu; SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = SIB1_pdu;
LOG_D(MAC,"NB-IoT fill SIB1\n"); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIB1\n",hypersfn,frame,subframe);
//LOG_I(MAC,"NB-IoT fill SIB1\n"); //LOG_I(MAC,"NB-IoT fill SIB1\n");
//start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now //start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now
//dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1"); //dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1");
...@@ -205,7 +273,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -205,7 +273,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep;
}else if(schedule_result_list_DL->direction == UL) }else if(schedule_result_list_DL->direction == UL)
{ {
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL_DCI\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL_DCI\n",hypersfn,frame,subframe);
//SCHED_info->HI_DCI0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t)); //SCHED_info->HI_DCI0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t));
//SCHED_info->HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0; //SCHED_info->HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0;
//SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t)); //SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t));
...@@ -251,7 +319,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -251,7 +319,13 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = get_num_sf(dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment); dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = get_num_sf(dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment);
SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = schedule_result_list_DL->DLSCH_pdu; SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = schedule_result_list_DL->DLSCH_pdu;
if(schedule_result_list_DL->rnti==SI_RNTI) if(schedule_result_list_DL->rnti==SI_RNTI)
{
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment =((DCIFormatN1_t *)DCI_pdu)->ResAssign; dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment =((DCIFormatN1_t *)DCI_pdu)->ResAssign;
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIBs\n",hypersfn,frame,subframe);
}else
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data\n",hypersfn,frame,subframe);
//LOG_D(MAC,"A NB-IoT fill DL Data pdu : %d \n",schedule_result_list_DL->DLSCH_pdu); //LOG_D(MAC,"A NB-IoT fill DL Data pdu : %d \n",schedule_result_list_DL->DLSCH_pdu);
break; break;
......
...@@ -17,20 +17,22 @@ void enable_preamble_simulation(UL_IND_NB_IoT_t *UL_INFO,int i) ...@@ -17,20 +17,22 @@ void enable_preamble_simulation(UL_IND_NB_IoT_t *UL_INFO,int i)
if(i == 1) if(i == 1)
{ {
// simulate preamble session // simulate preamble session
if(UL_INFO->frame==60 && UL_INFO->subframe==2 && tmp==0) /*
if(UL_INFO->frame==60 && UL_INFO->subframe==2 && (tmp%3==0))
{ {
simulate_preamble(UL_INFO,0,2); simulate_preamble(UL_INFO,0,2);
tmp++; tmp++;
} }
if(UL_INFO->frame==100 && UL_INFO->subframe==2 && tmp==1) if(UL_INFO->frame==100 && UL_INFO->subframe==2 && (tmp%3==1))
{ {
simulate_preamble(UL_INFO,1,13); simulate_preamble(UL_INFO,1,13);
tmp++; tmp++;
} }
if(UL_INFO->frame==60 && UL_INFO->subframe==2 && tmp==2) */
if(UL_INFO->frame==525 && UL_INFO->subframe==8)
{ {
simulate_preamble(UL_INFO,2,26); simulate_preamble(UL_INFO,2,26);
tmp++; //tmp++;
} }
} }
} }
...@@ -43,7 +45,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -43,7 +45,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO; Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO;
//UE_TEMPLATE_NB_IoT *UE_info; //UE_TEMPLATE_NB_IoT *UE_info;
enable_preamble_simulation(UL_INFO,1); enable_preamble_simulation(UL_INFO,0);
//If there is a preamble, do the initiate RA procedure //If there is a preamble, do the initiate RA procedure
if(UL_INFO->nrach_ind.number_of_initial_scs_detected>0) if(UL_INFO->nrach_ind.number_of_initial_scs_detected>0)
...@@ -138,4 +140,4 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -138,4 +140,4 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
free(SCHED_info->DL_req); free(SCHED_info->DL_req);
free(SCHED_info->UL_req); free(SCHED_info->UL_req);
*/ */
} }
\ No newline at end of file
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