Commit 4624f3ff authored by masayuki.harada's avatar masayuki.harada Committed by Haruki NAOI

Fix PUCCH noise estimation.

(cherry picked from commit 51634853671e07ef3013bc44ec79fc38c0646147)
parent 3520e531
...@@ -728,7 +728,8 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, ...@@ -728,7 +728,8 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
uint8_t n_cs,alpha_ind; uint8_t n_cs,alpha_ind;
int16_t tmp_re,tmp_im,W_re=0,W_im=0; int16_t tmp_re,tmp_im,W_re=0,W_im=0;
int16_t W4_nouse[4]={32767,32767,-32768,-32768}; int16_t W4_nouse[4]={32767,32767,-32768,-32768};
int32_t interference_power; int32_t n0_IQ[2];
double interference_power;
int16_t *rxptr; int16_t *rxptr;
uint32_t symbol_offset; uint32_t symbol_offset;
...@@ -754,7 +755,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, ...@@ -754,7 +755,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
zptr = (int16_t *)z; zptr = (int16_t *)z;
N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6; N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6;
interference_power=0; interference_power=0.0;
calc_cnt=0; calc_cnt=0;
// loop over 2 slots // loop over 2 slots
for (n_cs=0; n_cs<12; n_cs++) { for (n_cs=0; n_cs<12; n_cs++) {
...@@ -763,6 +764,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, ...@@ -763,6 +764,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
//loop over symbols in slot //loop over symbols in slot
for (l=0; l<N_UL_symb; l++) { for (l=0; l<N_UL_symb; l++) {
if(((l>1)&&(l<N_UL_symb-2)) || ((ns==(1+(subframe<<1))) && (shortened_format==1)) ){ if(((l>1)&&(l<N_UL_symb-2)) || ((ns==(1+(subframe<<1))) && (shortened_format==1)) ){
zptr+=24;
continue; continue;
} }
...@@ -802,8 +804,11 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, ...@@ -802,8 +804,11 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
// Do detection // Do detection
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
n0_IQ[0]=0;
n0_IQ[1]=0;
for (j=0,l=0; l<nsymb; l++) { for (j=0,l=0; l<nsymb; l++) {
if((((l%N_UL_symb)>1)&&((l%N_UL_symb)<N_UL_symb-2)) || ((nsymb>=N_UL_symb) && (shortened_format==1)) ){ if((((l%N_UL_symb)>1)&&((l%N_UL_symb)<N_UL_symb-2)) || ((nsymb>=N_UL_symb) && (shortened_format==1)) ){
j+=24;
continue; continue;
} }
if ((l<(nsymb>>1)) && ((m&1) == 0)) if ((l<(nsymb>>1)) && ((m&1) == 0))
...@@ -826,16 +831,18 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, ...@@ -826,16 +831,18 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
re_offset = 0; re_offset = 0;
rxcomp[aa][j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[j])>>15) - ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[1+j])>>15); rxcomp[aa][j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[j])>>15) - ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[1+j])>>15);
rxcomp[aa][1+j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[1+j])>>15) + ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[j])>>15); rxcomp[aa][1+j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[1+j])>>15) + ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[j])>>15);+ n0_IQ[0]+=rxcomp[aa][j];
interference_power+= ((int32_t)rxcomp[aa][j]*(int32_t)rxcomp[aa][j]+(int32_t)rxcomp[aa][1+j]*(int32_t)rxcomp[aa][1+j]); n0_IQ[0]+=rxcomp[aa][j];
n0_IQ[1]+=rxcomp[aa][1+j];
calc_cnt++; calc_cnt++;
} //re } //re
} // symbol } // symbol
interference_power+= (int32_t)(n0_IQ[0]*n0_IQ[0]+n0_IQ[1]*n0_IQ[1]);
} // antenna } // antenna
} }
calc_cnt; interference_power /= calc_cnt;
eNB->measurements.n0_pucch_dB = dB_fixed_x10(interference_power/calc_cnt)/10; eNB->measurements.n0_pucch_dB = dB_fixed_x10((int)(interference_power/calc_cnt))/10;
//printf("pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_pucch_dB); LOG_D(PHY,"estimate pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_pucch_dB);
return 0; return 0;
} }
......
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