Merge branch 'eurecom-develop' into episys/merge_nsa_w_develop
At this point we are successfully able to build. Additionally, we can run the scenario, however, it does not pass. It seems that the gNB is not connecting to the proxy correctly. Just wanted to push the progress so far. FYI, the items that had to be changed to correct the linking issues were the following: - mac_rrc_data_ind_ue vs. nr_mac_rrc_data_ind_ue - rrc_data_req vs. nr_rrc_data_req - mac_rrc_data_req_ue vs. nr_mac_rrc_data_req_ue - rrc_data_req_ue vs. rrc_data_req_nr_ue - rrc_data_req vs. nr_rrc_data_req The listed functions should be declard in the LTE/NR UE directory depending on the functionality. Several were mixed. i.e.: LTE functions being called in NR UE. Also, removing siWindowLength, siWindowLength_int, SIBType, SIBPeriod, and siPeriod_int from the NR UE RRC. These variable were not used in the NR UE and are defined for LTE only. Lastly, in the NR_IF_Module.c of the NR UE, the global variable def_dci_pdu_rel15 is not accessible. Need to revisit this. For not it is commented out.
This commit is contained in:
@@ -46,13 +46,13 @@ void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastAc
|
||||
}
|
||||
|
||||
double squareRoot(time_stats_t *ptr) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials -
|
||||
pow((double)ptr->diff/ptr->trials*timeBase,2));
|
||||
}
|
||||
|
||||
void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
printf("%-43s %6.2f us (%d trials)\n",
|
||||
txt,
|
||||
(double)ptr->diff/ptr->trials*timeBase,
|
||||
@@ -69,7 +69,7 @@ void printStatIndent(time_stats_t *ptr, char *txt) {
|
||||
}
|
||||
|
||||
void printStatIndent2(time_stats_t *ptr, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
printf(" |__ %-34s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
|
||||
@@ -77,7 +77,7 @@ void printStatIndent2(time_stats_t *ptr, char *txt) {
|
||||
}
|
||||
|
||||
void printStatIndent3(time_stats_t *ptr, char *txt) {
|
||||
double timeBase=1/(1000*cpu_freq_GHz);
|
||||
double timeBase=1/(1000*get_cpu_freq_GHz());
|
||||
printf(" |__ %-30s %6.2f us (%3d trials)\n",
|
||||
txt,
|
||||
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
|
||||
|
||||
@@ -60,16 +60,19 @@
|
||||
#include "dummy_functions.c"
|
||||
#include "executables/thread-common.h"
|
||||
#include "executables/split_headers.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
void feptx_ofdm(RU_t *ru, int frame, int subframe);
|
||||
void feptx_prec(RU_t *ru, int frame, int subframe);
|
||||
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
#include <openair1/SIMULATION/LTE_PHY/common_sim.h>
|
||||
|
||||
int otg_enabled=0;
|
||||
THREAD_STRUCT thread_struct;
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
|
||||
/*the following parameters are used to control the processing times calculations*/
|
||||
double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */
|
||||
double t_rx_max = -1000000000; /*!< \brief initial max process time for rx */
|
||||
@@ -82,6 +85,7 @@ double DS_TDL = .03;
|
||||
static int cmpdouble(const void *p1, const void *p2) {
|
||||
return *(double *)p1 > *(double *)p2;
|
||||
}
|
||||
RAN_CONTEXT_t RC;
|
||||
|
||||
int emulate_rf = 0;
|
||||
int split73=0;
|
||||
@@ -933,9 +937,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
NB_RB = conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL);
|
||||
} else {
|
||||
if (rballocset==0) NB_RB = 8;
|
||||
if (rballocset==0) NB_RB = 2+TPC;
|
||||
else NB_RB = DLSCH_RB_ALLOC;
|
||||
|
||||
printf("Common PDSCH: NB_RB = %d\n",NB_RB);
|
||||
AssertFatal(NB_RB <= N_RB_DL,"illegal NB_RB %d\n",NB_RB);
|
||||
}
|
||||
|
||||
@@ -1179,7 +1184,7 @@ int main(int argc, char **argv) {
|
||||
DS_TDL,
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
reset_meas(&eNB2UE[0]->random_channel);
|
||||
reset_meas(&eNB2UE[0]->interp_time);
|
||||
|
||||
@@ -1193,7 +1198,7 @@ int main(int argc, char **argv) {
|
||||
DS_TDL,
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
reset_meas(&eNB2UE[n]->random_channel);
|
||||
reset_meas(&eNB2UE[n]->interp_time);
|
||||
}
|
||||
|
||||
@@ -988,7 +988,7 @@ int main(int argc, char **argv)
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if(num_rounds>1) {
|
||||
for(n=1; n<8; n++)
|
||||
@@ -999,7 +999,7 @@ int main(int argc, char **argv)
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
}
|
||||
|
||||
if (eNB2UE[0]==NULL) {
|
||||
|
||||
@@ -834,7 +834,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if(num_rounds>1) {
|
||||
for(n=1; n<4; n++)
|
||||
@@ -845,7 +845,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
}
|
||||
|
||||
if (eNB2UE[0]==NULL) {
|
||||
|
||||
@@ -1290,7 +1290,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
reset_meas(&eNB2UE[0]->random_channel);
|
||||
reset_meas(&eNB2UE[0]->interp_time);
|
||||
|
||||
@@ -1303,7 +1303,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
forgetting_factor,
|
||||
rx_sample_offset,
|
||||
0);
|
||||
0, 0);
|
||||
reset_meas(&eNB2UE[n]->random_channel);
|
||||
reset_meas(&eNB2UE[n]->interp_time);
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf1>-20)
|
||||
eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
@@ -396,7 +396,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
4,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf2>-20)
|
||||
eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
@@ -406,7 +406,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
8,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -708,7 +708,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx;
|
||||
eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0);
|
||||
UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
|
||||
|
||||
@@ -343,7 +343,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
delay,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (UE2eNB==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -323,7 +323,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (UE2eNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -335,7 +335,7 @@ int main(int argc, char **argv) {
|
||||
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -724,7 +724,7 @@ int main(int argc, char **argv) {
|
||||
BW,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf1>-20)
|
||||
eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
|
||||
@@ -733,7 +733,7 @@ int main(int argc, char **argv) {
|
||||
BW,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (interf2>-20)
|
||||
eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
|
||||
@@ -742,7 +742,7 @@ int main(int argc, char **argv) {
|
||||
BW,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
|
||||
@@ -55,9 +55,11 @@
|
||||
#include "executables/thread-common.h"
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
#include "executables/split_headers.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
//#define MCS_COUNT 23//added for PHY abstraction
|
||||
#include <openair1/SIMULATION/LTE_PHY/common_sim.h>
|
||||
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
|
||||
@@ -70,6 +72,9 @@ node_desc_t *ue_data[NUMBER_OF_UE_MAX];
|
||||
extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16];
|
||||
//extern char* namepointer_chMag ;
|
||||
int xforms=0;
|
||||
THREAD_STRUCT thread_struct;
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
|
||||
FD_lte_phy_scope_enb *form_enb;
|
||||
char title[255];
|
||||
|
||||
@@ -84,7 +89,7 @@ static int cmpdouble(const void *p1, const void *p2) {
|
||||
return *(double *)p1 > *(double *)p2;
|
||||
}
|
||||
|
||||
|
||||
RAN_CONTEXT_t RC;
|
||||
int split73=0;
|
||||
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
|
||||
AssertFatal(false, "Must not be called in this context\n");
|
||||
@@ -342,7 +347,6 @@ int main(int argc, char **argv) {
|
||||
int UE_id = 0;
|
||||
static int nb_rb=25,first_rb=0,mcs=0,round=0;
|
||||
//unsigned char l;
|
||||
static int awgn_flag = 0 ;
|
||||
SCM_t channel_model=Rice1;
|
||||
unsigned char *input_buffer=0,harq_pid;
|
||||
unsigned short input_buffer_length;
|
||||
@@ -404,7 +408,7 @@ int main(int argc, char **argv) {
|
||||
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
|
||||
AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL, "Cannot load configuration module, exiting\n");
|
||||
logInit();
|
||||
set_glog(OAILOG_WARNING);
|
||||
set_glog(OAILOG_INFO);
|
||||
T_stdout = 1;
|
||||
// enable these lines if you need debug info
|
||||
// however itti will catch all signals, so ctrl-c won't work anymore
|
||||
@@ -734,7 +738,7 @@ int main(int argc, char **argv) {
|
||||
30e-9,
|
||||
forgetting_factor,
|
||||
delay,
|
||||
0);
|
||||
0, 0);
|
||||
// set Doppler
|
||||
UE2eNB->max_Doppler = maxDoppler;
|
||||
|
||||
@@ -1086,14 +1090,12 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (awgn_flag == 0) {
|
||||
if (UE2eNB->max_Doppler == 0) {
|
||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
eNB->frame_parms.samples_per_tti,hold_channel,0);
|
||||
} else {
|
||||
multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
2*eNB->frame_parms.samples_per_tti,hold_channel);
|
||||
}
|
||||
if (UE2eNB->max_Doppler == 0) {
|
||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
eNB->frame_parms.samples_per_tti,hold_channel,0);
|
||||
} else {
|
||||
multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
2*eNB->frame_parms.samples_per_tti,hold_channel);
|
||||
}
|
||||
|
||||
if(abstx) {
|
||||
@@ -1136,6 +1138,15 @@ int main(int argc, char **argv) {
|
||||
sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
if (n_frames==1)
|
||||
for (i=0; i<eNB->frame_parms.samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i] =
|
||||
(short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i+1] =
|
||||
(short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
|
||||
if (n_frames<=10) {
|
||||
printf("rx_level Null symbol %f\n",10*log10((double)signal_energy((int *)
|
||||
@@ -1161,9 +1172,10 @@ int main(int argc, char **argv) {
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full;
|
||||
ru->feprx(ru,subframe);
|
||||
if (n_frames==1) lte_eNB_I0_measurements(eNB,(subframe+1)%10,0,1);
|
||||
|
||||
phy_procedures_eNB_uespec_RX(eNB,proc_rxtx);
|
||||
stop_meas(&eNB->phy_proc_rx);
|
||||
|
||||
if (cqi_flag > 0) {
|
||||
cqi_error = 0;
|
||||
|
||||
@@ -1203,6 +1215,9 @@ int main(int argc, char **argv) {
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->uci_format,0,eNB->frame_parms.N_RB_DL);
|
||||
|
||||
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
|
||||
dump_I0_stats(stdout,eNB);
|
||||
dump_ulsch_stats(stdout,eNB,0);
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -1263,14 +1278,16 @@ int main(int argc, char **argv) {
|
||||
if (t_rx > 2000 )
|
||||
n_rx_dropped++;
|
||||
|
||||
appendVarArray(table_tx, &t_tx);
|
||||
appendVarArray(table_tx_ifft, &t_tx_ifft);
|
||||
appendVarArray(table_tx_mod, &t_tx_mod );
|
||||
appendVarArray(table_tx_enc, &t_tx_enc );
|
||||
appendVarArray(table_rx, &t_rx );
|
||||
appendVarArray(table_rx_fft, &t_rx_fft );
|
||||
appendVarArray(table_rx_demod, &t_rx_demod );
|
||||
appendVarArray(table_rx_dec, &t_rx_dec );
|
||||
if (trials < 1000) {
|
||||
appendVarArray(table_tx, &t_tx);
|
||||
appendVarArray(table_tx_ifft, &t_tx_ifft);
|
||||
appendVarArray(table_tx_mod, &t_tx_mod );
|
||||
appendVarArray(table_tx_enc, &t_tx_enc );
|
||||
appendVarArray(table_rx, &t_rx );
|
||||
appendVarArray(table_rx_fft, &t_rx_fft );
|
||||
appendVarArray(table_rx_demod, &t_rx_demod );
|
||||
appendVarArray(table_rx_dec, &t_rx_dec );
|
||||
}
|
||||
} //trials
|
||||
|
||||
// sort table
|
||||
@@ -1289,6 +1306,7 @@ int main(int argc, char **argv) {
|
||||
LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n");
|
||||
}
|
||||
|
||||
dump_ulsch_stats(stdout,eNB,0);
|
||||
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %u dB, delta_IF %d [ (%d,%d) dB / (%u,%u) dB ]**************************\n",
|
||||
nb_rb,mcs,SNR,SNR2,
|
||||
tx_lev_dB,
|
||||
|
||||
@@ -339,7 +339,7 @@ int main(int argc, char **argv)
|
||||
61.44e6, //N_RB2sampling_rate(N_RB_DL),
|
||||
40e6, //N_RB2channel_bandwidth(N_RB_DL),
|
||||
DS_TDL,
|
||||
0, 0, 0);
|
||||
0, 0, 0, 0);
|
||||
|
||||
if (gNB2UE == NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -357,7 +357,7 @@ int main(int argc, char **argv)
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
crcTableInit();
|
||||
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell,SSB_positions);
|
||||
phy_init_nr_gNB(gNB, 0, 0);
|
||||
phy_init_nr_gNB(gNB, 0, 1); //lowmem
|
||||
//init_eNB_afterRU();
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe;
|
||||
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
|
||||
|
||||
+327
-129
@@ -63,12 +63,14 @@
|
||||
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
#include "NR_RRCReconfiguration.h"
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
#include "SIMULATION/LTE_PHY/common_sim.h"
|
||||
|
||||
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||
|
||||
#include <executables/softmodem-common.h>
|
||||
|
||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||
rlc_info_t Rlc_info_um,Rlc_info_am_config;
|
||||
|
||||
@@ -79,20 +81,42 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
double cpuf;
|
||||
|
||||
int sf_ahead=4 ;
|
||||
int sl_ahead=0;
|
||||
uint16_t sf_ahead=4 ;
|
||||
uint16_t sl_ahead=0;
|
||||
//uint8_t nfapi_mode = 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
|
||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_index,
|
||||
const int8_t channel,
|
||||
const uint8_t* pduP,
|
||||
const sdu_size_t pdu_len)
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_index,
|
||||
const frame_t frame,
|
||||
const sub_frame_t sub_frame,
|
||||
const rnti_t rnti,
|
||||
const channel_t channel,
|
||||
const uint8_t* pduP,
|
||||
const sdu_size_t pdu_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
uint8_t *buffer_pP)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -107,6 +131,12 @@ rrc_data_ind(
|
||||
{
|
||||
}
|
||||
|
||||
int ocp_gtpv1u_create_s1u_tunnel(instance_t instance,
|
||||
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
|
||||
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
gtpv1u_create_s1u_tunnel(
|
||||
const instance_t instanceP,
|
||||
@@ -142,6 +172,10 @@ gtpv1u_update_ngu_tunnel(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
@@ -158,7 +192,9 @@ int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||
}
|
||||
|
||||
void config_common(int Mod_idP,
|
||||
int pdsch_AntennaPorts,
|
||||
int ssb_SubcarrierOffset,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc
|
||||
);
|
||||
|
||||
@@ -178,6 +214,19 @@ int is_x2ap_enabled(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
int CC_idP,
|
||||
int UE_id,
|
||||
rnti_t rntiP,
|
||||
const uint8_t *sduP,
|
||||
sdu_size_t sdu_lenP,
|
||||
const uint8_t *sdu2P,
|
||||
sdu_size_t sdu2_lenP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void processSlotTX(void *arg) {}
|
||||
|
||||
//nFAPI P7 dummy functions
|
||||
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
@@ -185,43 +234,66 @@ 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); }
|
||||
|
||||
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// needed for some functions
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg);
|
||||
void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dmrs_arg);
|
||||
void update_dmrs_config(NR_CellGroupConfig_t *scg, int8_t* dmrs_arg);
|
||||
extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration
|
||||
|
||||
/* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs from command line of
|
||||
/* specific dlsim DL preprocessor: uses rbStart/rbSize/mcs/nrOfLayers from command line of
|
||||
dlsim, does not search for CCE/PUCCH occasion but simply sets to 0 */
|
||||
int g_mcsIndex = -1, g_mcsTableIdx = 0, g_rbStart = -1, g_rbSize = -1;
|
||||
int g_mcsIndex = -1, g_mcsTableIdx = 0, g_rbStart = -1, g_rbSize = -1, g_nrOfLayers = 1;
|
||||
void nr_dlsim_preprocessor(module_id_t module_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot) {
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
AssertFatal(UE_info->num_UEs == 1, "can have only a single UE\n");
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[0];
|
||||
NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon;
|
||||
|
||||
/* manually set free CCE to 0 */
|
||||
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss);
|
||||
sched_ctrl->search_space = get_searchspace(scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, target_ss);
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&sched_ctrl->aggregation_level,
|
||||
&nr_of_candidates,
|
||||
sched_ctrl->search_space);
|
||||
sched_ctrl->coreset = get_coreset(
|
||||
sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
||||
sched_ctrl->coreset = get_coreset(scc, sched_ctrl->active_bwp, sched_ctrl->search_space, target_ss);
|
||||
sched_ctrl->cce_index = 0;
|
||||
|
||||
sched_ctrl->rbStart = g_rbStart;
|
||||
sched_ctrl->rbSize = g_rbSize;
|
||||
sched_ctrl->mcs = g_mcsIndex;
|
||||
sched_ctrl->time_domain_allocation = 2;
|
||||
sched_ctrl->mcsTableIdx = g_mcsTableIdx;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
|
||||
nr_set_pdsch_semi_static(scc,
|
||||
UE_info->CellGroup[0],
|
||||
sched_ctrl->active_bwp,
|
||||
/* tda = */ 2,
|
||||
/* num_dmrs_cdm_grps_no_data = */ 1,
|
||||
ps);
|
||||
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
sched_pdsch->rbStart = g_rbStart;
|
||||
sched_pdsch->rbSize = g_rbSize;
|
||||
sched_pdsch->mcs = g_mcsIndex;
|
||||
/* the following might override the table that is mandated by RRC
|
||||
* 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,
|
||||
sched_pdsch->R,
|
||||
sched_pdsch->rbSize,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
|
||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||
0 /* tb_scaling */,
|
||||
sched_pdsch->nrOfLayers)
|
||||
>> 3;
|
||||
|
||||
/* the simulator assumes the HARQ PID is equal to the slot number */
|
||||
sched_ctrl->dl_harq_pid = slot;
|
||||
sched_pdsch->dl_harq_pid = slot;
|
||||
|
||||
/* The scheduler uses lists to track whether a HARQ process is
|
||||
* free/busy/awaiting retransmission, and updates the HARQ process states.
|
||||
* However, in the simulation, we never get ack or nack for any HARQ process,
|
||||
@@ -234,13 +306,26 @@ void nr_dlsim_preprocessor(module_id_t module_id,
|
||||
else
|
||||
add_front_nr_list(&sched_ctrl->retrans_dl_harq, slot); // ... make PID retransmission
|
||||
sched_ctrl->harq_processes[slot].is_waiting = false;
|
||||
AssertFatal(sched_ctrl->rbStart >= 0, "invalid rbStart %d\n", sched_ctrl->rbStart);
|
||||
AssertFatal(sched_ctrl->rbSize > 0, "invalid rbSize %d\n", sched_ctrl->rbSize);
|
||||
AssertFatal(sched_ctrl->mcs >= 0, "invalid sched_ctrl->mcs %d\n", sched_ctrl->mcs);
|
||||
AssertFatal(sched_ctrl->mcsTableIdx >= 0 && sched_ctrl->mcsTableIdx <= 2, "invalid sched_ctrl->mcsTableIdx %d\n", sched_ctrl->mcsTableIdx);
|
||||
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
||||
AssertFatal(sched_pdsch->rbStart >= 0, "invalid rbStart %d\n", sched_pdsch->rbStart);
|
||||
AssertFatal(sched_pdsch->rbSize > 0, "invalid rbSize %d\n", sched_pdsch->rbSize);
|
||||
AssertFatal(sched_pdsch->mcs >= 0, "invalid mcs %d\n", sched_pdsch->mcs);
|
||||
AssertFatal(ps->mcsTableIdx >= 0 && ps->mcsTableIdx <= 2, "invalid mcsTableIdx %d\n", ps->mcsTableIdx);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint64_t optmask; //mask to store boolean config options
|
||||
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
|
||||
tpool_t Tpool; // thread pool
|
||||
} nrUE_params_t;
|
||||
|
||||
nrUE_params_t nrUE_params;
|
||||
|
||||
nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
|
||||
void do_nothing(void *args) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -248,12 +333,15 @@ int main(int argc, char **argv)
|
||||
int i,aa;//,l;
|
||||
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
|
||||
uint8_t snr1set=0;
|
||||
float roundStats[50];
|
||||
double roundStats[500] = {0};
|
||||
double blerStats[500] = {0};
|
||||
double berStats[500] = {0};
|
||||
double snrStats[500] = {0};
|
||||
float effRate;
|
||||
//float psnr;
|
||||
float eff_tp_check = 0.7;
|
||||
uint8_t snrRun;
|
||||
uint32_t TBS;
|
||||
uint32_t TBS = 0;
|
||||
int **txdata;
|
||||
double **s_re,**s_im,**r_re,**r_im;
|
||||
//double iqim = 0.0;
|
||||
@@ -268,7 +356,7 @@ int main(int argc, char **argv)
|
||||
// char fname[40], vname[40];
|
||||
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
|
||||
//int n_errors2, n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint8_t n_tx=1,n_rx=1;
|
||||
uint8_t round;
|
||||
uint8_t num_rounds = 4;
|
||||
|
||||
@@ -282,7 +370,7 @@ int main(int argc, char **argv)
|
||||
|
||||
//uint8_t frame_mod4,num_pdcch_symbols = 0;
|
||||
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
SCM_t channel_model = AWGN; // AWGN Rayleigh1 Rayleigh1_anticorr;
|
||||
|
||||
NB_UE_INST = 1;
|
||||
//double pbch_sinr;
|
||||
@@ -301,8 +389,6 @@ int main(int argc, char **argv)
|
||||
NR_UE_MAC_INST_t *UE_mac;
|
||||
int cyclic_prefix_type = NFAPI_CP_NORMAL;
|
||||
int run_initial_sync=0;
|
||||
int pusch_tgt_snrx10 = 200;
|
||||
int pucch_tgt_snrx10 = 200;
|
||||
int loglvl=OAILOG_INFO;
|
||||
|
||||
//float target_error_rate = 0.01;
|
||||
@@ -312,7 +398,7 @@ int main(int argc, char **argv)
|
||||
int8_t enable_ptrs = 0;
|
||||
int8_t modify_dmrs = 0;
|
||||
|
||||
int8_t dmrs_arg[2] = {-1,-1};// Invalid values
|
||||
int8_t dmrs_arg[3] = {-1,-1,-1};// Invalid values
|
||||
/* L_PTRS = ptrs_arg[0], K_PTRS = ptrs_arg[1] */
|
||||
int8_t ptrs_arg[2] = {-1,-1};// Invalid values
|
||||
|
||||
@@ -378,6 +464,10 @@ int main(int argc, char **argv)
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
channel_model=Rayleigh1;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
@@ -427,12 +517,11 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
g_nrOfLayers=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
printf("Unsupported transmission mode %d\n",transmission_mode);
|
||||
if ((g_nrOfLayers!=1) &&
|
||||
(g_nrOfLayers!=2)) {
|
||||
printf("Unsupported nr Of Layers %d\n",g_nrOfLayers);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -441,7 +530,7 @@ int main(int argc, char **argv)
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
if ((n_tx==0) || (n_tx>4)) {//extend gNB to support n_tx = 4
|
||||
printf("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -451,7 +540,7 @@ int main(int argc, char **argv)
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
if ((n_rx==0) || (n_rx>4)) {//extend UE to support n_tx = 4
|
||||
printf("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -549,7 +638,7 @@ int main(int argc, char **argv)
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\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("-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");
|
||||
@@ -570,7 +659,7 @@ int main(int argc, char **argv)
|
||||
printf("-q Use 2nd MCS table (256 QAM table) for PDSCH\n");
|
||||
printf("-t Acceptable effective throughput (in percentage)\n");
|
||||
printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n");
|
||||
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2}, e.g. -U 2 0 2 \n");
|
||||
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n");
|
||||
printf("-P Print DLSCH performances\n");
|
||||
printf("-w Write txdata to binary file (one frame)\n");
|
||||
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
|
||||
@@ -586,7 +675,8 @@ int main(int argc, char **argv)
|
||||
InitSinLUT();
|
||||
|
||||
get_softmodem_params()->phy_test = 1;
|
||||
|
||||
get_softmodem_params()->do_ra = 0;
|
||||
|
||||
if (snr1set==0)
|
||||
snr1 = snr0+10;
|
||||
init_dlsch_tpool(dlsch_threads);
|
||||
@@ -609,7 +699,6 @@ int main(int argc, char **argv)
|
||||
RC.nb_nr_mac_CC[i] = 1;
|
||||
mac_top_init_gNB();
|
||||
gNB_mac = RC.nrmac[0];
|
||||
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
|
||||
gNB_RRC_INST rrc;
|
||||
memset((void*)&rrc,0,sizeof(rrc));
|
||||
|
||||
@@ -659,23 +748,23 @@ int main(int argc, char **argv)
|
||||
rrc.carrier.servingcellconfigcommon = calloc(1,sizeof(*rrc.carrier.servingcellconfigcommon));
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = rrc.carrier.servingcellconfigcommon;
|
||||
NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t));
|
||||
NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup));
|
||||
prepare_scc(rrc.carrier.servingcellconfigcommon);
|
||||
uint64_t ssb_bitmap;
|
||||
uint64_t ssb_bitmap = 1;
|
||||
fill_scc(rrc.carrier.servingcellconfigcommon,&ssb_bitmap,N_RB_DL,N_RB_DL,mu,mu);
|
||||
|
||||
ssb_bitmap = 1;// Enable only first SSB with index ssb_indx=0
|
||||
fix_scc(scc,ssb_bitmap);
|
||||
|
||||
fill_default_secondaryCellGroup(scc,
|
||||
secondaryCellGroup,
|
||||
0,
|
||||
1,
|
||||
n_tx,
|
||||
0);
|
||||
prepare_scd(scd);
|
||||
|
||||
fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0);
|
||||
|
||||
/* RRC parameter validation for secondaryCellGroup */
|
||||
fix_scd(scd);
|
||||
/* -U option modify DMRS */
|
||||
if(modify_dmrs) {
|
||||
update_dmrs_config(secondaryCellGroup, NULL,dmrs_arg);
|
||||
update_dmrs_config(secondaryCellGroup, dmrs_arg);
|
||||
}
|
||||
/* -T option enable PTRS */
|
||||
if(enable_ptrs) {
|
||||
@@ -688,10 +777,13 @@ 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,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL);
|
||||
// UE dedicated configuration
|
||||
rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 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;
|
||||
phy_init_nr_gNB(gNB,0,1);
|
||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info;
|
||||
UE_info->num_UEs=1;
|
||||
@@ -738,12 +830,12 @@ int main(int argc, char **argv)
|
||||
gNB2UE = new_channel_desc_scm(n_tx,
|
||||
n_rx,
|
||||
channel_model,
|
||||
fs,
|
||||
fs/1e6,//sampling frequency in MHz
|
||||
bw,
|
||||
30e-9,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (gNB2UE==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -753,28 +845,28 @@ int main(int argc, char **argv)
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
//frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
txdata = malloc(2*sizeof(int*));
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
s_re = malloc(n_tx*sizeof(double*));
|
||||
s_im = malloc(n_tx*sizeof(double*));
|
||||
r_re = malloc(n_rx*sizeof(double*));
|
||||
r_im = malloc(n_rx*sizeof(double*));
|
||||
txdata = malloc(n_tx*sizeof(int*));
|
||||
|
||||
for (i=0; i<n_tx; i++) {
|
||||
s_re[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(s_re[i],frame_length_complex_samples*sizeof(double));
|
||||
s_im[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(s_im[i],frame_length_complex_samples*sizeof(double));
|
||||
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(txdata[i],frame_length_complex_samples*sizeof(int));
|
||||
}
|
||||
|
||||
for (i=0; i<n_rx; i++) {
|
||||
r_re[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(double));
|
||||
r_im[i] = malloc(frame_length_complex_samples*sizeof(double));
|
||||
bzero(r_im[i],frame_length_complex_samples*sizeof(double));
|
||||
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(txdata[i],frame_length_complex_samples*sizeof(int));
|
||||
|
||||
}
|
||||
|
||||
if (pbch_file_fd!=NULL) {
|
||||
@@ -789,6 +881,7 @@ int main(int argc, char **argv)
|
||||
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE*));
|
||||
PHY_vars_UE_g[0][0] = UE;
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
UE->frame_parms.nb_antennas_rx = n_rx;
|
||||
|
||||
if (run_initial_sync==1) UE->is_synchronized = 0;
|
||||
else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;}
|
||||
@@ -801,13 +894,10 @@ int main(int argc, char **argv)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if(modify_dmrs) {
|
||||
update_dmrs_config( NULL,UE,dmrs_arg);
|
||||
}
|
||||
init_nr_ue_transport(UE,0);
|
||||
|
||||
nr_gold_pbch(UE);
|
||||
nr_gold_pdcch(UE,0,2);
|
||||
nr_gold_pdcch(UE,0);
|
||||
|
||||
nr_l2_init_ue(NULL);
|
||||
UE_mac = get_mac_inst(0);
|
||||
@@ -827,6 +917,7 @@ int main(int argc, char **argv)
|
||||
unsigned int errors_bit = 0;
|
||||
uint32_t errors_scrambling = 0;
|
||||
|
||||
initTpool("N", &(nrUE_params.Tpool), false);
|
||||
|
||||
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
@@ -834,13 +925,13 @@ int main(int argc, char **argv)
|
||||
// generate signal
|
||||
AssertFatal(input_fd==NULL,"Not ready for input signal file\n");
|
||||
gNB->pbch_configured = 1;
|
||||
gNB->ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
|
||||
gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
|
||||
gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0;
|
||||
|
||||
//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,secondaryCellGroup);
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
|
||||
|
||||
|
||||
nr_dcireq_t dcireq;
|
||||
@@ -858,7 +949,7 @@ int main(int argc, char **argv)
|
||||
scheduled_response.CC_id = 0;
|
||||
scheduled_response.frame = frame;
|
||||
scheduled_response.slot = slot;
|
||||
scheduled_response.thread_id = UE_proc.thread_id;
|
||||
scheduled_response.thread_id = 0;
|
||||
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
||||
@@ -960,16 +1051,16 @@ int main(int argc, char **argv)
|
||||
printf("[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb );
|
||||
}
|
||||
if (run_initial_sync)
|
||||
nr_common_signal_procedures(gNB,frame,slot);
|
||||
nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[0].ssb_pdu);
|
||||
else
|
||||
phy_procedures_gNB_TX(gNB,frame,slot,0);
|
||||
phy_procedures_gNB_TX(gNB,frame,slot,1);
|
||||
|
||||
int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsigF0.m","txsF0", &gNB->common_vars.txdataF[0][txdataF_offset],frame_parms->samples_per_slot_wCP,1,1);
|
||||
LOG_M("txsigF0.m","txsF0=", &gNB->common_vars.txdataF[0][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1", &gNB->common_vars.txdataF[1][txdataF_offset],frame_parms->samples_per_slot_wCP,1,1);
|
||||
LOG_M("txsigF1.m","txsF1=", &gNB->common_vars.txdataF[1][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
}
|
||||
int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
if (n_trials==1) printf("tx_offset %d, txdataF_offset %d \n", tx_offset,txdataF_offset);
|
||||
@@ -993,45 +1084,84 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", &txdata[0][tx_offset],frame_parms->get_samples_slot_timestamp(slot,frame_parms,0),1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsig1.m","txs1", &txdata[1][tx_offset],frame_parms->get_samples_slot_timestamp(slot,frame_parms,0),1,1);
|
||||
char filename[100];//LOG_M
|
||||
for (aa=0;aa<n_tx;aa++) {
|
||||
sprintf(filename,"txsig%d.m", aa);//LOG_M
|
||||
LOG_M(filename,"txs", &txdata[aa][tx_offset+frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0],6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples),1,1);
|
||||
}
|
||||
}
|
||||
if (output_fd) {
|
||||
printf("writing txdata to binary file\n");
|
||||
fwrite(txdata[0],sizeof(int32_t),frame_length_complex_samples,output_fd);
|
||||
}
|
||||
|
||||
int txlev = signal_energy(&txdata[0][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
|
||||
// if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev));
|
||||
int txlev[n_tx];
|
||||
int txlev_sum = 0;
|
||||
int l_ofdm = 6;
|
||||
for (aa=0; aa<n_tx; aa++) {
|
||||
txlev[aa] = signal_energy(&txdata[aa][tx_offset+l_ofdm*frame_parms->ofdm_symbol_size + (l_ofdm-1)*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
txlev_sum += txlev[aa];
|
||||
if (n_trials==1) printf("txlev[%d] = %d (%f dB) txlev_sum %d\n",aa,txlev[aa],10*log10((double)txlev[aa]),txlev_sum);
|
||||
}
|
||||
|
||||
for (i=(frame_parms->get_samples_slot_timestamp(slot,frame_parms,0));
|
||||
i<(frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0));
|
||||
i++) {
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
||||
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
||||
s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
||||
s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
||||
}
|
||||
}
|
||||
|
||||
double ts = 1.0/(frame_parms->subcarrier_spacing * frame_parms->ofdm_symbol_size);
|
||||
//AWGN
|
||||
sigma2_dB = 10 * log10((double)txlev * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR;
|
||||
//Compute AWGN variance
|
||||
sigma2_dB = 10 * log10((double)txlev_sum * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR;
|
||||
sigma2 = pow(10, sigma2_dB/10);
|
||||
if (n_trials==1) printf("sigma2 %f (%f dB), txlev %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize));
|
||||
if (n_trials==1) printf("sigma2 %f (%f dB), txlev_sum %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev_sum),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize));
|
||||
|
||||
for (aa=0; aa<n_rx; aa++) {
|
||||
bzero(r_re[aa],frame_length_complex_samples*sizeof(double));
|
||||
bzero(r_im[aa],frame_length_complex_samples*sizeof(double));
|
||||
}
|
||||
|
||||
// Apply MIMO Channel
|
||||
if (channel_model != AWGN) multipath_tv_channel(gNB2UE,
|
||||
s_re,
|
||||
s_im,
|
||||
r_re,
|
||||
r_im,
|
||||
frame_length_complex_samples,
|
||||
0);
|
||||
|
||||
double H_awgn_mimo[4][4] ={{1.0, 0.5, 0.25, 0.125},//rx 0
|
||||
{0.5, 1.0, 0.5, 0.25}, //rx 1
|
||||
{0.25, 0.5, 1.0, 0.5}, //rx 2
|
||||
{0.125, 0.25, 0.5, 1.0}};//rx 3
|
||||
|
||||
for (i=frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
i<frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0);
|
||||
i++) {
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
for (int aa_rx=0; aa_rx<n_rx; aa_rx++) {
|
||||
|
||||
if (channel_model == AWGN) {
|
||||
// sum up signals from different Tx antennas
|
||||
r_re[aa_rx][i] = 0;
|
||||
r_im[aa_rx][i] = 0;
|
||||
for (aa=0; aa<n_tx; aa++) {
|
||||
r_re[aa_rx][i] += s_re[aa][i]*H_awgn_mimo[aa_rx][aa];
|
||||
r_im[aa_rx][i] += s_im[aa][i]*H_awgn_mimo[aa_rx][aa];
|
||||
}
|
||||
}
|
||||
// Add Gaussian noise
|
||||
((short*) UE->common_vars.rxdata[aa_rx])[2*i] = (short) ((r_re[aa_rx][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa_rx])[2*i+1] = (short) ((r_im[aa_rx][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
/* Add phase noise if enabled */
|
||||
if (pdu_bit_map & 0x1) {
|
||||
phase_noise(ts, &((short*) UE->common_vars.rxdata[aa])[2*i],
|
||||
&((short*) UE->common_vars.rxdata[aa])[2*i+1]);
|
||||
phase_noise(ts, &((short*) UE->common_vars.rxdata[aa_rx])[2*i],
|
||||
&((short*) UE->common_vars.rxdata[aa_rx])[2*i+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1042,7 +1172,8 @@ int main(int argc, char **argv)
|
||||
phy_procedures_nrUE_RX(UE,
|
||||
&UE_proc,
|
||||
0,
|
||||
dlsch_threads);
|
||||
dlsch_threads,
|
||||
NULL);
|
||||
|
||||
//printf("dlsim round %d ends\n",round);
|
||||
round++;
|
||||
@@ -1071,10 +1202,10 @@ int main(int argc, char **argv)
|
||||
available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2);
|
||||
printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) );
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < available_bits; i++) {
|
||||
|
||||
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
||||
|
||||
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
||||
((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0)))
|
||||
{
|
||||
if(errors_scrambling == 0) {
|
||||
@@ -1083,7 +1214,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
errors_scrambling++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for (i = 0; i < TBS; i++) {
|
||||
|
||||
@@ -1114,7 +1245,9 @@ int main(int argc, char **argv)
|
||||
if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round;
|
||||
} // noise trials
|
||||
|
||||
blerStats[snrRun] = (float) n_errors / (float) n_trials;
|
||||
roundStats[snrRun]/=((float)n_trials);
|
||||
berStats[snrRun] = (double)errors_scrambling/available_bits/n_trials;
|
||||
effRate /= n_trials;
|
||||
printf("*****************************************\n");
|
||||
printf("SNR %f, (false positive %f)\n", SNR,
|
||||
@@ -1122,7 +1255,7 @@ int main(int argc, char **argv)
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
dump_pdsch_stats(gNB);
|
||||
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS);
|
||||
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS);
|
||||
printf("\n");
|
||||
|
||||
if (print_perf==1) {
|
||||
@@ -1187,15 +1320,19 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
//if ((float)n_errors/(float)n_trials <= target_error_rate) {
|
||||
if (effRate > (eff_tp_check*TBS)) {
|
||||
printf("PDSCH test OK\n");
|
||||
break;
|
||||
}
|
||||
|
||||
snrStats[snrRun] = SNR;
|
||||
snrRun++;
|
||||
} // NSR
|
||||
|
||||
LOG_M("dlsimStats.m","SNR",snrStats,snrRun,1,7);
|
||||
LOG_MM("dlsimStats.m","BLER",blerStats,snrRun,1,7);
|
||||
LOG_MM("dlsimStats.m","BER",berStats,snrRun,1,7);
|
||||
LOG_MM("dlsimStats.m","rounds",roundStats,snrRun,1,7);
|
||||
/*if (n_trials>1) {
|
||||
printf("HARQ stats:\nSNR\tRounds\n");
|
||||
psnr = snr0;
|
||||
@@ -1205,12 +1342,16 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}*/
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
free_channel_desc_scm(gNB2UE);
|
||||
|
||||
for (i = 0; i < n_tx; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
free(txdata[i]);
|
||||
}
|
||||
for (i = 0; i < n_rx; i++) {
|
||||
free(r_re[i]);
|
||||
free(r_im[i]);
|
||||
free(txdata[i]);
|
||||
}
|
||||
|
||||
free(s_re);
|
||||
@@ -1278,33 +1419,90 @@ void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSi
|
||||
rrc_config_dl_ptrs_params(bwp, ptrsFreqDenst, ptrsTimeDenst, &epre_Ratio, &reOffset);
|
||||
}
|
||||
|
||||
void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dmrs_arg)
|
||||
void update_dmrs_config(NR_CellGroupConfig_t *scg, int8_t* dmrs_arg)
|
||||
{
|
||||
int8_t mapping_type = typeA;//default value
|
||||
int8_t add_pos = pdsch_dmrs_pos0;//default value
|
||||
int8_t dmrs_config_type = NFAPI_NR_DMRS_TYPE1;//default value
|
||||
|
||||
if(dmrs_arg[0] == 0) {
|
||||
mapping_type = typeA;
|
||||
}
|
||||
else if (dmrs_arg[0] == 1) {
|
||||
mapping_type = typeB;
|
||||
}
|
||||
/* Additional DMRS positions 0 ,1 and 2 */
|
||||
if(dmrs_arg[1] >= 0 && dmrs_arg[1] <3 ) {
|
||||
add_pos = dmrs_arg[1];
|
||||
} else {
|
||||
AssertFatal(1==0,"Incorrect Mappingtype, valid options 0-typeA, 1-typeB\n");
|
||||
}
|
||||
|
||||
if(scg != NULL) {
|
||||
NR_BWP_Downlink_t *bwp = scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0];
|
||||
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = add_pos;
|
||||
for (int i=0;i<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) {
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType = mapping_type;
|
||||
}
|
||||
/* Additional DMRS positions 0 ,1 ,2 and 3 */
|
||||
if(dmrs_arg[1] >= 0 && dmrs_arg[1] <4 ) {
|
||||
add_pos = dmrs_arg[1];
|
||||
} else {
|
||||
AssertFatal(1==0,"Incorrect Additional Position, valid options 0-pos1, 1-pos1, 2-pos2, 3-pos3\n");
|
||||
}
|
||||
if(ue != NULL) {
|
||||
for (int i=0;i<MAX_NR_OF_DL_ALLOCATIONS;i++) {
|
||||
ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i]->mappingType = mapping_type;
|
||||
}
|
||||
ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = add_pos;
|
||||
|
||||
/* DMRS Conf Type 1 or 2 */
|
||||
if(dmrs_arg[2] == 1) {
|
||||
dmrs_config_type = NFAPI_NR_DMRS_TYPE1;
|
||||
} else if(dmrs_arg[2] == 2) {
|
||||
dmrs_config_type = NFAPI_NR_DMRS_TYPE2;
|
||||
}
|
||||
printf("[DLSIM] DMRS Config is modified with Mapping Type %d, Additional Positions %d \n", dmrs_arg[0], dmrs_arg[1] );
|
||||
|
||||
NR_BWP_Downlink_t *bwp = scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0];
|
||||
|
||||
AssertFatal((bwp->bwp_Dedicated->pdsch_Config != NULL && bwp->bwp_Dedicated->pdsch_Config->choice.setup != NULL), "Base RRC reconfig structures are not allocated.\n");
|
||||
|
||||
if(mapping_type == typeA) {
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA));
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
|
||||
if (dmrs_config_type == NFAPI_NR_DMRS_TYPE2)
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type));
|
||||
else
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type = NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL;
|
||||
printf("DLSIM: Allocated Mapping TypeA in RRC reconfig message\n");
|
||||
}
|
||||
|
||||
if(mapping_type == typeB) {
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB));
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup));
|
||||
if (dmrs_config_type == NFAPI_NR_DMRS_TYPE2)
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type));
|
||||
else
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type = NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->maxLength=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->scramblingID0=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->scramblingID1=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->phaseTrackingRS=NULL;
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_AdditionalPosition = NULL;
|
||||
printf("DLSIM: Allocated Mapping TypeB in RRC reconfig message\n");
|
||||
}
|
||||
|
||||
struct NR_SetupRelease_DMRS_DownlinkConfig *dmrs_MappingtypeA = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA;
|
||||
struct NR_SetupRelease_DMRS_DownlinkConfig *dmrs_MappingtypeB = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB;
|
||||
|
||||
|
||||
NR_DMRS_DownlinkConfig_t *dmrs_config = (mapping_type == typeA) ? dmrs_MappingtypeA->choice.setup : dmrs_MappingtypeB->choice.setup;
|
||||
|
||||
if (add_pos != 2) { // pos0,pos1,pos3
|
||||
if (dmrs_config->dmrs_AdditionalPosition == NULL) {
|
||||
dmrs_config->dmrs_AdditionalPosition = calloc(1,sizeof(*dmrs_MappingtypeA->choice.setup->dmrs_AdditionalPosition));
|
||||
}
|
||||
*dmrs_config->dmrs_AdditionalPosition = add_pos;
|
||||
} else { // if NULL, Value pos2
|
||||
free(dmrs_config->dmrs_AdditionalPosition);
|
||||
dmrs_config->dmrs_AdditionalPosition = NULL;
|
||||
}
|
||||
|
||||
for (int i=0;i<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) {
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType = mapping_type;
|
||||
}
|
||||
|
||||
printf("[DLSIM] DMRS Config is modified with Mapping Type %d, Additional Positions %d Config. Type %d \n", mapping_type, add_pos, dmrs_config_type);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); }
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
|
||||
|
||||
@@ -55,19 +55,6 @@ signed char quantize(double D, double x, unsigned char B) {
|
||||
return ((char) qxd);
|
||||
}
|
||||
|
||||
|
||||
int8_t
|
||||
mac_rrc_data_req_ue(
|
||||
const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
const uint8_t Nb_tb,
|
||||
uint8_t *const buffer_pP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_area
|
||||
) { return(0);}
|
||||
|
||||
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {return(0);}
|
||||
//NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);}
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
|
||||
@@ -162,13 +149,13 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present=NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139=0;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig=NR_RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=2;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=6;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=2;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=6;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->startSymbolAndLength=69;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=2;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=6;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->startSymbolAndLength=55;
|
||||
*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[3]->k2=33;
|
||||
@@ -235,6 +222,7 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL
|
||||
|
||||
void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap);
|
||||
void prepare_scc(NR_ServingCellConfigCommon_t *scc);
|
||||
void prepare_scd(NR_ServingCellConfig_t *scd);
|
||||
ngap_gNB_config_t ngap_config;
|
||||
uint32_t ngap_generate_gNB_id(void) {return 0;}
|
||||
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) { return;}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
#include "openair1/PHY/MODULATION/nr_modulation.h"
|
||||
|
||||
#include <executables/softmodem-common.h>
|
||||
//#define DEBUG_NR_PBCHSIM
|
||||
|
||||
PHY_VARS_gNB *gNB;
|
||||
@@ -66,6 +66,7 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
softmodem_params_t *get_softmodem_params(void) {return 0;}
|
||||
|
||||
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
|
||||
|
||||
@@ -101,8 +102,8 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
//gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED;
|
||||
|
||||
gNB->mac_enabled = 1;
|
||||
fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
|
||||
fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
|
||||
fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
|
||||
fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
|
||||
if (mu>2) fp->nr_band = 257;
|
||||
else fp->nr_band = 78;
|
||||
fp->threequarter_fs= 0;
|
||||
@@ -111,7 +112,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
|
||||
nr_init_frame_parms(gNB_config, fp);
|
||||
|
||||
init_symbol_rotation(fp,fp->dl_CarrierFreq);
|
||||
init_symbol_rotation(fp);
|
||||
|
||||
gNB->configured = 1;
|
||||
LOG_I(PHY,"gNB configured\n");
|
||||
@@ -119,7 +120,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
int i,aa;//,l;
|
||||
int i,aa,start_symbol;
|
||||
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
|
||||
double cfo=0;
|
||||
uint8_t snr1set=0;
|
||||
@@ -415,7 +416,7 @@ int main(int argc, char **argv)
|
||||
frame_parms->ssb_type = nr_ssb_type_C;
|
||||
|
||||
nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
phy_init_nr_gNB(gNB,0,1);
|
||||
nr_set_ssb_first_subcarrier(&gNB->gNB_config,frame_parms);
|
||||
|
||||
uint8_t n_hf = 0;
|
||||
@@ -427,29 +428,28 @@ int main(int argc, char **argv)
|
||||
|
||||
switch (mu) {
|
||||
case 1:
|
||||
scs = 30000;
|
||||
if (N_RB_DL == 217) {
|
||||
fs = 122.88e6;
|
||||
bw = 80e6;
|
||||
|
||||
}
|
||||
else if (N_RB_DL == 245) {
|
||||
fs = 122.88e6;
|
||||
bw = 90e6;
|
||||
}
|
||||
else if (N_RB_DL == 273) {
|
||||
fs = 122.88e6;
|
||||
bw = 100e6;
|
||||
}
|
||||
else if (N_RB_DL == 106) {
|
||||
fs = 61.44e6;
|
||||
bw = 40e6;
|
||||
}
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
break;
|
||||
|
||||
|
||||
scs = 30000;
|
||||
frame_parms->Lmax = 8;
|
||||
if (N_RB_DL == 217) {
|
||||
fs = 122.88e6;
|
||||
bw = 80e6;
|
||||
}
|
||||
else if (N_RB_DL == 245) {
|
||||
fs = 122.88e6;
|
||||
bw = 90e6;
|
||||
}
|
||||
else if (N_RB_DL == 273) {
|
||||
fs = 122.88e6;
|
||||
bw = 100e6;
|
||||
}
|
||||
else if (N_RB_DL == 106) {
|
||||
fs = 61.44e6;
|
||||
bw = 40e6;
|
||||
}
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
break;
|
||||
case 3:
|
||||
frame_parms->Lmax = 64;
|
||||
scs = 120000;
|
||||
if (N_RB_DL == 66) {
|
||||
fs = 122.88e6;
|
||||
@@ -458,6 +458,7 @@ int main(int argc, char **argv)
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
break;
|
||||
}
|
||||
|
||||
// cfo with respect to sub-carrier spacing
|
||||
eps = cfo/scs;
|
||||
|
||||
@@ -480,7 +481,7 @@ int main(int argc, char **argv)
|
||||
300e-9,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (gNB2UE==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -511,7 +512,6 @@ int main(int argc, char **argv)
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
|
||||
bzero(r_re[i],frame_length_complex_samples*sizeof(int));
|
||||
|
||||
}
|
||||
|
||||
if (pbch_file_fd!=NULL) {
|
||||
@@ -537,60 +537,68 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
nr_gold_pbch(UE);
|
||||
|
||||
// generate signal
|
||||
if (input_fd==NULL) {
|
||||
gNB->pbch_configured = 1;
|
||||
|
||||
gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0;
|
||||
|
||||
for (int slot=0;slot<frame_parms->slots_per_frame;slot++) {
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
|
||||
memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
nr_common_signal_procedures (gNB,frame,slot);
|
||||
for (i=0; i<frame_parms->Lmax; i++) {
|
||||
if((SSB_positions >> i) & 0x01) {
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
/* nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
14,
|
||||
frame_parms);*/
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
1,
|
||||
frame_parms->nb_prefix_samples0,
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
apply_nr_rotation(frame_parms,
|
||||
(int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
slot,
|
||||
0,
|
||||
1,
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0);
|
||||
PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
13,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
apply_nr_rotation(frame_parms,
|
||||
(int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
slot,
|
||||
1,
|
||||
13,
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
|
||||
}
|
||||
}
|
||||
gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33;
|
||||
gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i;
|
||||
|
||||
start_symbol = nr_get_ssb_start_symbol(frame_parms,i);
|
||||
int slot = start_symbol/14;
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
|
||||
memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
nr_common_signal_procedures (gNB,frame,slot,gNB->ssb[i].ssb_pdu);
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
/*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
14,
|
||||
frame_parms);*/
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
1,
|
||||
frame_parms->nb_prefix_samples0,
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
apply_nr_rotation(frame_parms,
|
||||
(int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
slot,
|
||||
0,
|
||||
1,
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0);
|
||||
|
||||
PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
13,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
apply_nr_rotation(frame_parms,
|
||||
(int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
slot,
|
||||
1,
|
||||
13,
|
||||
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
|
||||
@@ -599,9 +607,9 @@ int main(int argc, char **argv)
|
||||
printf("Reading %d samples from file to antenna buffer %d\n",frame_length_complex_samples,0);
|
||||
UE->UE_fo_compensation = 1; // perform fo compensation when samples from file are used
|
||||
if (fread(txdata[0],
|
||||
sizeof(int32_t),
|
||||
frame_length_complex_samples,
|
||||
input_fd) != frame_length_complex_samples) {
|
||||
sizeof(int32_t),
|
||||
frame_length_complex_samples,
|
||||
input_fd) != frame_length_complex_samples) {
|
||||
printf("error reading from file\n");
|
||||
//exit(-1);
|
||||
}
|
||||
@@ -685,30 +693,26 @@ int main(int argc, char **argv)
|
||||
UE->rx_offset=0;
|
||||
uint8_t ssb_index = 0;
|
||||
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
|
||||
frame_parms->ssb_index = ssb_index;
|
||||
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms);
|
||||
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index);
|
||||
|
||||
int ssb_slot = (ssb_index>>1)+(n_hf*frame_parms->slots_per_frame);
|
||||
int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1));
|
||||
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
|
||||
nr_slot_fep(UE,
|
||||
&proc,
|
||||
i%frame_parms->symbols_per_slot,
|
||||
ssb_slot,
|
||||
0,
|
||||
0);
|
||||
ssb_slot);
|
||||
|
||||
nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
|
||||
|
||||
}
|
||||
|
||||
ret = nr_rx_pbch(UE,
|
||||
&proc,
|
||||
UE->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
ssb_index%8,
|
||||
SISO,
|
||||
UE->high_speed_flag);
|
||||
&proc,
|
||||
UE->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
ssb_index%8,
|
||||
SISO);
|
||||
|
||||
if (ret==0) {
|
||||
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
|
||||
@@ -719,9 +723,9 @@ int main(int argc, char **argv)
|
||||
|
||||
payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte);
|
||||
for (i=0;i<3;i++){
|
||||
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)));
|
||||
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
|
||||
}
|
||||
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->rx_ind.rx_indication_body->mib_pdu.additional_bits);
|
||||
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
|
||||
//printf("ret %d\n", payload_ret);
|
||||
if (payload_ret!=4)
|
||||
n_errors_payload++;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "SCHED_NR_UE/phy_frame_config_nr.h"
|
||||
#include "PHY/phy_vars_nr_ue.h"
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "PHY/MODULATION/modulation_eNB.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
@@ -47,9 +48,10 @@
|
||||
#include "OCG_vars.h"
|
||||
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||
#include <executables/softmodem-common.h>
|
||||
#include <openair2/RRC/NR_UE/rrc_defs.h>
|
||||
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
|
||||
|
||||
#define NR_PRACH_DEBUG 1
|
||||
#define PRACH_WRITE_OUTPUT_DEBUG 1
|
||||
|
||||
@@ -64,11 +66,15 @@ double cpuf;
|
||||
extern uint16_t prach_root_sequence_map0_3[838];
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
//uint8_t nfapi_mode=0;
|
||||
int sl_ahead = 0;
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
uint16_t sl_ahead = 0;
|
||||
msc_interface_t msc_interface;
|
||||
uint32_t N_RB_DL = 106;
|
||||
|
||||
//void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
|
||||
|
||||
/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
|
||||
msc_interface_t msc_interface;
|
||||
uint64_t get_softmodem_optmask(void) {return 0;}
|
||||
softmodem_params_t *get_softmodem_params(void) {return 0;}
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
|
||||
@@ -86,6 +92,12 @@ rrc_data_ind(
|
||||
{
|
||||
}
|
||||
|
||||
int ocp_gtpv1u_create_s1u_tunnel(instance_t instance,
|
||||
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
|
||||
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
gtpv1u_create_s1u_tunnel(
|
||||
const instance_t instanceP,
|
||||
@@ -121,6 +133,10 @@ gtpv1u_update_ngu_tunnel(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
@@ -130,15 +146,37 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return 0;}
|
||||
|
||||
// Dummy function to avoid linking error at compilation of nr-prachsim
|
||||
int is_x2ap_enabled(void)
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_index,
|
||||
const frame_t frame,
|
||||
const sub_frame_t sub_frame,
|
||||
const rnti_t rnti,
|
||||
const channel_t channel,
|
||||
const uint8_t* pduP,
|
||||
const sdu_size_t pdu_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
uint8_t *buffer_pP)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Dummy function to avoid linking error at compilation of nr-prachsim
|
||||
int is_x2ap_enabled(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -148,13 +186,38 @@ int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
int CC_idP,
|
||||
int UE_id,
|
||||
rnti_t rntiP,
|
||||
const uint8_t *sduP,
|
||||
sdu_size_t sdu_lenP,
|
||||
const uint8_t *sdu2P,
|
||||
sdu_size_t sdu2_lenP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint64_t optmask; //mask to store boolean config options
|
||||
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
|
||||
tpool_t Tpool; // thread pool
|
||||
} nrUE_params_t;
|
||||
|
||||
nrUE_params_t nrUE_params;
|
||||
|
||||
nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
|
||||
void processSlotTX(void *arg) {}
|
||||
|
||||
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;
|
||||
int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
||||
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;
|
||||
uint8_t frame = 1, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
||||
@@ -194,7 +257,7 @@ int main(int argc, char **argv){
|
||||
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt (argc, argv, "hHaA:Cc:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
|
||||
while ((c = getopt (argc, argv, "hHaA:Cc:l:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
@@ -207,6 +270,10 @@ int main(int argc, char **argv){
|
||||
config_index = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
loglvl = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
msg1_frequencystart = atoi(optarg);
|
||||
break;
|
||||
@@ -454,7 +521,10 @@ int main(int argc, char **argv){
|
||||
|
||||
nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions);
|
||||
|
||||
uint64_t absoluteFrequencyPointA = (mu==1 ? 640000 : 2070833);
|
||||
uint64_t absoluteFrequencyPointA = to_nrarfcn(frame_parms->nr_band,
|
||||
frame_parms->dl_CarrierFreq,
|
||||
frame_parms->numerology_index,
|
||||
frame_parms->N_RB_UL*(180e3)*(1 << frame_parms->numerology_index));
|
||||
|
||||
uint8_t subframe = slot/frame_parms->slots_per_subframe;
|
||||
|
||||
@@ -475,7 +545,8 @@ int main(int argc, char **argv){
|
||||
ru->if_south = LOCAL_RF;
|
||||
ru->nb_tx = n_tx;
|
||||
ru->nb_rx = n_rx;
|
||||
|
||||
ru->num_gNB = 1;
|
||||
ru->gNB_list[0] = gNB;
|
||||
gNB->gNB_config.carrier_config.num_tx_ant.value = 1;
|
||||
gNB->gNB_config.carrier_config.num_rx_ant.value = 1;
|
||||
if (mu==1)
|
||||
@@ -576,7 +647,7 @@ int main(int argc, char **argv){
|
||||
|
||||
memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config));
|
||||
RC.nb_nr_L1_inst=1;
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
phy_init_nr_gNB(gNB,0,1); //lowmem
|
||||
nr_phy_init_RU(ru);
|
||||
gNB->common_vars.rxdata = ru->common.rxdata;
|
||||
set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4);
|
||||
@@ -644,7 +715,7 @@ int main(int argc, char **argv){
|
||||
DS_TDL,
|
||||
0.0,
|
||||
delay,
|
||||
0);
|
||||
0, 0);
|
||||
|
||||
if (UE2gNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -782,7 +853,17 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (l = 0; l < frame_parms->symbols_per_slot; l++) {
|
||||
for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
|
||||
nr_slot_fep_ul(frame_parms,
|
||||
ru->common.rxdata[aa],
|
||||
ru->common.rxdataF[aa],
|
||||
l,
|
||||
slot,
|
||||
ru->N_TA_offset);
|
||||
}
|
||||
}
|
||||
|
||||
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
|
||||
|
||||
gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion];
|
||||
@@ -805,7 +886,8 @@ int main(int argc, char **argv){
|
||||
LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1);
|
||||
LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||
LOG_M("ru_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1);
|
||||
LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1);
|
||||
LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1);
|
||||
LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1);
|
||||
LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1);
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
|
||||
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||
|
||||
|
||||
PHY_VARS_gNB *gNB;
|
||||
PHY_VARS_NR_UE *UE;
|
||||
RAN_CONTEXT_t RC;
|
||||
@@ -91,6 +92,7 @@ int main(int argc, char **argv)
|
||||
//uint8_t nacktoack_flag=0;
|
||||
int16_t amp=0x7FFF;
|
||||
int nr_slot_tx=0;
|
||||
int nr_frame_tx=0;
|
||||
uint64_t actual_payload=0,payload_received;
|
||||
int nr_bit=1; // maximum value possible is 2
|
||||
uint8_t m0=0;// higher layer paramater initial cyclic shift
|
||||
@@ -418,7 +420,7 @@ int main(int argc, char **argv)
|
||||
printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO);
|
||||
}
|
||||
|
||||
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0);
|
||||
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0, 0);
|
||||
|
||||
if (UE2gNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -501,13 +503,13 @@ 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);
|
||||
nr_generate_pucch0(UE,txdataF,frame_parms,PUCCH_GroupHopping,hopping_id,amp,nr_slot_tx,m0,mcs,nrofSymbols,startingSymbolIndex,startingPRB, 0);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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,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);
|
||||
}
|
||||
|
||||
int txlev = signal_energy(&txdataF[aa][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
@@ -532,7 +534,7 @@ int main(int argc, char **argv)
|
||||
int rb2 = rb+startingPRB;
|
||||
gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
gNB_I0_measurements(gNB);
|
||||
gNB_I0_measurements(gNB, startingSymbolIndex, nrofSymbols);
|
||||
|
||||
if (n_trials==1) printf("rxlev %d (%d dB), sigma2 %f dB, SNR %f, TX %f\n",rxlev,dB_fixed(rxlev),sigma2_dB,SNR,10*log10((double)txlev*UE->frame_parms.ofdm_symbol_size/12));
|
||||
if(format==0){
|
||||
@@ -550,7 +552,9 @@ int main(int argc, char **argv)
|
||||
pucch_pdu.initial_cyclic_shift = 0;
|
||||
pucch_pdu.start_symbol_index = startingSymbolIndex;
|
||||
pucch_pdu.prb_start = startingPRB;
|
||||
nr_decode_pucch0(gNB,nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
pucch_pdu.bwp_start = 0;
|
||||
pucch_pdu.freq_hop_flag = 0;
|
||||
nr_decode_pucch0(gNB, nr_frame_tx, nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
if(sr_flag==1){
|
||||
if (uci_pdu.sr->sr_indication == 0 || uci_pdu.sr->sr_confidence_level == 1)
|
||||
sr_errors+=1;
|
||||
|
||||
@@ -364,7 +364,7 @@ int main(int argc, char **argv)
|
||||
61.44e6, //N_RB2sampling_rate(N_RB_DL),
|
||||
40e6, //N_RB2channel_bandwidth(N_RB_DL),
|
||||
DS_TDL,
|
||||
0,0,0);
|
||||
0,0,0, 0);
|
||||
|
||||
if (gNB2UE == NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -394,7 +394,7 @@ int main(int argc, char **argv)
|
||||
|
||||
nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions);
|
||||
|
||||
phy_init_nr_gNB(gNB, 0, 0);
|
||||
phy_init_nr_gNB(gNB, 0, 1); //lowmem
|
||||
|
||||
//configure UE
|
||||
UE = malloc(sizeof(PHY_VARS_NR_UE));
|
||||
|
||||
@@ -57,14 +57,14 @@
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "common/utils/threadPool/thread-pool.h"
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
|
||||
#include "SIMULATION/LTE_PHY/common_sim.h"
|
||||
|
||||
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||
|
||||
#include <executables/softmodem-common.h>
|
||||
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
|
||||
|
||||
//#define DEBUG_ULSIM
|
||||
|
||||
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
|
||||
@@ -75,16 +75,32 @@ PHY_VARS_NR_UE *UE;
|
||||
RAN_CONTEXT_t RC;
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
int sf_ahead=4 ;
|
||||
uint16_t sf_ahead=4 ;
|
||||
int slot_ahead=6 ;
|
||||
int sl_ahead=0;
|
||||
uint16_t sl_ahead=0;
|
||||
double cpuf;
|
||||
//uint8_t nfapi_mode = 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;
|
||||
|
||||
extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration
|
||||
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_index,
|
||||
const frame_t frame,
|
||||
const sub_frame_t sub_frame,
|
||||
const rnti_t rnti,
|
||||
const channel_t channel,
|
||||
const uint8_t* pduP,
|
||||
const sdu_size_t pdu_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
|
||||
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
|
||||
int generate_dlsch_header(unsigned char *mac_header,
|
||||
unsigned char num_sdus,
|
||||
unsigned short *sdu_lengths,
|
||||
@@ -105,6 +121,12 @@ rrc_data_ind(
|
||||
{
|
||||
}
|
||||
|
||||
int ocp_gtpv1u_create_s1u_tunnel(instance_t instance,
|
||||
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
|
||||
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
gtpv1u_create_s1u_tunnel(
|
||||
const instance_t instanceP,
|
||||
@@ -114,6 +136,10 @@ gtpv1u_create_s1u_tunnel(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
@@ -155,15 +181,38 @@ int is_x2ap_enabled(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//nFAPI P7 dummy functions
|
||||
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const uint8_t gNB_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
uint8_t *buffer_pP)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
int CC_idP,
|
||||
int UE_id,
|
||||
rnti_t rntiP,
|
||||
const uint8_t *sduP,
|
||||
sdu_size_t sdu_lenP,
|
||||
const uint8_t *sdu2P,
|
||||
sdu_size_t sdu2_lenP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//nFAPI P7 dummy functions
|
||||
|
||||
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); }
|
||||
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||
const uint8_t key[32], uint8_t **out)
|
||||
@@ -171,6 +220,19 @@ int nr_derive_key(int alg_type, uint8_t alg_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint64_t optmask; //mask to store boolean config options
|
||||
uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization
|
||||
tpool_t Tpool; // thread pool
|
||||
} nrUE_params_t;
|
||||
|
||||
void processSlotTX(void *arg) {}
|
||||
|
||||
nrUE_params_t nrUE_params;
|
||||
|
||||
nrUE_params_t *get_nrUE_params(void) {
|
||||
return &nrUE_params;
|
||||
}
|
||||
// needed for some functions
|
||||
uint16_t n_rnti = 0x1234;
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
@@ -182,6 +244,7 @@ double s_re1[122880],s_im1[122880],r_re1[122880],r_im1[122880];
|
||||
double r_re2[122880],r_im2[122880];
|
||||
double r_re3[122880],r_im3[122880];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
@@ -255,15 +318,13 @@ int main(int argc, char **argv)
|
||||
int file_offset = 0;
|
||||
|
||||
double DS_TDL = .03;
|
||||
int pusch_tgt_snrx10 = 200;
|
||||
int pucch_tgt_snrx10 = 200;
|
||||
int ibwps=24;
|
||||
int ibwp_rboffset=41;
|
||||
int params_from_file = 0;
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) {
|
||||
exit_fun("[NR_ULSIM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
int ul_proc_error = 0; // uplink processing checking status flag
|
||||
//logInit();
|
||||
randominit(0);
|
||||
|
||||
@@ -580,7 +641,7 @@ int main(int argc, char **argv)
|
||||
sampling_frequency,
|
||||
bandwidth,
|
||||
DS_TDL,
|
||||
0, 0, 0);
|
||||
0, 0, 0, 0);
|
||||
|
||||
if (UE2gNB == NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
@@ -607,8 +668,8 @@ int main(int argc, char **argv)
|
||||
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;
|
||||
//frame_parms->nb_antennas_tx = n_tx;
|
||||
//frame_parms->nb_antennas_rx = n_rx;
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
frame_parms->N_RB_UL = N_RB_UL;
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
@@ -626,6 +687,7 @@ int main(int argc, char **argv)
|
||||
rrc.carrier.servingcellconfigcommon = calloc(1,sizeof(*rrc.carrier.servingcellconfigcommon));
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc = rrc.carrier.servingcellconfigcommon;
|
||||
NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t));
|
||||
NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup));
|
||||
prepare_scc(rrc.carrier.servingcellconfigcommon);
|
||||
uint64_t ssb_bitmap;
|
||||
@@ -633,23 +695,23 @@ int main(int argc, char **argv)
|
||||
|
||||
fix_scc(scc,ssb_bitmap);
|
||||
|
||||
fill_default_secondaryCellGroup(scc,
|
||||
secondaryCellGroup,
|
||||
0,
|
||||
1,
|
||||
n_tx,
|
||||
0);
|
||||
prepare_scd(scd);
|
||||
|
||||
fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0);
|
||||
|
||||
// xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
|
||||
|
||||
/* RRC parameter validation for secondaryCellGroup */
|
||||
fix_scd(scd);
|
||||
|
||||
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,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL);
|
||||
// UE dedicated configuration
|
||||
rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
|
||||
phy_init_nr_gNB(gNB,0,1);
|
||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||
|
||||
|
||||
@@ -706,7 +768,7 @@ int main(int argc, char **argv)
|
||||
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,secondaryCellGroup);
|
||||
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
|
||||
|
||||
nr_ue_phy_config_request(&UE_mac->phy_config);
|
||||
|
||||
@@ -774,7 +836,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
uint8_t length_dmrs = pusch_len1;
|
||||
uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs);
|
||||
uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs, start_symbol, NR_MIB__dmrs_TypeA_Position_pos2);
|
||||
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;
|
||||
|
||||
@@ -960,7 +1022,7 @@ int main(int argc, char **argv)
|
||||
pusch_pdu->transform_precoding = transform_precoding;
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << start_symbol;
|
||||
pusch_pdu->ul_dmrs_symb_pos = l_prime_mask;
|
||||
pusch_pdu->dmrs_config_type = dmrs_config_type;
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->scid = 0;
|
||||
@@ -1023,7 +1085,7 @@ int main(int argc, char **argv)
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
|
||||
@@ -1053,70 +1115,74 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
nr_fill_ulsch(gNB,frame,slot,pusch_pdu);
|
||||
//nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);"
|
||||
|
||||
for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff;
|
||||
if (input_fd == NULL) {
|
||||
|
||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
|
||||
|
||||
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
||||
///////////
|
||||
|
||||
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id);
|
||||
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1);
|
||||
LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
}
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
|
||||
txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
|
||||
|
||||
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
||||
///////////
|
||||
|
||||
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id);
|
||||
|
||||
/* We need to call common sending function to send signal */
|
||||
LOG_D(PHY, "Sending Uplink data \n");
|
||||
nr_ue_pusch_common_procedures(UE,
|
||||
slot,
|
||||
&UE->frame_parms,1);
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1);
|
||||
LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
}
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
|
||||
txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
}
|
||||
else n_trials = 1;
|
||||
|
||||
if (input_fd == NULL ) {
|
||||
|
||||
sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;;
|
||||
sigma = pow(10,sigma_dB/10);
|
||||
sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;;
|
||||
sigma = pow(10,sigma_dB/10);
|
||||
|
||||
|
||||
if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)frame_parms->ofdm_symbol_size/(12*nb_rb));
|
||||
if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)
|
||||
frame_parms->ofdm_symbol_size/(12*nb_rb));
|
||||
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (int aa=0; aa<1; 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]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (int aa=0; aa<frame_parms->nb_antennas_rx; 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]);
|
||||
}
|
||||
}
|
||||
|
||||
if (UE2gNB->max_Doppler == 0) {
|
||||
multipath_channel(UE2gNB,s_re,s_im,r_re,r_im,
|
||||
slot_length,0,(n_trials==1)?1:0);
|
||||
} else {
|
||||
multipath_tv_channel(UE2gNB,s_re,s_im,r_re,r_im,
|
||||
2*slot_length,0);
|
||||
}
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0)));
|
||||
|
||||
if (UE2gNB->max_Doppler == 0) {
|
||||
multipath_channel(UE2gNB, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials==1)?1:0);
|
||||
} else {
|
||||
multipath_tv_channel(UE2gNB, s_re, s_im, r_re, r_im, 2*slot_length, 0);
|
||||
}
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0)));
|
||||
/* Add phase noise if enabled */
|
||||
if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)],
|
||||
&((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} /*End input_fd */
|
||||
|
||||
|
||||
if(pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
@@ -1137,10 +1203,9 @@ int main(int argc, char **argv)
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
|
||||
start_meas(&gNB->phy_proc_rx);
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
|
||||
phy_procedures_gNB_uespec_RX(gNB, frame, slot);
|
||||
ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot);
|
||||
|
||||
if (n_trials==1 && round==0) {
|
||||
LOG_M("rxsig0.m","rx0",&gNB->common_vars.rxdata[0][slot_offset],slot_length,1,1);
|
||||
@@ -1171,11 +1236,10 @@ int main(int argc, char **argv)
|
||||
LOG_M("rxsigF0_llr.m","rxsF0_llr",
|
||||
&gNB->pusch_vars[0]->llr[0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
}
|
||||
start_meas(&gNB->phy_proc_rx);
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (gNB->ulsch[0][0]->last_iteration_cnt >=
|
||||
gNB->ulsch[0][0]->max_ldpc_iterations+1) {
|
||||
|
||||
if ((gNB->ulsch[0][0]->last_iteration_cnt >=
|
||||
gNB->ulsch[0][0]->max_ldpc_iterations+1) || ul_proc_error == 1) {
|
||||
error_flag = 1;
|
||||
n_errors[round]++;
|
||||
crc_status = 1;
|
||||
@@ -1264,7 +1328,8 @@ int main(int argc, char **argv)
|
||||
(double)errors_scrambling[3]/available_bits/round_trials[0],
|
||||
roundStats[snrRun],effRate,effRate/TBS*100,TBS);
|
||||
|
||||
dump_pusch_stats(gNB);
|
||||
FILE *fd=fopen("nr_ulsim.log","w");
|
||||
dump_pusch_stats(fd,gNB);
|
||||
|
||||
printf("*****************************************\n");
|
||||
printf("\n");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Channel simulation source files
|
||||
|
||||
1. [random_channel.c](../random_channel.c)
|
||||
1. [sim.h](../sim.h)
|
||||
|
||||
|
||||
|
||||
[channel simulation main page](channel_simulation.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -0,0 +1,13 @@
|
||||
# OAI channel simulation feature
|
||||
|
||||
oai includes a channel simulation feature that any component can use to alter time domain samples of a RF channel by applying pre-defined models as defined, for example, in 3GPP TR 36.873 or TR 38.901
|
||||
|
||||
Definition, configuration and run-time modification of a channel model are implemented in common code included in UEs, gNb, eNB and used when running with the rfsimulator or the L1 simulator. Phy simulators are also using channel simulation but configuration is done via dedicated command line options. The rfsimulator is the only option to get access to all the configurations and run-time modifications features of oai channel simulation.
|
||||
|
||||
## Documentation
|
||||
|
||||
* [runtime usage](rtusage.md)
|
||||
* [developer usage](devusage.md)
|
||||
* [module architecture](arch.md)
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -0,0 +1,7 @@
|
||||
### channel simulation developer usage
|
||||
|
||||
|
||||
[Configuring the channel simulation](rtusage.md)
|
||||
|
||||
[channel simulation main page](channel_simulation.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -0,0 +1,69 @@
|
||||
## configuring the channel simulation
|
||||
Oai channel simulation is using the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters
|
||||
|
||||
All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator.
|
||||
|
||||
### global parameters
|
||||
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `max_chan` | integer | `25` | Maximum number of channel model that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time. |
|
||||
| `modellist` | character string | `DefaultChannelList` | Name of the channel models list to load at init time. |
|
||||
|
||||
### Model lists
|
||||
|
||||
Several model lists can be defined in the oai configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters:
|
||||
|
||||
| parameter name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `model name` | character string | mandatory |name of the model, as used in the code to retrieve a model definition|
|
||||
| `type` | | `AWGN` | name of the channel modelization algorithm applied on rf signal. The list of available model types can be listed via the [telnet server](../../telnetsrv/DOC/telnetsrv.md) or by entering an invalid type name |
|
||||
| `ploss_dB` | real (float) | | path loss of the channel, in dB |
|
||||
| `noise_power_dB` | real (double) | | noise of the channel in dB |
|
||||
| `forgetfact` | real (double) | | |
|
||||
| `offset` | integer | | |
|
||||
| `ds_tdl` | real double | | |
|
||||
|
||||
Channel simulation parameters can also be specified on the command line:
|
||||
|
||||
```bash
|
||||
./lte-softmodem -O ../../../ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --noS1 --rfsim --rfsimulator.options chanmod --rfsimulator.serveraddr enb --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120
|
||||
```
|
||||
### Using the telnet server to modify channel simulator parameters
|
||||
The telnet server includes a `channelmod` command which can be used to dynamically modify some channel model parameters. This command is only available when channel simulation is enabled (via `rfsimulator.options chanmod` option when running the rfsimulator. `channelmod` command has its own help:
|
||||
|
||||
```
|
||||
$ telnet 127.0.0.1 9090
|
||||
Trying 127.0.0.1...
|
||||
Connected to 127.0.0.1.
|
||||
Escape character is '^]'.
|
||||
|
||||
softmodem_enb> help
|
||||
.....................................
|
||||
module 6 = channelmod:
|
||||
channelmod help
|
||||
channelmod show <predef,current>
|
||||
channelmod modify <channelid> <param> <value>
|
||||
module 7 = rfsimu:
|
||||
rfsimu setmodel <model name> <model type>
|
||||
softmodem_enb> channelmod help
|
||||
channelmod commands can be used to display or modify channel models parameters
|
||||
channelmod show predef: display predefined model algorithms available in oai
|
||||
channelmod show current: display the currently used models in the running executable
|
||||
channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value
|
||||
<model index> specifies the model, the show current model command can be used to list the current models indexes
|
||||
<param name> can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf"
|
||||
softmodem_enb>
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The [rfsimulator documentation](../../../../targets/ARCH/rfsimulator/README.md ) has also some specific information when using the channel simulation via this tool.
|
||||
|
||||
[channel simulation main page](channel_simulation.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -39,13 +39,13 @@ uint8_t multipath_channel_nosigconv(channel_desc_t *desc)
|
||||
//#define CHANNEL_SSE
|
||||
#ifdef CHANNEL_SSE
|
||||
void multipath_channel(channel_desc_t *desc,
|
||||
double tx_sig_re[2][30720*2],
|
||||
double tx_sig_im[2][30720*2],
|
||||
double rx_sig_re[2][30720*2],
|
||||
double rx_sig_im[2][30720*2],
|
||||
double tx_sig_re[NB_ANTENNAS_TX][30720*2],
|
||||
double tx_sig_im[NB_ANTENANS_TX][30720*2],
|
||||
double rx_sig_re[NB_ANTENNAS_RX][30720*2],
|
||||
double rx_sig_im[NB_ANTENNAS_RX][30720*2],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel,
|
||||
int log_channel)
|
||||
int log_channel)
|
||||
{
|
||||
|
||||
int i,ii,j,l;
|
||||
@@ -146,13 +146,13 @@ void multipath_channel(channel_desc_t *desc,
|
||||
|
||||
#else
|
||||
void multipath_channel(channel_desc_t *desc,
|
||||
double *tx_sig_re[2],
|
||||
double *tx_sig_im[2],
|
||||
double *rx_sig_re[2],
|
||||
double *rx_sig_im[2],
|
||||
double *tx_sig_re[NB_ANTENNAS_TX],
|
||||
double *tx_sig_im[NB_ANTENNAS_TX],
|
||||
double *rx_sig_re[NB_ANTENNAS_RX],
|
||||
double *rx_sig_im[NB_ANTENNAS_RX],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel,
|
||||
int log_channel)
|
||||
int log_channel)
|
||||
{
|
||||
|
||||
int i,ii,j,l;
|
||||
@@ -198,21 +198,22 @@ void multipath_channel(channel_desc_t *desc,
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
} //l
|
||||
} // j
|
||||
|
||||
rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss;
|
||||
rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss;
|
||||
|
||||
/* if ((ii==0)&&((i%32)==0)) {
|
||||
printf("%p %p %f,%f => %e,%e\n",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]);
|
||||
}*/
|
||||
|
||||
#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]);
|
||||
}
|
||||
#endif
|
||||
//rx_sig_re[ii][i] = sqrt(.5)*(tx_sig_re[0][i] + tx_sig_re[1][i]);
|
||||
//rx_sig_im[ii][i] = sqrt(.5)*(tx_sig_im[0][i] + tx_sig_im[1][i]);
|
||||
|
||||
|
||||
@@ -40,19 +40,17 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
uint8_t keep_channel)
|
||||
{
|
||||
|
||||
double complex **tx,**rx,***H_t,*rx_temp;//, *tv_H_t;
|
||||
double complex **tx,**rx,***H_t;
|
||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||
int i,j,k,dd;
|
||||
int i,j,dd;
|
||||
dd = abs(desc->channel_offset);
|
||||
#ifdef DEBUG_CH
|
||||
printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %g\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length,
|
||||
desc->max_Doppler);
|
||||
#endif
|
||||
tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex));
|
||||
rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex));
|
||||
H_t= (double complex ** *) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **));
|
||||
// tv_H_t = (double complex *) malloc(length*sizeof(double complex));
|
||||
rx_temp= (double complex *) calloc(length,sizeof(double complex));
|
||||
tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex *));
|
||||
rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex *));
|
||||
H_t= (double complex ***) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **));
|
||||
|
||||
for(i=0; i<desc->nb_tx; i++) {
|
||||
tx[i] = (double complex *)calloc(length,sizeof(double complex));
|
||||
@@ -63,10 +61,10 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
|
||||
for(i=0; i<desc->nb_tx*desc->nb_rx; i++) {
|
||||
H_t[i] = (double complex **) malloc(length*sizeof(double complex *));
|
||||
H_t[i] = (double complex **)malloc(desc->nb_taps*sizeof(double complex *));
|
||||
|
||||
for(j=0; j<length; j++) {
|
||||
H_t[i][j] = (double complex *) calloc (desc->nb_taps,sizeof(double complex));
|
||||
for(j=0; j<desc->nb_taps; j++) {
|
||||
H_t[i][j] = (double complex *)calloc(length,sizeof(double complex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,11 +82,7 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
|
||||
for(i=0; i<desc->nb_rx; i++) {
|
||||
for(j=0; j<desc->nb_tx; j++) {
|
||||
tv_conv(H_t[i+(j*desc->nb_rx)],tx[j],rx_temp,length,desc->nb_taps,dd);
|
||||
|
||||
for(k=0; k<length; k++) {
|
||||
rx[i][k] += rx_temp[k];
|
||||
}
|
||||
tv_conv(H_t[i+(j*desc->nb_rx)],tx[j],rx[i],length,desc->nb_taps,dd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,10 +93,6 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
}
|
||||
|
||||
/* for(k=0;k<length;k++) {
|
||||
tv_H_t[k] = H_t[0][k][0];
|
||||
}*/
|
||||
|
||||
for(i=0; i<desc->nb_tx; i++) {
|
||||
free(tx[i]);
|
||||
}
|
||||
@@ -116,7 +106,7 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
free(rx);
|
||||
|
||||
for(i=0; i<desc->nb_rx*desc->nb_tx; i++) {
|
||||
for(j=0; j<length; j++) {
|
||||
for(j=0; j<desc->nb_taps; j++) {
|
||||
free(H_t[i][j]);
|
||||
}
|
||||
|
||||
@@ -124,21 +114,35 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
|
||||
free(H_t);
|
||||
free(rx_temp);
|
||||
}
|
||||
|
||||
//TODO: make phi_rad a parameter of this function
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){
|
||||
|
||||
int i,j,p,l,k;
|
||||
double *alpha,*phi_rad,pi=acos(-1),*w_Hz;
|
||||
double *alpha,***phi_rad,pi=acos(-1),***w_Hz;
|
||||
alpha = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
phi_rad = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
w_Hz = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
phi_rad = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **));
|
||||
w_Hz = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **));
|
||||
|
||||
for(i=0; i<desc->nb_paths; i++) {
|
||||
w_Hz[i]=desc->max_Doppler*cos(frand_a_b(0,2*pi));
|
||||
phi_rad[i]=frand_a_b(0,2*pi);
|
||||
for(i=0; i<desc->nb_tx*desc->nb_rx; i++) {
|
||||
phi_rad[i] = (double **) malloc(desc->nb_taps*sizeof(double *));
|
||||
w_Hz[i] = (double **) malloc(desc->nb_taps*sizeof(double *));
|
||||
for(j=0; j<desc->nb_taps; j++) {
|
||||
phi_rad[i][j] = (double *) malloc(desc->nb_paths*sizeof(double));
|
||||
w_Hz[i][j] = (double *) malloc(desc->nb_paths*sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<desc->nb_tx*desc->nb_rx; i++) {
|
||||
for (j = 0; j<desc->nb_taps; j++) {
|
||||
for(k=0; k<desc->nb_paths; k++) {
|
||||
w_Hz[i][j][k] = desc->max_Doppler*cos(frand_a_b(0,2*M_PI));
|
||||
phi_rad[i][j][k] = frand_a_b(0,2*M_PI);
|
||||
//printf("w_hz[%d][%d][%d]=f_d*cos(theta) = %f\n",i,j,k,w_Hz[i][j][k]);
|
||||
//printf("phi_rad[%d][%d][%d] = %f\n",i,j,k,phi_rad[i][j][k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(desc->ricean_factor == 1) {
|
||||
@@ -153,57 +157,45 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// This is the code when we only consider a SISO case
|
||||
for(i=0;i<length;i++)
|
||||
{
|
||||
for(j=0;j<desc->nb_taps;j++)
|
||||
{
|
||||
for(p=0;p<desc->nb_paths;p++)
|
||||
{
|
||||
H[i][j] += sqrt(desc->amps[j]/2)*alpha[p]*cexp(-I*(2*pi*w_Hz[p]*i*(1/(desc->sampling_rate*1e6))+phi_rad[p]));
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0;j<desc->nb_paths;j++)
|
||||
{
|
||||
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi);
|
||||
}
|
||||
*/
|
||||
|
||||
// if MIMO
|
||||
// SISO or MIMO
|
||||
for (i=0; i<desc->nb_rx; i++) {
|
||||
for(j=0; j<desc->nb_tx; j++) {
|
||||
for(k=0; k<length; k++) {
|
||||
for(l=0; l<desc->nb_taps; l++) {
|
||||
H[i+(j*desc->nb_rx)][k][l] = 0;
|
||||
|
||||
for(k=0; k<desc->nb_taps; k++) {
|
||||
for(l=0; l<length; l++) {
|
||||
for(p=0; p<desc->nb_paths; p++) {
|
||||
H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[l]/2)*alpha[p]*cexp(I*(2*pi*w_Hz[p]*k*(1/(desc->sampling_rate*1e6))+phi_rad[p]));
|
||||
H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[k])*alpha[p]*cexp(I*(2*pi*w_Hz[i+(j*desc->nb_rx)][k][p]*l*(1/(desc->sampling_rate*1e6))+phi_rad[i+(j*desc->nb_rx)][k][p]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(j=0; j<desc->nb_paths; j++) {
|
||||
phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi);
|
||||
//printf("H[tx%d][rx%d][k%d][l%d] = %f+j%f \n",j,i,k,0,creal(H[i+(j*desc->nb_rx)][k][0]),cimag(H[i+(j*desc->nb_rx)][k][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//accumlate the phase
|
||||
/*for(k=0; k<desc->nb_taps; k++) {
|
||||
* for(j=0; j<desc->nb_paths; j++) {
|
||||
* desc->random_phase[k][j] = fmod(2*pi*w_Hz[k][j]*(length-1)*(1/(desc->sampling_rate*1e6))+phi_rad[k][j],2*pi);
|
||||
* }
|
||||
* }*/
|
||||
free(alpha);
|
||||
for(i=0; i<desc->nb_rx*desc->nb_tx; i++) {
|
||||
for (j=0; j<desc->nb_taps; j++) {
|
||||
free(w_Hz[i][j]);
|
||||
free(phi_rad[i][j]);
|
||||
}
|
||||
free(w_Hz[i]);
|
||||
free(phi_rad[i]);
|
||||
}
|
||||
free(w_Hz);
|
||||
free(phi_rad);
|
||||
}
|
||||
|
||||
// time varying convolution
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint32_t nb_samples, uint8_t nb_taps, int dd){
|
||||
|
||||
int i,j;
|
||||
|
||||
for(i=0; i<((int)nb_samples-dd); i++) {
|
||||
for(j=0; j<nb_taps; j++) {
|
||||
if(i>j)
|
||||
y[i+dd] += creal(h[i][j])*creal(x[i-j])-cimag(h[i][j])*cimag(x[i-j]) + I*(creal(h[i][j])*cimag(x[i-j])+cimag(h[i][j])*creal(x[i-j]));
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint32_t nb_samples, uint8_t nb_taps, int dd)
|
||||
{
|
||||
for(int i = 0; i < ((int)nb_samples-dd); i++) {
|
||||
for(int j = 0; j < nb_taps; j++) {
|
||||
if(i >= j)
|
||||
y[i+dd] += h[j][i] * x[i-j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "sim.h"
|
||||
|
||||
|
||||
static uint16_t LUTSin[ResolSinCos+1];
|
||||
/* linear phase noise model */
|
||||
void phase_noise(double ts, int16_t * InRe, int16_t * InIm)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -89,6 +89,7 @@ typedef struct {
|
||||
double path_loss_dB;
|
||||
///additional delay of channel in samples.
|
||||
int32_t channel_offset;
|
||||
float noise_power_dB;
|
||||
///This parameter (0...1) allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time
|
||||
double forgetting_factor;
|
||||
///needs to be set to 1 for the first call, 0 otherwise.
|
||||
@@ -106,8 +107,10 @@ typedef struct {
|
||||
unsigned int chan_idx;
|
||||
/// id of the channel modeling algorithm
|
||||
int modelid;
|
||||
/// identifies channel descriptor owner (the module which created this descriptor)
|
||||
/// identifies channel descriptor owner (the module which created this descriptor
|
||||
channelmod_moduleid_t module_id;
|
||||
/// name of this descriptor,used for model created from config file at init time
|
||||
char *model_name;
|
||||
/// flags to properly trigger memory free
|
||||
unsigned int free_flags;
|
||||
} channel_desc_t;
|
||||
@@ -241,12 +244,37 @@ typedef enum {
|
||||
|
||||
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
|
||||
#define CHANNELMOD_SECTION "channelmod"
|
||||
|
||||
/* global channel modelization parameters */
|
||||
#define CHANNELMOD_MODELLIST_PARANAME "modellist"
|
||||
|
||||
#define CHANNELMOD_HELP_MODELLIST "<list name> channel list name in config file describing the model type and its parameters\n"
|
||||
#define CHANNELMOD_PARAMS_DESC { \
|
||||
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\
|
||||
{"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
|
||||
{"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
|
||||
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\
|
||||
{"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\
|
||||
{"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
|
||||
{CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\
|
||||
}
|
||||
|
||||
/* parameters for one model */
|
||||
#define CHANNELMOD_MODEL_NAME_PNAME "model_name"
|
||||
#define CHANNELMOD_MODEL_TYPE_PNAME "type"
|
||||
#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB"
|
||||
#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB"
|
||||
#define CHANNELMOD_MODEL_FF_PNAME "forgetfact"
|
||||
#define CHANNELMOD_MODEL_CO_PNAME "offset"
|
||||
#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl"
|
||||
|
||||
#define CHANNELMOD_MODEL_PARAMS_DESC { \
|
||||
{CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\
|
||||
{CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\
|
||||
{CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:-50, TYPE_DOUBLE, 0 },\
|
||||
{CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\
|
||||
{CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\
|
||||
}
|
||||
|
||||
#include "platform_constants.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -275,12 +303,17 @@ typedef struct {
|
||||
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
|
||||
uint8_t nb_rx,
|
||||
SCM_t channel_model,
|
||||
double sampling_rate,
|
||||
double sampling_rate,
|
||||
double channel_bandwidth,
|
||||
double TDL_DS,
|
||||
double TDL_DS,
|
||||
double forgetting_factor,
|
||||
int32_t channel_offset,
|
||||
double path_loss_dB);
|
||||
double path_loss_dB,
|
||||
float noise_power_dB);
|
||||
|
||||
channel_desc_t *find_channel_desc_fromname( char *modelname );
|
||||
|
||||
|
||||
/**
|
||||
\brief free memory allocated for a model descriptor
|
||||
\param ch points to the model, which cannot be used after calling this fuction
|
||||
@@ -293,6 +326,12 @@ void free_channel_desc_scm(channel_desc_t *ch);
|
||||
\param module_id identifies the channel model. should be define as a macro in simu.h
|
||||
*/
|
||||
void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id);
|
||||
/**
|
||||
\brief This function set a model name to a model descriptor, can be later used to identify a allocated channel model
|
||||
\param cdesc points to the model descriptor
|
||||
\param module_name is the C string to use as model name for the channel pointed by cdesc
|
||||
*/
|
||||
void set_channeldesc_name(channel_desc_t *cdesc,char *modelname);
|
||||
/** \fn void random_channel(channel_desc_t *desc)
|
||||
\brief This routine generates a random channel response (time domain) according to a tapped delay line model.
|
||||
\param desc Pointer to the channel descriptor
|
||||
@@ -300,10 +339,10 @@ void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_i
|
||||
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
|
||||
|
||||
/**\fn void multipath_channel(channel_desc_t *desc,
|
||||
double tx_sig_re[2],
|
||||
double tx_sig_im[2],
|
||||
double rx_sig_re[2],
|
||||
double rx_sig_im[2],
|
||||
double tx_sig_re[NB_ANTENNAS_TX],
|
||||
double tx_sig_im[NB_ANTENANS_TX],
|
||||
double rx_sig_re[NB_ANTENNAS_RX],
|
||||
double rx_sig_im[NB_ANTENNAS_RX],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel,
|
||||
int log_channel)
|
||||
@@ -320,10 +359,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
|
||||
*/
|
||||
|
||||
void multipath_channel(channel_desc_t *desc,
|
||||
double *tx_sig_re[2],
|
||||
double *tx_sig_im[2],
|
||||
double *rx_sig_re[2],
|
||||
double *rx_sig_im[2],
|
||||
double *tx_sig_re[NB_ANTENNAS_TX],
|
||||
double *tx_sig_im[NB_ANTENNAS_TX],
|
||||
double *rx_sig_re[NB_ANTENNAS_RX],
|
||||
double *rx_sig_im[NB_ANTENNAS_RX],
|
||||
uint32_t length,
|
||||
uint8_t keep_channel,
|
||||
int log_channel);
|
||||
@@ -452,11 +491,11 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
/**@} */
|
||||
/**@} */
|
||||
|
||||
int modelid_fromname(char *modelname);
|
||||
int modelid_fromstrtype(char *modeltype);
|
||||
double channelmod_get_snr_dB(void);
|
||||
double channelmod_get_sinr_dB(void);
|
||||
void init_channelmod(void) ;
|
||||
|
||||
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ;
|
||||
double N_RB2sampling_rate(uint16_t N_RB);
|
||||
double N_RB2channel_bandwidth(uint16_t N_RB);
|
||||
|
||||
@@ -468,11 +507,9 @@ double N_RB2channel_bandwidth(uint16_t N_RB);
|
||||
*/
|
||||
//look-up table for the sine (cosine) function
|
||||
#define ResolSinCos 100
|
||||
uint16_t LUTSin[ResolSinCos+1];
|
||||
void InitSinLUT( void );
|
||||
void phase_noise(double ts, int16_t * InRe, int16_t * InIm);
|
||||
|
||||
#include "targets/RT/USER/rfsim.h"
|
||||
|
||||
void do_DL_sig(sim_t *sim,
|
||||
uint16_t subframe,
|
||||
|
||||
Reference in New Issue
Block a user