Added graph in T_Tracer to observe UL-SNR calculated using SRS

This commit is contained in:
rmagueta
2025-10-02 11:43:07 +01:00
parent 799934024e
commit 8ca05e51ac
7 changed files with 67 additions and 10 deletions
+4
View File
@@ -143,6 +143,10 @@ ID = GNB_PHY_UL_TIME_CHANNEL_ESTIMATE
DESC = gNodeB channel estimation in the time domain
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,gNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,chest_t
ID = GNB_PHY_UL_SNR_ESTIMATE
DESC = gNodeB SNR estimation based on SRS
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,gNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,snr
ID = GNB_PHY_PRACH_INPUT_SIGNAL
DESC = gNodeB input data in the time domain for slots with PRACH detection
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
+23 -1
View File
@@ -19,6 +19,7 @@ typedef struct {
widget *pucch_pusch_iq_plot;
widget *ul_freq_estimate_ue_xy_plot;
widget *ul_time_estimate_ue_xy_plot;
widget *ul_snr_estimate_ue_xy_plot;
widget *current_ue_label;
widget *current_ue_button;
widget *prev_ue_button;
@@ -26,6 +27,7 @@ typedef struct {
logger *pucch_pusch_iq_logger;
logger *ul_freq_estimate_ue_logger;
logger *ul_time_estimate_ue_logger;
logger *ul_snr_ue_logger;
} gnb_gui;
typedef struct {
@@ -98,6 +100,9 @@ static void set_current_ue(gui *g, gnb_data *e, int ue)
sprintf(s, "UL channel estimation in time domain [UE %d]", ue);
xy_plot_set_title(g, e->e->ul_time_estimate_ue_xy_plot, s);
sprintf(s, "UL SNR per RB based on SRS [UE %d]", ue);
xy_plot_set_title(g, e->e->ul_snr_estimate_ue_xy_plot, s);
}
void reset_ue_ids(void)
@@ -146,12 +151,13 @@ static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database, g
logger *l;
view *v;
main_window = new_toplevel_window(g, 1500, 230, "gNB tracer");
main_window = new_toplevel_window(g, 1500, 460, "gNB tracer");
top_container = new_container(g, VERTICAL);
widget_add_child(g, main_window, top_container, -1);
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
logo = new_image(g, openair_logo_png, openair_logo_png_len);
/* logo + prev/next UE buttons */
@@ -206,6 +212,21 @@ static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database, g
logger_add_view(l, v);
e->ul_time_estimate_ue_logger = l;
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
/* UL SNR based on SRS */
w = new_xy_plot(g, 1280, 200, "", 190);
e->ul_snr_estimate_ue_xy_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, 0, 273, -10, 65);
l = new_framelog(h, database, "GNB_PHY_UL_SNR_ESTIMATE", "subframe", "snr");
framelog_set_update_only_at_sf9(l, 0);
framelog_set_type_buffer_db(l);
v = new_view_xy(273, 10, g, w, new_color(g, "#0c0c72"), XY_LOOP_MODE);
logger_add_view(l, v);
e->ul_snr_ue_logger = l;
set_current_ue(g, ed, ed->ue);
register_notifier(g, "click", e->current_ue_button, click, ed);
register_notifier(g, "click", e->prev_ue_button, click, ed);
@@ -251,6 +272,7 @@ int main(int n, char **v)
on_off(database, "GNB_PHY_PUCCH_PUSCH_IQ", is_on, 1);
on_off(database, "GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE", is_on, 1);
on_off(database, "GNB_PHY_UL_TIME_CHANNEL_ESTIMATE", is_on, 1);
on_off(database, "GNB_PHY_UL_SNR_ESTIMATE", is_on, 1);
gnb_data.ue = 0;
gnb_data.e = ⪚
+27 -5
View File
@@ -8,6 +8,11 @@
#include <stdio.h>
#include <math.h>
typedef enum {
FRAMELOG_BUFFER,
FRAMELOG_BUFFER_dB,
} framelog_buffer_type_t;
struct framelog {
struct logger common;
void *database;
@@ -22,6 +27,7 @@ struct framelog {
int skip_current; /* internal data for the skip mechanism */
int skip_on; /* internal data for the skip mechanism */
int update_only_at_sf9;
framelog_buffer_type_t type;
};
static void _event(void *p, event e)
@@ -52,7 +58,10 @@ static void _event(void *p, event e)
}
if (l->skip_on) return;
nsamples = bsize / (2*sizeof(int16_t));
if (l->type == FRAMELOG_BUFFER)
nsamples = bsize / (2 * sizeof(int16_t));
else
nsamples = bsize / sizeof(int16_t);
if (l->blength != nsamples * 10) {
l->blength = nsamples * 10;
@@ -71,10 +80,15 @@ static void _event(void *p, event e)
}
/* TODO: compute the LOGs in the plotter (too much useless computations) */
for (i = 0; i < nsamples; i++) {
int I = ((int16_t *)buffer)[i*2];
int Q = ((int16_t *)buffer)[i*2+1];
l->buffer[subframe * nsamples + i] = 10*log10(1.0+(float)(I*I+Q*Q));
if (l->type == FRAMELOG_BUFFER_dB) {
for (i = 0; i < nsamples; i++)
l->buffer[subframe * nsamples + i] = ((int16_t *)buffer)[i];
} else {
for (i = 0; i < nsamples; i++) {
int I = ((int16_t *)buffer)[i * 2];
int Q = ((int16_t *)buffer)[i * 2 + 1];
l->buffer[subframe * nsamples + i] = 10 * log10(1.0 + (float)(I * I + Q * Q));
}
}
if (l->update_only_at_sf9 == 0 || subframe == 9)
@@ -132,6 +146,8 @@ logger *new_framelog(event_handler *h, void *database,
abort();
}
ret->type = FRAMELOG_BUFFER;
return ret;
}
@@ -153,3 +169,9 @@ void framelog_set_update_only_at_sf9(logger *_this, int update_only_at_sf9)
struct framelog *l = _this;
l->update_only_at_sf9 = update_only_at_sf9;
}
void framelog_set_type_buffer_db(logger *_this)
{
struct framelog *l = _this;
l->type = FRAMELOG_BUFFER_dB;
}
+1
View File
@@ -30,6 +30,7 @@ logger *new_iqdotlog(void *event_handler, void *database,
void framelog_set_skip(logger *_this, int skip_delay);
void framelog_set_update_only_at_sf9(logger *_this, int update_only_at_sf9);
void framelog_set_type_buffer_db(logger *_this);
void textlog_dump_buffer(logger *_this, int dump_buffer);
void textlog_raw_time(logger *_this, int raw_time);
@@ -782,7 +782,7 @@ int nr_srs_channel_estimation(
[gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)],
c16_t srs_estimated_channel_time[][1 << srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size],
c16_t srs_estimated_channel_time_shifted[][1 << srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size],
int8_t *snr_per_rb,
int16_t *snr_per_rb,
int8_t *snr)
{
#ifdef SRS_DEBUG
@@ -89,7 +89,7 @@ int nr_srs_channel_estimation(
[gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)],
c16_t srs_estimated_channel_time[][1 << srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size],
c16_t srs_estimated_channel_time_shifted[][1 << srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size],
int8_t *snr_per_rb,
int16_t *snr_per_rb,
int8_t *snr);
void nr_freq_equalization(NR_DL_FRAME_PARMS *frame_parms,
+10 -2
View File
@@ -710,7 +710,7 @@ static void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, uint32
int fill_srs_reported_symbol(nfapi_nr_srs_reported_symbol_t *reported_symbol,
const nfapi_nr_srs_pdu_t *srs_pdu,
const int N_RB_UL,
const int8_t *snr_per_rb,
const int16_t *snr_per_rb,
const int srs_est) {
reported_symbol->num_prgs = srs_pdu->beamforming.num_prgs;
for (int prg_idx = 0; prg_idx < reported_symbol->num_prgs; prg_idx++) {
@@ -1052,7 +1052,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
__attribute__((aligned(32)));
c16_t srs_estimated_channel_time_shifted[frame_parms->nb_antennas_rx][1 << srs_pdu->num_ant_ports]
[frame_parms->ofdm_symbol_size];
int8_t snr_per_rb[srs_pdu->bwp_size];
int16_t snr_per_rb[srs_pdu->bwp_size];
start_meas(&gNB->generate_srs_stats);
@@ -1110,6 +1110,14 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
T_INT(0),
T_BUFFER(srs_estimated_channel_time_shifted[0][0], frame_parms->ofdm_symbol_size * sizeof(int32_t)));
T(T_GNB_PHY_UL_SNR_ESTIMATE,
T_INT(0),
T_INT(srs_pdu->rnti),
T_INT(frame_rx),
T_INT(0),
T_INT(0),
T_BUFFER(snr_per_rb, srs_pdu->bwp_size * sizeof(int16_t)));
UL_INFO->srs_ind.sfn = frame_rx;
UL_INFO->srs_ind.slot = slot_rx;