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

Fix calculation of pucch interference power.

(cherry picked from commit 0622f7d40523e39334708ce4b9b0ee68e8fb2bf1)
parent ca836b6d
...@@ -707,6 +707,140 @@ int16_t pucchfmt3_Decode( int16_t b[48], ...@@ -707,6 +707,140 @@ int16_t pucchfmt3_Decode( int16_t b[48],
} }
} }
uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
int frame,
uint8_t subframe,
uint8_t shortened_format
)
//-----------------------------------------------------------------------------
{
LTE_eNB_COMMON *common_vars = &eNB->common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
uint32_t u,v,n,aa;
uint32_t z[12*14];
int16_t *zptr;
int16_t rxcomp[NB_ANTENNAS_RX][2*12*14];
uint8_t ns,N_UL_symb,nsymb;
uint8_t c = (frame_parms->Ncp==0) ? 3 : 2;
uint16_t i,j,re_offset;
uint8_t m,l;
uint8_t n_cs,alpha_ind;
int16_t tmp_re,tmp_im,W_re=0,W_im=0;
int16_t W4_nouse[4]={1,1,-1,-1};
int32_t interference_power;
int16_t *rxptr;
uint32_t symbol_offset;
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
uint8_t Ncs1_div_deltaPUCCH_Shift = frame_parms->pucch_config_common.nCS_AN;
uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
int calc_cnt;
if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) {
LOG_E(PHY,"[eNB] rx_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift);
return(-1);
}
if (Ncs1_div_deltaPUCCH_Shift > 7) {
LOG_E(PHY,"[eNB] rx_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift);
return(-1);
}
zptr = (int16_t *)z;
N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6;
interference_power=0;
calc_cnt=0;
// loop over 2 slots
for (n_cs=0; n_cs<12; n_cs++) {
for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) {
//loop over symbols in slot
for (l=0; l<N_UL_symb; l++) {
if(((l>1)&&(l<N_UL_symb-2)) || ((ns==(1+(subframe<<1))) && (shortened_format==1)) ){
continue;
}
if (l<2) { // data
W_re=W4_nouse[l];
W_im=0;
} else if ((l>=N_UL_symb-2)) { // data
W_re=W4_nouse[l-N_UL_symb+4];
W_im=0;
}
alpha_ind=0;
// compute output sequence
for (n=0; n<12; n++) {
// this is r_uv^alpha(n)
tmp_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15);
tmp_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15);
// this is S(ns)*w_noc(m)*r_uv^alpha(n)
zptr[n<<1] = (tmp_re*W_re - tmp_im*W_im)>>15;
zptr[1+(n<<1)] = -(tmp_re*W_im + tmp_im*W_re)>>15;
alpha_ind = (alpha_ind + n_cs)%12;
} // n
zptr+=24;
} // l
} // ns
m = 0;
nsymb = N_UL_symb<<1;
zptr = (int16_t*)z;
// Do detection
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
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)) ){
continue;
}
if ((l<(nsymb>>1)) && ((m&1) == 0))
re_offset = (m*6) + frame_parms->first_carrier_offset;
else if ((l<(nsymb>>1)) && ((m&1) == 1))
re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12;
else if ((m&1) == 0)
re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12;
else
re_offset = ((m-1)*6) + frame_parms->first_carrier_offset;
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size);
symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*l;
rxptr = (int16_t *)&common_vars->rxdataF[aa][symbol_offset];
for (i=0; i<12; i++,j+=2,re_offset++) {
if (re_offset==frame_parms->ofdm_symbol_size)
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][1+j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[1+j])>>15) + ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[j])>>15);
interference_power+= ((int32_t)rxcomp[aa][j]*(int32_t)rxcomp[aa][j]+(int32_t)rxcomp[aa][1+j]*(int32_t)rxcomp[aa][1+j]);
calc_cnt++;
} //re
} // symbol
} // antenna
}
calc_cnt/=12;
//printf("pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_subband_power_tot_dB[0]);
eNB->measurements.n0_pucch_dB = dB_fixed_x10(interference_power/calc_cnt)/10;
return 0;
}
/* PUCCH format3 << */ /* PUCCH format3 << */
uint32_t rx_pucch(PHY_VARS_eNB *eNB, uint32_t rx_pucch(PHY_VARS_eNB *eNB,
...@@ -728,7 +862,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, ...@@ -728,7 +862,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
static int first_call = 1; static int first_call = 1;
LTE_eNB_COMMON *common_vars = &eNB->common_vars; LTE_eNB_COMMON *common_vars = &eNB->common_vars;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
int8_t sigma2_dB = max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]); int8_t sigma2_dB = eNB->measurements.n0_pucch_dB;
uint32_t u,v,n,aa; uint32_t u,v,n,aa;
uint32_t z[12*14]; uint32_t z[12*14];
......
...@@ -542,7 +542,11 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -542,7 +542,11 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint16_t frame, uint16_t frame,
uint8_t Ns); uint8_t Ns);
uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB,
int frame,
uint8_t subframe,
uint8_t shortened_format
);
uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
PUCCH_FMT_t fmt, PUCCH_FMT_t fmt,
......
...@@ -992,6 +992,8 @@ typedef struct { ...@@ -992,6 +992,8 @@ typedef struct {
int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100]; int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
/// PRACH background noise level /// PRACH background noise level
int prach_I0; int prach_I0;
/// PUCCH background noise level
int n0_pucch_dB;
} PHY_MEASUREMENTS_eNB; } PHY_MEASUREMENTS_eNB;
......
...@@ -635,6 +635,8 @@ uci_procedures(PHY_VARS_eNB *eNB, ...@@ -635,6 +635,8 @@ uci_procedures(PHY_VARS_eNB *eNB,
LTE_eNB_UCI *uci = NULL; LTE_eNB_UCI *uci = NULL;
LTE_DL_FRAME_PARMS *fp = &(eNB->frame_parms); LTE_DL_FRAME_PARMS *fp = &(eNB->frame_parms);
calc_pucch_1x_interference(eNB, frame, subframe, 0);
for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) { for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) {
uci = &(eNB->uci_vars[i]); uci = &(eNB->uci_vars[i]);
......
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