Commit 2bb1f36a authored by Robert Schmidt's avatar Robert Schmidt

Remove SNR parameter

The structure in which was snr will be a "SRS job" in a follow-up
commit, so the snr parameter cannot be stored in there (and it is also
not necessary to do so, as it can be local to the function handling
nr_srs_rx_procedures()).

Correctly read SRS SNR through FAPI message in nr_ulsim. Switch to SRS
BEAMMANAGEMENT as only this message returns the actual SNR (unlike
CODEBOOK). Add asserts to check what is returned is valid data in the
sense of the test.
Signed-off-by: default avatarRobert Schmidt <robert.schmidt@openairinterface.org>
parent 81b2fe63
......@@ -197,7 +197,7 @@ void nr_fill_srs(PHY_VARS_gNB *gNB,
int nr_get_srs_signal(PHY_VARS_gNB *gNB,
c16_t **rxdataF,
slot_t slot,
nfapi_nr_srs_pdu_t *srs_pdu,
const nfapi_nr_srs_pdu_t *srs_pdu,
nr_srs_info_t *nr_srs_info,
c16_t srs_received_signal[][gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)],
c16_t srs_received_noise[][gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)]);
......@@ -209,8 +209,9 @@ nr_srs_info_t nr_srs_rx_procedures(PHY_VARS_gNB *gNB,
uint8_t N_ap,
uint8_t N_symb_SRS,
uint16_t ofdm_symbol_size,
NR_gNB_SRS_t *srs,
const NR_gNB_SRS_t *srs,
int *srs_est,
int8_t *snr,
c16_t srs_estimated_channel_freq[][N_ap][ofdm_symbol_size * N_symb_SRS],
int16_t *snr_per_rb,
uint16_t *timing_advance_offset,
......
......@@ -59,7 +59,7 @@ void nr_fill_srs(PHY_VARS_gNB *gNB, frame_t frame, slot_t slot, nfapi_nr_srs_pdu
int nr_get_srs_signal(PHY_VARS_gNB *gNB,
c16_t **rxdataF,
slot_t slot,
nfapi_nr_srs_pdu_t *srs_pdu,
const nfapi_nr_srs_pdu_t *srs_pdu,
nr_srs_info_t *nr_srs_info,
c16_t srs_received_signal[][gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)],
c16_t srs_received_noise[][gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)])
......
......@@ -215,8 +215,6 @@ typedef struct {
uint32_t frame;
/// Slot where current SRS pdu was received
uint32_t slot;
/// Measured SNR
int8_t snr;
/// ULSCH PDU
nfapi_nr_srs_pdu_t srs_pdu;
} NR_gNB_SRS_t;
......
......@@ -703,15 +703,16 @@ nr_srs_info_t nr_srs_rx_procedures(PHY_VARS_gNB *gNB,
uint8_t N_ap,
uint8_t N_symb_SRS,
uint16_t ofdm_symbol_size,
NR_gNB_SRS_t *srs,
const NR_gNB_SRS_t *srs,
int *srs_est,
int8_t *snr,
c16_t srs_estimated_channel_freq[][N_ap][ofdm_symbol_size * N_symb_SRS],
int16_t *snr_per_rb,
uint16_t *timing_advance_offset,
int16_t *timing_advance_offset_nsec)
{
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu;
const nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu;
c16_t srs_estimated_channel_time[nb_antennas_rx][N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR * ofdm_symbol_size]
__attribute__((aligned(32)));
......@@ -836,7 +837,7 @@ nr_srs_info_t nr_srs_rx_procedures(PHY_VARS_gNB *gNB,
}
noise_power_avg /= nb_antennas_rx;
gNB->srs->snr = dB_fixed(signal_power_avg) - dB_fixed(max(noise_power_avg, 1));
*snr = dB_fixed(signal_power_avg) - dB_fixed(max(noise_power_avg, 1));
const uint16_t m_SRS_b = get_m_srs(srs_pdu->config_index, srs_pdu->bandwidth_index);
for (int rb = 0; rb < m_SRS_b; rb++) {
......@@ -1180,6 +1181,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
c16_t srs_estimated_channel_freq[nb_antennas_rx][N_ap][ofdm_symbol_size * N_symb_SRS] __attribute__((aligned(32)));
int8_t snr;
nr_srs_info_t srs_info = nr_srs_rx_procedures(gNB,
frame_rx,
slot_rx,
......@@ -1189,12 +1191,13 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
ofdm_symbol_size,
srs,
&srs_est,
&snr,
srs_estimated_channel_freq,
snr_per_rb,
&timing_advance_offset,
timing_advance_offset_nsec);
if ((gNB->srs->snr * 10) < gNB->srs_thres) {
if ((snr * 10) < gNB->srs_thres) {
srs_est = -1;
}
......@@ -1236,7 +1239,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
nr_srs_bf_report.prg_size = srs_pdu->beamforming.prg_size;
nr_srs_bf_report.num_symbols = N_symb_SRS;
nr_srs_bf_report.wide_band_snr =
srs_est >= 0 ? (gNB->srs->snr + 64) << 1 : 0xFF; // 0xFF will be set if this field is invalid
srs_est >= 0 ? (snr + 64) << 1 : 0xFF; // 0xFF will be set if this field is invalid
nr_srs_bf_report.num_reported_symbols = N_symb_SRS;
AssertFatal(nr_srs_bf_report.num_reported_symbols == 1,
"nr_srs_bf_report.num_reported_symbols %i not handled yet!\n",
......
......@@ -568,6 +568,7 @@ int main(int argc, char *argv[])
int srs_est;
c16_t srs_estimated_channel_freq[n_rx][N_ap][ofdm_symbol_size * N_symb_SRS] __attribute__((aligned(32)));
int8_t snr;
nr_srs_rx_procedures(gNB,
frame,
slot,
......@@ -577,12 +578,13 @@ int main(int argc, char *argv[])
ofdm_symbol_size,
srs,
&srs_est,
&snr,
srs_estimated_channel_freq,
snr_per_rb,
&timing_advance_offset,
timing_advance_offset_nsec);
sum_srs_snr += pow(10, (double)gNB->srs->snr / 10.0);
sum_srs_snr += pow(10, (double)snr / 10.0);
int16_t delay_ns = delay * 1e9 / (fp->samples_per_frame * 100);
for (int ant_idx = 0; ant_idx < n_rx; ant_idx++) {
......
......@@ -1308,7 +1308,7 @@ int main(int argc, char *argv[])
srs_pdu->resource_type = NR_SRS_Resource__resourceType_PR_periodic;
srs_pdu->t_srs = 1;
srs_pdu->srs_parameters_v4.srs_bandwidth_size = m_SRS[srs_pdu->config_index];
srs_pdu->srs_parameters_v4.usage = 1 << NR_SRS_ResourceSet__usage_codebook;
srs_pdu->srs_parameters_v4.usage = 1 << NFAPI_NR_SRS_BEAMMANAGEMENT; // to get SNR
srs_pdu->srs_parameters_v4.report_type[0] = 1;
srs_pdu->srs_parameters_v4.iq_representation = 1;
srs_pdu->srs_parameters_v4.prg_size = 1;
......@@ -1748,7 +1748,14 @@ int main(int argc, char *argv[])
delay_pusch_est_count++;
if (do_SRS == 1) {
sum_srs_snr += gNB->srs->snr;
DevAssert(UL_INFO.srs_ind.number_of_pdus == 1); // there must be SRS indication
const nfapi_nr_srs_indication_pdu_t *srs_ind = &UL_INFO.srs_ind.pdu_list[0];
DevAssert(srs_ind->srs_usage == NFAPI_NR_SRS_BEAMMANAGEMENT);
nfapi_nr_srs_beamforming_report_t bf_rep;
unpack_nr_srs_beamforming_report((void *)srs_ind->report_tlv.value, srs_ind->report_tlv.length, &bf_rep, sizeof(bf_rep));
DevAssert(bf_rep.wide_band_snr != 0xff);
int8_t snr = (bf_rep.wide_band_snr >> 1) - 64;
sum_srs_snr += snr;
srs_snr_count++;
}
} // trial loop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment