Merge remote-tracking branch 'origin/bandwidth-testing' into bandwidth-testing-abs
# Conflicts: # openair1/PHY/NR_TRANSPORT/pucch_rx.c
This commit is contained in:
+8
-7
@@ -712,7 +712,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
||||
int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame);
|
||||
int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame);
|
||||
int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame);
|
||||
int sf_extension = 0; //sf_extension = ru->sf_extension;
|
||||
int sf_extension = 0;
|
||||
int siglen=fp->get_samples_per_slot(slot,fp);
|
||||
int flags=1;
|
||||
|
||||
@@ -738,9 +738,10 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
||||
flags = 3; // end of burst
|
||||
}
|
||||
|
||||
if (slot_type == NR_DOWNLINK_SLOT && prevslot_type == NR_UPLINK_SLOT)
|
||||
if (slot_type == NR_DOWNLINK_SLOT && prevslot_type == NR_UPLINK_SLOT) {
|
||||
flags = 2; // start of burst
|
||||
|
||||
sf_extension = ru->sf_extension;
|
||||
}
|
||||
if (slot_type == NR_DOWNLINK_SLOT && nextslot_type == NR_UPLINK_SLOT)
|
||||
flags = 3; // end of burst
|
||||
}
|
||||
@@ -773,7 +774,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot );
|
||||
|
||||
for (i=0; i<ru->nb_tx; i++)
|
||||
txp[i] = (void *)&ru->common.txdata[i][fp->get_samples_slot_timestamp(slot,fp,0)-sf_extension];
|
||||
txp[i] = (void *)&ru->common.txdata[i][fp->get_samples_slot_timestamp(slot,fp,0)]-sf_extension*sizeof(int32_t);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
|
||||
@@ -784,8 +785,8 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
||||
siglen+sf_extension,
|
||||
ru->nb_tx,
|
||||
flags);
|
||||
LOG_D(PHY,"[TXPATH] RU %d aa %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, slot %d, flags %d, siglen+sf_extension %d, returned %d, E %f\n",ru->idx,i,
|
||||
(long long unsigned int)(timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension),frame,proc->frame_tx_unwrap,slot, flags, siglen+sf_extension, txs,10*log10((double)signal_energy(txp[0],siglen+sf_extension)));
|
||||
LOG_D(PHY,"[TXPATH] RU %d aa %d tx_rf, writing to TS %llu, %d.%d, unwrapped_frame %d, slot %d, flags %d, siglen+sf_extension %d, returned %d, E %f\n",ru->idx,i,
|
||||
(long long unsigned int)(timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension),frame,slot,proc->frame_tx_unwrap,slot, flags, siglen+sf_extension, txs,10*log10((double)signal_energy(txp[0],siglen+sf_extension)));
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
|
||||
//AssertFatal(txs == 0,"trx write function error %d\n", txs);
|
||||
}
|
||||
@@ -2069,7 +2070,7 @@ static void NRRCconfig_RU(void) {
|
||||
RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
|
||||
RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
|
||||
RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
|
||||
|
||||
RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr);
|
||||
for (i=0; i<RC.ru[j]->num_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
|
||||
} //strcmp(local_rf, "yes") == 0
|
||||
else {
|
||||
|
||||
@@ -60,10 +60,12 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
|
||||
for (i=0; i<ru->nb_tx; i++) {
|
||||
// Allocate 10 subframes of I/Q TX signal data (time) if not
|
||||
ru->common.txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_frame*sizeof(int32_t) );
|
||||
ru->common.txdata[i] = (int32_t*)malloc16_clear( ru->sf_extension + (fp->samples_per_frame*sizeof(int32_t) ));
|
||||
LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i],
|
||||
(ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t),ru->sf_extension);
|
||||
ru->common.txdata[i] = &ru->common.txdata[i][ru->sf_extension];
|
||||
|
||||
LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes)\n",i,ru->common.txdata[i],
|
||||
fp->samples_per_frame*sizeof(int32_t));
|
||||
LOG_I(PHY,"[INIT] common.txdata[%d] = %p \n",i,ru->common.txdata[i]);
|
||||
|
||||
}
|
||||
for (i=0;i<ru->nb_rx;i++) {
|
||||
@@ -176,7 +178,11 @@ void nr_phy_free_RU(RU_t *ru)
|
||||
free_and_zero(ru->frame_parms);
|
||||
|
||||
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
|
||||
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]);
|
||||
int32_t *ptr;
|
||||
for (i = 0; i < ru->nb_tx; i++) {
|
||||
ptr=&ru->common.txdata[i][-ru->sf_extension];
|
||||
free_and_zero(ptr);
|
||||
}
|
||||
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
|
||||
free_and_zero(ru->common.txdata);
|
||||
free_and_zero(ru->common.rxdata);
|
||||
|
||||
@@ -114,12 +114,13 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
||||
|
||||
if (s==first_symb) {
|
||||
nb_symb[rb]=0;
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx;aarx++)
|
||||
measurements->n0_subband_power[aarx][rb]=0;
|
||||
}
|
||||
offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
|
||||
if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
|
||||
nb_symb[rb]++;
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
if (s==first_symb) measurements->n0_subband_power[aarx][rb]=0;
|
||||
offset = offset0 + (s*frame_parms->ofdm_symbol_size);
|
||||
ul_ch = &common_vars->rxdataF[aarx][offset];
|
||||
len = 12;
|
||||
@@ -129,7 +130,6 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
||||
}
|
||||
AssertFatal(ul_ch, "RX signal buffer (freq) problem\n");
|
||||
measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
|
||||
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
|
||||
} //antenna
|
||||
}
|
||||
} //rb
|
||||
@@ -144,6 +144,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
||||
if (nb_symb[rb] > 0) {
|
||||
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
||||
measurements->n0_subband_power[aarx][rb]/=nb_symb[rb];
|
||||
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
|
||||
n0_subband_tot_perPRB+=measurements->n0_subband_power[aarx][rb];
|
||||
if (rb==0) n0_subband_tot_perANT[aarx]=measurements->n0_subband_power[aarx][rb];
|
||||
else n0_subband_tot_perANT[aarx]+=measurements->n0_subband_power[aarx][rb];
|
||||
@@ -151,7 +152,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
||||
n0_subband_tot_perPRB/=frame_parms->nb_antennas_rx;
|
||||
measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_subband_tot_perPRB);
|
||||
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - gNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
|
||||
//printf("n0_subband_power_tot_dB[%d] => %d, over %d symbols\n",rb,measurements->n0_subband_power_tot_dB[rb],nb_symb[rb]);
|
||||
LOG_D(PHY,"n0_subband_power_tot_dB[%d] => %d, over %d symbols\n",rb,measurements->n0_subband_power_tot_dB[rb],nb_symb[rb]);
|
||||
n0_subband_tot += n0_subband_tot_perPRB;
|
||||
nb_rb++;
|
||||
}
|
||||
|
||||
@@ -144,10 +144,11 @@ void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
if (gNB->ulsch_stats[i].rnti>0 && gNB->ulsch_stats[i].frame != gNB->ulsch_stats[i].dump_frame) {
|
||||
gNB->ulsch_stats[i].dump_frame = gNB->ulsch_stats[i].frame;
|
||||
for (int aa=0;aa<gNB->frame_parms.nb_antennas_rx;aa++)
|
||||
if (aa==0) fprintf(fd,"ULSCH RNTI %4x, %d.%d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d\n",
|
||||
if (aa==0) fprintf(fd,"ULSCH RNTI %4x, %d.%d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n",
|
||||
gNB->ulsch_stats[i].rnti,gNB->ulsch_stats[i].frame,gNB->ulsch_stats[i].dump_frame,
|
||||
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
|
||||
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10);
|
||||
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10,
|
||||
gNB->ulsch_stats[i].sync_pos);
|
||||
else fprintf(fd," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
|
||||
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
|
||||
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10);
|
||||
|
||||
@@ -322,12 +322,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pucch_pdu->freq_hop_flag == 0 && l==1) {// non-coherent correlation
|
||||
temp=0;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++)
|
||||
temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0];
|
||||
}
|
||||
|
||||
LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0][0],corr_im[0][0],10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0]));
|
||||
if (l>1) LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0][1],corr_im[0][1],10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1]));
|
||||
if (pucch_pdu->freq_hop_flag == 0 && l==1) {// non-coherent correlation
|
||||
@@ -376,8 +370,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
|
||||
av_corr/=nr_sequences/l;
|
||||
|
||||
int xrtmag_dBtimes10 = 10*(int)dB_fixed64(xrtmag/frame_parms->nb_antennas_rx);
|
||||
int xrtmag_next_dBtimes10 = 10*(int)dB_fixed64(xrtmag_next/frame_parms->nb_antennas_rx);
|
||||
int xrtmag_dBtimes10 = 10*(int)dB_fixed64(xrtmag/(12*l));
|
||||
int xrtmag_next_dBtimes10 = 10*(int)dB_fixed64(xrtmag_next/(12*l));
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
||||
#endif
|
||||
@@ -432,8 +426,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0;
|
||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d srt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d\n",
|
||||
frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10);
|
||||
if (no_conf) LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n",
|
||||
frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos);
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
||||
@@ -449,8 +443,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
|
||||
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
||||
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
|
||||
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d\n",
|
||||
frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10);
|
||||
if (no_conf) LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n",
|
||||
frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos);
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
||||
|
||||
+12
-11
@@ -145,6 +145,7 @@ typedef struct {
|
||||
int power[NB_ANTENNAS_RX];
|
||||
int noise_power[NB_ANTENNAS_RX];
|
||||
int DTX;
|
||||
int sync_pos;
|
||||
} NR_gNB_SCH_STATS_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -661,33 +662,33 @@ typedef struct {
|
||||
//! estimated noise power (linear)
|
||||
unsigned int n0_power[MAX_NUM_RU_PER_gNB];
|
||||
//! estimated noise power (dB)
|
||||
unsigned short n0_power_dB[MAX_NUM_RU_PER_gNB];
|
||||
unsigned int n0_power_dB[MAX_NUM_RU_PER_gNB];
|
||||
//! total estimated noise power (linear)
|
||||
unsigned int n0_power_tot;
|
||||
//! estimated avg noise power (dB)
|
||||
unsigned short n0_power_tot_dB;
|
||||
unsigned int n0_power_tot_dB;
|
||||
//! estimated avg noise power (dB)
|
||||
short n0_power_tot_dBm;
|
||||
int n0_power_tot_dBm;
|
||||
//! estimated avg noise power per RB per RX ant (lin)
|
||||
unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275];
|
||||
unsigned int n0_subband_power[MAX_NUM_RU_PER_gNB][275];
|
||||
//! estimated avg noise power per RB per RX ant (dB)
|
||||
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275];
|
||||
unsigned int n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275];
|
||||
//! estimated avg subband noise power (dB)
|
||||
unsigned short n0_subband_power_avg_dB;
|
||||
unsigned int n0_subband_power_avg_dB;
|
||||
//! estimated avg subband noise power per antenna (dB)
|
||||
unsigned short n0_subband_power_avg_perANT_dB[NB_ANTENNAS_RX];
|
||||
unsigned int n0_subband_power_avg_perANT_dB[NB_ANTENNAS_RX];
|
||||
//! estimated avg noise power per RB (dB)
|
||||
short n0_subband_power_tot_dB[275];
|
||||
int n0_subband_power_tot_dB[275];
|
||||
//! estimated avg noise power per RB (dBm)
|
||||
short n0_subband_power_tot_dBm[275];
|
||||
int n0_subband_power_tot_dBm[275];
|
||||
|
||||
// gNB measurements (per user)
|
||||
//! estimated received spatial signal power (linear)
|
||||
unsigned int rx_spatial_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
||||
//! estimated received spatial signal power (dB)
|
||||
unsigned short rx_spatial_power_dB[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
||||
unsigned int rx_spatial_power_dB[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
||||
//! estimated rssi (dBm)
|
||||
short rx_rssi_dBm[NUMBER_OF_NR_ULSCH_MAX];
|
||||
int rx_rssi_dBm[NUMBER_OF_NR_ULSCH_MAX];
|
||||
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
||||
int rx_correlation[NUMBER_OF_NR_ULSCH_MAX][2];
|
||||
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
||||
|
||||
@@ -413,6 +413,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
int sync_pos;
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
||||
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
|
||||
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu;
|
||||
|
||||
@@ -427,6 +428,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1;
|
||||
else
|
||||
sync_pos_rounded = sync_pos - (bw_scaling / 2) - 1;
|
||||
if (stats) stats->sync_pos = sync_pos;
|
||||
|
||||
timing_advance_update = sync_pos_rounded / bw_scaling;
|
||||
|
||||
// put timing advance command in 0..63 range
|
||||
|
||||
@@ -104,7 +104,8 @@ int main(int argc, char **argv)
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
double DS_TDL = .03;
|
||||
|
||||
|
||||
double delay_us = 0;
|
||||
int N_RB_DL=273,mu=1;
|
||||
float target_error_rate=0.001;
|
||||
int frame_length_complex_samples;
|
||||
@@ -113,7 +114,7 @@ int main(int argc, char **argv)
|
||||
//unsigned char frame_type = 0;
|
||||
int loglvl=OAILOG_WARNING;
|
||||
int sr_flag = 0;
|
||||
int pucch_DTX_thres = 100;
|
||||
int pucch_DTX_thres = 50;
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||
@@ -123,7 +124,7 @@ int main(int argc, char **argv)
|
||||
randominit(0);
|
||||
logInit();
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:c")) != -1) {
|
||||
while ((c = getopt (argc, argv, "f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:cd:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
//write_output_file=1;
|
||||
@@ -228,6 +229,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'd':
|
||||
delay_us=atof(optarg);
|
||||
break;
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
@@ -346,6 +350,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
double phase = (1<<mu)*30e-3*delay_us;
|
||||
|
||||
set_glog(loglvl);
|
||||
|
||||
if (snr1set==0) snr1 = snr0+10;
|
||||
@@ -479,7 +485,7 @@ int main(int argc, char **argv)
|
||||
//configure UE
|
||||
UE = calloc(1,sizeof(PHY_VARS_NR_UE));
|
||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
UE->frame_parms.nb_antennas_rx=1;
|
||||
UE->perfect_ce = 0;
|
||||
|
||||
if(eps!=0.0)
|
||||
@@ -550,7 +556,7 @@ int main(int argc, char **argv)
|
||||
// sigma2 is variance per dimension, so N/(N_RB*12)
|
||||
// so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12)
|
||||
int N_RB = (format == 0 || format == 1) ? 1 : nrofPRB;
|
||||
sigma2_dB = 10*log10(txlev/(12.0*N_RB))-SNR;
|
||||
sigma2_dB = 10*log10(txlev*(N_RB_DL/N_RB))-SNR;
|
||||
sigma2 = pow(10.0,sigma2_dB/10.0);
|
||||
|
||||
if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB);
|
||||
@@ -574,15 +580,22 @@ int main(int argc, char **argv)
|
||||
|
||||
random_channel(UE2gNB,0);
|
||||
freq_channel(UE2gNB,N_RB_DL,2*N_RB_DL+1,scs/1000);
|
||||
struct complexd phasor;
|
||||
double rxr_tmp;
|
||||
for (int symb=0; symb<nrofSymbols; symb++) {
|
||||
i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
||||
for (int re=0;re<N_RB_DL*12;re++) {
|
||||
i=i0+((gNB->frame_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
|
||||
phasor.r = cos(2*M_PI*phase*re);
|
||||
phasor.i = sin(2*M_PI*phase*re);
|
||||
for (int aarx=0;aarx<n_rx;aarx++) {
|
||||
txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
||||
txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
||||
rxr = txr*UE2gNB->chF[aarx][re].r - txi*UE2gNB->chF[aarx][re].i;
|
||||
rxi = txr*UE2gNB->chF[aarx][re].i + txi*UE2gNB->chF[aarx][re].r;
|
||||
rxr_tmp = rxr*phasor.r - rxi*phasor.i;
|
||||
rxi = rxr*phasor.i + rxi*phasor.r;
|
||||
rxr = rxr_tmp;
|
||||
nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||
((int16_t*)rxdataF[aarx])[i<<1] = (int16_t)(100.0*(rxr + nr)/sqrt((double)txlev));
|
||||
@@ -601,7 +614,12 @@ int main(int argc, char **argv)
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size);
|
||||
|
||||
// noise measurement
|
||||
int rxlev_pucch=0;
|
||||
|
||||
for (int aarx=0;aarx<n_rx;aarx++) rxlev_pucch += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||
12);
|
||||
|
||||
// set UL mask for pucch allocation
|
||||
for (int s=0;s<frame_parms->symbols_per_slot;s++){
|
||||
if (s>=startingSymbolIndex && s<(startingSymbolIndex+nrofSymbols))
|
||||
for (int rb=0; rb<N_RB; rb++) {
|
||||
@@ -609,9 +627,11 @@ int main(int argc, char **argv)
|
||||
gNB->rb_mask_ul[s][rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
}
|
||||
|
||||
// noise measurement (all PRBs)
|
||||
gNB_I0_measurements(gNB, nr_slot_tx, 0, gNB->frame_parms.symbols_per_slot);
|
||||
|
||||
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 (n_trials==1) printf("noise rxlev %d (%d dB), rxlev pucch %d dB sigma2 %f dB, SNR %f, TX %f, I0 (pucch) %d, I0 (avg) %d\n",rxlev,dB_fixed(rxlev),dB_fixed(rxlev_pucch),sigma2_dB,SNR,10*log10((double)txlev*UE->frame_parms.ofdm_symbol_size/12),gNB->measurements.n0_subband_power_tot_dB[startingPRB],gNB->measurements.n0_subband_power_avg_dB);
|
||||
if(format==0){
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
||||
nfapi_nr_pucch_pdu_t pucch_pdu;
|
||||
@@ -643,7 +663,7 @@ int main(int argc, char **argv)
|
||||
sr_errors+=1;
|
||||
}
|
||||
if(nr_bit>0){
|
||||
if(nr_bit==1 && do_DTX == 0)
|
||||
if (nr_bit==1 && do_DTX == 0)
|
||||
ack_nack_errors+=(actual_payload^uci_pdu.harq->harq_list[0].harq_value);
|
||||
else if (do_DTX == 0)
|
||||
ack_nack_errors+=(((actual_payload&1)^uci_pdu.harq->harq_list[0].harq_value)+((actual_payload>>1)^uci_pdu.harq->harq_list[1].harq_value));
|
||||
|
||||
@@ -156,7 +156,7 @@ typedef enum {
|
||||
{CONFIG_STRING_RU_SDR_ADDRS, NULL, 0, strptr:NULL, defstrval:"type=b200", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_RU_SDR_CLK_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_RU_SDR_TME_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:312, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:320, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_RU_END_OF_BURST_DELAY, NULL, 0, uptr:NULL, defuintval:400, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_RU_BF_WEIGHTS_LIST, NULL, 0, iptr:NULL, defintarrayval:DEFBFW, TYPE_INTARRAY, 0}, \
|
||||
|
||||
@@ -1052,7 +1052,7 @@ void pf_ul(module_id_t module_id,
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
||||
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
||||
NR_UE_info_t *UE_info = &nrmac->UE_info;
|
||||
const int min_rb = 5;
|
||||
const int min_rb = 40;
|
||||
float coeff_ue[MAX_MOBILES_PER_GNB];
|
||||
// UEs that could be scheduled
|
||||
int ue_array[MAX_MOBILES_PER_GNB];
|
||||
|
||||
@@ -1024,6 +1024,7 @@ extern "C" {
|
||||
// USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
|
||||
if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") )
|
||||
LOG_W(HW,"Can't set kernel parameters for X3xx\n");
|
||||
|
||||
}
|
||||
|
||||
s->usrp = uhd::usrp::multi_usrp::make(args);
|
||||
@@ -1096,6 +1097,7 @@ extern "C" {
|
||||
if (device->type==USRP_X300_DEV) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
|
||||
std::cerr << "-- Using calibration table: calib_table_x310" << std::endl;
|
||||
s->usrp->set_rx_dc_offset(true);
|
||||
}
|
||||
|
||||
if (device->type==USRP_N300_DEV) {
|
||||
|
||||
Reference in New Issue
Block a user