Commit 6f51b930 authored by Roberto Louro Magueta's avatar Roberto Louro Magueta Committed by luis_pereira87

Put the correlation level (low, medium or high) as input of new_channel_desc_scm()

parent 3d966b09
......@@ -1192,9 +1192,11 @@ int main(int argc, char **argv) {
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
DS_TDL,
CORR_LEVEL_LOW,
forgetting_factor,
rx_sample_offset,
0, 0);
0,
0);
reset_meas(&eNB2UE[0]->random_channel);
reset_meas(&eNB2UE[0]->interp_time);
......@@ -1206,9 +1208,11 @@ int main(int argc, char **argv) {
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
DS_TDL,
CORR_LEVEL_LOW,
forgetting_factor,
rx_sample_offset,
0, 0);
0,
0);
reset_meas(&eNB2UE[n]->random_channel);
reset_meas(&eNB2UE[n]->interp_time);
}
......
......@@ -741,9 +741,11 @@ int main(int argc, char **argv) {
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
30e-9,
CORR_LEVEL_LOW,
forgetting_factor,
delay,
0, 0);
0,
0);
// set Doppler
UE2eNB->max_Doppler = maxDoppler;
......
......@@ -336,11 +336,15 @@ 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,
61.44e6, //N_RB2sampling_rate(N_RB_DL),
40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL,
0, 0, 0, 0);
gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model,
61.44e6, //N_RB2sampling_rate(N_RB_DL),
40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL,
CORR_LEVEL_LOW,
0,
0,
0,
0);
if (gNB2UE == NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -901,11 +901,13 @@ int main(int argc, char **argv)
n_rx,
channel_model,
fs/1e6,//sampling frequency in MHz
txbw,
30e-9,
txbw,
30e-9,
CORR_LEVEL_LOW,
0,
0,
0, 0);
0,
0);
if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -534,12 +534,14 @@ int main(int argc, char **argv)
gNB2UE = new_channel_desc_scm(n_tx,
n_rx,
channel_model,
fs,
bw,
300e-9,
fs,
bw,
300e-9,
CORR_LEVEL_LOW,
0,
0,
0, 0);
0,
0);
if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -734,9 +734,11 @@ int main(int argc, char **argv){
fs,
bw,
DS_TDL,
CORR_LEVEL_LOW,
0.0,
delay,
0, 0);
0,
0);
if (UE2gNB==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -415,7 +415,7 @@ int main(int argc, char **argv)
&txbw,
&rxbw);
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, txbw, DS_TDL,0, 0, 0, 0);
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, txbw, DS_TDL, CORR_LEVEL_LOW, 0, 0, 0, 0);
if (UE2gNB==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -383,7 +383,11 @@ int main(int argc, char **argv)
61.44e6, //N_RB2sampling_rate(N_RB_DL),
40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL,
0,0,0, 0);
CORR_LEVEL_LOW,
0,
0,
0,
0);
if (gNB2UE == NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -699,12 +699,17 @@ int main(int argc, char **argv)
LOG_I( PHY,"++++++++++++++++++++++++++++++++++++++++++++++%i+++++++++++++++++++++++++++++++++++++++++",loglvl);
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model,
corr_level_t corr_level = CORR_LEVEL_MEDIUM; // FIXME: Remove this hardcoded value
UE2gNB = new_channel_desc_scm(n_tx,
n_rx, channel_model,
sampling_frequency/1e6,
tx_bandwidth,
DS_TDL,
0, 0, 0, 0);
corr_level,
0,
0,
0,
0);
if (UE2gNB == NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -386,9 +386,6 @@ void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS
for (int i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
// FIXME: Remove this hardcoded value
chan_desc->corr_level = CORR_LEVEL_LOW;
int matrix_size = nb_tx*nb_rx;
double *correlation_matrix[matrix_size];
if (chan_desc->corr_level!=CORR_LEVEL_LOW) {
......@@ -459,10 +456,11 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double sampling_rate,
double channel_bandwidth,
double DS_TDL,
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) {
channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t));
for(int i=0; i<max_chan; i++) {
......@@ -481,16 +479,17 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double aoa,ricean_factor,Td,maxDoppler;
int channel_length,nb_taps;
struct complexd *R_sqrt_ptr2;
chan_desc->modelid = channel_model;
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->channel_bandwidth = channel_bandwidth;
chan_desc->corr_level = corr_level;
chan_desc->forgetting_factor = forgetting_factor;
chan_desc->channel_offset = channel_offset;
chan_desc->path_loss_dB = path_loss_dB;
chan_desc->first_run = 1;
chan_desc->ip = 0.0;
chan_desc->ip = 0.0;
chan_desc->noise_power_dB = noise_power_dB;
LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model);
int tdl_paths=0;
......@@ -2009,10 +2008,17 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double
AssertFatal(0, "\n Choose a valid model type\n");
}
channel_desc_t *channeldesc_p = new_channel_desc_scm(nb_tx,nb_rx,modid,sampling_rate,channel_bandwidth,
*(channel_list.paramarray[i][pindex_DT].dblptr), *(channel_list.paramarray[i][pindex_FF].dblptr),
*(channel_list.paramarray[i][pindex_CO].iptr), *(channel_list.paramarray[i][pindex_PL].dblptr),
*(channel_list.paramarray[i][pindex_NP].dblptr) );
channel_desc_t *channeldesc_p = new_channel_desc_scm(nb_tx,
nb_rx,
modid,
sampling_rate,
channel_bandwidth,
*(channel_list.paramarray[i][pindex_DT].dblptr),
CORR_LEVEL_LOW,
*(channel_list.paramarray[i][pindex_FF].dblptr),
*(channel_list.paramarray[i][pindex_CO].iptr),
*(channel_list.paramarray[i][pindex_PL].dblptr),
*(channel_list.paramarray[i][pindex_NP].dblptr));
AssertFatal( (channeldesc_p!= NULL), "Could not allocate channel %s type %s \n",*(channel_list.paramarray[i][pindex_NAME].strptr), *(channel_list.paramarray[i][pindex_TYPE].strptr));
channeldesc_p->model_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr));
LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr),
......
......@@ -312,13 +312,14 @@ typedef struct {
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
double sampling_rate,
double sampling_rate,
double channel_bandwidth,
double TDL_DS,
double DS_TDL,
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);
channel_desc_t *find_channel_desc_fromname( char *modelname );
......
......@@ -343,15 +343,15 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
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
t->chan_forgetfact, // forgetting_factor
t->chan_offset, // maybe used for TA
t->chan_pathloss,
t->noise_power_dB
); // path_loss in dB
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
set_channeldesc_owner(newmodel, RFSIMU_MODULEID);
set_channeldesc_name(newmodel,modelname);
random_channel(newmodel,false);
......
......@@ -352,31 +352,33 @@ void init_ocm(void) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_I(PHY,"Initializing channel descriptors (RU %d, UE %d) for N_RB_DL %d\n",ru_id,UE_id,
RC.ru[ru_id]->frame_parms->N_RB_DL);
sim.RU2UE[ru_id][UE_id][CC_id] =
new_channel_desc_scm(RC.ru[ru_id]->nb_tx,
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_rx,
AWGN,
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms->N_RB_DL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms->N_RB_DL),
DS_TDL,
0.0,
0,
0,
0);
sim.RU2UE[ru_id][UE_id][CC_id] =
new_channel_desc_scm(RC.ru[ru_id]->nb_tx,
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_rx,
AWGN,
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms->N_RB_DL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms->N_RB_DL),
DS_TDL,
CORR_LEVEL_LOW,
0.0,
0,
0,
0);
random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0);
LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id);
sim.UE2RU[UE_id][ru_id][CC_id] =
new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_tx,
RC.ru[ru_id]->nb_rx,
AWGN,
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms->N_RB_UL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms->N_RB_UL),
DS_TDL,
0.0,
0,
0,
0);
new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_tx,
RC.ru[ru_id]->nb_rx,
AWGN,
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms->N_RB_UL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms->N_RB_UL),
DS_TDL,
CORR_LEVEL_LOW,
0.0,
0,
0,
0);
random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0);
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
//UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id];
......
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