Commit d6a155a8 authored by rmagueta's avatar rmagueta

SINR in dB

parent 7286552a
......@@ -349,7 +349,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
ue->nr_csi_rs_info->rank_indicator = (uint8_t*)malloc16_clear(sizeof(uint8_t));
ue->nr_csi_rs_info->i1 = (uint8_t*)malloc16_clear(3*sizeof(uint8_t));
ue->nr_csi_rs_info->i2 = (uint8_t*)malloc16_clear(sizeof(uint8_t));
ue->nr_csi_rs_info->precoded_sinr = (uint32_t*)malloc16_clear(sizeof(uint32_t));
ue->nr_csi_rs_info->precoded_sinr_dB = (uint32_t*)malloc16_clear(sizeof(uint32_t));
ue->nr_csi_rs_info->cqi = (uint8_t*)malloc16_clear(sizeof(uint8_t));
ue->nr_csi_rs_info->csi_rs_generated_signal = (int32_t **)malloc16(NR_MAX_NB_PORTS * sizeof(int32_t *) );
for (i=0; i<NR_MAX_NB_PORTS; i++) {
ue->nr_csi_rs_info->csi_rs_generated_signal[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t));
......
......@@ -471,7 +471,7 @@ int nr_csi_rs_pmi_estimation(PHY_VARS_NR_UE *ue,
uint8_t rank_indicator,
uint8_t *i1,
uint8_t *i2,
uint32_t *precoded_sinr) {
uint32_t *precoded_sinr_dB) {
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
memset(i1,0,3*sizeof(uint8_t));
......@@ -498,8 +498,6 @@ int nr_csi_rs_pmi_estimation(PHY_VARS_NR_UE *ue,
int32_t sum2_im[4] = {0};
int32_t tested_precoded_sinr[4] = {0};
uint16_t shift = nr_csi_rs_info->log2_maxh + log2_approx(frame_parms->nb_antennas_rx) + log2_approx(csirs_config_pdu->nr_of_rbs) - 1;
for (int rb = csirs_config_pdu->start_rb; rb < (csirs_config_pdu->start_rb+csirs_config_pdu->nr_of_rbs); rb++) {
if (csirs_config_pdu->freq_density <= 1 && csirs_config_pdu->freq_density != (rb % 2)) {
......@@ -552,10 +550,10 @@ int nr_csi_rs_pmi_estimation(PHY_VARS_NR_UE *ue,
i2[0] = tested_i2;
}
}
*precoded_sinr = tested_precoded_sinr[i2[0]];
*precoded_sinr_dB = dB_fixed(tested_precoded_sinr[i2[0]]);
} else {
i2[0] = tested_precoded_sinr[0]+tested_precoded_sinr[2] > tested_precoded_sinr[1]+tested_precoded_sinr[3] ? 0 : 1;
*precoded_sinr = (tested_precoded_sinr[i2[0]] + tested_precoded_sinr[i2[0]+2])>>1;
*precoded_sinr_dB = dB_fixed((tested_precoded_sinr[i2[0]] + tested_precoded_sinr[i2[0]+2]))>>1;
}
} else {
......@@ -566,6 +564,14 @@ int nr_csi_rs_pmi_estimation(PHY_VARS_NR_UE *ue,
return 0;
}
int nr_csi_rs_cqi_estimation(uint32_t precoded_sinr,
uint8_t *cqi) {
*cqi = 0;
return 0;
}
int nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id) {
return 0;
}
......@@ -632,12 +638,17 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
*ue->nr_csi_rs_info->rank_indicator,
ue->nr_csi_rs_info->i1,
ue->nr_csi_rs_info->i2,
ue->nr_csi_rs_info->precoded_sinr);
ue->nr_csi_rs_info->precoded_sinr_dB);
nr_csi_rs_cqi_estimation(*ue->nr_csi_rs_info->precoded_sinr_dB,
ue->nr_csi_rs_info->cqi);
LOG_I(NR_PHY, "RI = %i, i1 = %i.%i.%i, i2 = %i\n",
LOG_I(NR_PHY, "RI = %i, i1 = %i.%i.%i, i2 = %i. SINR = %i dB, CQI = %i\n",
*ue->nr_csi_rs_info->rank_indicator + 1,
ue->nr_csi_rs_info->i1[0], ue->nr_csi_rs_info->i1[1], ue->nr_csi_rs_info->i1[2],
ue->nr_csi_rs_info->i2[0]);
ue->nr_csi_rs_info->i2[0],
*ue->nr_csi_rs_info->precoded_sinr_dB,
*ue->nr_csi_rs_info->cqi);
return 0;
}
......@@ -272,7 +272,8 @@ typedef struct {
uint8_t *rank_indicator;
uint8_t *i1;
uint8_t *i2;
uint32_t *precoded_sinr;
uint32_t *precoded_sinr_dB;
uint8_t *cqi;
} nr_csi_rs_info_t;
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
......
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