Merge branch 'develop' into phy-asan-fixes
This commit is contained in:
@@ -231,7 +231,6 @@ void clear_UE_transport_info(uint8_t nb_UE)
|
||||
|
||||
for (UE_id=0; UE_id<nb_UE; UE_id++)
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
UE_transport_info_TB_index[UE_id][CC_id]=0;
|
||||
memset((void *)&UE_transport_info[UE_id][CC_id].cntl,0,sizeof(UE_cntl));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ extern eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
extern uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
|
||||
extern UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
extern uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
|
||||
extern UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
|
||||
|
||||
UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
|
||||
|
||||
UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -87,7 +87,6 @@ uint16_t sl_ahead=0;
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
THREAD_STRUCT thread_struct;
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
msc_interface_t msc_interface;
|
||||
uint32_t N_RB_DL = 106;
|
||||
|
||||
// dummy functions
|
||||
@@ -227,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];
|
||||
@@ -263,6 +267,8 @@ void nr_dlsim_preprocessor(module_id_t module_id,
|
||||
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
|
||||
ps->nrOfLayers = g_nrOfLayers;
|
||||
|
||||
nr_set_pdsch_semi_static(scc,
|
||||
UE_info->CellGroup[0],
|
||||
sched_ctrl->active_bwp,
|
||||
@@ -278,7 +284,6 @@ void nr_dlsim_preprocessor(module_id_t module_id,
|
||||
* configuration */
|
||||
ps->mcsTableIdx = g_mcsTableIdx;
|
||||
|
||||
sched_pdsch->nrOfLayers = g_nrOfLayers;
|
||||
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
|
||||
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
|
||||
@@ -288,7 +293,7 @@ void nr_dlsim_preprocessor(module_id_t module_id,
|
||||
ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
|
||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||
0 /* tb_scaling */,
|
||||
sched_pdsch->nrOfLayers)
|
||||
ps->nrOfLayers)
|
||||
>> 3;
|
||||
|
||||
/* the simulator assumes the HARQ PID is equal to the slot number */
|
||||
@@ -409,6 +414,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");
|
||||
}
|
||||
@@ -419,7 +425,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");
|
||||
@@ -475,14 +481,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;
|
||||
@@ -641,7 +643,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");
|
||||
@@ -687,6 +689,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;
|
||||
@@ -758,7 +761,7 @@ int main(int argc, char **argv)
|
||||
|
||||
prepare_scd(scd);
|
||||
|
||||
fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0);
|
||||
fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0);
|
||||
|
||||
/* RRC parameter validation for secondaryCellGroup */
|
||||
fix_scd(scd);
|
||||
@@ -777,9 +780,9 @@ int main(int argc, char **argv)
|
||||
AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface");
|
||||
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||
// common configuration
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 0, 0, NULL);
|
||||
// UE dedicated configuration
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
// reset preprocessor to the one of DLSIM after it has been set during
|
||||
// rrc_mac_config_req_gNB
|
||||
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
|
||||
@@ -907,6 +910,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);
|
||||
@@ -929,6 +933,7 @@ int main(int argc, char **argv)
|
||||
//Configure UE
|
||||
rrc.carrier.MIB = (uint8_t*) malloc(4);
|
||||
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
|
||||
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
|
||||
|
||||
|
||||
@@ -1015,12 +1020,13 @@ int main(int argc, char **argv)
|
||||
NR_gNB_DLSCH_t *gNB_dlsch = msgDataTx->dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
UE_harq_process->harq_ack.ack = 0;
|
||||
UE_harq_process->ack = 0;
|
||||
round = 0;
|
||||
UE_harq_process->round = round;
|
||||
UE_harq_process->first_tx = 1;
|
||||
UE_harq_process->first_rx = 1;
|
||||
|
||||
while ((round<num_rounds) && (UE_harq_process->harq_ack.ack==0)) {
|
||||
while ((round<num_rounds) && (UE_harq_process->ack==0)) {
|
||||
|
||||
memset(RC.nrmac[0]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
|
||||
memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int));
|
||||
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot);
|
||||
@@ -1095,7 +1101,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,7 +1265,7 @@ int main(int argc, char **argv)
|
||||
printf("errors_bit = %u (trial %d)\n", errors_bit, trial);
|
||||
}
|
||||
roundStats[snrRun]+=((float)round);
|
||||
if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round;
|
||||
if (UE_harq_process->ack==1) effRate += ((float)TBS)/round;
|
||||
} // noise trials
|
||||
|
||||
blerStats[snrRun] = (float) n_errors / (float) n_trials;
|
||||
@@ -1330,7 +1337,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;
|
||||
@@ -27,4 +33,5 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
NR_UE_DLSCH_t *dlsch1,
|
||||
uint16_t n_pdus) {}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -70,6 +70,31 @@ softmodem_params_t *get_softmodem_params(void) {return 0;}
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int n_ss) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int eNB_id, PDSCH_t pdsch,
|
||||
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int gNB_id,
|
||||
PDSCH_t pdsch,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
NR_UE_DLSCH_t *dlsch1,
|
||||
int *dlsch_errors,
|
||||
uint8_t dlsch_parallel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
int N_RB_DL,
|
||||
int N_RB_UL,
|
||||
@@ -110,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);
|
||||
|
||||
@@ -406,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;
|
||||
@@ -684,7 +712,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if (UE->is_synchronized == 0) {
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
ret = nr_initial_sync(&proc, UE, 1);
|
||||
ret = nr_initial_sync(&proc, UE, 1, 0, 0);
|
||||
printf("nr_initial_sync1 returns %d\n",ret);
|
||||
if (ret<0) n_errors++;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ extern uint16_t prach_root_sequence_map0_3[838];
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
//uint8_t nfapi_mode=0;
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
uint16_t sl_ahead = 0;
|
||||
msc_interface_t msc_interface;
|
||||
uint32_t N_RB_DL = 106;
|
||||
@@ -81,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(
|
||||
@@ -216,7 +222,7 @@ int main(int argc, char **argv){
|
||||
char c;
|
||||
|
||||
double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0;
|
||||
double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw;
|
||||
double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs=-1, bw;
|
||||
int i, l, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
||||
int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0;
|
||||
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0;
|
||||
|
||||
@@ -457,32 +457,8 @@ int main(int argc, char **argv)
|
||||
bzero(rxdataF[i],14*frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
UE->pucch_config_common_nr->hoppingId = Nid_cell;
|
||||
//phy_init_nr_top(UE); //called from init_nr_ue_signal
|
||||
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0)
|
||||
{
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
uint8_t mcs=0;
|
||||
startingPRB_intraSlotHopping=N_RB_DL-1;
|
||||
pucch_GroupHopping_t PUCCH_GroupHopping=UE->pucch_config_common_nr->pucch_GroupHopping;
|
||||
uint32_t hopping_id=UE->pucch_config_common_nr->hoppingId;
|
||||
uint32_t dmrs_scrambling_id = 0, data_scrambling_id=0;
|
||||
//t_nrPolar_params *currentPtr;
|
||||
|
||||
int shift = 0;
|
||||
|
||||
if(format==0){
|
||||
if (sr_flag)
|
||||
shift = 1<<nr_bit;
|
||||
@@ -496,6 +472,63 @@ int main(int argc, char **argv)
|
||||
}
|
||||
else if (format == 2 && nr_bit > 11) gNB->uci_polarParams = nr_polar_params(2, nr_bit, nrofPRB, 1, NULL);
|
||||
|
||||
startingPRB_intraSlotHopping=N_RB_DL-1;
|
||||
uint32_t hopping_id=Nid_cell;
|
||||
uint32_t dmrs_scrambling_id = 0, data_scrambling_id=0;
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
fapi_nr_ul_config_pucch_pdu pucch_tx_pdu;
|
||||
if (format==0) {
|
||||
pucch_tx_pdu.format_type = 0;
|
||||
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
||||
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_tx_pdu.bwp_start = 0;
|
||||
pucch_tx_pdu.prb_start = startingPRB;
|
||||
pucch_tx_pdu.hopping_id = hopping_id;
|
||||
pucch_tx_pdu.group_hop_flag = 0;
|
||||
pucch_tx_pdu.sequence_hop_flag = 0;
|
||||
pucch_tx_pdu.freq_hop_flag = 0;
|
||||
pucch_tx_pdu.mcs = mcs;
|
||||
pucch_tx_pdu.initial_cyclic_shift = 0;
|
||||
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
||||
}
|
||||
if (format==2) {
|
||||
pucch_tx_pdu.format_type = 2;
|
||||
pucch_tx_pdu.rnti = 0x1234;
|
||||
pucch_tx_pdu.n_bit = nr_bit;
|
||||
pucch_tx_pdu.payload = actual_payload;
|
||||
pucch_tx_pdu.nr_of_symbols = nrofSymbols;
|
||||
pucch_tx_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_tx_pdu.bwp_start = 0;
|
||||
pucch_tx_pdu.prb_start = startingPRB;
|
||||
pucch_tx_pdu.prb_size = nrofPRB;
|
||||
pucch_tx_pdu.hopping_id = hopping_id;
|
||||
pucch_tx_pdu.group_hop_flag = 0;
|
||||
pucch_tx_pdu.sequence_hop_flag = 0;
|
||||
pucch_tx_pdu.freq_hop_flag = 0;
|
||||
pucch_tx_pdu.dmrs_scrambling_id = dmrs_scrambling_id;
|
||||
pucch_tx_pdu.data_scrambling_id = data_scrambling_id;
|
||||
pucch_tx_pdu.second_hop_prb = startingPRB_intraSlotHopping;
|
||||
}
|
||||
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if(eps!=0.0)
|
||||
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
|
||||
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0)
|
||||
{
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag<<1);
|
||||
|
||||
//t_nrPolar_params *currentPtr;
|
||||
|
||||
for(SNR=snr0;SNR<=snr1;SNR=SNR+1){
|
||||
ack_nack_errors=0;
|
||||
sr_errors=0;
|
||||
@@ -503,13 +536,28 @@ int main(int argc, char **argv)
|
||||
for (trial=0; trial<n_trials; trial++) {
|
||||
bzero(txdataF[aa],frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
if(format==0){
|
||||
nr_generate_pucch0(UE,txdataF,frame_parms,PUCCH_GroupHopping,hopping_id,amp,nr_slot_tx,m0,mcs,nrofSymbols,startingSymbolIndex,startingPRB, 0);
|
||||
nr_generate_pucch0(UE,
|
||||
txdataF,
|
||||
frame_parms,
|
||||
amp,
|
||||
nr_slot_tx,
|
||||
&pucch_tx_pdu);
|
||||
}
|
||||
else if (format == 1){
|
||||
nr_generate_pucch1(UE,txdataF,frame_parms,UE->pucch_config_dedicated,actual_payload,amp,nr_slot_tx,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,0,nr_bit);
|
||||
nr_generate_pucch1(UE,
|
||||
txdataF,
|
||||
frame_parms,
|
||||
amp,
|
||||
nr_slot_tx,
|
||||
&pucch_tx_pdu);
|
||||
}
|
||||
else {
|
||||
nr_generate_pucch2(UE,0x1234,dmrs_scrambling_id,data_scrambling_id,txdataF,frame_parms,UE->pucch_config_dedicated,actual_payload,amp,nr_slot_tx,nrofSymbols,startingSymbolIndex,nrofPRB,startingPRB,nr_bit);
|
||||
nr_generate_pucch2(UE,
|
||||
txdataF,
|
||||
frame_parms,
|
||||
amp,
|
||||
nr_slot_tx,
|
||||
&pucch_tx_pdu);
|
||||
}
|
||||
|
||||
int txlev = signal_energy(&txdataF[aa][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -83,7 +83,6 @@ double cpuf;
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
THREAD_STRUCT thread_struct;
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
msc_interface_t msc_interface;
|
||||
uint32_t N_RB_DL = 106;
|
||||
|
||||
extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration
|
||||
@@ -213,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)
|
||||
@@ -286,7 +290,7 @@ int main(int argc, char **argv)
|
||||
int gNB_id = 0;
|
||||
int ap;
|
||||
int tx_offset;
|
||||
int32_t txlev;
|
||||
int32_t txlev=0;
|
||||
int start_rb = 0;
|
||||
int UE_id =0; // [hna] only works for UE_id = 0 because NUMBER_OF_NR_UE_MAX is set to 1 (phy_init_nr_gNB causes segmentation fault)
|
||||
float target_error_rate = 0.01;
|
||||
@@ -298,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;
|
||||
@@ -309,7 +314,7 @@ int main(int argc, char **argv)
|
||||
uint16_t ptrsSymbPerSlot = 0;
|
||||
uint16_t ptrsRePerSymb = 0;
|
||||
|
||||
uint8_t transform_precoding = transform_precoder_disabled; // 0 - ENABLE, 1 - DISABLE
|
||||
uint8_t transform_precoding = 1; // 0 - ENABLE, 1 - DISABLE
|
||||
uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
uint8_t mcs_table = 0;
|
||||
|
||||
@@ -331,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) {
|
||||
|
||||
@@ -423,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;
|
||||
@@ -461,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;
|
||||
@@ -566,7 +575,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case 'Z':
|
||||
|
||||
transform_precoding = transform_precoder_enabled;
|
||||
transform_precoding = 0; // enabled
|
||||
num_dmrs_cdm_grps_no_data = 2;
|
||||
mcs_table = 3;
|
||||
|
||||
@@ -582,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");
|
||||
@@ -629,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;
|
||||
@@ -653,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";
|
||||
@@ -665,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)
|
||||
|
||||
|
||||
@@ -697,7 +712,7 @@ int main(int argc, char **argv)
|
||||
|
||||
prepare_scd(scd);
|
||||
|
||||
fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0);
|
||||
fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0);
|
||||
|
||||
// xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
|
||||
|
||||
@@ -708,9 +723,9 @@ int main(int argc, char **argv)
|
||||
|
||||
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||
// common configuration
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 0, 0, NULL);
|
||||
// UE dedicated configuration
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
phy_init_nr_gNB(gNB,0,1);
|
||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||
|
||||
@@ -797,7 +812,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;
|
||||
@@ -840,7 +859,8 @@ int main(int argc, char **argv)
|
||||
uint16_t number_dmrs_symbols = get_dmrs_symbols_in_slot(l_prime_mask, nb_symb_sch);
|
||||
uint8_t nb_re_dmrs = (dmrs_config_type == pusch_dmrs_type1) ? 6 : 4;
|
||||
|
||||
if (transform_precoding == transform_precoder_enabled) {
|
||||
// if transform precoding is enabled
|
||||
if (transform_precoding == 0) {
|
||||
|
||||
AssertFatal(enable_ptrs == 0, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n");
|
||||
|
||||
@@ -944,9 +964,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) {
|
||||
@@ -968,6 +991,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++) {
|
||||
@@ -1045,7 +1072,8 @@ int main(int argc, char **argv)
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
|
||||
|
||||
if (transform_precoding == transform_precoder_enabled) {
|
||||
// if transform precoding is enabled
|
||||
if (transform_precoding == 0) {
|
||||
|
||||
pusch_pdu->dfts_ofdm.low_papr_group_number = *scc->physCellId % 30; // U as defined in 38.211 section 6.4.1.1.1.2
|
||||
pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0; // V as defined in 38.211 section 6.4.1.1.1.2
|
||||
@@ -1105,7 +1133,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.transform_precoding = transform_precoding;
|
||||
|
||||
if (transform_precoding == transform_precoder_enabled) {
|
||||
// if transform precoding is enabled
|
||||
if (transform_precoding == 0) {
|
||||
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dfts_ofdm.low_papr_group_number = *scc->physCellId % 30;// U as defined in 38.211 section 6.4.1.1.1.2
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dfts_ofdm.low_papr_sequence_number = 0;// V as defined in 38.211 section 6.4.1.1.1.2
|
||||
@@ -1158,7 +1187,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]);
|
||||
}
|
||||
@@ -1215,7 +1244,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
if (n_trials == 1 && round==0) {
|
||||
if (n_trials == 1 && round==0) {
|
||||
#ifdef __AVX2__
|
||||
int off = ((nb_rb&1) == 1)? 4:0;
|
||||
#else
|
||||
@@ -1226,6 +1255,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);
|
||||
@@ -1343,6 +1374,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); }
|
||||
|
||||
|
||||
@@ -111,14 +111,14 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
|
||||
for (aarx=0; aarx<desc->nb_rx; aarx++) {
|
||||
for (aatx=0; aatx<desc->nb_tx; aatx++) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,42 +138,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);
|
||||
@@ -191,42 +191,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);
|
||||
|
||||
@@ -70,16 +70,16 @@ void do_DL_sig(sim_t *sim,
|
||||
|
||||
double s_re0[30720];
|
||||
double s_re1[30720];
|
||||
double *s_re[2];
|
||||
double *s_re[RC.nb_RU];
|
||||
double s_im0[30720];
|
||||
double s_im1[30720];
|
||||
double *s_im[2];
|
||||
double *s_im[RC.nb_RU];
|
||||
double r_re00[30720];
|
||||
double r_re01[30720];
|
||||
double *r_re0[2];
|
||||
double *r_re0[RC.nb_RU];
|
||||
double r_im00[30720];
|
||||
double r_im01[30720];
|
||||
double *r_im0[2];
|
||||
double *r_im0[RC.nb_RU];
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
s_re[0] = s_re0;
|
||||
@@ -320,16 +320,16 @@ void do_UL_sig(sim_t *sim,
|
||||
|
||||
double s_re0[30720];
|
||||
double s_re1[30720];
|
||||
double *s_re[2];
|
||||
double *s_re[NB_UE_INST];
|
||||
double s_im0[30720];
|
||||
double s_im1[30720];
|
||||
double *s_im[2];
|
||||
double *s_im[NB_UE_INST];
|
||||
double r_re00[30720];
|
||||
double r_re01[30720];
|
||||
double *r_re0[2];
|
||||
double *r_re0[NB_UE_INST];
|
||||
double r_im00[30720];
|
||||
double r_im01[30720];
|
||||
double *r_im0[2];
|
||||
double *r_im0[NB_UE_INST];
|
||||
|
||||
s_re[0] = s_re0;
|
||||
s_im[0] = s_im0;
|
||||
|
||||
@@ -57,11 +57,11 @@ R22_sqrt_int(2:2:end,:,:) = imag(R22_sqrt);
|
||||
|
||||
%%
|
||||
fid = fopen('scm_corrmat.h','w');
|
||||
fprintf(fid,'double R22_sqrt[][] = {\n');
|
||||
fprintf(fid,'static double R22_sqrt[][] = {\n');
|
||||
for i=1:size(Gamma,3)
|
||||
fprintf(fid,'{');
|
||||
fprintf(fid,'%f, ',R22_sqrt_int(:,:,i));
|
||||
fprintf(fid,'\b\b},\n');
|
||||
end
|
||||
fprintf(fid,'};\n');
|
||||
fclose(fid)
|
||||
fclose(fid)
|
||||
|
||||
@@ -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,52 +116,52 @@ 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[0];
|
||||
chan_desc->R_sqrt[i] = R_sqrt;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,13 +177,13 @@ void fill_channel_desc(channel_desc_t *chan_desc,
|
||||
reset_meas(&chan_desc->convolution);
|
||||
}
|
||||
|
||||
double mbsfn_delays[] = {0,.03,.15,.31,.37,1.09,12.490,12.52,12.64,12.80,12.86,13.58,27.49,27.52,27.64,27.80,27.86,28.58};
|
||||
double mbsfn_amps_dB[] = {0,-1.5,-1.4,-3.6,-0.6,-7.0,-10,-11.5,-11.4,-13.6,-10.6,-17.0,-20,-21.5,-21.4,-23.6,-20.6,-27};
|
||||
static double mbsfn_delays[] = {0,.03,.15,.31,.37,1.09,12.490,12.52,12.64,12.80,12.86,13.58,27.49,27.52,27.64,27.80,27.86,28.58};
|
||||
static double mbsfn_amps_dB[] = {0,-1.5,-1.4,-3.6,-0.6,-7.0,-10,-11.5,-11.4,-13.6,-10.6,-17.0,-20,-21.5,-21.4,-23.6,-20.6,-27};
|
||||
|
||||
double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250};
|
||||
double scm_c_amps_dB[] = {0.00, -2.22, -3.98, -1.86, -4.08, -5.84, -1.08, -3.30, -5.06, -9.08, -11.30, -13.06, -15.14, -17.36, -19.12, -20.64, -22.85, -24.62};
|
||||
static double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250};
|
||||
static double scm_c_amps_dB[] = {0.00, -2.22, -3.98, -1.86, -4.08, -5.84, -1.08, -3.30, -5.06, -9.08, -11.30, -13.06, -15.14, -17.36, -19.12, -20.64, -22.85, -24.62};
|
||||
|
||||
double tdl_a_delays[] = {0.0000,
|
||||
static double tdl_a_delays[] = {0.0000,
|
||||
0.3819,
|
||||
0.4025,
|
||||
0.5868,
|
||||
@@ -207,7 +207,7 @@ double tdl_a_delays[] = {0.0000,
|
||||
5.3043,
|
||||
9.6586
|
||||
};
|
||||
double tdl_a_amps_dB[] = {-13.4,
|
||||
static double tdl_a_amps_dB[] = {-13.4,
|
||||
0,
|
||||
-2.2,
|
||||
-4,
|
||||
@@ -232,7 +232,7 @@ double tdl_a_amps_dB[] = {-13.4,
|
||||
-29.7
|
||||
};
|
||||
|
||||
double tdl_b_delays[] = {0.0000,
|
||||
static double tdl_b_delays[] = {0.0000,
|
||||
0.1072,
|
||||
0.2155,
|
||||
0.2095,
|
||||
@@ -257,7 +257,7 @@ double tdl_b_delays[] = {0.0000,
|
||||
4.7834
|
||||
};
|
||||
|
||||
double tdl_b_amps_dB[] = {0,
|
||||
static double tdl_b_amps_dB[] = {0,
|
||||
-2.2,
|
||||
-4,
|
||||
-3.2,
|
||||
@@ -282,7 +282,7 @@ double tdl_b_amps_dB[] = {0,
|
||||
-11.3
|
||||
};
|
||||
|
||||
double tdl_c_delays[] = {0,
|
||||
static double tdl_c_delays[] = {0,
|
||||
0.2099,
|
||||
0.2219,
|
||||
0.2329,
|
||||
@@ -308,7 +308,7 @@ double tdl_c_delays[] = {0,
|
||||
8.6523
|
||||
};
|
||||
|
||||
double tdl_c_amps_dB[] = {-4.4,
|
||||
static double tdl_c_amps_dB[] = {-4.4,
|
||||
-1.2,
|
||||
-3.5,
|
||||
-5.2,
|
||||
@@ -334,7 +334,7 @@ double tdl_c_amps_dB[] = {-4.4,
|
||||
-22.8
|
||||
};
|
||||
|
||||
double tdl_d_delays[] = {//0,
|
||||
static double tdl_d_delays[] = {//0,
|
||||
0,
|
||||
0.035,
|
||||
0.612,
|
||||
@@ -350,7 +350,7 @@ double tdl_d_delays[] = {//0,
|
||||
12.525
|
||||
};
|
||||
|
||||
double tdl_d_amps_dB[] = {//-0.2,
|
||||
static double tdl_d_amps_dB[] = {//-0.2,
|
||||
//-13.5,
|
||||
-.00147,
|
||||
-18.8,
|
||||
@@ -369,7 +369,7 @@ double tdl_d_amps_dB[] = {//-0.2,
|
||||
|
||||
#define TDL_D_RICEAN_FACTOR .046774
|
||||
|
||||
double tdl_e_delays[] = {0,
|
||||
static double tdl_e_delays[] = {0,
|
||||
0.5133,
|
||||
0.5440,
|
||||
0.5630,
|
||||
@@ -385,7 +385,7 @@ double tdl_e_delays[] = {0,
|
||||
20.6519
|
||||
};
|
||||
|
||||
double tdl_e_amps_dB[] = {//-0.03,
|
||||
static double tdl_e_amps_dB[] = {//-0.03,
|
||||
//-22.03,
|
||||
-.00433,
|
||||
-15.8,
|
||||
@@ -405,102 +405,78 @@ double tdl_e_amps_dB[] = {//-0.03,
|
||||
|
||||
#define TDL_E_RICEAN_FACTOR 0.0063096
|
||||
|
||||
double epa_delays[] = { 0,.03,.07,.09,.11,.19,.41};
|
||||
double epa_amps_dB[] = {0.0,-1.0,-2.0,-3.0,-8.0,-17.2,-20.8};
|
||||
static double epa_delays[] = { 0,.03,.07,.09,.11,.19,.41};
|
||||
static double epa_amps_dB[] = {0.0,-1.0,-2.0,-3.0,-8.0,-17.2,-20.8};
|
||||
|
||||
double eva_delays[] = { 0,.03,.15,.31,.37,.71,1.09,1.73,2.51};
|
||||
double eva_amps_dB[] = {0.0,-1.5,-1.4,-3.6,-0.6,-9.1,-7.0,-12.0,-16.9};
|
||||
static double eva_delays[] = { 0,.03,.15,.31,.37,.71,1.09,1.73,2.51};
|
||||
static double eva_amps_dB[] = {0.0,-1.5,-1.4,-3.6,-0.6,-9.1,-7.0,-12.0,-16.9};
|
||||
|
||||
double etu_delays[] = { 0,.05,.12,.2,.23,.5,1.6,2.3,5.0};
|
||||
double etu_amps_dB[] = {-1.0,-1.0,-1.0,0.0,0.0,0.0,-3.0,-5.0,-7.0};
|
||||
static double etu_delays[] = { 0,.05,.12,.2,.23,.5,1.6,2.3,5.0};
|
||||
static double etu_amps_dB[] = {-1.0,-1.0,-1.0,0.0,0.0,0.0,-3.0,-5.0,-7.0};
|
||||
|
||||
double default_amps_lin[] = {0.3868472, 0.3094778, 0.1547389, 0.0773694, 0.0386847, 0.0193424, 0.0096712, 0.0038685};
|
||||
double default_amp_lin[] = {1};
|
||||
|
||||
double ts_shift_delays[] = {0, 1/7.68};
|
||||
double ts_shift_amps[] = {0, 1};
|
||||
static double default_amps_lin[] = {0.3868472, 0.3094778, 0.1547389, 0.0773694, 0.0386847, 0.0193424, 0.0096712, 0.0038685};
|
||||
static double default_amp_lin[] = {1};
|
||||
|
||||
//correlation matrix for a 2x2 channel with full Tx correlation
|
||||
struct complex R_sqrt_22_corr_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_corr[1] = {R_sqrt_22_corr_tap};
|
||||
|
||||
//correlation matrix for a fully correlated 2x1 channel (h1==h2)
|
||||
struct complex R_sqrt_21_corr_tap[4] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}};
|
||||
struct complex *R_sqrt_21_corr[1] = {R_sqrt_21_corr_tap};
|
||||
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
|
||||
struct complex R_sqrt_22_anticorr_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_anticorr[1] = {R_sqrt_22_anticorr_tap};
|
||||
|
||||
//correlation matrix for a fully anti-correlated 2x1 channel (h1==-h2)
|
||||
struct complex R_sqrt_21_anticorr_tap[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}};
|
||||
struct complex *R_sqrt_21_anticorr[1] = {R_sqrt_21_anticorr_tap};
|
||||
|
||||
struct complex **R_sqrt_ptr2;
|
||||
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
|
||||
|
||||
struct complex R_sqrt_22_orthogonal_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_orthogonal[1] = {R_sqrt_22_orthogonal_tap};
|
||||
|
||||
// full correlation matrix for TM4 to make orthogonal effective channel
|
||||
|
||||
|
||||
|
||||
|
||||
struct complex R_sqrt_22_orth_eff_ch_TM4_prec_real_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_real[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_real_tap};
|
||||
|
||||
|
||||
|
||||
|
||||
struct complex R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_imag[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap};
|
||||
|
||||
//Correlation matrix for EPA channel
|
||||
struct complex R_sqrt_22_EPA_low_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_EPA_low[1] = {R_sqrt_22_EPA_low_tap};
|
||||
|
||||
struct complex R_sqrt_22_EPA_high_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_EPA_high[1] = {R_sqrt_22_EPA_high_tap};
|
||||
|
||||
struct complex R_sqrt_22_EPA_medium_tap[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}
|
||||
};
|
||||
struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap};
|
||||
|
||||
|
||||
|
||||
//Rayleigh1_orth_eff_ch_TM4
|
||||
|
||||
@@ -535,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(1200 * sizeof(struct complex));
|
||||
chan_desc->chF[i] = (struct complexd *) malloc(1200 * sizeof(struct complexd));
|
||||
|
||||
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(6*sizeof(struct complex **));
|
||||
chan_desc->R_sqrt = (struct complexd **) malloc(6*sizeof(struct complexd **));
|
||||
|
||||
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);
|
||||
@@ -600,6 +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 complexd *R_sqrt_ptr2;
|
||||
chan_desc->modelid = channel_model;
|
||||
chan_desc->nb_tx = nb_tx;
|
||||
chan_desc->nb_rx = nb_rx;
|
||||
@@ -648,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);
|
||||
@@ -710,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);
|
||||
@@ -807,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");
|
||||
@@ -863,32 +840,32 @@ 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[0];
|
||||
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_low;
|
||||
} else {
|
||||
printf("Correlation matrices are implemented for 2 x 2 only");
|
||||
}
|
||||
|
||||
/*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;
|
||||
@@ -918,32 +895,32 @@ 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[0];
|
||||
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_high;
|
||||
} else {
|
||||
printf("Correlation matrices are implemented for 2 x 2 only");
|
||||
}
|
||||
|
||||
/*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;
|
||||
@@ -973,32 +950,32 @@ 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[0];
|
||||
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_medium;
|
||||
} else {
|
||||
printf("Correlation matrices are implemented for 2 x 2 only");
|
||||
}
|
||||
|
||||
/*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;
|
||||
@@ -1028,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");
|
||||
@@ -1084,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");
|
||||
@@ -1140,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");
|
||||
@@ -1397,11 +1374,13 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
|
||||
case TS_SHIFT:
|
||||
nb_taps = 2;
|
||||
double ts_shift_delays[] = {0, 1/7.68};
|
||||
Td = ts_shift_delays[1];
|
||||
channel_length = 10;
|
||||
ricean_factor = 0.0;
|
||||
aoa = 0.0;
|
||||
maxDoppler = 0;
|
||||
double ts_shift_amps[] = {0, 1};
|
||||
fill_channel_desc(chan_desc,nb_tx,
|
||||
nb_rx,
|
||||
nb_taps,
|
||||
@@ -1729,8 +1708,8 @@ void set_channeldesc_name(channel_desc_t *cdesc,char *modelname) {
|
||||
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
|
||||
double s;
|
||||
int i,k,l,aarx,aatx;
|
||||
struct complex anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX];
|
||||
struct complex phase, alpha, beta;
|
||||
struct complexd anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX];
|
||||
struct complexd phase, alpha, beta;
|
||||
AssertFatal(desc->nb_tx<=NB_ANTENNAS_TX && desc->nb_rx <= NB_ANTENNAS_RX,
|
||||
"random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx);
|
||||
start_meas(&desc->random_channel);
|
||||
@@ -1738,8 +1717,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) {
|
||||
@@ -1749,10 +1728,10 @@ 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
|
||||
@@ -1773,10 +1752,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);
|
||||
@@ -1797,10 +1776,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;
|
||||
@@ -1820,7 +1799,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);
|
||||
@@ -1828,12 +1807,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)
|
||||
@@ -1842,8 +1821,8 @@ 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
|
||||
|
||||
@@ -2123,7 +2102,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;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
double R22_sqrt[6][32] = {
|
||||
static double R22_sqrt[6][32] = {
|
||||
{0.921700, -0.000000, 0.010380, -0.027448, -0.250153, 0.294754, 0.005961, 0.010769, 0.010380, 0.027448, 0.921700, 0.000000, -0.011595, -0.004130, -0.250153, 0.294754, -0.250153, -0.294754, -0.011595, 0.004130, 0.921700, 0.000000, 0.010380, -0.027448, 0.005961, -0.010769, -0.250153, -0.294754, 0.010380, 0.027448, 0.921700, 0.000000},
|
||||
{0.923810, 0.000000, 0.004069, 0.027832, 0.151730, 0.350180, -0.009882, 0.006114, 0.004069, -0.027832, 0.923810, 0.000000, 0.011218, -0.003029, 0.151730, 0.350180, 0.151730, -0.350180, 0.011218, 0.003029, 0.923810, -0.000000, 0.004069, 0.027832, -0.009882, -0.006114, 0.151730, -0.350180, 0.004069, -0.027832, 0.923810, 0.000000},
|
||||
{0.927613, 0.000000, 0.014253, 0.025767, -0.061171, -0.367133, 0.009258, -0.007340, 0.014253, -0.025767, 0.927613, -0.000000, -0.011138, -0.003942, -0.061171, -0.367133, -0.061171, 0.367133, -0.011138, 0.003942, 0.927613, 0.000000, 0.014253, 0.025767, 0.009258, 0.007340, -0.061171, 0.367133, 0.014253, -0.025767, 0.927613, 0.000000},
|
||||
@@ -27,7 +27,7 @@ double R22_sqrt[6][32] = {
|
||||
{0.919726, -0.000000, 0.038700, -0.111146, 0.217804, 0.300925, 0.045531, -0.013659, 0.038700, 0.111146, 0.919726, 0.000000, -0.027201, 0.038983, 0.217804, 0.300925, 0.217804, -0.300925, -0.027201, -0.038983, 0.919726, 0.000000, 0.038700, -0.111146, 0.045531, 0.013659, 0.217804, -0.300925, 0.038700, 0.111146, 0.919726, 0.000000},
|
||||
{0.867608, -0.000000, 0.194097, -0.112414, -0.418811, 0.095938, -0.081264, 0.075727, 0.194097, 0.112414, 0.867608, -0.000000, -0.106125, -0.032801, -0.418811, 0.095938, -0.418811, -0.095938, -0.106125, 0.032801, 0.867608, 0.000000, 0.194097, -0.112414, -0.081264, -0.075727, -0.418811, -0.095938, 0.194097, 0.112414, 0.867608, 0.000000},
|
||||
};
|
||||
double R21_sqrt[6][8] = {
|
||||
static double R21_sqrt[6][8] = {
|
||||
{0.922167, 0.000000,-0.250280, 0.294903,-0.250280, -0.294903,0.922167, 0.000000},
|
||||
{0.924238, 0.000000,0.151801, 0.350342,0.151801, -0.350342,0.924238, 0.000000},
|
||||
{0.928080, 0.000000,-0.061202, -0.367318,-0.061202, 0.367318,0.928080, 0.000000},
|
||||
@@ -35,7 +35,7 @@ double R21_sqrt[6][8] = {
|
||||
{0.927225, 0.000000,0.219580, 0.303378,0.219580, -0.303378,0.927225, 0.000000},
|
||||
{0.896133, 0.000000,-0.432581, 0.099092,-0.432581, -0.099092,0.896133, 0.000000},
|
||||
};
|
||||
double R12_sqrt[6][8] = {
|
||||
static double R12_sqrt[6][8] = {
|
||||
{0.999494, 0.000000,0.011256, -0.029765,0.011256, 0.029765,0.999494, 0.000000},
|
||||
{0.999537, 0.000000,0.004402, 0.030114,0.004402, -0.030114,0.999537, 0.000000},
|
||||
{0.999497, 0.000000,0.015358, 0.027764,0.015358, -0.027764,0.999497, 0.000000},
|
||||
|
||||
@@ -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