Commit b8a5183b authored by Sakthivel Velumani's avatar Sakthivel Velumani Committed by Thomas Schlichter

Update LLR & IQ plot with correct number of elements

parent 1cbd6c71
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "PHY/NR_ESTIMATION/nr_ul_estimation.h" #include "PHY/NR_ESTIMATION/nr_ul_estimation.h"
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include <openair1/PHY/TOOLS/phy_scope_interface.h>
//#define DEBUG_CH_COMP //#define DEBUG_CH_COMP
//#define DEBUG_RB_EXT //#define DEBUG_RB_EXT
...@@ -2015,6 +2016,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2015,6 +2016,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
ad_shift = -3; // For 2-layers, we are already doing a bit shift in the nr_ulsch_mmse_2layers() function, so we can use more bits ad_shift = -3; // For 2-layers, we are already doing a bit shift in the nr_ulsch_mmse_2layers() function, so we can use more bits
} }
int num_re_total = 0;
for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) { for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) {
uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01; uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
if (dmrs_symbol_flag == 1) { if (dmrs_symbol_flag == 1) {
...@@ -2037,6 +2039,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2037,6 +2039,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
} }
num_re_total += nb_re_pusch;
pusch_vars->ul_valid_re_per_slot[symbol] = nb_re_pusch; pusch_vars->ul_valid_re_per_slot[symbol] = nb_re_pusch;
LOG_D(PHY, "symbol %d: nb_re_pusch %d, DMRS symbl used for Chest :%d \n", symbol, nb_re_pusch, pusch_vars->dmrs_symbol); LOG_D(PHY, "symbol %d: nb_re_pusch %d, DMRS symbl used for Chest :%d \n", symbol, nb_re_pusch, pusch_vars->dmrs_symbol);
...@@ -2214,4 +2217,9 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -2214,4 +2217,9 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
rxdataF_ext_offset += pusch_vars->ul_valid_re_per_slot[symbol]; rxdataF_ext_offset += pusch_vars->ul_valid_re_per_slot[symbol];
} }
} // symbol loop } // symbol loop
if (!(frame % 128)) {
int num_llr = num_re_total*rel15_ul->qam_mod_order;
GnbScopeUpdate(gNB, puschLLR, num_llr);
GnbScopeUpdate(gNB, puschIQ, num_re_total);
}
} }
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <QApplication> #include <QApplication>
#include <QtWidgets> #include <QtWidgets>
#include <QMessageBox>
#include <QPainter> #include <QPainter>
#include <QtGui> #include <QtGui>
#include <QLineEdit> #include <QLineEdit>
...@@ -70,6 +71,23 @@ float Limits_KPI_ue[2][2] = { ...@@ -70,6 +71,23 @@ float Limits_KPI_ue[2][2] = {
{0.2, 10} // Throughput in Mbs {0.2, 10} // Throughput in Mbs
}; };
// Holds status of active plots
bool currentActivePlots[static_cast<int>(PlotTypeGnb::config)];
LLRPlotGnb *puschLlr;
IQPlotGnb *puschIq;
void scopeUpdaterGnb(enum PlotTypeGnbIf plotType, int numElt)
{
if (plotType == puschLLR && currentActivePlots[static_cast<int>(PlotTypeGnb::puschLLR)]) {
puschLlr->len = numElt;
puschLlr->newData->updateScope();
} else if (plotType == puschIQ && currentActivePlots[static_cast<int>(PlotTypeGnb::puschIQ)]) {
puschIq->len = numElt;
puschIq->newData->updateScope();
}
}
/* This class creates the window when choosing the option 'Configs' to configure the threshold values. */ /* This class creates the window when choosing the option 'Configs' to configure the threshold values. */
ConfigBoxFloat::ConfigBoxFloat(float *valuePtr, QWidget *parent) : QLineEdit(parent), valuePtr(valuePtr) ConfigBoxFloat::ConfigBoxFloat(float *valuePtr, QWidget *parent) : QLineEdit(parent), valuePtr(valuePtr)
{ {
...@@ -372,6 +390,61 @@ LLRPlot::LLRPlot(int16_t *data, int len) : data(data), len(len) ...@@ -372,6 +390,61 @@ LLRPlot::LLRPlot(int16_t *data, int len) : data(data), len(len)
startTimer(1000); startTimer(1000);
} }
LLRPlotGnb::LLRPlotGnb(int16_t *data, int len, PlotTypeGnb plotType) : data(data)
{
this->len = len;
this->plotType = plotType;
NewDataHere *newData = new NewDataHere();
this->newData = newData;
puschLlr = this;
connect(newData, &NewDataHere::updateScope, this, &LLRPlotGnb::updatePlot);
this->legend()->hide();
// add new series to the chart
this->series = new QScatterSeries();
this->series->setMarkerSize(3);
this->series->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
this->series->setColor(Qt::blue);
this->series->setPen(Qt::NoPen);
this->addSeries(series);
// add new X axis
this->axisX = new QValueAxis();
this->axisX->setLabelFormat("%d");
this->axisX->setRange(0, len);
this->addAxis(this->axisX, Qt::AlignBottom);
this->series->attachAxis(this->axisX);
// add new Y axis
this->axisY = new QValueAxis();
this->addAxis(this->axisY, Qt::AlignLeft);
this->series->attachAxis(this->axisY);
}
LLRPlotGnb::~LLRPlotGnb()
{
currentActivePlots[static_cast<int>(this->plotType)] = false;
puschLlr = nullptr;
}
void LLRPlotGnb::updatePlot()
{
if (!this->isVisible())
return;
QVector<QPointF> points(this->len);
int maxY = this->axisY->max();
for (int i = 0; i < this->len; i++) {
points[i] = QPointF(i, this->data[i]);
maxY = std::max(maxY, abs(this->data[i]));
}
this->axisX->setRange(0, len);
this->axisY->setRange(-maxY, maxY);
this->series->replace(points);
}
void LLRPlot::timerEvent(QTimerEvent *event) void LLRPlot::timerEvent(QTimerEvent *event)
{ {
if (!this->isVisible()) if (!this->isVisible())
...@@ -411,6 +484,62 @@ void LLRPlotUE::timerEvent(QTimerEvent *event) ...@@ -411,6 +484,62 @@ void LLRPlotUE::timerEvent(QTimerEvent *event)
} }
} }
IQPlotGnb::IQPlotGnb(complex16 *data, int len, PlotTypeGnb plotType) : data(data)
{
this->len = len;
this->plotType = plotType;
NewDataHere *newData = new NewDataHere();
this->newData = newData;
puschIq = this;
connect(newData, &NewDataHere::updateScope, this, &IQPlotGnb::updatePlot);
this->legend()->hide();
// add new series to the chart
this->series = new QScatterSeries();
this->series->setMarkerSize(3);
this->series->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
this->series->setColor(Qt::blue);
this->series->setPen(Qt::NoPen);
this->addSeries(series);
// add new X axis
this->axisX = new QValueAxis();
this->addAxis(this->axisX, Qt::AlignBottom);
this->series->attachAxis(this->axisX);
// add new Y axis
this->axisY = new QValueAxis();
this->addAxis(this->axisY, Qt::AlignLeft);
this->series->attachAxis(this->axisY);
}
IQPlotGnb::~IQPlotGnb()
{
currentActivePlots[static_cast<int>(this->plotType)] = false;
puschIq = nullptr;
}
void IQPlotGnb::updatePlot()
{
if (!this->isVisible())
return;
QVector<QPointF> points(this->len);
int maxX = this->axisX->max();
int maxY = this->axisY->max();
for (int i = 0; i < this->len; i++) {
points[i] = QPointF(this->data[i].r, this->data[i].i);
maxX = std::max(maxX, abs(this->data[i].r));
maxY = std::max(maxY, abs(this->data[i].i));
}
this->axisX->setRange(-maxX, maxX);
this->axisY->setRange(-maxY, maxY);
this->series->replace(points);
}
IQPlot::IQPlot(complex16 *data, int len) : data(data), len(len) IQPlot::IQPlot(complex16 *data, int len) : data(data), len(len)
{ {
this->legend()->hide(); this->legend()->hide();
...@@ -742,6 +871,15 @@ void PainterWidgetGnb::makeConnections(int type) ...@@ -742,6 +871,15 @@ void PainterWidgetGnb::makeConnections(int type)
return; return;
} }
if (currentActivePlots[static_cast<int>(plotType)]) {
QMessageBox::information(
this,
tr("gNB Scope"),
tr("Plot already exists."));
return;
}
const PlotTypeGnb prevPlotType = this->plotType;
this->plotType = plotType; this->plotType = plotType;
this->chartView->hide(); this->chartView->hide();
QChart *prevChart = this->chartView->chart(); QChart *prevChart = this->chartView->chart();
...@@ -767,76 +905,76 @@ void PainterWidgetGnb::makeConnections(int type) ...@@ -767,76 +905,76 @@ void PainterWidgetGnb::makeConnections(int type)
QChart *newChart = nullptr; QChart *newChart = nullptr;
switch (plotType) { if (plotType == PlotTypeGnb::empty) {
case PlotTypeGnb::empty: { newChart = new QChart();
newChart = new QChart(); currentActivePlots[static_cast<int>(prevPlotType)] = false;
break; } else {
} switch (plotType) {
case PlotTypeGnb::CIR: { case PlotTypeGnb::CIR: {
newChart = new CIRPlot((complex16 *)p->gNB->pusch_vars[0].ul_ch_estimates_time[0], frame_parms->ofdm_symbol_size); newChart = new CIRPlot((complex16 *)p->gNB->pusch_vars[0].ul_ch_estimates_time[0], frame_parms->ofdm_symbol_size);
break; break;
} }
case PlotTypeGnb::puschLLR: { case PlotTypeGnb::puschLLR: {
int num_re = frame_parms->N_RB_UL * 12 * frame_parms->symbols_per_slot; int init_coded_bits_per_codeword = 100;
int Qm = 2; newChart = new LLRPlotGnb((int16_t *)p->gNB->pusch_vars[0].llr, init_coded_bits_per_codeword, plotType);
int coded_bits_per_codeword = num_re * Qm; break;
newChart = new LLRPlot((int16_t *)p->gNB->pusch_vars[0].llr, coded_bits_per_codeword); }
break; case PlotTypeGnb::puschIQ: {
} int init_num_re = 100;
case PlotTypeGnb::puschIQ: { newChart = new IQPlotGnb((complex16 *)p->gNB->pusch_vars[0].rxdataF_comp[0], init_num_re, plotType);
int num_re = frame_parms->N_RB_UL * 12 * frame_parms->symbols_per_slot; break;
newChart = new IQPlot((complex16 *)p->gNB->pusch_vars[0].rxdataF_comp[0], num_re); }
break; case PlotTypeGnb::puschSNR: {
} newChart = new KPIPlot(this);
case PlotTypeGnb::puschSNR: { break;
newChart = new KPIPlot(this); }
break; case PlotTypeGnb::puschBLER: {
} newChart = new KPIPlot(this, Limits_KPI_gNB[0]);
case PlotTypeGnb::puschBLER: { break;
newChart = new KPIPlot(this, Limits_KPI_gNB[0]); }
break; case PlotTypeGnb::puschMCS: {
} newChart = new KPIPlot(this);
case PlotTypeGnb::puschMCS: { break;
newChart = new KPIPlot(this); }
break; case PlotTypeGnb::puschRETX: {
} newChart = new RTXPlot(targetUE->mac_stats.ul.rounds);
case PlotTypeGnb::puschRETX: { break;
newChart = new RTXPlot(targetUE->mac_stats.ul.rounds); }
break; case PlotTypeGnb::puschThroughput: {
} newChart = new KPIPlot(this, Limits_KPI_gNB[1]);
case PlotTypeGnb::puschThroughput: { break;
newChart = new KPIPlot(this, Limits_KPI_gNB[1]); }
break;
}
case PlotTypeGnb::pdschSNR: { case PlotTypeGnb::pdschSNR: {
newChart = new KPIPlot(this); newChart = new KPIPlot(this);
break; break;
} }
case PlotTypeGnb::pdschBLER: { case PlotTypeGnb::pdschBLER: {
newChart = new KPIPlot(this, Limits_KPI_gNB[2]); newChart = new KPIPlot(this, Limits_KPI_gNB[2]);
break; break;
} }
case PlotTypeGnb::pdschMCS: { case PlotTypeGnb::pdschMCS: {
newChart = new KPIPlot(this); newChart = new KPIPlot(this);
break; break;
} }
case PlotTypeGnb::pdschRETX: { case PlotTypeGnb::pdschRETX: {
newChart = new RTXPlot(targetUE->mac_stats.dl.rounds); newChart = new RTXPlot(targetUE->mac_stats.dl.rounds);
break; break;
} }
case PlotTypeGnb::pdschThroughput: { case PlotTypeGnb::pdschThroughput: {
newChart = new KPIPlot(this, Limits_KPI_gNB[3]); newChart = new KPIPlot(this, Limits_KPI_gNB[3]);
break; break;
} }
case PlotTypeGnb::pdschRBs: { case PlotTypeGnb::pdschRBs: {
newChart = new KPIPlot(this); newChart = new KPIPlot(this);
break; break;
} }
default: default:
break; break;
}
currentActivePlots[static_cast<int>(plotType)] = true;
} }
this->chartView->setChart(newChart); this->chartView->setChart(newChart);
...@@ -1240,6 +1378,7 @@ void nrgNBinitQtScope(scopeParms_t *p) ...@@ -1240,6 +1378,7 @@ void nrgNBinitQtScope(scopeParms_t *p)
scope->argc = p->argc; scope->argc = p->argc;
scope->argv = p->argv; scope->argv = p->argv;
scope->ru = p->ru; scope->ru = p->ru;
scope->scopeUpdater = scopeUpdaterGnb;
scope->copyData = copyData; scope->copyData = copyData;
copyDataMutexInit(scope); copyDataMutexInit(scope);
......
...@@ -245,6 +245,51 @@ class CIRPlotUE : public CIRPlot { ...@@ -245,6 +245,51 @@ class CIRPlotUE : public CIRPlot {
ValueProviderUE *valueProvider; ValueProviderUE *valueProvider;
}; };
/// New data signal emiter
class NewDataHere : public QObject {
Q_OBJECT
signals:
void updateScope();
};
/// Chart class for plotting LLRs
class LLRPlotGnb : public QChart {
Q_OBJECT
public:
/// Constructor
/// \param data Pointer to the LLR data
/// \param len Length of the LLR data
LLRPlotGnb(int16_t *data, int len, PlotTypeGnb plotType);
~LLRPlotGnb();
public slots:
void updatePlot();
public:
/// Length of the LLR data
int len;
NewDataHere *newData;
private:
/// Pointer to the LLR data
int16_t *data;
/// Scatter series used to plot the LLR in the chart
QScatterSeries *series;
/// Horizontal axis of the chart
QValueAxis *axisX;
/// Vertical axis of the chart
QValueAxis *axisY;
/// Currently plotted KPI type
PlotTypeGnb plotType;
};
/// Chart class for plotting LLRs /// Chart class for plotting LLRs
class LLRPlot : public QChart { class LLRPlot : public QChart {
Q_OBJECT Q_OBJECT
...@@ -291,6 +336,42 @@ class LLRPlotUE : public LLRPlot { ...@@ -291,6 +336,42 @@ class LLRPlotUE : public LLRPlot {
ValueProviderUE *valueProvider; ValueProviderUE *valueProvider;
}; };
/// Chart class for plotting the I/Q constellation diagram
class IQPlotGnb : public QChart {
Q_OBJECT
public:
/// Constructor
/// \param data Pointer to the complex I/Q data
/// \param len Length of the I/Q data
IQPlotGnb(complex16 *data, int len, PlotTypeGnb plotType);
~IQPlotGnb();
/// Length of the I/Q data
int len;
NewDataHere *newData;
public slots:
void updatePlot();
private:
/// Pointer to the I/Q data
complex16 *data;
/// Scatter series used to plot the I/Q constellation diagram
QScatterSeries *series;
/// Horizontal axis of the chart
QValueAxis *axisX;
/// Vertical axis of the chart
QValueAxis *axisY;
/// Currently plotted KPI type
PlotTypeGnb plotType;
};
/// Chart class for plotting the I/Q constellation diagram /// Chart class for plotting the I/Q constellation diagram
class IQPlot : public QChart { class IQPlot : public QChart {
Q_OBJECT Q_OBJECT
......
...@@ -70,6 +70,26 @@ enum scopeDataType { ...@@ -70,6 +70,26 @@ enum scopeDataType {
MAX_SCOPE_TYPES MAX_SCOPE_TYPES
}; };
enum PlotTypeGnbIf {
empty,
waterFall,
CIR,
puschLLR,
puschIQ,
puschSNR,
puschBLER,
puschMCS,
puschRETX,
puschThroughput,
pdschSNR,
pdschBLER,
pdschMCS,
pdschRETX,
pdschThroughput,
pdschRBs,
config
};
#define COPIES_MEM 4 #define COPIES_MEM 4
typedef struct { typedef struct {
...@@ -89,6 +109,7 @@ typedef struct scopeData_s { ...@@ -89,6 +109,7 @@ typedef struct scopeData_s {
pthread_mutex_t copyDataMutex; pthread_mutex_t copyDataMutex;
scopeGraphData_t *copyDataBufs[MAX_SCOPE_TYPES][COPIES_MEM]; scopeGraphData_t *copyDataBufs[MAX_SCOPE_TYPES][COPIES_MEM];
int copyDataBufsIdx[MAX_SCOPE_TYPES]; int copyDataBufsIdx[MAX_SCOPE_TYPES];
void (*scopeUpdater)(enum PlotTypeGnbIf plotType, int numElements);
} scopeData_t; } scopeData_t;
int load_softscope(char *exectype, void *initarg); int load_softscope(char *exectype, void *initarg);
...@@ -102,6 +123,9 @@ void copyData(void *, enum scopeDataType type, void *dataIn, int elementSz, int ...@@ -102,6 +123,9 @@ void copyData(void *, enum scopeDataType type, void *dataIn, int elementSz, int
#define gNBscopeCopy(gnb, type, ...) \ #define gNBscopeCopy(gnb, type, ...) \
if (gnb->scopeData) \ if (gnb->scopeData) \
((scopeData_t *)gnb->scopeData)->copyData((scopeData_t *)gNB->scopeData, type, ##__VA_ARGS__); ((scopeData_t *)gnb->scopeData)->copyData((scopeData_t *)gNB->scopeData, type, ##__VA_ARGS__);
#define GnbScopeUpdate(gnb, type, numElt) \
if (gnb->scopeData) \
((scopeData_t *)gnb->scopeData)->scopeUpdater(type, numElt);
extended_kpi_ue* getKPIUE(); extended_kpi_ue* getKPIUE();
......
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