Merge remote-tracking branch 'origin/develop-nr' into 409-merge-ulschsim-containing-pusch-encoding-and-decoding
This commit is contained in:
@@ -160,7 +160,7 @@ int main(int argc, char **argv) {
|
||||
//int run_initial_sync=0;
|
||||
int loglvl = OAILOG_WARNING;
|
||||
float target_error_rate = 0.01;
|
||||
|
||||
uint64_t SSB_positions=0x01;
|
||||
uint16_t nb_symb_sch = 12;
|
||||
uint16_t nb_rb = 50;
|
||||
uint8_t Imcs = 9;
|
||||
@@ -174,7 +174,7 @@ int main(int argc, char **argv) {
|
||||
//logInit();
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt(argc, argv, "df:hpg:i:j:n:l:m:r:s:S:y:z:N:F:R:P:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "df:hpg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file = 1;
|
||||
@@ -285,6 +285,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
SSB_positions = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
@@ -343,6 +347,7 @@ int main(int argc, char **argv) {
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
@@ -383,7 +388,7 @@ int main(int argc, char **argv) {
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
crcTableInit();
|
||||
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell);
|
||||
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell,SSB_positions);
|
||||
phy_init_nr_gNB(gNB, 0, 0);
|
||||
//init_eNB_afterRU();
|
||||
frame_length_complex_samples = frame_parms->samples_per_subframe;
|
||||
|
||||
@@ -101,7 +101,9 @@ int rrc_init_nr_global_param(void){return(0);}
|
||||
|
||||
void config_common(int Mod_idP,
|
||||
int CC_idP,
|
||||
int Nid_cell,
|
||||
int nr_bandP,
|
||||
uint64_t ssb_pattern,
|
||||
uint64_t dl_CarrierFreqP,
|
||||
uint32_t dl_BandwidthP
|
||||
);
|
||||
@@ -134,6 +136,7 @@ int main(int argc, char **argv)
|
||||
int trial,n_trials=1,n_errors,n_errors2,n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
uint64_t SSB_positions=0x01;
|
||||
|
||||
channel_desc_t *gNB2UE;
|
||||
uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
||||
@@ -151,6 +154,8 @@ int main(int argc, char **argv)
|
||||
int pbch_tx_ant;
|
||||
int N_RB_DL=273,mu=1;
|
||||
|
||||
uint64_t ssb_pattern = 0x01;
|
||||
|
||||
unsigned char frame_type = 0;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
@@ -182,7 +187,7 @@ int main(int argc, char **argv)
|
||||
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:N:F:GR:dP:IL:")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
@@ -309,6 +314,10 @@ int main(int argc, char **argv)
|
||||
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
SSB_positions = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
@@ -361,6 +370,7 @@ int main(int argc, char **argv)
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
@@ -396,7 +406,7 @@ int main(int argc, char **argv)
|
||||
frame_parms->N_RB_UL = N_RB_DL;
|
||||
|
||||
// stub to configure frame_parms
|
||||
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell);
|
||||
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||
// call MAC to configure common parameters
|
||||
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
@@ -499,7 +509,7 @@ int main(int argc, char **argv)
|
||||
mac_top_init_gNB();
|
||||
gNB_mac = RC.nrmac[0];
|
||||
|
||||
config_common(0,0,78,(uint64_t)3640000000L,N_RB_DL);
|
||||
config_common(0,0,Nid_cell,78,ssb_pattern,(uint64_t)3640000000L,N_RB_DL);
|
||||
config_nr_mib(0,0,1,kHz30,0,0,0,0);
|
||||
|
||||
nr_l2_init_ue();
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
|
||||
@@ -105,6 +106,7 @@ int main(int argc, char **argv)
|
||||
int trial,n_trials=1,n_errors=0,n_errors_payload=0;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
uint64_t SSB_positions=0x01;
|
||||
|
||||
channel_desc_t *gNB2UE;
|
||||
|
||||
@@ -127,7 +129,7 @@ int main(int argc, char **argv)
|
||||
unsigned char frame_type = 0;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
int frame=0,subframe=0;
|
||||
int frame=0;
|
||||
int frame_length_complex_samples;
|
||||
int frame_length_complex_samples_no_prefix;
|
||||
NR_DL_FRAME_PARMS *frame_parms;
|
||||
@@ -148,7 +150,7 @@ int main(int argc, char **argv)
|
||||
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:o:s:S:t:x:y:z:N:F:GR:dP:IL:")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:o:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
@@ -280,6 +282,10 @@ int main(int argc, char **argv)
|
||||
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
SSB_positions = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
@@ -333,6 +339,7 @@ int main(int argc, char **argv)
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-o Carrier frequency offset in Hz\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
@@ -365,33 +372,39 @@ int main(int argc, char **argv)
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
frame_parms->N_RB_UL = N_RB_DL;
|
||||
frame_parms->Nid_cell = Nid_cell;
|
||||
frame_parms->nushift = Nid_cell%4;
|
||||
frame_parms->ssb_type = nr_ssb_type_C;
|
||||
|
||||
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell);
|
||||
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
|
||||
phy_init_nr_gNB(gNB,0,0);
|
||||
|
||||
double fs,bw,scs,eps;
|
||||
uint8_t n_hf = gNB_config->sch_config.half_frame_index.value;
|
||||
|
||||
if (mu == 1 && N_RB_DL == 217) {
|
||||
fs = 122.88e6;
|
||||
bw = 80e6;
|
||||
scs = 30000;
|
||||
}
|
||||
else if (mu == 1 && N_RB_DL == 245) {
|
||||
fs = 122.88e6;
|
||||
bw = 90e6;
|
||||
scs = 30000;
|
||||
double fs,bw,scs,eps;
|
||||
|
||||
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;
|
||||
}
|
||||
else if (mu == 1 && N_RB_DL == 273) {
|
||||
fs = 122.88e6;
|
||||
bw = 100e6;
|
||||
scs = 30000;
|
||||
}
|
||||
else if (mu == 1 && N_RB_DL == 106) {
|
||||
fs = 61.44e6;
|
||||
bw = 40e6;
|
||||
scs = 30000;
|
||||
}
|
||||
else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL);
|
||||
|
||||
// cfo with respect to sub-carrier spacing
|
||||
eps = cfo/scs;
|
||||
@@ -476,31 +489,38 @@ int main(int argc, char **argv)
|
||||
if (input_fd==NULL) {
|
||||
gNB->pbch_configured = 1;
|
||||
for (int i=0;i<4;i++) gNB->pbch_pdu[i]=i+1;
|
||||
nr_common_signal_procedures (gNB,frame,subframe);
|
||||
|
||||
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);
|
||||
|
||||
//TODO: loop over slots
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (gNB_config->subframe_config.dl_cyclic_prefix_type.value == 1) {
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
txdata[aa],
|
||||
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],
|
||||
14,
|
||||
frame_parms);
|
||||
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 (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (gNB_config->subframe_config.dl_cyclic_prefix_type.value == 1) {
|
||||
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][slot*frame_parms->samples_per_slot],
|
||||
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][slot*frame_parms->samples_per_slot],
|
||||
14,
|
||||
frame_parms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
} else {
|
||||
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,
|
||||
@@ -536,7 +556,6 @@ int main(int argc, char **argv)
|
||||
n_errors_payload = 0;
|
||||
|
||||
for (trial=0; trial<n_trials; trial++) {
|
||||
|
||||
// multipath channel
|
||||
//multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
|
||||
|
||||
@@ -575,9 +594,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0],frame_parms->samples_per_subframe,1,1);
|
||||
LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0],frame_parms->samples_per_frame,1,1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1],frame_parms->samples_per_subframe,1,1);
|
||||
LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1],frame_parms->samples_per_frame,1,1);
|
||||
}
|
||||
|
||||
if (UE->is_synchronized == 0) {
|
||||
@@ -587,40 +606,30 @@ int main(int argc, char **argv)
|
||||
}
|
||||
else {
|
||||
UE->rx_offset=0;
|
||||
//symbol 1
|
||||
nr_slot_fep(UE,
|
||||
5,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
NR_PBCH_EST);
|
||||
|
||||
//symbol 2
|
||||
nr_slot_fep(UE,
|
||||
6,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
NR_PBCH_EST);
|
||||
|
||||
//symbol 3
|
||||
nr_slot_fep(UE,
|
||||
7,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
NR_PBCH_EST);
|
||||
|
||||
ret = nr_rx_pbch(UE,
|
||||
0,
|
||||
UE->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
SISO,
|
||||
UE->high_speed_flag);
|
||||
uint8_t ssb_index = 0;
|
||||
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
|
||||
|
||||
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index, n_hf);
|
||||
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
|
||||
nr_slot_fep(UE,
|
||||
i,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NR_PBCH_EST);
|
||||
|
||||
nr_pbch_channel_estimation(UE,0,0,i,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
|
||||
}
|
||||
|
||||
ret = nr_rx_pbch(UE,
|
||||
0,
|
||||
UE->pbch_vars[0],
|
||||
frame_parms,
|
||||
0,
|
||||
ssb_index%8,
|
||||
SISO,
|
||||
UE->high_speed_flag);
|
||||
|
||||
if (ret==0) {
|
||||
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
|
||||
@@ -643,11 +652,11 @@ int main(int argc, char **argv)
|
||||
if (ret!=0) n_errors++;
|
||||
}
|
||||
} //noise trials
|
||||
|
||||
printf("SNR %f: trials %d, n_errors_crc = %d, n_errors_payload %d\n", SNR,n_trials,n_errors,n_errors_payload);
|
||||
|
||||
if (((float)n_errors/(float)n_trials <= target_error_rate) && (n_errors_payload==0)) {
|
||||
printf("PBCH test OK\n");
|
||||
printf("Synchronization obtained for i_ssb = %d\n",UE->rx_ind.rx_indication_body[0].mib_pdu.ssb_index);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user