Commit 7d46e433 authored by Francesco Mani's avatar Francesco Mani

using the right structures for n0 measurements

parent e7ca1619
......@@ -95,11 +95,11 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) {
n0_subband_power_temp += signal_energy_nodc(ul_ch,12);
}
}
measurements->n0_subband_power[aarx] = n0_subband_power_temp/nb_rb;
measurements->n0_subband_power_dB[aarx] = dB_fixed(measurements->n0_subband_power[aarx]);
measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb;
measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]);
n0_power_tot += measurements->n0_subband_power[aarx];
}
//measurements->n0_subband_power_tot_dB = dB_fixed(n0_power_tot);
measurements->n0_power_tot_dB = dB_fixed(n0_power_tot);
}
}
......@@ -383,30 +383,30 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
if (pucch_pdu->bit_len_harq==0) {
uci_pdu->harq = NULL;
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
if (xrtmag_dB>(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres)) {
if (xrtmag_dB>(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres)) {
uci_pdu->sr->sr_indication = 1;
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres);
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
} else {
uci_pdu->sr->sr_indication = 0;
uci_pdu->sr->sr_confidence_level = (gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres)-xrtmag_dB;
uci_pdu->sr->sr_confidence_level = (gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres)-xrtmag_dB;
}
}
else if (pucch_pdu->bit_len_harq==1) {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
uci_pdu->harq->num_harq = 1;
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres);
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres);
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
}
}
else {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
uci_pdu->harq->num_harq = 2;
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres);
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
......@@ -415,7 +415,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_subband_power_tot_dB[pucch_pdu->prb_start]+gNB->pucch0_thres);
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
}
}
}
......
......@@ -588,10 +588,10 @@ typedef struct {
unsigned short n0_power_tot_dB;
//! estimated avg noise power (dB)
short n0_power_tot_dBm;
//! estimated avg noise power per RX ant (lin)
unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB];
//! estimated avg noise power per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB];
//! estimated avg noise power per RB per RX ant (lin)
unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275];
//! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275];
//! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[275];
//! estimated avg noise power per RB (dBm)
......
......@@ -313,7 +313,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
LOG_I(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
// estimate UL_CQI for MAC (from antenna port 0 only)
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - (10*gNB->measurements.n0_subband_power_dB[0]);
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - (10*gNB->measurements.n0_power_dB[0]);
LOG_I(PHY, "Estimated SNR for PUSCH is = %d dB\n", SNRtimes10/10);
......
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