Merge remote-tracking branch 'origin/develop' into bandwidth-testing
Conflicts: executables/nr-uesoftmodem.c executables/nr-uesoftmodem.h executables/softmodem-common.h openair1/PHY/MODULATION/slot_fep_nr.c openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c openair1/PHY/NR_TRANSPORT/pucch_rx.c openair1/SCHED_NR/fapi_nr_l1.c openair1/SCHED_NR_UE/phy_procedures_nr_ue.c openair1/SIMULATION/TOOLS/abstraction.c openair1/SIMULATION/TOOLS/random_channel.c openair2/LAYER2/NR_MAC_UE/mac_proto.h openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
This commit is contained in:
@@ -200,8 +200,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[0]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[0]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].x;
|
||||
channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].r;
|
||||
channely = eNB2UE[0]->chF[aarx+(aatx*eNB2UE[0]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
@@ -213,8 +213,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[1]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[1]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].x;
|
||||
channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].r;
|
||||
channely = eNB2UE[1]->chF[aarx+(aatx*eNB2UE[1]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
@@ -225,8 +225,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[2]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[2]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].x;
|
||||
channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].r;
|
||||
channely = eNB2UE[2]->chF[aarx+(aatx*eNB2UE[2]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
@@ -237,8 +237,8 @@ void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR,
|
||||
for (u=0; u<2*ru->frame_parms->N_RB_DL; u++) {
|
||||
for (aarx=0; aarx<eNB2UE[3]->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<eNB2UE[3]->nb_tx; aatx++) {
|
||||
channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].x;
|
||||
channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].y;
|
||||
channelx = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].r;
|
||||
channely = eNB2UE[3]->chF[aarx+(aatx*eNB2UE[3]->nb_rx)][u].i;
|
||||
fprintf(csv_fd,"%e+i*(%e),",channelx,channely);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
|
||||
double rx_gain;
|
||||
int rx_pwr2, target_rx_pwr_dB;
|
||||
|
||||
struct complex **ch;
|
||||
struct complexd **ch;
|
||||
unsigned char first_call = 1;
|
||||
|
||||
LTE_DL_FRAME_PARMS frame_parms;
|
||||
@@ -169,10 +169,10 @@ int main(int argc, char **argv)
|
||||
|
||||
channel_length = (int) 11+2*BW*Td;
|
||||
|
||||
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
|
||||
ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
|
||||
|
||||
for (i = 0; i<4; i++)
|
||||
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
|
||||
ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
|
||||
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
@@ -1111,8 +1111,8 @@ int main(int argc, char **argv) {
|
||||
for (aarx=0; aarx<UE2eNB->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<UE2eNB->nb_tx; aatx++) {
|
||||
// abs_channel = (eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].x + eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y*eNB2UE->chF[aarx+(aatx*eNB2UE->nb_rx)][u].y);
|
||||
channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].x;
|
||||
channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].y;
|
||||
channelx = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].r;
|
||||
channely = UE2eNB->chF[aarx+(aatx*UE2eNB->nb_rx)][u].i;
|
||||
// if(transmission_m==5){
|
||||
fprintf(csv_fdUL,"%e+i*(%e),",channelx,channely);
|
||||
// }
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
|
||||
double amps[8] = {0.3868472 , 0.3094778 , 0.1547389 , 0.0773694 , 0.0386847 , 0.0193424 , 0.0096712 , 0.0038685};
|
||||
double aoa=.03,ricean_factor=1; //0.0000005;
|
||||
int channel_length;
|
||||
struct complex **ch;
|
||||
struct complexd **ch;
|
||||
unsigned char pbch_pdu[6];
|
||||
int sync_pos, sync_pos_slot;
|
||||
FILE *rx_frame_file;
|
||||
@@ -170,10 +170,10 @@ int main(int argc, char **argv)
|
||||
bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
}
|
||||
|
||||
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
|
||||
ch = (struct complexd**) malloc(4 * sizeof(struct complexd*));
|
||||
|
||||
for (i = 0; i<4; i++)
|
||||
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
|
||||
ch[i] = (struct complexd*) malloc(channel_length * sizeof(struct complexd));
|
||||
|
||||
generate_srs_tx(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0);
|
||||
generate_drs_puch(lte_frame_parms,lte_ue_common_vars->txdataF[0],AMP,0,first_rb,nb_rb);
|
||||
|
||||
@@ -226,12 +226,17 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
|
||||
void processSlotTX(void *arg) {}
|
||||
|
||||
//nFAPI P7 dummy functions
|
||||
//nFAPI P7 dummy functions to avoid linking errors
|
||||
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
// needed for some functions
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
@@ -408,6 +413,7 @@ int main(int argc, char **argv)
|
||||
uint16_t rbSize = 106;
|
||||
uint8_t mcsIndex = 9;
|
||||
uint8_t dlsch_threads = 0;
|
||||
int prb_inter = 0;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
exit_fun("[NR_DLSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
@@ -418,7 +424,7 @@ int main(int argc, char **argv)
|
||||
|
||||
FILE *scg_fd=NULL;
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:q")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:q")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
scg_fd = fopen(optarg,"r");
|
||||
@@ -474,14 +480,10 @@ int main(int argc, char **argv)
|
||||
|
||||
break;
|
||||
|
||||
/*case 'i':
|
||||
interf1=atoi(optarg);
|
||||
case 'i':
|
||||
prb_inter=1;
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;*/
|
||||
|
||||
case 'n':
|
||||
n_trials = atoi(optarg);
|
||||
break;
|
||||
@@ -640,7 +642,7 @@ int main(int argc, char **argv)
|
||||
printf("-g [A,B,C,D,E,F,G,R] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models or R for MIMO model (ignores delay spread and Ricean factor)\n");
|
||||
printf("-y Number of TX antennas used in gNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
//printf("-i Relative strength of first intefering gNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n");
|
||||
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
@@ -686,6 +688,7 @@ int main(int argc, char **argv)
|
||||
memset(RC.gNB[0],0,sizeof(PHY_VARS_gNB));
|
||||
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
@@ -906,6 +909,7 @@ int main(int argc, char **argv)
|
||||
UE->if_inst->phy_config_request = nr_ue_phy_config_request;
|
||||
UE->if_inst->dl_indication = nr_ue_dl_indication;
|
||||
UE->if_inst->ul_indication = dummy_nr_ue_ul_indication;
|
||||
UE->prb_interpolation = prb_inter;
|
||||
|
||||
|
||||
UE_mac->if_module = nr_ue_if_module_init(0);
|
||||
@@ -1079,7 +1083,8 @@ int main(int argc, char **argv)
|
||||
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
&txdata[aa][tx_offset],
|
||||
14,
|
||||
frame_parms);
|
||||
frame_parms,
|
||||
slot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1314,7 +1319,7 @@ int main(int argc, char **argv)
|
||||
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
|
||||
if (UE->frame_parms.nb_antennas_rx>1)
|
||||
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1);
|
||||
LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1);
|
||||
LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1);
|
||||
write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1);
|
||||
LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0);
|
||||
break;
|
||||
|
||||
@@ -8,6 +8,12 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||
nfapi_mode_t nfapi_mod;
|
||||
|
||||
@@ -3,9 +3,15 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { re
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int32_t get_uldl_offset(int nr_bandP) { return(0); }
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
||||
@@ -315,7 +321,7 @@ void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
|
||||
mac->RA_attempt_number++;
|
||||
}
|
||||
|
||||
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
|
||||
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id){
|
||||
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||
LOG_D(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Starting contention resolution timer\n", mod_id, frameP);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
|
||||
@@ -135,7 +135,9 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
|
||||
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
|
||||
|
||||
fp->ofdm_offset_divisor = UINT_MAX;
|
||||
nr_init_frame_parms(gNB_config, fp);
|
||||
init_timeshift_rotation(fp);
|
||||
|
||||
init_symbol_rotation(fp);
|
||||
|
||||
@@ -431,6 +433,7 @@ int main(int argc, char **argv)
|
||||
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
|
||||
@@ -82,6 +82,11 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
void
|
||||
rrc_data_ind(
|
||||
|
||||
@@ -504,7 +504,7 @@ int main(int argc, char **argv)
|
||||
unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl);
|
||||
|
||||
if (input_fd == NULL) {
|
||||
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G);
|
||||
nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
@@ -212,6 +212,11 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||
const uint8_t key[32], uint8_t **out)
|
||||
@@ -297,6 +302,7 @@ int main(int argc, char **argv)
|
||||
float effRate;
|
||||
//float eff_tp_check = 0.7;
|
||||
uint8_t snrRun;
|
||||
int prb_inter = 0;
|
||||
|
||||
int enable_ptrs = 0;
|
||||
int modify_dmrs = 0;
|
||||
@@ -330,7 +336,7 @@ int main(int argc, char **argv)
|
||||
/* initialize the sin-cos table */
|
||||
InitSinLUT();
|
||||
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:p:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
|
||||
printf("handling optarg %c\n",c);
|
||||
switch (c) {
|
||||
|
||||
@@ -422,14 +428,10 @@ int main(int argc, char **argv)
|
||||
|
||||
break;
|
||||
|
||||
/*case 'i':
|
||||
interf1 = atoi(optarg);
|
||||
break;
|
||||
case 'i':
|
||||
prb_inter=1;
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
interf2 = atoi(optarg);
|
||||
break;*/
|
||||
|
||||
case 'k':
|
||||
printf("Setting threequarter_fs_flag\n");
|
||||
openair0_cfg[0].threequarter_fs= 1;
|
||||
@@ -460,6 +462,14 @@ int main(int argc, char **argv)
|
||||
printf("Setting SNR0 to %f\n", snr0);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
mu = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
start_rb = atoi(optarg);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 't':
|
||||
eff_tp_check = (float)atoi(optarg)/100;
|
||||
@@ -581,13 +591,15 @@ int main(int argc, char **argv)
|
||||
printf("-f Number of frames to simulate\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-h This message\n");
|
||||
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-i Activate PRB based averaging for channel estimation. Frequncy domain interpolation by default.\n");
|
||||
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
|
||||
printf("-m MCS value\n");
|
||||
printf("-n Number of trials to simulate\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-u Set the numerology\n");
|
||||
printf("-w Start PRB for PUSCH\n");
|
||||
//printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
@@ -628,10 +640,12 @@ int main(int argc, char **argv)
|
||||
|
||||
if (N_RB_UL >= 217) sampling_frequency = 122.88;
|
||||
else if (N_RB_UL >= 106) sampling_frequency = 61.44;
|
||||
else if (N_RB_UL >= 32) sampling_frequency = 32.72;
|
||||
else { printf("Need at least 106 PRBs\b"); exit(-1); }
|
||||
if (N_RB_UL == 273) bandwidth = 100;
|
||||
else if (N_RB_UL == 217) bandwidth = 80;
|
||||
else if (N_RB_UL == 106) bandwidth = 40;
|
||||
else if (N_RB_UL == 32) bandwidth = 50;
|
||||
else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); }
|
||||
|
||||
if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75;
|
||||
@@ -652,6 +666,7 @@ int main(int argc, char **argv)
|
||||
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
|
||||
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
char tp_param[] = "n";
|
||||
@@ -664,6 +679,7 @@ int main(int argc, char **argv)
|
||||
gNB->UL_INFO.crc_ind.crc_list = (nfapi_nr_crc_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_crc_t));
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
gNB->prb_interpolation = prb_inter;
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
|
||||
|
||||
@@ -803,7 +819,11 @@ int main(int argc, char **argv)
|
||||
nr_scheduled_response_t scheduled_response;
|
||||
fapi_nr_ul_config_request_t ul_config;
|
||||
fapi_nr_tx_request_t tx_req;
|
||||
|
||||
|
||||
memset(&scheduled_response, 0, sizeof(scheduled_response));
|
||||
memset(&ul_config, 0, sizeof(ul_config));
|
||||
memset(&tx_req, 0, sizeof(tx_req));
|
||||
|
||||
uint8_t ptrs_mcs1 = 2;
|
||||
uint8_t ptrs_mcs2 = 4;
|
||||
uint8_t ptrs_mcs3 = 10;
|
||||
@@ -951,9 +971,12 @@ int main(int argc, char **argv)
|
||||
input_fd);
|
||||
if (read_errors==0) exit(1);
|
||||
for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n",
|
||||
slot_offset,
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
|
||||
slot_offset,
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[i],
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
|
||||
|
||||
mod_order = nr_get_Qm_ul(Imcs, mcs_table);
|
||||
code_rate = nr_get_code_rate_ul(Imcs, mcs_table);
|
||||
}
|
||||
|
||||
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
||||
@@ -975,6 +998,10 @@ int main(int argc, char **argv)
|
||||
reset_meas(&gNB->ulsch_llr_stats);
|
||||
reset_meas(&gNB->ulsch_channel_compensation_stats);
|
||||
reset_meas(&gNB->ulsch_rbs_extraction_stats);
|
||||
reset_meas(&UE->ulsch_ldpc_encoding_stats);
|
||||
reset_meas(&UE->ulsch_rate_matching_stats);
|
||||
reset_meas(&UE->ulsch_interleaving_stats);
|
||||
reset_meas(&UE->ulsch_encoding_stats);
|
||||
|
||||
clear_pusch_stats(gNB);
|
||||
for (trial = 0; trial < n_trials; trial++) {
|
||||
@@ -1167,7 +1194,7 @@ int main(int argc, char **argv)
|
||||
frame_parms->ofdm_symbol_size/(12*nb_rb));
|
||||
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (int aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
for (int aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]);
|
||||
s_im[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)+1]);
|
||||
}
|
||||
@@ -1235,6 +1262,8 @@ int main(int argc, char **argv)
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[0][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("chestF0.m","chF0",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[0][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("chestT0.m","chT0",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_time[0][0],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("chestF0_ext.m","chF0_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
@@ -1346,6 +1375,11 @@ int main(int argc, char **argv)
|
||||
printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation");
|
||||
printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling");
|
||||
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
|
||||
printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time");
|
||||
printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time");
|
||||
printStatIndent2(&UE->ulsch_ldpc_encoding_stats,"ULSCH LDPC encoder time");
|
||||
printStatIndent2(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
|
||||
printStatIndent2(&UE->ulsch_interleaving_stats,"ULSCH interleaving time");
|
||||
//printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving");
|
||||
//printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx");
|
||||
//printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding");
|
||||
|
||||
@@ -146,6 +146,11 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0);
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
|
||||
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
|
||||
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
|
||||
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||
|
||||
|
||||
@@ -112,14 +112,14 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs)
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
AssertFatal(n_samples/2+f2 < (2+(275*12)),"reading past chF %d (n_samples %d, f2 %d)\n",n_samples/2+f2,n_samples,f2);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x=0.0;
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r=0.0;
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i=0.0;
|
||||
|
||||
for (l=0; l<(int)desc->nb_taps; l++) {
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].r+=(desc->a[l][aarx+(aatx*desc->nb_rx)].r*clut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].i*slut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].i+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].r*slut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].i*clut[l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,42 +139,42 @@ double compute_pbch_sinr(channel_desc_t *desc,
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
struct complexd S_i1;
|
||||
struct complexd S_i2;
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
for (f=(nb_rb-6); f<(nb_rb+6); f++) {
|
||||
S = 0.0;
|
||||
S_i1.x =0.0;
|
||||
S_i1.y =0.0;
|
||||
S_i2.x =0.0;
|
||||
S_i2.y =0.0;
|
||||
S_i1.r =0.0;
|
||||
S_i1.i =0.0;
|
||||
S_i2.r =0.0;
|
||||
S_i2.i =0.0;
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
// printf("%d %d chF[%d] => (%f,%f)\n",aarx,aatx,f,desc->chF[aarx+(aatx*desc->nb_rx)][f].x,desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
|
||||
if (desc_i1) {
|
||||
S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
|
||||
if (desc_i2) {
|
||||
S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// printf("snr %f f %d : S %f, S_i1 %f, S_i2 %f\n",snr,f-nb_rb,S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
|
||||
}
|
||||
|
||||
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
|
||||
@@ -192,42 +192,42 @@ double compute_sinr(channel_desc_t *desc,
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
struct complexd S_i1;
|
||||
struct complexd S_i2;
|
||||
DevAssert( nb_rb > 0 );
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
for (f=0; f<2*nb_rb; f++) {
|
||||
S = 0.0;
|
||||
S_i1.x =0.0;
|
||||
S_i1.y =0.0;
|
||||
S_i2.x =0.0;
|
||||
S_i2.y =0.0;
|
||||
S_i1.r =0.0;
|
||||
S_i1.i =0.0;
|
||||
S_i2.r =0.0;
|
||||
S_i2.i =0.0;
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
|
||||
if (desc_i1) {
|
||||
S_i1.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i1.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i1.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i1.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i1->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
|
||||
if (desc_i2) {
|
||||
S_i2.x += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y);
|
||||
S_i2.y += (desc->chF[aarx+(aatx*desc->nb_rx)][f].x*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].y -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].y*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].x);
|
||||
S_i2.r += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r +
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i);
|
||||
S_i2.i += (desc->chF[aarx+(aatx*desc->nb_rx)][f].r*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].i -
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][f].i*desc_i2->chF[aarx+(aatx*desc->nb_rx)][f].r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// printf("f %d : S %f, S_i1 %f, S_i2 %f\n",f-nb_rb,snr*S,snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y),snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.x*S_i1.x + S_i1.y*S_i1.y)+snr_i2*sqrt(S_i2.x*S_i2.x + S_i2.y*S_i2.y)));
|
||||
avg_sinr += (snr*S/(desc->nb_tx+snr_i1*sqrt(S_i1.r*S_i1.r + S_i1.i*S_i1.i)+snr_i2*sqrt(S_i2.r*S_i2.r + S_i2.i*S_i2.i)));
|
||||
}
|
||||
|
||||
// printf("avg_sinr %f (%f,%f,%f)\n",avg_sinr/12.0,snr,snr_i1,snr_i2);
|
||||
|
||||
@@ -156,7 +156,7 @@ void multipath_channel(channel_desc_t *desc,
|
||||
{
|
||||
|
||||
int i,ii,j,l;
|
||||
struct complex rx_tmp,tx;
|
||||
struct complexd rx_tmp,tx;
|
||||
|
||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||
int dd;
|
||||
@@ -183,32 +183,32 @@ void multipath_channel(channel_desc_t *desc,
|
||||
|
||||
for (i=0; i<((int)length-dd); i++) {
|
||||
for (ii=0; ii<desc->nb_rx; ii++) {
|
||||
rx_tmp.x = 0;
|
||||
rx_tmp.y = 0;
|
||||
rx_tmp.r = 0;
|
||||
rx_tmp.i = 0;
|
||||
|
||||
for (j=0; j<desc->nb_tx; j++) {
|
||||
for (l = 0; l<(int)desc->channel_length; l++) {
|
||||
if ((i>=0) && (i-l)>=0) {
|
||||
tx.x = tx_sig_re[j][i-l];
|
||||
tx.y = tx_sig_im[j][i-l];
|
||||
tx.r = tx_sig_re[j][i-l];
|
||||
tx.i = tx_sig_im[j][i-l];
|
||||
} else {
|
||||
tx.x =0;
|
||||
tx.y =0;
|
||||
tx.r =0;
|
||||
tx.i =0;
|
||||
}
|
||||
|
||||
rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y);
|
||||
rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y);
|
||||
rx_tmp.r += (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].r) - (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].i);
|
||||
rx_tmp.i += (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].r) + (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].i);
|
||||
|
||||
if (i==0 && log_channel == 1) {
|
||||
printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)),
|
||||
desc->ch[ii+(j*desc->nb_rx)][l].x,
|
||||
desc->ch[ii+(j*desc->nb_rx)][l].y);
|
||||
printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].r,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].i,2.0)),
|
||||
desc->ch[ii+(j*desc->nb_rx)][l].r,
|
||||
desc->ch[ii+(j*desc->nb_rx)][l].i);
|
||||
}
|
||||
} //l
|
||||
} // j
|
||||
|
||||
rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss;
|
||||
rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss;
|
||||
rx_sig_re[ii][i+dd] = rx_tmp.r*path_loss;
|
||||
rx_sig_im[ii][i+dd] = rx_tmp.i*path_loss;
|
||||
#ifdef DEBUG_CHANNEL
|
||||
if ((i%32)==0) {
|
||||
printf("rx aa %d: %p %p %f,%f => %e,%e\n",ii,rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]);
|
||||
|
||||
@@ -72,7 +72,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
|
||||
uint8_t channel_length,
|
||||
double *amps,
|
||||
double *delays,
|
||||
struct complex *R_sqrt,
|
||||
struct complexd *R_sqrt,
|
||||
double Td,
|
||||
double sampling_rate,
|
||||
double channel_bandwidth,
|
||||
@@ -116,44 +116,44 @@ 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->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(nb_taps*sizeof(struct complexd *));
|
||||
LOG_D(OCM,"[CHANNEL] Filling ch \n");
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); // allocate for up to 100 RBs, 12 samples per RB
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd)); // allocate for up to 100 RBs, 12 samples per RB
|
||||
|
||||
LOG_D(OCM,"[CHANNEL] Filling a (nb_taps %d)\n",nb_taps);
|
||||
|
||||
for (i = 0; i<nb_taps; i++) {
|
||||
LOG_D(OCM,"tap %d (%p,%zu)\n",i,&chan_desc->a[i],nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
LOG_D(OCM,"tap %d (%p,%zu)\n",i,&chan_desc->a[i],nb_tx*nb_rx * sizeof(struct complexd));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
}
|
||||
|
||||
LOG_D(OCM,"[CHANNEL] Doing R_sqrt ...\n");
|
||||
|
||||
if (R_sqrt == NULL) {
|
||||
chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *));
|
||||
chan_desc->R_sqrt = (struct complexd **) calloc(nb_taps,sizeof(struct complexd *));
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_NTAPS ;
|
||||
|
||||
for (i = 0; i<nb_taps; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *));
|
||||
chan_desc->R_sqrt = (struct complexd **) calloc(nb_taps,sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_taps; i++) {
|
||||
//chan_desc->R_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
|
||||
//chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0];
|
||||
//chan_desc->R_sqrt[i] = (struct complexd*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complexd));
|
||||
//chan_desc->R_sqrt = (struct complexd*)&R_sqrt[i][0];
|
||||
/* all chan_desc share the same R_sqrt, coming from caller */
|
||||
chan_desc->R_sqrt[i] = R_sqrt;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
|
||||
|
||||
for (i = 0; i<nb_taps; i++) {
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
LOG_D(OCM,"Rsqrt[%d][%d] %f %f\n",i,j,chan_desc->R_sqrt[i][j].x,chan_desc->R_sqrt[i][j].y);
|
||||
LOG_D(OCM,"Rsqrt[%d][%d] %f %f\n",i,j,chan_desc->R_sqrt[i][j].r,chan_desc->R_sqrt[i][j].i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,61 +418,61 @@ static double default_amps_lin[] = {0.3868472, 0.3094778, 0.1547389, 0.0773694,
|
||||
static double default_amp_lin[] = {1};
|
||||
|
||||
//correlation matrix for a 2x2 channel with full Tx correlation
|
||||
static struct complex R_sqrt_22_corr[16] = {{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
|
||||
static struct complexd R_sqrt_22_corr[16] = {{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0},
|
||||
{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}
|
||||
};
|
||||
|
||||
//correlation matrix for a fully correlated 2x1 channel (h1==h2)
|
||||
static struct complex R_sqrt_21_corr[] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}};
|
||||
static struct complexd R_sqrt_21_corr[] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}};
|
||||
|
||||
//correlation matrix for a 2x2 channel with full Tx anti-correlation
|
||||
static struct complex R_sqrt_22_anticorr[16] = {{0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0},
|
||||
static struct complexd R_sqrt_22_anticorr[16] = {{0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {-0.70711,0},
|
||||
{-0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, {0.70711,0}
|
||||
};
|
||||
|
||||
//correlation matrix for a fully anti-correlated 2x1 channel (h1==-h2)
|
||||
static struct complex R_sqrt_21_anticorr[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}};
|
||||
static struct complexd R_sqrt_21_anticorr[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}};
|
||||
|
||||
// full correlation matrix in vectorized form for 2x2 channel, where h1 is perfectly orthogonal to h2
|
||||
|
||||
static struct complex R_sqrt_22_orthogonal[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
|
||||
static struct complexd R_sqrt_22_orthogonal[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0},
|
||||
{0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.70711,0.0}
|
||||
};
|
||||
|
||||
// full correlation matrix for TM4 to make orthogonal effective channel
|
||||
static struct complex R_sqrt_22_orth_eff_ch_TM4_prec_real[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
|
||||
static struct complexd R_sqrt_22_orth_eff_ch_TM4_prec_real[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {-0.70711,0.0},
|
||||
{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}
|
||||
};
|
||||
|
||||
static struct complex R_sqrt_22_orth_eff_ch_TM4_prec_imag[16] = {{0.70711,0.0}, {0.0,0.0}, {0.0, -0.70711}, {0.0,0.0},
|
||||
static struct complexd R_sqrt_22_orth_eff_ch_TM4_prec_imag[16] = {{0.70711,0.0}, {0.0,0.0}, {0.0, -0.70711}, {0.0,0.0},
|
||||
{0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {0.0,0.70711},
|
||||
{0.0,-0.70711}, {0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0},
|
||||
{0.0, 0.0}, {0.0,0.70711}, {0.0, 0.0}, {-0.70711,0.0}
|
||||
};
|
||||
|
||||
//Correlation matrix for EPA channel
|
||||
static struct complex R_sqrt_22_EPA_low[16] = {{1.0,0.0}, {0.0,0.0}, {0.0,0.0}, {0.0,0.0},
|
||||
static struct complexd R_sqrt_22_EPA_low[16] = {{1.0,0.0}, {0.0,0.0}, {0.0,0.0}, {0.0,0.0},
|
||||
{0.0,0.0}, {1.0,0.0}, {0.0,0.0}, {0.0,0.0},
|
||||
{0.0,0.0}, {0.0,0.0}, {1.0,0.0}, {0.0,0.0},
|
||||
{0.0,0.0}, {0.0,0.0}, {0.0,0.0}, {1.0,0.0}
|
||||
};
|
||||
|
||||
static struct complex R_sqrt_22_EPA_high[16] = {
|
||||
static struct complexd R_sqrt_22_EPA_high[16] = {
|
||||
{0.7179,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.2821,0.0},
|
||||
{0.4500,0.0}, {0.7179,0.0}, {0.2821,0.0}, {0.4500,0.0},
|
||||
{0.4500,0.0}, {0.2821,0.0}, {0.7179,0.0}, {0.4500,0.0},
|
||||
{0.2821,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.7179,0.0}
|
||||
};
|
||||
|
||||
static struct complex R_sqrt_22_EPA_medium[16] = {{0.8375,0.0}, {0.5249,0.0}, {0.1286,0.0}, {0.0806,0.0},
|
||||
static struct complexd R_sqrt_22_EPA_medium[16] = {{0.8375,0.0}, {0.5249,0.0}, {0.1286,0.0}, {0.0806,0.0},
|
||||
{0.5249,0.0}, {0.8375,0.0}, {0.0806,0.0}, {0.1286,0.0},
|
||||
{0.1286,0.0}, {0.0806,0.0}, {0.8375,0.0}, {0.5249,0.0},
|
||||
{0.0806,0.0}, {0.1286,0.0}, {0.5249,0.0}, {0.8375,0.0}
|
||||
@@ -511,37 +511,37 @@ void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS
|
||||
chan_desc->delays = tdl_delays;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (int i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (int i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc((2+(275*12)) * sizeof(struct complex));
|
||||
|
||||
for (int i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(tdl_pathsby3*sizeof(struct complex **));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
for (int i = 0; i<(tdl_pathsby3); i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
|
||||
} else if (nb_tx==2 && nb_rx==1) {
|
||||
for (int i = 0; i<(tdl_pathsby3); i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R21_sqrt[i][0];
|
||||
} else if (nb_tx==1 && nb_rx==2) {
|
||||
for (int i = 0; i<(tdl_pathsby3); i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R12_sqrt[i][0];
|
||||
} else {
|
||||
for (int i = 0; i<(tdl_pathsby3); i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (int j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
|
||||
@@ -576,7 +576,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
double sum_amps;
|
||||
double aoa,ricean_factor,Td,maxDoppler;
|
||||
int channel_length,nb_taps;
|
||||
struct complex *R_sqrt_ptr2;
|
||||
struct complexd *R_sqrt_ptr2;
|
||||
chan_desc->modelid = channel_model;
|
||||
chan_desc->nb_tx = nb_tx;
|
||||
chan_desc->nb_rx = nb_rx;
|
||||
@@ -625,39 +625,39 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
|
||||
} else if (nb_tx==2 && nb_rx==1) {
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R21_sqrt[i][0];
|
||||
} else if (nb_tx==1 && nb_rx==2) {
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R12_sqrt[i][0];
|
||||
} else {
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
|
||||
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
|
||||
@@ -687,39 +687,39 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 0.1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
|
||||
} else if (nb_tx==2 && nb_rx==1) {
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R21_sqrt[i][0];
|
||||
} else if (nb_tx==1 && nb_rx==2) {
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R12_sqrt[i][0];
|
||||
} else {
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
|
||||
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
|
||||
@@ -784,34 +784,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
|
||||
} else {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
|
||||
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
|
||||
@@ -840,21 +840,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd **));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_low;
|
||||
@@ -863,9 +863,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
}
|
||||
|
||||
/*else {
|
||||
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
|
||||
chan_desc->R_sqrt = (struct complexd**) malloc(6*sizeof(struct complexd**));
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
@@ -895,21 +895,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd **));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_high;
|
||||
@@ -918,9 +918,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
}
|
||||
|
||||
/*else {
|
||||
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
|
||||
chan_desc->R_sqrt = (struct complexd**) malloc(6*sizeof(struct complexd**));
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
@@ -950,21 +950,21 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd **));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_medium;
|
||||
@@ -973,9 +973,9 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
}
|
||||
|
||||
/*else {
|
||||
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
|
||||
chan_desc->R_sqrt = (struct complexd**) malloc(6*sizeof(struct complexd**));
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
@@ -1005,34 +1005,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
|
||||
} else {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
|
||||
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
|
||||
@@ -1061,34 +1061,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
if (nb_tx==2 && nb_rx==2) {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
|
||||
for (i = 0; i<6; i++)
|
||||
chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0];
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) &R22_sqrt[i][0];
|
||||
} else {
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ;
|
||||
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
|
||||
@@ -1117,28 +1117,28 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
chan_desc->ricean_factor = 1;
|
||||
chan_desc->aoa = 0;
|
||||
chan_desc->random_aoa = 0;
|
||||
chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *));
|
||||
chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *));
|
||||
chan_desc->ch = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->chF = (struct complexd **) malloc(nb_tx*nb_rx*sizeof(struct complexd *));
|
||||
chan_desc->a = (struct complexd **) malloc(chan_desc->nb_taps*sizeof(struct complexd *));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->ch[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex));
|
||||
chan_desc->ch[i] = (struct complexd *) malloc(chan_desc->channel_length * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<nb_tx*nb_rx; i++)
|
||||
chan_desc->chF[i] = (struct complex *) malloc(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
for (i = 0; i<chan_desc->nb_taps; i++)
|
||||
chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->a[i] = (struct complexd *) malloc(nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex *));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd *));
|
||||
chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6;
|
||||
|
||||
for (i = 0; i<6; i++) {
|
||||
chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
|
||||
chan_desc->R_sqrt[i] = (struct complexd *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complexd));
|
||||
|
||||
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
|
||||
chan_desc->R_sqrt[i][j].x = 1.0;
|
||||
chan_desc->R_sqrt[i][j].y = 0.0;
|
||||
chan_desc->R_sqrt[i][j].r = 1.0;
|
||||
chan_desc->R_sqrt[i][j].i = 0.0;
|
||||
}
|
||||
|
||||
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
|
||||
@@ -1716,8 +1716,8 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
for (i=0; i<(int)desc->nb_taps; i++) {
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
anew[aarx+(aatx*desc->nb_rx)].x = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
|
||||
anew[aarx+(aatx*desc->nb_rx)].y = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
|
||||
anew[aarx+(aatx*desc->nb_rx)].r = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
|
||||
anew[aarx+(aatx*desc->nb_rx)].i = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
|
||||
|
||||
if ((i==0) && (desc->ricean_factor != 1.0)) {
|
||||
if (desc->random_aoa==1) {
|
||||
@@ -1727,14 +1727,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
// this assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing.
|
||||
// Furhter it is assumed that the arrays are parallel to each other and that they are far enough apart so
|
||||
// that we can safely assume plane wave propagation.
|
||||
phase.x = cos(M_PI*((aarx-aatx)*sin(desc->aoa)));
|
||||
phase.y = sin(M_PI*((aarx-aatx)*sin(desc->aoa)));
|
||||
anew[aarx+(aatx*desc->nb_rx)].x += phase.x * sqrt(1.0-desc->ricean_factor);
|
||||
anew[aarx+(aatx*desc->nb_rx)].y += phase.y * sqrt(1.0-desc->ricean_factor);
|
||||
phase.r = cos(M_PI*((aarx-aatx)*sin(desc->aoa)));
|
||||
phase.i = sin(M_PI*((aarx-aatx)*sin(desc->aoa)));
|
||||
anew[aarx+(aatx*desc->nb_rx)].r += phase.r * sqrt(1.0-desc->ricean_factor);
|
||||
anew[aarx+(aatx*desc->nb_rx)].i += phase.i * sqrt(1.0-desc->ricean_factor);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].x,anew[aarx+(aatx*desc->nb_rx)].y,desc->aoa,desc->ricean_factor,phase.x,phase.y);
|
||||
printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].r,anew[aarx+(aatx*desc->nb_rx)].i,desc->aoa,desc->ricean_factor,phase.r,phase.i);
|
||||
#endif
|
||||
} //aatx
|
||||
} //aarx
|
||||
@@ -1751,10 +1751,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
*/
|
||||
//apply correlation matrix
|
||||
//compute acorr = R_sqrt[i] * anew
|
||||
alpha.x = 1.0;
|
||||
alpha.y = 0.0;
|
||||
beta.x = 0.0;
|
||||
beta.y = 0.0;
|
||||
alpha.r = 1.0;
|
||||
alpha.i = 0.0;
|
||||
beta.r = 0.0;
|
||||
beta.i = 0.0;
|
||||
cblas_zgemv(CblasRowMajor, CblasNoTrans, desc->nb_tx*desc->nb_rx, desc->nb_tx*desc->nb_rx,
|
||||
(void *) &alpha, (void *) desc->R_sqrt[i/3], desc->nb_rx*desc->nb_tx,
|
||||
(void *) anew, 1, (void *) &beta, (void *) acorr, 1);
|
||||
@@ -1775,10 +1775,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
// a = alpha*acorr+beta*a
|
||||
// a = beta*a
|
||||
// a = a+alpha*acorr
|
||||
alpha.x = sqrt(1-desc->forgetting_factor);
|
||||
alpha.y = 0;
|
||||
beta.x = sqrt(desc->forgetting_factor);
|
||||
beta.y = 0;
|
||||
alpha.r = sqrt(1-desc->forgetting_factor);
|
||||
alpha.i = 0;
|
||||
beta.r = sqrt(desc->forgetting_factor);
|
||||
beta.i = 0;
|
||||
cblas_zscal(desc->nb_tx*desc->nb_rx, (void *) &beta, (void *) desc->a[i], 1);
|
||||
cblas_zaxpy(desc->nb_tx*desc->nb_rx, (void *) &alpha, (void *) acorr, 1, (void *) desc->a[i], 1);
|
||||
// desc->a[i][aarx+(aatx*desc->nb_rx)].x = (sqrt(desc->forgetting_factor)*desc->a[i][aarx+(aatx*desc->nb_rx)].x) + sqrt(1-desc->forgetting_factor)*anew.x;
|
||||
@@ -1798,7 +1798,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
|
||||
stop_meas(&desc->random_channel);
|
||||
|
||||
//memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complex));
|
||||
//memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complexd));
|
||||
|
||||
if (abstraction_flag==0) {
|
||||
start_meas(&desc->interp_time);
|
||||
@@ -1806,12 +1806,12 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
if (desc->channel_length == 1) {
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][0].x = desc->a[0][aarx+(aatx*desc->nb_rx)].x;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][0].y = desc->a[0][aarx+(aatx*desc->nb_rx)].y;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][0].r = desc->a[0][aarx+(aatx*desc->nb_rx)].r;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][0].i = desc->a[0][aarx+(aatx*desc->nb_rx)].i;
|
||||
} else {
|
||||
for (k=0; k<(int)desc->channel_length; k++) {
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].x = 0.0;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].y = 0.0;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].r = 0.0;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].i = 0.0;
|
||||
|
||||
for (l=0; l<desc->nb_taps; l++) {
|
||||
if ((k - (desc->delays[l]*desc->sampling_rate) - desc->channel_offset) == 0)
|
||||
@@ -1820,13 +1820,13 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
s = sin(M_PI*(k - (desc->delays[l]*desc->sampling_rate) - desc->channel_offset))/
|
||||
(M_PI*(k - (desc->delays[l]*desc->sampling_rate) - desc->channel_offset));
|
||||
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].x += s*desc->a[l][aarx+(aatx*desc->nb_rx)].x;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].y += s*desc->a[l][aarx+(aatx*desc->nb_rx)].y;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].r += s*desc->a[l][aarx+(aatx*desc->nb_rx)].r;
|
||||
desc->ch[aarx+(aatx*desc->nb_rx)][k].i += s*desc->a[l][aarx+(aatx*desc->nb_rx)].i;
|
||||
// printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]);
|
||||
} //nb_taps
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y);
|
||||
printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].r,desc->ch[aarx+(aatx*desc->nb_rx)][k].i);
|
||||
#endif
|
||||
} //channel_length
|
||||
}
|
||||
@@ -2101,7 +2101,7 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double
|
||||
#define Td 2.0
|
||||
main(int argc,char **argv) {
|
||||
double amps[8] = {.8,.2,.1,.04,.02,.01,.005};
|
||||
struct complex ch[(int)(1+2*sampling_rate*Td)],phase;
|
||||
struct complexd ch[(int)(1+2*sampling_rate*Td)],phase;
|
||||
int i;
|
||||
randominit();
|
||||
phase.x = 1.0;
|
||||
|
||||
@@ -64,11 +64,11 @@ typedef struct {
|
||||
///length of impulse response. should be set to 11+2*bw*t_max
|
||||
uint8_t channel_length;
|
||||
///channel state vector. size(state) = nb_taps * (n_tx * n_rx);
|
||||
struct complex **a;
|
||||
struct complexd **a;
|
||||
///interpolated (sample-spaced) channel impulse response. size(ch) = (n_tx * n_rx) * channel_length. ATTENTION: the dimensions of ch are the transposed ones of a. This is to allow the use of BLAS when applying the correlation matrices to the state.
|
||||
struct complex **ch;
|
||||
struct complexd **ch;
|
||||
///Sampled frequency response (90 kHz resolution)
|
||||
struct complex **chF;
|
||||
struct complexd **chF;
|
||||
///Maximum path delay in mus.
|
||||
double Td;
|
||||
///Channel bandwidth in MHz.
|
||||
@@ -84,7 +84,7 @@ typedef struct {
|
||||
///in Hz. if >0 generate a channel with a Clarke's Doppler profile with a maximum Doppler bandwidth max_Doppler. CURRENTLY NOT IMPLEMENTED!
|
||||
double max_Doppler;
|
||||
///Square root of the full correlation matrix size(R_tx) = nb_taps * (n_tx * n_rx) * (n_tx * n_rx).
|
||||
struct complex **R_sqrt;
|
||||
struct complexd **R_sqrt;
|
||||
///path loss including shadow fading in dB
|
||||
double path_loss_dB;
|
||||
///additional delay of channel in samples.
|
||||
|
||||
Reference in New Issue
Block a user