From 373afcddc919548290af9921d4288319e3ff38e8 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 18 Jan 2018 17:14:04 +0100 Subject: [PATCH] Added cross channels to srsue GUI --- srsue/hdr/phy/phch_worker.h | 4 ++- srsue/src/phy/phch_worker.cc | 49 +++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/srsue/hdr/phy/phch_worker.h b/srsue/hdr/phy/phch_worker.h index 679fd177c..5430a2d18 100644 --- a/srsue/hdr/phy/phch_worker.h +++ b/srsue/hdr/phy/phch_worker.h @@ -63,7 +63,9 @@ public: void start_trace(); void write_trace(std::string filename); - int read_ce_abs(float *ce_abs); + int read_ce_abs(float *ce_abs, uint32_t tx_antenna, uint32_t rx_antenna); + uint32_t get_cell_nof_ports() {return cell.nof_ports;}; + uint32_t get_rx_nof_antennas() {return ue_dl.nof_rx_antennas;}; int read_pdsch_d(cf_t *pdsch_d); void start_plot(); diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index 016483468..2910f07ff 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -1287,13 +1287,13 @@ void phch_worker::start_plot() { #endif } -int phch_worker::read_ce_abs(float *ce_abs) { +int phch_worker::read_ce_abs(float *ce_abs, uint32_t tx_antenna, uint32_t rx_antenna) { uint32_t i=0; int sz = srslte_symbol_sz(cell.nof_prb); bzero(ce_abs, sizeof(float)*sz); int g = (sz - 12*cell.nof_prb)/2; for (i = 0; i < 12*cell.nof_prb; i++) { - ce_abs[g+i] = 20 * log10f(cabsf(ue_dl.ce_m[0][0][i])); + ce_abs[g+i] = 20 * log10f(cabsf(ue_dl.ce_m[tx_antenna][rx_antenna][i])); if (isinf(ce_abs[g+i])) { ce_abs[g+i] = -80; } @@ -1434,7 +1434,7 @@ void phch_worker::tr_log_end() #ifdef ENABLE_GUI -plot_real_t pce; +plot_real_t pce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; plot_scatter_t pconst; #define SCATTER_PDSCH_BUFFER_LEN (20*6*SRSLTE_SF_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)) #define SCATTER_PDSCH_PLOT_LEN 4000 @@ -1443,22 +1443,33 @@ cf_t tmp_plot2[SRSLTE_SF_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)]; void *plot_thread_run(void *arg) { srsue::phch_worker *worker = (srsue::phch_worker*) arg; - - sdrgui_init(); - plot_real_init(&pce); - plot_real_setTitle(&pce, (char*) "Channel Response - Magnitude"); - plot_real_setLabels(&pce, (char*) "Index", (char*) "dB"); - plot_real_setYAxisScale(&pce, -40, 40); - + + sdrgui_init(); + for (uint32_t tx = 0; tx < worker->get_cell_nof_ports(); tx++) { + for (uint32_t rx = 0; rx < worker->get_rx_nof_antennas(); rx++) { + char str_buf[64]; + snprintf(str_buf, 64, "|H%d%d|", rx, tx); + plot_real_init(&pce[tx][rx]); + plot_real_setTitle(&pce[tx][rx], str_buf); + plot_real_setLabels(&pce[tx][rx], (char *) "Index", (char *) "dB"); + plot_real_setYAxisScale(&pce[tx][rx], -40, 40); + + plot_real_addToWindowGrid(&pce[tx][rx], (char*)"srsue", tx, rx); + } + } + plot_scatter_init(&pconst); plot_scatter_setTitle(&pconst, (char*) "PDSCH - Equalized Symbols"); plot_scatter_setXAxisScale(&pconst, -4, 4); plot_scatter_setYAxisScale(&pconst, -4, 4); - plot_real_addToWindowGrid(&pce, (char*)"srsue", 0, 0); - plot_scatter_addToWindowGrid(&pconst, (char*)"srsue", 0, 1); + plot_scatter_addToWindowGrid(&pconst, (char*)"srsue", 0, worker->get_rx_nof_antennas()); + + + + + - int n; int readed_pdsch_re=0; while(1) { @@ -1468,10 +1479,14 @@ void *plot_thread_run(void *arg) { n = worker->read_pdsch_d(&tmp_plot2[readed_pdsch_re]); readed_pdsch_re += n; } else { - n = worker->read_ce_abs(tmp_plot); - if (n>0) { - plot_real_setNewData(&pce, tmp_plot, n); - } + for (uint32_t tx = 0; tx < worker->get_cell_nof_ports(); tx++) { + for (uint32_t rx = 0; rx < worker->get_rx_nof_antennas(); rx++) { + n = worker->read_ce_abs(tmp_plot, tx, rx); + if (n > 0) { + plot_real_setNewData(&pce[tx][rx], tmp_plot, n); + } + } + } if (readed_pdsch_re > 0) { plot_scatter_setNewData(&pconst, tmp_plot2, readed_pdsch_re); }