Remove dependency of init_codebook_gNB on mac parameters

This commit is contained in:
sfn
2021-12-09 10:36:01 +01:00
parent 2242c6a8a9
commit a778f69a76
6 changed files with 438 additions and 445 deletions
+1 -2
View File
@@ -505,10 +505,9 @@ void init_eNB_afterRU(void) {
for (inst=0; inst<RC.nb_nr_inst; inst++) { for (inst=0; inst<RC.nb_nr_inst; inst++) {
LOG_I(PHY,"RC.nb_nr_CC[inst:%d]:%p\n", inst, RC.gNB[inst]); LOG_I(PHY,"RC.nb_nr_CC[inst:%d]:%p\n", inst, RC.gNB[inst]);
gNB = RC.gNB[inst]; gNB = RC.gNB[inst];
mac = RC.nrmac[gNB->UL_INFO.module_id];
phy_init_nr_gNB(gNB,0,0); phy_init_nr_gNB(gNB,0,0);
init_codebook_gNB(gNB,mac); init_codebook_gNB(gNB);
// map antennas and PRACH signals to gNB RX // map antennas and PRACH signals to gNB RX
if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id);
+13 -32
View File
@@ -72,38 +72,32 @@ int l1_north_init_gNB() {
return(0); return(0);
} }
int init_codebook_gNB(PHY_VARS_gNB *gNB, int init_codebook_gNB(PHY_VARS_gNB *gNB) {
gNB_MAC_INST *mac) {
//get RRC Codebook configuration
struct NR_CSI_ReportConfig *csi_reportconfig = mac->UE_info.CellGroup[0]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup->csi_ReportConfigToAddModList->list.array[0];
if(gNB->frame_parms.nb_antennas_tx>1){ if(gNB->frame_parms.nb_antennas_tx>1){
LOG_D(PHY, "NR init_codebook_gNB: codebookType present %d\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present); //NR Codebook Generation for codebook type1 SinglePanel
if(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present==NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { //csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present
int N1=1; int N1;
int N2=1; int N2;
int O1=0; int O1;
int O2=0; int O2;
int CSI_RS_antenna_ports=1; int CSI_RS_antenna_ports;
//Uniform Planner Array: UPA //Uniform Planner Array: UPA
// X X X X ... X // X X X X ... X
// X X X X ... X // X X X X ... X
// N2 . . . . ... . // N2 . . . . ... .
// X X X X ... X // X X X X ... X
// |<-----N1---->| // |<-----N1---->|
LOG_D(PHY, "NR Codebook Config: codebookType, type1, subType_PR_typeI_SinglePanel\n"); if (gNB->frame_parms.nb_antennas_tx == 2) {//nrOfAntennaPorts = two
struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel;
if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) {
N1=1; N1=1;
N2=1; N2=1;
O1=1; O1=1;
O2=1; O2=1;
CSI_RS_antenna_ports=2; CSI_RS_antenna_ports=2;
LOG_D(PHY, "NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports); LOG_D(PHY, "NR Codebook Config: antenna ports: %d\n",CSI_RS_antenna_ports);
} else if(type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { } else if(gNB->frame_parms.nb_antennas_tx > 2) {//nrOfAntennaPorts moreThanTwo
//Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2) //Type 1 Single Panel : Based on 38.214 v15.3-Table 5.2.2.2.1-2: Supported configurations of (N1,N2) and (O1,O2)
switch(type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present) { switch(gNB->frame_parms.antennas_tx_n1_n2) {
case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction: case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction:
N1=2; N1=2;
N2=1; N2=1;
@@ -214,12 +208,12 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
O1=1; O1=1;
O2=1; O2=1;
CSI_RS_antenna_ports=2; CSI_RS_antenna_ports=2;
LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d n1_n2 %d\n",CSI_RS_antenna_ports,type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present); LOG_D(PHY, "NR Codebook Config: codebookType: type1, antenna ports: %d \n",CSI_RS_antenna_ports);
break; break;
} }
} }
if(csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode==1){ // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16)
if (CSI_RS_antenna_ports < 16) { if (CSI_RS_antenna_ports < 16) {
//Generate DFT vertical beams //Generate DFT vertical beams
//ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214)
@@ -310,7 +304,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]);
} }
} }
@@ -365,7 +358,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]);
} }
for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) {
@@ -378,7 +370,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]);
} }
} }
@@ -439,7 +430,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]);
} }
for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) {
@@ -452,7 +442,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]);
} }
} }
@@ -519,7 +508,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]);
} }
@@ -533,7 +521,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15
else else
((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15
LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n",pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]);
} }
} }
@@ -544,12 +531,6 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB,
} }
} }
} }
} else {//codebookMode 2
AssertFatal(1==0, "CodeBook Type 1, CodebookMode %ld is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->codebookMode);
}
} else {
AssertFatal(1==0, "subType_PR_typeI %d is not supported\n",csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present);
}
} }
return 0; return 0;
} }
+9
View File
@@ -269,6 +269,15 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB
fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts (logical antenna ports) fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts (logical antenna ports)
//RRC Parameters: depends on the physical structure of the gNB Uniform planner array
if (fp->nb_antennas_tx == 4)
fp->antennas_tx_n1_n2 = 1;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction;
else if (fp->nb_antennas_tx == 8)
fp->antennas_tx_n1_n2 = 3;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction;
else if (fp->nb_antennas_tx == 12)
fp->antennas_tx_n1_n2 = 5;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction;
else//We currently support codebook 1 for nrOfAntennaPorts < 16
fp->antennas_tx_n1_n2 = 0;//NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_NOTHING;
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe; fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
+1 -1
View File
@@ -402,7 +402,7 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
void init_N_TA_offset(PHY_VARS_NR_UE *ue); void init_N_TA_offset(PHY_VARS_NR_UE *ue);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag);
int init_codebook_gNB(PHY_VARS_gNB *gNB, gNB_MAC_INST *mac); int init_codebook_gNB(PHY_VARS_gNB *gNB);
void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request(NR_PHY_Config_t *gNB);
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst); void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst);
void phy_free_nr_gNB(PHY_VARS_gNB *gNB); void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
+5 -1
View File
@@ -318,8 +318,12 @@ struct NR_DL_FRAME_PARMS {
uint32_t samples_per_frame_wCP; uint32_t samples_per_frame_wCP;
/// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc /// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc
uint8_t numerology_index; uint8_t numerology_index;
/// Number of Physical transmit antennas in node /// Number of Physical transmit antennas in node (corresponds to nrOfAntennaPorts)
uint8_t nb_antennas_tx; uint8_t nb_antennas_tx;
/// UPA Panel Antenna configuration: two_one, two_two, four_one, three_two, six_one, etc
uint8_t antennas_tx_n1_n2;
/// UPA Panel Antenna Type: non, Single panel, or multiple
uint8_t antennas_tx_panel_type;
/// Number of Receive antennas in node /// Number of Receive antennas in node
uint8_t nb_antennas_rx; uint8_t nb_antennas_rx;
/// Number of common transmit antenna ports in eNodeB (1 or 2) /// Number of common transmit antenna ports in eNodeB (1 or 2)
+1 -1
View File
@@ -794,7 +794,7 @@ int main(int argc, char **argv)
// rrc_mac_config_req_gNB // rrc_mac_config_req_gNB
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
phy_init_nr_gNB(gNB,0,1); phy_init_nr_gNB(gNB,0,1);
init_codebook_gNB(gNB,gNB_mac); init_codebook_gNB(gNB);
N_RB_DL = gNB->frame_parms.N_RB_DL; N_RB_DL = gNB->frame_parms.N_RB_DL;
NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info;
UE_info->num_UEs=1; UE_info->num_UEs=1;