Commit 9b04af1b authored by Roberto Louro Magueta's avatar Roberto Louro Magueta

Put the center_freq and maxDoppler as input of new_channel_desc_scm() function

parent e44a99b3
...@@ -135,7 +135,7 @@ uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex) ...@@ -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 uint64_t dl_freq_khz = downlink_frequency / 1000;
const int32_t delta_duplex_khz = delta_duplex / 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; uint16_t current_band = 0;
for (int ind = 0; ind < sizeofArray(nr_bandtable); ind++) { for (int ind = 0; ind < sizeofArray(nr_bandtable); ind++) {
......
...@@ -1190,8 +1190,10 @@ int main(int argc, char **argv) { ...@@ -1190,8 +1190,10 @@ int main(int argc, char **argv) {
UE->frame_parms.nb_antennas_rx, UE->frame_parms.nb_antennas_rx,
channel_model, channel_model,
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL), N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
0,
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
DS_TDL, DS_TDL,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
forgetting_factor, forgetting_factor,
rx_sample_offset, rx_sample_offset,
...@@ -1206,8 +1208,10 @@ int main(int argc, char **argv) { ...@@ -1206,8 +1208,10 @@ int main(int argc, char **argv) {
UE->frame_parms.nb_antennas_rx, UE->frame_parms.nb_antennas_rx,
channel_model, channel_model,
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL), N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
0,
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
DS_TDL, DS_TDL,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
forgetting_factor, forgetting_factor,
rx_sample_offset, rx_sample_offset,
......
...@@ -739,15 +739,15 @@ int main(int argc, char **argv) { ...@@ -739,15 +739,15 @@ int main(int argc, char **argv) {
n_rx, n_rx,
channel_model, channel_model,
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL), N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
0,
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
30e-9, 30e-9,
maxDoppler,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
forgetting_factor, forgetting_factor,
delay, delay,
0, 0,
0); 0);
// set Doppler
UE2eNB->max_Doppler = maxDoppler;
// NN: N_RB_UL has to be defined in ulsim // NN: N_RB_UL has to be defined in ulsim
for (int k=0; k<NUMBER_OF_ULSCH_MAX; k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0); for (int k=0; k<NUMBER_OF_ULSCH_MAX; k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
......
...@@ -334,10 +334,14 @@ int main(int argc, char **argv) ...@@ -334,10 +334,14 @@ int main(int argc, char **argv)
if (ouput_vcd) if (ouput_vcd)
vcd_signal_dumper_init("/tmp/openair_dump_nr_dlschsim.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), 61.44e6, //N_RB2sampling_rate(N_RB_DL),
0,
40e6, //N_RB2channel_bandwidth(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL, DS_TDL,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
0, 0,
0, 0,
......
...@@ -900,8 +900,10 @@ int main(int argc, char **argv) ...@@ -900,8 +900,10 @@ int main(int argc, char **argv)
n_rx, n_rx,
channel_model, channel_model,
fs/1e6,//sampling frequency in MHz fs/1e6,//sampling frequency in MHz
0,
txbw, txbw,
30e-9, 30e-9,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
0, 0,
0, 0,
......
...@@ -533,8 +533,10 @@ int main(int argc, char **argv) ...@@ -533,8 +533,10 @@ int main(int argc, char **argv)
n_rx, n_rx,
channel_model, channel_model,
fs, fs,
0,
bw, bw,
300e-9, 300e-9,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
0, 0,
0, 0,
......
...@@ -729,8 +729,10 @@ int main(int argc, char **argv){ ...@@ -729,8 +729,10 @@ int main(int argc, char **argv){
gNB->frame_parms.nb_antennas_rx, gNB->frame_parms.nb_antennas_rx,
channel_model, channel_model,
fs, fs,
0,
bw, bw,
DS_TDL, DS_TDL,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
0.0, 0.0,
delay, delay,
......
...@@ -421,7 +421,7 @@ int main(int argc, char **argv) ...@@ -421,7 +421,7 @@ int main(int argc, char **argv)
&txbw, &txbw,
&rxbw); &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) { if (UE2gNB==NULL) {
printf("Problem generating channel model. Exiting.\n"); printf("Problem generating channel model. Exiting.\n");
......
...@@ -381,8 +381,10 @@ int main(int argc, char **argv) ...@@ -381,8 +381,10 @@ int main(int argc, char **argv)
n_rx, n_rx,
channel_model, channel_model,
61.44e6, //N_RB2sampling_rate(N_RB_DL), 61.44e6, //N_RB2sampling_rate(N_RB_DL),
0,
40e6, //N_RB2channel_bandwidth(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL, DS_TDL,
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
0, 0,
0, 0,
......
...@@ -683,26 +683,6 @@ int main(int argc, char **argv) ...@@ -683,26 +683,6 @@ int main(int argc, char **argv)
&tx_bandwidth, &tx_bandwidth,
&rx_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 = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB)); RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
...@@ -809,8 +789,27 @@ int main(int argc, char **argv) ...@@ -809,8 +789,27 @@ int main(int argc, char **argv)
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; 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);
if (UE2gNB == NULL) {
printf("Problem generating channel model. Exiting.\n");
exit(-1);
}
//configure UE // Configure UE
UE = malloc(sizeof(PHY_VARS_NR_UE)); UE = malloc(sizeof(PHY_VARS_NR_UE));
memset((void*)UE,0,sizeof(PHY_VARS_NR_UE)); memset((void*)UE,0,sizeof(PHY_VARS_NR_UE));
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE**)); PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE**));
......
...@@ -559,18 +559,20 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -559,18 +559,20 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx, uint8_t nb_rx,
SCM_t channel_model, SCM_t channel_model,
double sampling_rate, double sampling_rate,
uint64_t center_freq,
double channel_bandwidth, double channel_bandwidth,
double DS_TDL, double DS_TDL,
double maxDoppler,
const corr_level_t corr_level, const corr_level_t corr_level,
double forgetting_factor, double forgetting_factor,
int32_t channel_offset, int32_t channel_offset,
double path_loss_dB, double path_loss_dB,
float noise_power_dB) { float noise_power_dB)
{
// To create tables for normal distribution // To create tables for normal distribution
struct timespec t; struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &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)); 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, ...@@ -587,14 +589,16 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint16_t i,j; uint16_t i,j;
double sum_amps; double sum_amps;
double aoa,ricean_factor,Td,maxDoppler; double aoa, ricean_factor, Td;
int channel_length,nb_taps; int channel_length,nb_taps;
struct complexd *R_sqrt_ptr2; struct complexd *R_sqrt_ptr2;
chan_desc->modelid = channel_model; chan_desc->modelid = channel_model;
chan_desc->nb_tx = nb_tx; chan_desc->nb_tx = nb_tx;
chan_desc->nb_rx = nb_rx; chan_desc->nb_rx = nb_rx;
chan_desc->sampling_rate = sampling_rate; chan_desc->sampling_rate = sampling_rate;
chan_desc->center_freq = center_freq;
chan_desc->channel_bandwidth = channel_bandwidth; chan_desc->channel_bandwidth = channel_bandwidth;
chan_desc->max_Doppler = maxDoppler;
chan_desc->corr_level = corr_level; chan_desc->corr_level = corr_level;
chan_desc->forgetting_factor = forgetting_factor; chan_desc->forgetting_factor = forgetting_factor;
chan_desc->channel_offset = channel_offset; 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 ...@@ -2161,8 +2165,10 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double
nb_rx, nb_rx,
modid, modid,
sampling_rate, sampling_rate,
0,
channel_bandwidth, channel_bandwidth,
*(channel_list.paramarray[i][pindex_DT].dblptr), *(channel_list.paramarray[i][pindex_DT].dblptr),
0.0,
CORR_LEVEL_LOW, CORR_LEVEL_LOW,
*(channel_list.paramarray[i][pindex_FF].dblptr), *(channel_list.paramarray[i][pindex_FF].dblptr),
*(channel_list.paramarray[i][pindex_CO].iptr), *(channel_list.paramarray[i][pindex_CO].iptr),
......
...@@ -317,8 +317,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -317,8 +317,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx, uint8_t nb_rx,
SCM_t channel_model, SCM_t channel_model,
double sampling_rate, double sampling_rate,
uint64_t center_freq,
double channel_bandwidth, double channel_bandwidth,
double DS_TDL, double DS_TDL,
double maxDoppler,
const corr_level_t corr_level, const corr_level_t corr_level,
double forgetting_factor, double forgetting_factor,
int32_t channel_offset, int32_t channel_offset,
......
...@@ -341,17 +341,19 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, ...@@ -341,17 +341,19 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
if (b->channel_model->model_name==NULL) if (b->channel_model->model_name==NULL)
continue; continue;
if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) { 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,
channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels, t->rx_num_channels,
channelmod, channelmod,
t->sample_rate, t->sample_rate,
t->tx_bw, 0,
30e-9, // TDL delay-spread parameter t->tx_bw,
CORR_LEVEL_LOW, 30e-9, // TDL delay-spread parameter
t->chan_forgetfact, // forgetting_factor 0.0,
t->chan_offset, // maybe used for TA CORR_LEVEL_LOW,
t->chan_pathloss, t->chan_forgetfact, // forgetting_factor
t->noise_power_dB); // path_loss in dB 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_owner(newmodel, RFSIMU_MODULEID);
set_channeldesc_name(newmodel,modelname); set_channeldesc_name(newmodel,modelname);
random_channel(newmodel,false); random_channel(newmodel,false);
......
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