Commit d1d99d41 authored by Marwan Hammouda's avatar Marwan Hammouda

ta_frame and ta_slot calculation corrected

parent be48ec8a
......@@ -881,9 +881,6 @@ void *UE_thread(void *arg)
UL_TO_Tx_ofs += 2*rx_offset_slot; //to adapt the UE's transmission time in order to get aligned at gNB
}
LOG_I(PHY, "diff: %d, PI_Out: %d, offset_slot: %d, offset_UL: %d, TA: %d, TO_PScal: %f, TO_IScal: %f\n",
UE->rx_offset, UE->rx_offset_TO, rx_offset_slot, UL_TO_Tx_ofs, UE->timing_advance, TO_PScaling, TO_IScaling);
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) + rx_offset_slot;
writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX) % nb_slot_frame, &UE->frame_parms);
/*
......@@ -917,15 +914,17 @@ void *UE_thread(void *arg)
} else
LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
}
printf("**** Option: 4 Activated \n");
//timing_advance += 1*rx_offset_slot;
//timing_advance += 2*rx_offset_slot;
//UE->timing_advance += 1*rx_offset_slot;
UE->timing_advance += 2*rx_offset_slot;
extern uint64_t RFsim_PropDelay;
LOG_D(PHY, "RFsim_PropDelay: %lu, TA: %d, diff: %d, PI_Out: %d, offset_slot: %d, offset_UL: %d\n",
RFsim_PropDelay, timing_advance, UE->rx_offset, UE->rx_offset_TO, rx_offset_slot, UL_TO_Tx_ofs);
// use previous timing_advance value to compute writeTimestamp
writeTimestamp = timestamp +
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
......
......@@ -120,7 +120,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
ue->rx_offset_comp = 0;
}
LOG_I(PHY, "Frame: %u, diff: %d, rx_offset_TO: %d, PScaling: %f, IScaling: %f, TA: %d, TO_I_Ctrl: %ld \n", frame, ue->rx_offset, ue->rx_offset_TO, TO_PScaling, TO_IScaling, ue->timing_advance, TO_I_Ctrl);
LOG_D(PHY, "Frame: %u, diff: %d, rx_offset_TO: %d, PScaling: %f, IScaling: %f, TA: %d, TO_I_Ctrl: %ld \n", frame, ue->rx_offset, ue->rx_offset_TO, TO_PScaling, TO_IScaling, ue->timing_advance, TO_I_Ctrl);
if(abs(diff)<5)
count_max_pos_ok ++;
......
......@@ -375,9 +375,10 @@ void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command
const double t_subframe = 1.0; // subframe duration of 1 msec
const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe);
ue->ta_slot = (ta_command_pdu->ta_slot + ul_tx_timing_adjustment + NTN_UE_slot_Rx_to_Tx) % slots_per_frame;
if (ta_command_pdu->ta_slot + ul_tx_timing_adjustment > slots_per_frame)
ue->ta_frame = (ta_command_pdu->ta_frame + 1) % 1024;
int ta_slot_temp = ta_command_pdu->ta_slot + ul_tx_timing_adjustment + NTN_UE_slot_Rx_to_Tx;
ue->ta_slot = ta_slot_temp % slots_per_frame;
if (ta_slot_temp > slots_per_frame)
ue->ta_frame = (ta_command_pdu->ta_frame + ta_slot_temp/slots_per_frame) % 1024;
else
ue->ta_frame = ta_command_pdu->ta_frame;
......
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