Merge remote-tracking branch 'origin/ntn_leo_time_comp' into integration_2024_w34
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "executables/nr-uesoftmodem.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
//#define DEBUG_PHY
|
||||
@@ -43,12 +43,9 @@ int nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
short coef)
|
||||
{
|
||||
int max_val = 0, max_pos = 0;
|
||||
uint8_t sync_offset = 0;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_IN);
|
||||
|
||||
short ncoef = 32767 - coef;
|
||||
|
||||
// search for maximum position within the cyclic prefix
|
||||
for (int i = -frame_parms->nb_prefix_samples/2; i < frame_parms->nb_prefix_samples/2; i++) {
|
||||
int temp = 0;
|
||||
@@ -67,32 +64,37 @@ int nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
// filter position to reduce jitter
|
||||
ue->max_pos_avg = ((ue->max_pos_avg * coef) >> 15) + (max_pos * ncoef);
|
||||
|
||||
int diff = ue->max_pos_avg >> 15;
|
||||
const int ncoef = 32767 - coef;
|
||||
ue->max_pos_iir = ((ue->max_pos_iir * coef) >> 15) + (max_pos * ncoef);
|
||||
const int diff = (ue->max_pos_iir + 16384) >> 15;
|
||||
|
||||
// FIXME: Do we really need this hysteresis for FR2?
|
||||
int sampleShift = diff;
|
||||
if (frame_parms->freq_range == FR2)
|
||||
sync_offset = 2;
|
||||
else
|
||||
sync_offset = 0;
|
||||
if (abs(diff) <= 2)
|
||||
sampleShift = 0;
|
||||
|
||||
int sampleShift = 0;
|
||||
if (abs(diff) > (NR_SYNCH_HYST + sync_offset))
|
||||
sampleShift = diff;
|
||||
|
||||
const int sample_shift = -(sampleShift / 2);
|
||||
// reset IIR filter for next offset calculation
|
||||
ue->max_pos_avg += sample_shift * 32768;
|
||||
// PI controller
|
||||
const double PID_P = get_nrUE_params()->time_sync_P;
|
||||
const double PID_I = get_nrUE_params()->time_sync_I;
|
||||
int sample_shift = -round(sampleShift * PID_P + ue->max_pos_acc * PID_I);
|
||||
|
||||
LOG_D(PHY,
|
||||
"Slot %d: diff = %i, rx_offset (final) = %i : max_pos = %d, max_pos filtered = %ld, max_power = %d\n",
|
||||
"Frame %d, Slot %d: max_pos = %d, max_pos filtered = %f, diff = %i, sampleShift = %i, max_pos_acc = %d, sample_shift (final) = %d, max_power = %d\n",
|
||||
frame,
|
||||
slot,
|
||||
max_pos,
|
||||
ue->max_pos_iir / 32768.0,
|
||||
diff,
|
||||
sampleShift,
|
||||
max_pos,
|
||||
ue->max_pos_avg,
|
||||
ue->max_pos_acc,
|
||||
sample_shift,
|
||||
max_val);
|
||||
|
||||
// reset IIR filter for next offset calculation
|
||||
ue->max_pos_iir += -round(sampleShift * PID_P) * 32768;
|
||||
ue->max_pos_acc += max_pos;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT);
|
||||
return sample_shift;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!\brief Timing drift hysterisis in samples*/
|
||||
#define NR_SYNCH_HYST 1
|
||||
|
||||
/* A function to perform the channel estimation of DL PRS signal */
|
||||
int nr_prs_channel_estimation(uint8_t gNB_id,
|
||||
uint8_t rsc_id,
|
||||
|
||||
@@ -456,7 +456,8 @@ typedef struct PHY_VARS_NR_UE_s {
|
||||
/// temporary offset during cell search prior to MIB decoding
|
||||
int ssb_offset;
|
||||
uint16_t symbol_offset; /// offset in terms of symbols for detected ssb in sync
|
||||
int64_t max_pos_avg; /// Timing offset IIR filter
|
||||
int64_t max_pos_iir; /// Timing offset IIR filter
|
||||
int max_pos_acc; /// Timing offset accumuluated error for PI filter
|
||||
|
||||
/// Timing Advance updates variables
|
||||
/// Timing advance update computed from the TA command signalled from gNB
|
||||
|
||||
@@ -877,7 +877,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
|
||||
fapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config;
|
||||
int sampleShift = 0;
|
||||
int sampleShift = INT_MAX;
|
||||
nr_ue_dlsch_init(phy_data->dlsch, NR_MAX_NB_LAYERS>4 ? 2:1, ue->max_ldpc_iterations);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
|
||||
|
||||
@@ -168,7 +168,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr
|
||||
int nr_slot_rx = proc->nr_slot_rx;
|
||||
sl_nr_ue_phy_params_t *sl_phy_params = &ue->SL_UE_PHY_PARAMS;
|
||||
NR_DL_FRAME_PARMS *fp = &sl_phy_params->sl_frame_params;
|
||||
int sampleShift = 0;
|
||||
int sampleShift = INT_MAX;
|
||||
|
||||
// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX_SL, VCD_FUNCTION_IN);
|
||||
start_meas(&sl_phy_params->phy_proc_sl_rx);
|
||||
|
||||
@@ -128,6 +128,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
|
||||
chan_desc->first_run = 1;
|
||||
chan_desc->ip = 0.0;
|
||||
chan_desc->max_Doppler = max_Doppler;
|
||||
chan_desc->Doppler_phase_cur = calloc(nb_rx, sizeof(double));
|
||||
chan_desc->ch = calloc(nb_tx*nb_rx, sizeof(struct complexd *));
|
||||
chan_desc->chF = calloc(nb_tx*nb_rx, sizeof(struct complexd *));
|
||||
chan_desc->a = calloc(nb_taps, sizeof(struct complexd *));
|
||||
@@ -1653,6 +1654,37 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
0);
|
||||
break;
|
||||
|
||||
case SAT_LEO_TRANS:
|
||||
case SAT_LEO_REGEN:
|
||||
nb_taps = 1;
|
||||
Td = 0;
|
||||
channel_length = 1;
|
||||
ricean_factor = 0.0;
|
||||
aoa = 0.0;
|
||||
maxDoppler = 0;
|
||||
chan_desc->sat_height = 600e3;
|
||||
chan_desc->enable_dynamic_delay = true;
|
||||
chan_desc->enable_dynamic_Doppler = false; // TODO: requires UE to support continuous Doppler estimation, compensation and pre-compensation
|
||||
fill_channel_desc(chan_desc,nb_tx,
|
||||
nb_rx,
|
||||
nb_taps,
|
||||
channel_length,
|
||||
default_amp_lin,
|
||||
NULL,
|
||||
NULL,
|
||||
Td,
|
||||
sampling_rate,
|
||||
channel_bandwidth,
|
||||
ricean_factor,
|
||||
aoa,
|
||||
forgetting_factor,
|
||||
maxDoppler,
|
||||
channel_offset,
|
||||
path_loss_dB,
|
||||
0);
|
||||
printf("%s: satellite orbit height %f km\n", map_int_to_str(channelmod_names, channel_model), chan_desc->sat_height / 1000);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_W(OCM,"channel model not yet supported\n");
|
||||
free(chan_desc);
|
||||
@@ -1711,6 +1743,7 @@ void free_channel_desc_scm(channel_desc_t *ch) {
|
||||
free(ch->R_sqrt[i]);
|
||||
|
||||
free(ch->R_sqrt);
|
||||
free(ch->Doppler_phase_cur);
|
||||
free(ch->ch);
|
||||
free(ch->chF);
|
||||
free(ch->a);
|
||||
@@ -1743,9 +1776,9 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
struct complexd phase, alpha, beta;
|
||||
start_meas(&desc->random_channel);
|
||||
|
||||
// For AWGN channel, the received signal (Srx) is equal to transmitted signal (Stx) plus noise (N), i.e., Srx = Stx + N,
|
||||
// For AWGN and SAT_LEO_* channels, the received signal (Srx) is equal to transmitted signal (Stx) plus noise (N), i.e., Srx = Stx + N,
|
||||
// therefore, the channel matrix is the identity matrix.
|
||||
if (desc->modelid == AWGN) {
|
||||
if (desc->modelid == AWGN || desc->modelid == SAT_LEO_TRANS || desc->modelid == SAT_LEO_REGEN) {
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx = 0; aatx < desc->nb_tx; aatx++) {
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][0].r = aarx%desc->nb_tx == aatx ? 1.0 : 0.0;
|
||||
@@ -2071,6 +2104,8 @@ static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_
|
||||
cd->forgetting_factor);
|
||||
prnt("Initial phase: %lf nb_path: %i \n",
|
||||
cd->ip, cd->nb_paths);
|
||||
if (cd->modelid == SAT_LEO_TRANS || cd->modelid == SAT_LEO_REGEN)
|
||||
prnt("satellite orbit height: %f\n", cd->sat_height);
|
||||
|
||||
for (int i=0; i<cd->nb_taps ; i++) {
|
||||
prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]);
|
||||
@@ -2281,7 +2316,7 @@ void init_channelmod(void) {
|
||||
} /* init_channelmod */
|
||||
|
||||
|
||||
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) {
|
||||
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, uint64_t center_freq, double channel_bandwidth) {
|
||||
paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC;
|
||||
paramlist_def_t channel_list;
|
||||
memset(&channel_list,0,sizeof(paramlist_def_t));
|
||||
@@ -2314,7 +2349,7 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double
|
||||
nb_rx,
|
||||
modid,
|
||||
sampling_rate,
|
||||
0,
|
||||
center_freq,
|
||||
channel_bandwidth,
|
||||
*(channel_list.paramarray[i][pindex_DT].dblptr),
|
||||
0.0,
|
||||
|
||||
@@ -126,6 +126,18 @@ typedef struct {
|
||||
char *model_name;
|
||||
/// flags to properly trigger memory free
|
||||
unsigned int free_flags;
|
||||
/// time stamp when the time varying channel emulation starts (when client connected)
|
||||
uint64_t start_TS;
|
||||
/// height of LEO satellite
|
||||
float sat_height;
|
||||
/// flag to enable dynamic delay simulation for LEO satellite
|
||||
bool enable_dynamic_delay;
|
||||
/// flag to enable dynamic Doppler simulation for LEO satellite
|
||||
bool enable_dynamic_Doppler;
|
||||
/// Doppler phase increment (might vary over time, e.g. for LEO satellite)
|
||||
float Doppler_phase_inc;
|
||||
/// current Doppler phase of each RX antenna (for continuous phase from one block to the next)
|
||||
float *Doppler_phase_cur;
|
||||
} channel_desc_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -218,6 +230,8 @@ typedef enum {
|
||||
EPA_low,
|
||||
EPA_medium,
|
||||
EPA_high,
|
||||
SAT_LEO_TRANS,
|
||||
SAT_LEO_REGEN,
|
||||
} SCM_t;
|
||||
#define CHANNELMOD_MAP_INIT \
|
||||
{"custom",custom},\
|
||||
@@ -253,6 +267,8 @@ typedef enum {
|
||||
{"EPA_low",EPA_low},\
|
||||
{"EPA_medium",EPA_medium},\
|
||||
{"EPA_high",EPA_high},\
|
||||
{"SAT_LEO_TRANS",SAT_LEO_TRANS},\
|
||||
{"SAT_LEO_REGEN",SAT_LEO_REGEN},\
|
||||
{NULL, -1}
|
||||
|
||||
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
|
||||
@@ -543,7 +559,7 @@ int modelid_fromstrtype(char *modeltype);
|
||||
double channelmod_get_snr_dB(void);
|
||||
double channelmod_get_sinr_dB(void);
|
||||
void init_channelmod(void) ;
|
||||
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ;
|
||||
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, uint64_t center_freq, double channel_bandwidth) ;
|
||||
double N_RB2sampling_rate(uint16_t N_RB);
|
||||
double N_RB2channel_bandwidth(uint16_t N_RB);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user