changes in PUCCH0 SNR measurement, testing for PUCCH power control
This commit is contained in:
@@ -114,12 +114,13 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
|||||||
|
|
||||||
if (s==first_symb) {
|
if (s==first_symb) {
|
||||||
nb_symb[rb]=0;
|
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;
|
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
|
if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
|
||||||
nb_symb[rb]++;
|
nb_symb[rb]++;
|
||||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
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);
|
offset = offset0 + (s*frame_parms->ofdm_symbol_size);
|
||||||
ul_ch = &common_vars->rxdataF[aarx][offset];
|
ul_ch = &common_vars->rxdataF[aarx][offset];
|
||||||
len = 12;
|
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");
|
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[aarx][rb] += signal_energy_nodc(ul_ch,len);
|
||||||
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
|
|
||||||
} //antenna
|
} //antenna
|
||||||
}
|
}
|
||||||
} //rb
|
} //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) {
|
if (nb_symb[rb] > 0) {
|
||||||
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
||||||
measurements->n0_subband_power[aarx][rb]/=nb_symb[rb];
|
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];
|
n0_subband_tot_perPRB+=measurements->n0_subband_power[aarx][rb];
|
||||||
if (rb==0) n0_subband_tot_perANT[aarx]=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];
|
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;
|
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_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);
|
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;
|
n0_subband_tot += n0_subband_tot_perPRB;
|
||||||
nb_rb++;
|
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) {
|
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;
|
gNB->ulsch_stats[i].dump_frame = gNB->ulsch_stats[i].frame;
|
||||||
for (int aa=0;aa<gNB->frame_parms.nb_antennas_rx;aa++)
|
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,
|
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].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",
|
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].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);
|
||||||
|
|||||||
@@ -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]));
|
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 (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
|
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;
|
av_corr/=nr_sequences/l;
|
||||||
|
|
||||||
int xrtmag_dBtimes10 = 10*(int)dB_fixed64(xrtmag/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/frame_parms->nb_antennas_rx);
|
int xrtmag_next_dBtimes10 = 10*(int)dB_fixed64(xrtmag_next/(12*l));
|
||||||
#ifdef DEBUG_NR_PUCCH_RX
|
#ifdef DEBUG_NR_PUCCH_RX
|
||||||
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
||||||
#endif
|
#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_confidence_level = no_conf ? 1 : 0;
|
||||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
||||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||||
LOG_I(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",
|
if (no_conf) LOG_I(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);
|
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) {
|
if (pucch_pdu->sr_flag == 1) {
|
||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
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 = (nfapi_nr_harq_t*)malloc(2);
|
||||||
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
||||||
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
|
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
|
||||||
LOG_I(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",
|
if (no_conf) LOG_I(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);
|
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) {
|
if (pucch_pdu->sr_flag == 1) {
|
||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
||||||
|
|||||||
+12
-11
@@ -145,6 +145,7 @@ typedef struct {
|
|||||||
int power[NB_ANTENNAS_RX];
|
int power[NB_ANTENNAS_RX];
|
||||||
int noise_power[NB_ANTENNAS_RX];
|
int noise_power[NB_ANTENNAS_RX];
|
||||||
int DTX;
|
int DTX;
|
||||||
|
int sync_pos;
|
||||||
} NR_gNB_SCH_STATS_t;
|
} NR_gNB_SCH_STATS_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -661,33 +662,33 @@ typedef struct {
|
|||||||
//! estimated noise power (linear)
|
//! estimated noise power (linear)
|
||||||
unsigned int n0_power[MAX_NUM_RU_PER_gNB];
|
unsigned int n0_power[MAX_NUM_RU_PER_gNB];
|
||||||
//! estimated noise power (dB)
|
//! 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)
|
//! total estimated noise power (linear)
|
||||||
unsigned int n0_power_tot;
|
unsigned int n0_power_tot;
|
||||||
//! estimated avg noise power (dB)
|
//! estimated avg noise power (dB)
|
||||||
unsigned short n0_power_tot_dB;
|
unsigned int n0_power_tot_dB;
|
||||||
//! estimated avg noise power (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)
|
//! 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)
|
//! 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)
|
//! 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)
|
//! 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)
|
//! 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)
|
//! 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)
|
// gNB measurements (per user)
|
||||||
//! estimated received spatial signal power (linear)
|
//! estimated received spatial signal power (linear)
|
||||||
unsigned int rx_spatial_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
unsigned int rx_spatial_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
|
||||||
//! estimated received spatial signal power (dB)
|
//! 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)
|
//! 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)
|
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
||||||
int rx_correlation[NUMBER_OF_NR_ULSCH_MAX][2];
|
int rx_correlation[NUMBER_OF_NR_ULSCH_MAX][2];
|
||||||
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
//! 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;
|
int sync_pos;
|
||||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||||
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
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;
|
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;
|
sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1;
|
||||||
else
|
else
|
||||||
sync_pos_rounded = sync_pos - (bw_scaling / 2) - 1;
|
sync_pos_rounded = sync_pos - (bw_scaling / 2) - 1;
|
||||||
|
if (stats) stats->sync_pos = sync_pos;
|
||||||
|
|
||||||
timing_advance_update = sync_pos_rounded / bw_scaling;
|
timing_advance_update = sync_pos_rounded / bw_scaling;
|
||||||
|
|
||||||
// put timing advance command in 0..63 range
|
// 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;
|
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||||
|
|
||||||
double DS_TDL = .03;
|
double DS_TDL = .03;
|
||||||
|
|
||||||
|
double delay_us = 0;
|
||||||
int N_RB_DL=273,mu=1;
|
int N_RB_DL=273,mu=1;
|
||||||
float target_error_rate=0.001;
|
float target_error_rate=0.001;
|
||||||
int frame_length_complex_samples;
|
int frame_length_complex_samples;
|
||||||
@@ -113,7 +114,7 @@ int main(int argc, char **argv)
|
|||||||
//unsigned char frame_type = 0;
|
//unsigned char frame_type = 0;
|
||||||
int loglvl=OAILOG_WARNING;
|
int loglvl=OAILOG_WARNING;
|
||||||
int sr_flag = 0;
|
int sr_flag = 0;
|
||||||
int pucch_DTX_thres = 100;
|
int pucch_DTX_thres = 50;
|
||||||
cpuf = get_cpu_freq_GHz();
|
cpuf = get_cpu_freq_GHz();
|
||||||
|
|
||||||
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
|
||||||
@@ -123,7 +124,7 @@ int main(int argc, char **argv)
|
|||||||
randominit(0);
|
randominit(0);
|
||||||
logInit();
|
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) {
|
switch (c) {
|
||||||
case 'f':
|
case 'f':
|
||||||
//write_output_file=1;
|
//write_output_file=1;
|
||||||
@@ -228,6 +229,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
|
case 'd':
|
||||||
|
delay_us=atof(optarg);
|
||||||
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
transmission_mode=atoi(optarg);
|
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);
|
set_glog(loglvl);
|
||||||
|
|
||||||
if (snr1set==0) snr1 = snr0+10;
|
if (snr1set==0) snr1 = snr0+10;
|
||||||
@@ -479,7 +485,7 @@ int main(int argc, char **argv)
|
|||||||
//configure UE
|
//configure UE
|
||||||
UE = calloc(1,sizeof(PHY_VARS_NR_UE));
|
UE = calloc(1,sizeof(PHY_VARS_NR_UE));
|
||||||
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
|
||||||
|
UE->frame_parms.nb_antennas_rx=1;
|
||||||
UE->perfect_ce = 0;
|
UE->perfect_ce = 0;
|
||||||
|
|
||||||
if(eps!=0.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)
|
// sigma2 is variance per dimension, so N/(N_RB*12)
|
||||||
// so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12)
|
// so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12)
|
||||||
int N_RB = (format == 0 || format == 1) ? 1 : nrofPRB;
|
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);
|
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);
|
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);
|
random_channel(UE2gNB,0);
|
||||||
freq_channel(UE2gNB,N_RB_DL,2*N_RB_DL+1,scs/1000);
|
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++) {
|
for (int symb=0; symb<nrofSymbols; symb++) {
|
||||||
i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
|
||||||
for (int re=0;re<N_RB_DL*12;re++) {
|
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);
|
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++) {
|
for (int aarx=0;aarx<n_rx;aarx++) {
|
||||||
txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
|
||||||
txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
|
||||||
rxr = txr*UE2gNB->chF[aarx][re].r - txi*UE2gNB->chF[aarx][re].i;
|
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;
|
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);
|
nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
|
||||||
ni = 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));
|
((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],
|
for (int aarx=0;aarx<n_rx;aarx++) rxlev += signal_energy(&rxdataF[aarx][startingSymbolIndex*frame_parms->ofdm_symbol_size],
|
||||||
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++){
|
for (int s=0;s<frame_parms->symbols_per_slot;s++){
|
||||||
if (s>=startingSymbolIndex && s<(startingSymbolIndex+nrofSymbols))
|
if (s>=startingSymbolIndex && s<(startingSymbolIndex+nrofSymbols))
|
||||||
for (int rb=0; rb<N_RB; rb++) {
|
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));
|
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);
|
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){
|
if(format==0){
|
||||||
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
|
||||||
nfapi_nr_pucch_pdu_t pucch_pdu;
|
nfapi_nr_pucch_pdu_t pucch_pdu;
|
||||||
@@ -643,7 +663,7 @@ int main(int argc, char **argv)
|
|||||||
sr_errors+=1;
|
sr_errors+=1;
|
||||||
}
|
}
|
||||||
if(nr_bit>0){
|
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);
|
ack_nack_errors+=(actual_payload^uci_pdu.harq->harq_list[0].harq_value);
|
||||||
else if (do_DTX == 0)
|
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));
|
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));
|
||||||
|
|||||||
@@ -899,7 +899,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
harq->is_waiting = true;
|
harq->is_waiting = true;
|
||||||
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
|
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
|
||||||
|
|
||||||
LOG_I(NR_MAC,
|
LOG_D(NR_MAC,
|
||||||
"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) TPC %d\n",
|
"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) TPC %d\n",
|
||||||
frame,
|
frame,
|
||||||
slot,
|
slot,
|
||||||
|
|||||||
@@ -1234,7 +1234,7 @@ int nr_acknack_scheduling(int mod_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_I(NR_MAC,"pucch_acknak 1. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c);
|
LOG_D(NR_MAC,"pucch_acknak 1. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c);
|
||||||
|
|
||||||
// this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP
|
// this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP
|
||||||
NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id];
|
NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id];
|
||||||
@@ -1286,7 +1286,7 @@ int nr_acknack_scheduling(int mod_id,
|
|||||||
pucch->timing_indicator = i;
|
pucch->timing_indicator = i;
|
||||||
pucch->dai_c++;
|
pucch->dai_c++;
|
||||||
// retain old resource indicator, and we are good
|
// retain old resource indicator, and we are good
|
||||||
LOG_I(NR_MAC,"pucch_acknak : %d.%d. DAI > 0, pucch allocated for %d.%d (index %d)\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
|
LOG_D(NR_MAC,"pucch_acknak : %d.%d. DAI > 0, pucch allocated for %d.%d (index %d)\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1373,7 +1373,7 @@ int nr_acknack_scheduling(int mod_id,
|
|||||||
|
|
||||||
pucch->timing_indicator = ind_found; // index in the list of timing indicators
|
pucch->timing_indicator = ind_found; // index in the list of timing indicators
|
||||||
|
|
||||||
LOG_I(NR_MAC,"pucch_acknak 2. DAI 0 DL %d.%d, UL_ACK %d.%d (index %d)\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
|
LOG_D(NR_MAC,"pucch_acknak 2. DAI 0 DL %d.%d, UL_ACK %d.%d (index %d)\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
|
||||||
|
|
||||||
pucch->dai_c++;
|
pucch->dai_c++;
|
||||||
pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources
|
pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources
|
||||||
|
|||||||
@@ -1044,7 +1044,7 @@ void pf_ul(module_id_t module_id,
|
|||||||
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
||||||
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
||||||
NR_UE_info_t *UE_info = &nrmac->UE_info;
|
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];
|
float coeff_ue[MAX_MOBILES_PER_GNB];
|
||||||
// UEs that could be scheduled
|
// UEs that could be scheduled
|
||||||
int ue_array[MAX_MOBILES_PER_GNB];
|
int ue_array[MAX_MOBILES_PER_GNB];
|
||||||
@@ -1218,7 +1218,7 @@ void pf_ul(module_id_t module_id,
|
|||||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else LOG_I(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||||
|
|
||||||
/* Save PUSCH field */
|
/* Save PUSCH field */
|
||||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||||
@@ -1247,7 +1247,7 @@ void pf_ul(module_id_t module_id,
|
|||||||
&rbSize);
|
&rbSize);
|
||||||
sched_pusch->rbSize = rbSize;
|
sched_pusch->rbSize = rbSize;
|
||||||
sched_pusch->tb_size = TBS;
|
sched_pusch->tb_size = TBS;
|
||||||
LOG_I(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n",
|
LOG_D(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n",
|
||||||
rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS);
|
rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS);
|
||||||
|
|
||||||
/* Mark the corresponding RBs as used */
|
/* Mark the corresponding RBs as used */
|
||||||
|
|||||||
Reference in New Issue
Block a user