Commit 5d8d478f authored by cig's avatar cig

NR gNB UL power measurements

- new function has been introduced for the computation of UL SNR
- minor bugfix to noise power computation
- FAPI data type for referenceSignalPower has been updated to reflect the
  range of values for the SSB power
parent 76ef9b42
...@@ -373,7 +373,7 @@ typedef struct ...@@ -373,7 +373,7 @@ typedef struct
//table 3-23 //table 3-23
typedef struct typedef struct
{ {
nfapi_uint32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) nfapi_int32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
nfapi_uint8_tlv_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload nfapi_uint8_tlv_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
nfapi_uint8_tlv_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3 nfapi_uint8_tlv_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
*/ */
/*! \file PHY/NR_ESTIMATION/nr_measurements_gNB.c /*! \file PHY/NR_ESTIMATION/nr_measurements_gNB.c
* \brief TA estimation for TA updates * \brief gNB measurement routines
* \author Ahmed Hussein * \author Ahmed Hussein, G. Casati, K. Saaifan
* \date 2019 * \date 2019
* \version 0.1 * \version 0.1
* \company Fraunhofer IIS * \company Fraunhofer IIS
* \email: ahmed.hussein@iis.fraunhofer.de * \email: ahmed.hussein@iis.fraunhofer.de, guido.casati@iis.fraunhofer.de, khodr.saaifan@iis.fraunhofer.de
* \note * \note
* \warning * \warning
*/ */
...@@ -75,14 +75,18 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) { ...@@ -75,14 +75,18 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) {
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
NR_gNB_COMMON *common_vars = &gNB->common_vars; NR_gNB_COMMON *common_vars = &gNB->common_vars;
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
openair0_config_t *cfg = &gNB->RU_list[0]->openair0_cfg;
double rx_gain = cfg->rx_gain[0];
double rx_gain_offset = cfg->rx_gain_offset[0];
uint32_t *rb_mask = gNB->rb_mask_ul; uint32_t *rb_mask = gNB->rb_mask_ul;
int symbol = gNB->ulmask_symb; int symbol = gNB->ulmask_symb;
int rb, offset, nb_rb; int rb, offset, nb_rb;
uint32_t n0_power_tot, n0_subband_power_temp=0; uint32_t n0_subband_power_temp = 0;
int32_t *ul_ch; int32_t *ul_ch;
if (symbol>-1) { if (symbol>-1) {
n0_power_tot = 0; measurements->n0_power_tot = 0;
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
nb_rb = 0; nb_rb = 0;
for (rb=0; rb<frame_parms->N_RB_UL; rb++) { for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
...@@ -95,11 +99,80 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) { ...@@ -95,11 +99,80 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) {
n0_subband_power_temp += signal_energy_nodc(ul_ch,12); n0_subband_power_temp += signal_energy_nodc(ul_ch,12);
} }
} }
measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb;
measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]); if (nb_rb != 0) {
n0_power_tot += measurements->n0_power[aarx]; measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb;
measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]);
measurements->n0_power_tot += measurements->n0_power[aarx];
}
} }
measurements->n0_power_tot_dB = dB_fixed(n0_power_tot);
measurements->n0_power_tot_dB = dB_fixed(measurements->n0_power_tot);
measurements->n0_power_tot_dBm = measurements->n0_power_tot_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size);
LOG_D(PHY, "In %s: tot n0 power %d dBm for %d RBs (tot N0 power = %d)\n", __FUNCTION__, measurements->n0_power_tot_dBm, nb_rb, measurements->n0_power_tot);
} }
} }
// Scope: This function computes the UL SNR from the UL channel estimates
//
// Todo:
// - averaging IIR filter for RX power and noise
void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol){
int rx_power_tot[NUMBER_OF_NR_ULSCH_MAX];
int rx_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_RX];
int wideband_cqi_avg[NUMBER_OF_NR_ULSCH_MAX];
unsigned short rx_power_avg_dB[NUMBER_OF_NR_ULSCH_MAX];
unsigned short rx_power_dB[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_RX];
unsigned short rx_power_tot_dB[NUMBER_OF_NR_ULSCH_MAX];
openair0_config_t * cfg = &gNB->RU_list[0]->openair0_cfg;
double rx_gain = cfg->rx_gain[0];
double rx_gain_offset = cfg->rx_gain_offset[0];
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int ch_offset = fp->ofdm_symbol_size * symbol;
int N_RB_UL = gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu.rb_size;
rx_power_tot[ulsch_id] = 0;
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){
rx_power[ulsch_id][aarx] = 0;
for (int aatx = 0; aatx < fp->nb_antennas_tx; aatx++){
meas->rx_spatial_power[ulsch_id][aatx][aarx] = (signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB));
if (meas->rx_spatial_power[ulsch_id][aatx][aarx] < 0) {
meas->rx_spatial_power[ulsch_id][aatx][aarx] = 0;
}
meas->rx_spatial_power_dB[ulsch_id][aatx][aarx] = (unsigned short) dB_fixed(meas->rx_spatial_power[ulsch_id][aatx][aarx]);
rx_power[ulsch_id][aarx] += meas->rx_spatial_power[ulsch_id][aatx][aarx];
}
rx_power_dB[ulsch_id][aarx] = (unsigned short) dB_fixed(rx_power[ulsch_id][aarx]);
rx_power_tot[ulsch_id] += rx_power[ulsch_id][aarx];
}
rx_power_tot_dB[ulsch_id] = (unsigned short) dB_fixed(rx_power_tot[ulsch_id]);
rx_power_avg_dB[ulsch_id] = rx_power_tot_dB[ulsch_id];
meas->wideband_cqi_tot[ulsch_id] = dB_fixed2(rx_power_tot[ulsch_id], meas->n0_power_tot);
meas->rx_rssi_dBm[ulsch_id] = rx_power_avg_dB[ulsch_id] + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size);
LOG_D(PHY, "[ULSCH %d] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d\n",
ulsch_id,
meas->rx_rssi_dBm[ulsch_id],
rx_power_avg_dB[ulsch_id],
N_RB_UL,
meas->wideband_cqi_tot[ulsch_id],
meas->n0_power_tot);
}
\ No newline at end of file
...@@ -1136,6 +1136,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1136,6 +1136,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
bwp_start_subcarrier, bwp_start_subcarrier,
rel15_ul); rel15_ul);
nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol);
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size], gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size],
rel15_ul->rb_size*12); rel15_ul->rb_size*12);
......
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