diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index 2a50488ad3f14aa3a2c075853156d0e5d8d45ed5..7f01ae32ba598b5408c18aaaab8e357480e924d8 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -1648,13 +1648,13 @@ void rx_prach0(PHY_VARS_eNB *eNB, idft1024(prachF,prach_ifft_tmp,1); // compute energy and accumulate over receive antennas and repetitions for BR for (i=0;i<2048;i++) - prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>15; + prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10; } else { idft256(prachF,prach_ifft_tmp,1); log2_ifft_size = 8; // compute energy and accumulate over receive antennas and repetitions for BR for (i=0;i<256;i++) - prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>15; + prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10; } #ifdef PRACH_DEBUG diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 12ddcdeb70471b2259ddfdefcfb4dae1610a93c5..bdfc3731445059ba57d0bbafa8a68ac457a50c2a 100644 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -919,7 +919,8 @@ typedef struct { int subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100]; /// Total Subband CQI and RB int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100]; - + /// PRACH background noise level + int prach_I0; } PHY_MEASUREMENTS_eNB; @@ -1035,8 +1036,8 @@ typedef struct PHY_VARS_eNB_s { /// if ==0 enables phy only test mode int mac_enabled; - - + /// counter to average prach energh over first 100 prach opportunities + int prach_energy_counter; // PDSCH Varaibles PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_UE_MAX]; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 5862f27b714c76b6f88700a145d83492b7f12b9a..05a6dca09b9cb572acc4a63b26abb27882c786f5 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -633,7 +633,8 @@ void prach_procedures(PHY_VARS_eNB *eNB, eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level])) { */ if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){ - if (max_preamble_energy[0] > 350) { + if ((eNB->prach_energy_counter == 100) && + (max_preamble_energy[0] > eNB->measurements.prach_I0 + 100)) { eNB->UL_INFO.rach_ind_br.number_of_preambles++; eNB->preamble_list_br[ind].preamble_rel8.timing_advance = max_preamble_delay[ind];// @@ -661,7 +662,8 @@ void prach_procedures(PHY_VARS_eNB *eNB, #endif { - if (max_preamble_energy[0] > 350) { + if ((eNB->prach_energy_counter == 100) && + (max_preamble_energy[0] > eNB->measurements.prach_I0+100)) { LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n", eNB->Mod_id, @@ -694,22 +696,13 @@ void prach_procedures(PHY_VARS_eNB *eNB, eNB->preamble_list[0].preamble_rel13.rach_resource_type); pthread_mutex_unlock(&eNB->UL_INFO_mutex); - } // max_preamble_energy > 350 + } // max_preamble_energy > prach_I0 + 100 + else { + eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); + if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10); + if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++; + } } // else br_flag - /* - mac_xface->initiate_ra_proc(eNB->Mod_id, - eNB->CC_id, - frame, - preamble_max, - preamble_delay_list[preamble_max]*update_TA/update_TA2, - 0,subframe,0);*/ - - - /* } else { - MSC_LOG_EVENT(MSC_PHY_ENB, "0 RA Failed add user, too many"); - LOG_I(PHY,"[eNB %d][RAPROC] frame %d, subframe %d: Unable to add user, max user count reached\n", - eNB->Mod_id,frame, subframe); - }*/ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0); } @@ -1952,16 +1945,27 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const // Call SRS first since all others depend on presence of SRS or lack thereof srs_procedures(eNB,proc); - lte_eNB_I0_measurements(eNB, - subframe, - 0, - eNB->first_run_I0_measurements); eNB->first_run_I0_measurements = 0; uci_procedures(eNB,proc); pusch_procedures(eNB,proc); + lte_eNB_I0_measurements(eNB, + subframe, + 0, + eNB->first_run_I0_measurements); + + int min_I0=1000,max_I0=0; + if ((frame==0) && (subframe==6)) { + for (int i=0;i<eNB->frame_parms.N_RB_UL;i++) { + if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2; + + if (eNB->measurements.n0_subband_power_tot_dB[i]<min_I0) min_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; + if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; + } + LOG_I(PHY,"max_I0 %d, min_I0 %d\n",max_I0,min_I0); + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 ); diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index c7cc203da6ba20e2316b843e88f3da6e9edc216c..a457480c70ad02f55ad7d62a6ceae282b4fe3caf 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -943,6 +943,7 @@ void init_eNB(int single_thread_flag,int wait_for_sync) { eNB->UL_INFO.harq_ind.harq_pdu_list = eNB->harq_pdu_list; eNB->UL_INFO.cqi_ind.cqi_pdu_list = eNB->cqi_pdu_list; eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = eNB->cqi_raw_pdu_list; + eNB->prach_energy_counter = 0; } }