Commit 6da42658 authored by Cedric Roux's avatar Cedric Roux

bugfix: fix timing advance

- remove global variables in the function lte_est_timing_advance_pusch
- do the smoothing logic that was in lte_est_timing_advance_pusch
  in rx_sdu (is it necessary? is it correct?)
- put back the value 100 in prach_procedures for the test on prach energy
- change the value of timing_advance_update

  it was:

     timing_advance_update                  = sync_pos - eNB->frame_parms.nb_prefix_samples/4; //to check

  it is now:

     timing_advance_update                  = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check

  this should be checked somehow. The computation looked suspicious. Maybe
  the new one is wrong.
parent 2e5f0a07
......@@ -227,11 +227,8 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
{
static int first_run=1;
static int max_pos_fil2=0;
int temp, i, aa, max_pos=0, max_val=0;
short Re,Im,coef=24576;
short ncoef = 32768 - coef;
short Re,Im;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
......@@ -260,16 +257,9 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
if (max_pos>frame_parms->ofdm_symbol_size/2)
max_pos = max_pos-frame_parms->ofdm_symbol_size;
// filter position to reduce jitter
if (first_run == 1) {
first_run=0;
max_pos_fil2 = max_pos;
} else
max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15;
//#ifdef DEBUG_PHY
LOG_D(PHY,"frame %d: max_pos = %d, max_pos_fil = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,max_pos_fil2,sync_pos);
LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos);
//#endif //DEBUG_PHY
return(max_pos_fil2-sync_pos);
return max_pos - sync_pos;
}
......@@ -663,7 +663,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
{
if ((eNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > eNB->measurements.prach_I0+200)) {
(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,
......@@ -1524,7 +1524,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe)
pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->b;
// estimate timing advance for MAC
sync_pos = lte_est_timing_advance_pusch(eNB,UE_id);
timing_advance_update = sync_pos - eNB->frame_parms.nb_prefix_samples/4; //to check
timing_advance_update = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check
// if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
// if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);}
......
......@@ -113,9 +113,13 @@ void rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1<<harq_pid));
/* don't take into account TA if timer is running */
if (UE_list->UE_sched_ctrl[UE_id].ta_timer == 0)
UE_list->UE_sched_ctrl[UE_id].ta_update = timing_advance;
/* Update with smoothing: 3/4 of old value and 1/4 of new.
* This is the logic that was done in the function
* lte_est_timing_advance_pusch, maybe it's not necessary?
* maybe it's even not correct at all?
*/
UE_list->UE_sched_ctrl[UE_id].ta_update =
(UE_list->UE_sched_ctrl[UE_id].ta_update * 3 + timing_advance)/4;
UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi;
UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors = 0;
first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
......
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