Commit 484ab945 authored by Marwan Hammouda's avatar Marwan Hammouda

[develop] Added: common frequency offset compensation at gNB

    - post-compensation for UL and pre-compensation for DL
    - offset to be compensated is given through the  command-line option 'FDC'
    - compensation is default activated and it can be deactivated via the command-line option 'FC'
parent 99463054
......@@ -121,6 +121,7 @@
#define CONFIG_HLP_FDopplerRate "Set the Doppler rate in Hz/s\n"
#define CONFIG_HLP_FDopplerVar "Set Doppler variance, [fdoppler +/- fdopplerVar]\n"
#define CONFIG_HLP_TDriftComp "Execute continous timing drift compensation\n"
#define CONFIG_HLP_FDopplerPrePost "Set the pre/post compensation value for the Doppler shift at the gNB side\n"
/*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
......@@ -176,5 +177,6 @@ extern int RFsim_DriftPerFrame; //the timing offset/drift per frame in the RF si
extern int32_t fdopplerRate; //Doppler rate in Hz/s
extern uint32_t fdopplerVar; //Doppler variance, [fdoppler +/- fdopplerVar]
extern int tdriftComp; // flag to activate/deactivate continous timing drift compensation
extern int32_t fdopplerPrePost; //pre/post compensation of the Doppler shift at the gNB side
#endif
......@@ -577,6 +577,7 @@ int RFsim_DriftPerFrame = 0;
int32_t fdopplerRate;
uint32_t fdopplerVar;
int tdriftComp = 1;
int32_t fdopplerPrePost = 0; //pre/post compensation of the Doppler shift at the gNB side
int main( int argc, char **argv ) {
int ru_id, CC_id = 0;
......
......@@ -39,6 +39,8 @@
{"TD" , CONFIG_HLP_TDRIFT, 0, .iptr=&RFsim_DriftPerFrame, .defintval=0, TYPE_INT, 0}, \
{"DSR" , CONFIG_HLP_FDopplerRate, 0, .iptr=&fdopplerRate, .defintval=0, TYPE_INT32, 0}, \
{"DSV" , CONFIG_HLP_FDopplerVar, 0, .uptr=&fdopplerVar, .defintval=0, TYPE_UINT32, 0}, \
{"FDC" , CONFIG_HLP_FDopplerPrePost, 0, .iptr=&fdopplerPrePost, .defintval=0, TYPE_INT32, 0}, \
{"FC" , CONFIG_HLP_FDopplerComp, 0, .iptr=&fdopplerComp, .defintval=0, TYPE_INT32, 0} \
}
// clang-format on
......
......@@ -433,6 +433,7 @@ int32_t fdopplerRate; //Doppler rate in Hz/s
uint32_t fdopplerVar; //Doppler variance, [fdoppler +/- fdopplerVar]
int fdopplerComp = 1; // flag to activate continous frequency offset compensation (=0 deacticated, =1 activated (default case))
int tdriftComp = 1;
int32_t fdopplerPrePost = 0; //pre/post compensation of the Doppler shift at the gNB side. Dummy definition at UE to avoid linking error.
int main( int argc, char **argv ) {
......
......@@ -220,7 +220,8 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
return 0;
}
extern int fdopplerPrePost; //Doppler frequency shift
extern int fdopplerComp;
int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdata,
int32_t *rxdataF,
......@@ -242,6 +243,14 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
rxdata_offset += (idx_symb%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
rxdata_offset += frame_parms->ofdm_symbol_size * symbol;
if ((fdopplerComp == 1) && (fdopplerPrePost != 0)){
unsigned int curr_nb_prefix = (abs_symbol%(0x7<<frame_parms->numerology_index)) ? nb_prefix_samples : nb_prefix_samples0;
unsigned int nsamps = frame_parms->ofdm_symbol_size + curr_nb_prefix;
int16_t *rxdataDopp_ptr = (int16_t *)&rxdata[rxdata_offset - sample_offset - curr_nb_prefix];
uint32_t IdxDopp_Rx = rxdata_offset - curr_nb_prefix; //sample index in the calculation of the Doppler shift compensation for a slot
nr_apply_Doppler( rxdataDopp_ptr, nsamps, fdopplerPrePost, &IdxDopp_Rx, frame_parms);
}
// use OFDM symbol from within 1/8th of the CP to avoid ISI
rxdata_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
......
......@@ -50,7 +50,8 @@
extern int oai_exit;
extern int fdopplerPrePost; //Doppler frequency shift
extern int fdopplerComp;
// OFDM modulation core routine, generates a first_symbol to first_symbol+num_symbols on a particular slot and TX antenna port
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
......@@ -58,6 +59,7 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
unsigned int slot_offset,slot_offsetF;
int slot = tti_tx;
uint32_t IdxDopp_Tx; //sample index in the calculation of the Doppler shift compensation for a slot on gNB side
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0) , 1 );
......@@ -75,6 +77,7 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
LOG_D(PHY,"SFN/SF:RU:TX:%d/%d aa %d Generating slot %d (first_symbol %d num_symbols %d) slot_offset %d, slot_offsetF %d\n",ru->proc.frame_tx, ru->proc.tti_tx,aa,slot,first_symbol,num_symbols,slot_offset,slot_offsetF);
IdxDopp_Tx = slot_offset;
if (fp->Ncp == 1) {
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
(int*)&ru->common.txdata[aa][slot_offset],
......@@ -99,6 +102,11 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
num_symbols-1,
fp->nb_prefix_samples,
CYCLIC_PREFIX);
if ((fdopplerComp == 1) && (fdopplerPrePost != 0)){
nr_apply_Doppler( &ru->common.txdata[aa][slot_offset], (num_symbols-1)*(fp->nb_prefix_samples+fp->ofdm_symbol_size)
+fp->ofdm_symbol_size+fp->nb_prefix_samples0, fdopplerPrePost, &(IdxDopp_Tx), fp); //Doppler pre-compensation at gNB Tx
}
}
else { // all symbols in slot have shorter prefix
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
......@@ -107,6 +115,10 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
num_symbols,
fp->nb_prefix_samples,
CYCLIC_PREFIX);
if ((fdopplerComp == 1) && (fdopplerPrePost != 0)){
nr_apply_Doppler( &ru->common.txdata[aa][slot_offset], num_symbols*(fp->nb_prefix_samples+fp->ofdm_symbol_size),
fdopplerPrePost, &(IdxDopp_Tx), fp); //Doppler pre-compensation at gNB Tx
}
}
} // numerology_index!=0
else { //numerology_index == 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