diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 5a5ab83420..d8398def67 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -135,7 +135,7 @@ uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) const uint64_t dl_freq_khz = downlink_frequency / 1000; const int32_t delta_duplex_khz = delta_duplex / 1000; - uint64_t center_freq_diff_khz = 999999999999999999; // 2^64 + uint64_t center_freq_diff_khz = UINT64_MAX; // 2^64 uint16_t current_band = 0; for (int ind = 0; ind < sizeofArray(nr_bandtable); ind++) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 5da6a3cde7..dcaff8f088 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1190,8 +1190,10 @@ int main(int argc, char **argv) { UE->frame_parms.nb_antennas_rx, channel_model, N_RB2sampling_rate(eNB->frame_parms.N_RB_DL), + 0, N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), DS_TDL, + 0.0, CORR_LEVEL_LOW, forgetting_factor, rx_sample_offset, @@ -1206,8 +1208,10 @@ int main(int argc, char **argv) { UE->frame_parms.nb_antennas_rx, channel_model, N_RB2sampling_rate(eNB->frame_parms.N_RB_DL), + 0, N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), DS_TDL, + 0.0, CORR_LEVEL_LOW, forgetting_factor, rx_sample_offset, diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 5db449e4b9..3d13a4244f 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -739,15 +739,15 @@ int main(int argc, char **argv) { n_rx, channel_model, N_RB2sampling_rate(eNB->frame_parms.N_RB_UL), + 0, N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 30e-9, + maxDoppler, CORR_LEVEL_LOW, forgetting_factor, delay, 0, 0); - // set Doppler - UE2eNB->max_Doppler = maxDoppler; // NN: N_RB_UL has to be defined in ulsim for (int k=0; kulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0); diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 04c203b594..518a655f19 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -334,10 +334,14 @@ int main(int argc, char **argv) if (ouput_vcd) vcd_signal_dumper_init("/tmp/openair_dump_nr_dlschsim.vcd"); - gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, + gNB2UE = new_channel_desc_scm(n_tx, + n_rx, + channel_model, 61.44e6, //N_RB2sampling_rate(N_RB_DL), + 0, 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, + 0.0, CORR_LEVEL_LOW, 0, 0, diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 68f63d9512..068f098981 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -900,8 +900,10 @@ int main(int argc, char **argv) n_rx, channel_model, fs/1e6,//sampling frequency in MHz + 0, txbw, 30e-9, + 0.0, CORR_LEVEL_LOW, 0, 0, diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index d8514dee51..9f85d91a39 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -533,8 +533,10 @@ int main(int argc, char **argv) n_rx, channel_model, fs, + 0, bw, 300e-9, + 0.0, CORR_LEVEL_LOW, 0, 0, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 982e5b4136..6df4896bc5 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -729,8 +729,10 @@ int main(int argc, char **argv){ gNB->frame_parms.nb_antennas_rx, channel_model, fs, + 0, bw, DS_TDL, + 0.0, CORR_LEVEL_LOW, 0.0, delay, diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index d3f7ef5c7b..3f0e493f3e 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -421,7 +421,7 @@ int main(int argc, char **argv) &txbw, &rxbw); - UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, txbw, DS_TDL, CORR_LEVEL_LOW, 0, 0, 0, 0); + UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, 0, txbw, DS_TDL, 0.0, CORR_LEVEL_LOW, 0, 0, 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index ac7b9b5c48..27f21515cc 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -381,8 +381,10 @@ int main(int argc, char **argv) n_rx, channel_model, 61.44e6, //N_RB2sampling_rate(N_RB_DL), + 0, 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, + 0.0, CORR_LEVEL_LOW, 0, 0, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 5355f34d65..758b63345c 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -683,26 +683,6 @@ int main(int argc, char **argv) &tx_bandwidth, &rx_bandwidth); - LOG_I( PHY,"++++++++++++++++++++++++++++++++++++++++++++++%i+++++++++++++++++++++++++++++++++++++++++",loglvl); - - UE2gNB = new_channel_desc_scm(n_tx, - n_rx, channel_model, - sampling_frequency/1e6, - tx_bandwidth, - DS_TDL, - corr_level, - 0, - 0, - 0, - 0); - - if (UE2gNB == NULL) { - printf("Problem generating channel model. Exiting.\n"); - exit(-1); - } - - UE2gNB->max_Doppler = maxDoppler; - RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB)); gNB = RC.gNB[0]; @@ -809,8 +789,27 @@ int main(int argc, char **argv) NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; + // Configure channel model + UE2gNB = new_channel_desc_scm(n_tx, + n_rx, + channel_model, + sampling_frequency / 1e6, + frame_parms->ul_CarrierFreq, + tx_bandwidth, + DS_TDL, + maxDoppler, + corr_level, + 0, + 0, + 0, + 0); - //configure UE + if (UE2gNB == NULL) { + printf("Problem generating channel model. Exiting.\n"); + exit(-1); + } + + // Configure UE UE = malloc(sizeof(PHY_VARS_NR_UE)); memset((void*)UE,0,sizeof(PHY_VARS_NR_UE)); PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE**)); diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 8774108437..54375d79d4 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -559,18 +559,20 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, + uint64_t center_freq, double channel_bandwidth, double DS_TDL, + double maxDoppler, const corr_level_t corr_level, double forgetting_factor, int32_t channel_offset, double path_loss_dB, - float noise_power_dB) { - + float noise_power_dB) +{ // To create tables for normal distribution struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); - tableNor((long)(t.tv_nsec%INT_MAX)); + tableNor((long) (t.tv_nsec % INT_MAX)); channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); @@ -587,14 +589,16 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint16_t i,j; double sum_amps; - double aoa,ricean_factor,Td,maxDoppler; + double aoa, ricean_factor, Td; int channel_length,nb_taps; struct complexd *R_sqrt_ptr2; chan_desc->modelid = channel_model; chan_desc->nb_tx = nb_tx; chan_desc->nb_rx = nb_rx; chan_desc->sampling_rate = sampling_rate; + chan_desc->center_freq = center_freq; chan_desc->channel_bandwidth = channel_bandwidth; + chan_desc->max_Doppler = maxDoppler; chan_desc->corr_level = corr_level; chan_desc->forgetting_factor = forgetting_factor; chan_desc->channel_offset = channel_offset; @@ -2161,8 +2165,10 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double nb_rx, modid, sampling_rate, + 0, channel_bandwidth, *(channel_list.paramarray[i][pindex_DT].dblptr), + 0.0, CORR_LEVEL_LOW, *(channel_list.paramarray[i][pindex_FF].dblptr), *(channel_list.paramarray[i][pindex_CO].iptr), diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 0704bae02a..e673c3a807 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -317,8 +317,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, + uint64_t center_freq, double channel_bandwidth, double DS_TDL, + double maxDoppler, const corr_level_t corr_level, double forgetting_factor, int32_t channel_offset, diff --git a/radio/rfsimulator/simulator.c b/radio/rfsimulator/simulator.c index 48a78448ed..b98e7a6172 100644 --- a/radio/rfsimulator/simulator.c +++ b/radio/rfsimulator/simulator.c @@ -341,17 +341,19 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, if (b->channel_model->model_name==NULL) continue; if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) { - - channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels, - channelmod, - t->sample_rate, - t->tx_bw, - 30e-9, // TDL delay-spread parameter - CORR_LEVEL_LOW, - t->chan_forgetfact, // forgetting_factor - t->chan_offset, // maybe used for TA - t->chan_pathloss, - t->noise_power_dB); // path_loss in dB + channel_desc_t *newmodel = new_channel_desc_scm(t->tx_num_channels, + t->rx_num_channels, + channelmod, + t->sample_rate, + 0, + t->tx_bw, + 30e-9, // TDL delay-spread parameter + 0.0, + CORR_LEVEL_LOW, + t->chan_forgetfact, // forgetting_factor + t->chan_offset, // maybe used for TA + t->chan_pathloss, + t->noise_power_dB); // path_loss in dB set_channeldesc_owner(newmodel, RFSIMU_MODULEID); set_channeldesc_name(newmodel,modelname); random_channel(newmodel,false);