Commit b7f958a8 authored by Marwan Hammouda's avatar Marwan Hammouda

Scopes for DL BLER and MCS at the gNB side added

parent ff206dba
...@@ -46,9 +46,9 @@ KPIListSelectgNB::KPIListSelectgNB(QWidget *parent) : QComboBox(parent) ...@@ -46,9 +46,9 @@ KPIListSelectgNB::KPIListSelectgNB(QWidget *parent) : QComboBox(parent)
this->addItem("I/Q PUSCH", 0); this->addItem("I/Q PUSCH", 0);
this->addItem("LLR PUSCH", 1); this->addItem("LLR PUSCH", 1);
this->addItem("Channel Response", 2); this->addItem("Channel Response", 2);
this->addItem("KPI4", 3); this->addItem("UL BLER", 3);
this->addItem("KPI5", 4); this->addItem("DL BLER", 4);
this->addItem("KPI6", 5); this->addItem("DL MCS", 5);
} }
KPIListSelectgNB::~KPIListSelectgNB() KPIListSelectgNB::~KPIListSelectgNB()
{ {
...@@ -67,6 +67,29 @@ PainterWidgetgNB::PainterWidgetgNB(QComboBox *parent, scopeData_t *p) ...@@ -67,6 +67,29 @@ PainterWidgetgNB::PainterWidgetgNB(QComboBox *parent, scopeData_t *p)
this->indexToPlot = this->parentWindow->currentIndex(); this->indexToPlot = this->parentWindow->currentIndex();
//
this->extendKPIgNB.UP_BLER = -1.0;
this->idx_ULBLER = 0;
this->seriesULBLER = new QLineSeries();
QColor MarkerColor(255, 0, 0);
this->seriesULBLER->setColor(MarkerColor);
//
// DL BLER
this->extendKPIgNB_1.DL_BLER = 0.0;
this->extendKPIgNB_1.idx_DLBLER = 0;
this->seriesDLBLER = new QLineSeries();
this->seriesDLBLER->setColor(QColor(0, 255, 0));
// DL MCS
this->extendKPIgNB_1.idx_DLMCS = 0;
this->extendKPIgNB_1.DL_MCS = 0.0;
this->seriesDLMCS = new QLineSeries();
this->seriesDLMCS->setColor(QColor(0,0,255));
makeConnections(); makeConnections();
} }
...@@ -85,6 +108,7 @@ void PainterWidgetgNB::paintEvent(QPaintEvent *) ...@@ -85,6 +108,7 @@ void PainterWidgetgNB::paintEvent(QPaintEvent *)
void PainterWidgetgNB::makeConnections() void PainterWidgetgNB::makeConnections()
{ {
getKPIgNB(&this->extendKPIgNB_1);
disconnect(timer, nullptr, nullptr, nullptr); disconnect(timer, nullptr, nullptr, nullptr);
...@@ -100,11 +124,174 @@ void PainterWidgetgNB::makeConnections() ...@@ -100,11 +124,174 @@ void PainterWidgetgNB::makeConnections()
{ {
connect(timer, &QTimer::timeout, this, &PainterWidgetgNB::KPI_ChannelResponse); connect(timer, &QTimer::timeout, this, &PainterWidgetgNB::KPI_ChannelResponse);
} }
else if (this->indexToPlot == 3)
{
this->extendKPIgNB.UP_BLER = returnULBLER();
this->idx_ULBLER++;
if (this->idx_ULBLER > this->chartWidth)
{
this->seriesULBLER = new QLineSeries();
this->seriesULBLER->setColor(QColor(255, 0, 0));
this->idx_ULBLER = 0;
}
connect(timer, &QTimer::timeout, this, &PainterWidgetgNB::KPI_UL_BLER);
}
else if (this->indexToPlot == 4)
{
this->extendKPIgNB_1.idx_DLBLER++;
if (this->extendKPIgNB_1.idx_DLBLER > this->chartWidth)
{
this->extendKPIgNB_1.idx_DLBLER = 0;
this->seriesDLBLER = new QLineSeries();
this->seriesDLBLER->setColor(QColor(0, 255, 0));
}
connect(timer, &QTimer::timeout, this, &PainterWidgetgNB::KPI_DL_BLER);
}
else if (this->indexToPlot == 5)
{
this->extendKPIgNB_1.idx_DLMCS++;
if (this->extendKPIgNB_1.idx_DLMCS > this->chartWidth)
{
this->extendKPIgNB_1.idx_DLMCS = 0;
this->seriesDLMCS = new QLineSeries();
this->seriesDLMCS->setColor(QColor(0, 0, 0));
}
connect(timer, &QTimer::timeout, this, &PainterWidgetgNB::KPI_DL_MCS);
}
timer->start(100); // paintPixmap_xx every 100ms timer->start(100); // paintPixmap_xx every 100ms
} }
void PainterWidgetgNB::KPI_DL_MCS()
{
// erase the previous paint
this->pix->fill(QColor(240,240,240));
float Xpaint, Ypaint;
Xpaint = this->extendKPIgNB_1.idx_DLMCS;
Ypaint = this->extendKPIgNB_1.DL_MCS;
this->seriesDLMCS->append(Xpaint, Ypaint);
QChart *chart = new QChart();
chart->legend()->hide();
int nofTicks = 6;
QValueAxis *axisX = new QValueAxis;
axisX->setTickCount(nofTicks);
axisX->setRange(0 , this->chartWidth);
axisX->setTitleText("Time Index (calc window: 100 ms)");
chart->addAxis(axisX, Qt::AlignBottom);
QValueAxis *axisY = new QValueAxis;
axisY->setTickCount(nofTicks);
axisY->setRange(-1, 1.5);
axisY->setTitleText("DL MCS");
chart->addAxis(axisY, Qt::AlignLeft);
chart->addSeries(this->seriesDLMCS);
this->seriesDLMCS->attachAxis(axisX);
this->seriesDLMCS->attachAxis(axisY);
QChartView *chartView = new QChartView(chart);
chartView->resize(this->chartWidth, this->chartHight);
QPixmap p = chartView->grab();
*this->pix = p;
update();
}
void PainterWidgetgNB::KPI_DL_BLER()
{
// erase the previous paint
this->pix->fill(QColor(240,240,240));
float Xpaint, Ypaint;
Xpaint = this->extendKPIgNB_1.idx_DLBLER;
Ypaint = this->extendKPIgNB_1.DL_BLER;
this->seriesDLBLER->append(Xpaint, Ypaint);
QChart *chart = new QChart();
chart->legend()->hide();
int nofTicks = 6;
QValueAxis *axisX = new QValueAxis;
axisX->setTickCount(nofTicks);
axisX->setRange(0 , this->chartWidth);
axisX->setTitleText("Time Index (calc window: 100 ms)");
chart->addAxis(axisX, Qt::AlignBottom);
QValueAxis *axisY = new QValueAxis;
axisY->setTickCount(nofTicks);
axisY->setRange(-1, 1.5);
axisY->setTitleText("DL BLER");
chart->addAxis(axisY, Qt::AlignLeft);
chart->addSeries(this->seriesDLBLER);
this->seriesDLBLER->attachAxis(axisX);
this->seriesDLBLER->attachAxis(axisY);
QChartView *chartView = new QChartView(chart);
chartView->resize(this->chartWidth, this->chartHight);
QPixmap p = chartView->grab();
*this->pix = p;
update();
}
void PainterWidgetgNB::KPI_UL_BLER()
{
// erase the previous paint
this->pix->fill(QColor(240,240,240));
std::cout << "UL BLER: " << this->extendKPIgNB.UP_BLER << std::endl;
float Xpaint, Ypaint;
Xpaint = this->idx_ULBLER;
std::cout << "*** FromWidget: " << this->extendKPIgNB.UP_BLER << std::endl;
Ypaint = this->extendKPIgNB.UP_BLER;
this->seriesULBLER->append(Xpaint, Ypaint);
QChart *chart = new QChart();
chart->legend()->hide();
int nofTicks = 6;
QValueAxis *axisX = new QValueAxis;
axisX->setTickCount(nofTicks);
axisX->setRange(0 , this->chartWidth);
axisX->setTitleText("Time Index (calc window: 100 ms)");
chart->addAxis(axisX, Qt::AlignBottom);
QValueAxis *axisY = new QValueAxis;
axisY->setTickCount(nofTicks);
axisY->setRange(-1, 1.5);
axisY->setTitleText("UL BLER");
chart->addAxis(axisY, Qt::AlignLeft);
chart->addSeries(this->seriesULBLER);
this->seriesULBLER->attachAxis(axisX);
this->seriesULBLER->attachAxis(axisY);
QChartView *chartView = new QChartView(chart);
chartView->resize(this->chartWidth, this->chartHight);
QPixmap p = chartView->grab();
*this->pix = p;
update();
}
void PainterWidgetgNB::KPI_PuschIQ() void PainterWidgetgNB::KPI_PuschIQ()
{ {
// erase the previous paint // erase the previous paint
...@@ -269,6 +456,8 @@ void PainterWidgetgNB::KPI_ChannelResponse() ...@@ -269,6 +456,8 @@ void PainterWidgetgNB::KPI_ChannelResponse()
update(); update();
} }
void PainterWidgetgNB::createPixMap(float *xData, float *yData, int len, QColor MarkerColor, void PainterWidgetgNB::createPixMap(float *xData, float *yData, int len, QColor MarkerColor,
const QString xLabel, const QString yLabel, bool scaleX) const QString xLabel, const QString yLabel, bool scaleX)
{ {
......
...@@ -38,6 +38,7 @@ extern "C" { ...@@ -38,6 +38,7 @@ extern "C" {
#include "PHY/defs_RU.h" #include "PHY/defs_RU.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "phy_scope_interface.h" #include "phy_scope_interface.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
} }
// drop-down list UE // drop-down list UE
...@@ -142,7 +143,6 @@ public: ...@@ -142,7 +143,6 @@ public:
void makeConnections(); void makeConnections();
void createPixMap(float *xData, float *yData, int len, QColor MarkerColor, const QString xLabel, const QString yLabel, bool scaleX); void createPixMap(float *xData, float *yData, int len, QColor MarkerColor, const QString xLabel, const QString yLabel, bool scaleX);
QPixmap *pix; QPixmap *pix;
QTimer *timer; QTimer *timer;
int chartHight, chartWidth; int chartHight, chartWidth;
...@@ -150,6 +150,14 @@ public: ...@@ -150,6 +150,14 @@ public:
QComboBox *parentWindow; QComboBox *parentWindow;
extended_kpi extendKPIgNB;
extended_kpi_gNB extendKPIgNB_1;
int idx_ULBLER;
QLineSeries *seriesULBLER;
QLineSeries *seriesDLBLER;
QLineSeries *seriesDLMCS;
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
...@@ -157,6 +165,9 @@ public slots: ...@@ -157,6 +165,9 @@ public slots:
void KPI_PuschIQ(); void KPI_PuschIQ();
void KPI_PuschLLR(); void KPI_PuschLLR();
void KPI_ChannelResponse(); void KPI_ChannelResponse();
void KPI_UL_BLER();
void KPI_DL_BLER();
void KPI_DL_MCS();
private: private:
scopeData_t *p; scopeData_t *p;
......
...@@ -34,6 +34,25 @@ ...@@ -34,6 +34,25 @@
#include <openair1/PHY/defs_gNB.h> #include <openair1/PHY/defs_gNB.h>
#include <openair1/PHY/defs_nr_UE.h> #include <openair1/PHY/defs_nr_UE.h>
typedef struct {
float UP_BLER; // Uplink BLock Error Rate
float UP_MCS; // Uplink MCS
float DL_BLER; // Downlink BLock Error Rate
float DL_MCS; // Downlink MCS
}extended_kpi;
typedef struct {
float UL_BLER; // Uplink BLock Error Rate
float UL_MCS; // Uplink MCS
float DL_BLER; // Downlink BLock Error Rate
float DL_MCS; // Downlink MCS
int idx_DLBLER;
int idx_DLMCS;
}extended_kpi_gNB;
typedef struct { typedef struct {
int *argc; int *argc;
char **argv; char **argv;
...@@ -68,4 +87,7 @@ int end_forms(void) ; ...@@ -68,4 +87,7 @@ int end_forms(void) ;
#define UEscopeCopy(ue, type, ...) if(ue->scopeData) ((scopeData_t*)ue->scopeData)->copyData(ue, type, ##__VA_ARGS__); #define UEscopeCopy(ue, type, ...) if(ue->scopeData) ((scopeData_t*)ue->scopeData)->copyData(ue, type, ##__VA_ARGS__);
#define gNBscopeCopy(gNB, type, data, elementSZ, colSz, lineSz) if(gNB->scopeData) ((scopeData_t*)gNB->scopeData)->copyDatagNB(gNB, type, data, elementSZ, colSz, lineSz); #define gNBscopeCopy(gNB, type, data, elementSZ, colSz, lineSz) if(gNB->scopeData) ((scopeData_t*)gNB->scopeData)->copyDatagNB(gNB, type, data, elementSZ, colSz, lineSz);
void getKPIgNB(extended_kpi_gNB* kpiStructure);
#endif #endif
...@@ -38,6 +38,17 @@ ...@@ -38,6 +38,17 @@
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
//#define SRS_IND_DEBUG //#define SRS_IND_DEBUG
static int nofBlocks = 0;
static int nofErrors = 0;
int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl) {
int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType &&
sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ?
NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0;
return(dci_format);
}
const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot) { const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot) {
...@@ -425,6 +436,8 @@ int nr_process_mac_pdu(instance_t module_idP, ...@@ -425,6 +436,8 @@ int nr_process_mac_pdu(instance_t module_idP,
void abort_nr_ul_harq(NR_UE_info_t *UE, int8_t harq_pid) void abort_nr_ul_harq(NR_UE_info_t *UE, int8_t harq_pid)
{ {
nofErrors++;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_ul_harq_t *harq = &sched_ctrl->ul_harq_processes[harq_pid]; NR_UE_ul_harq_t *harq = &sched_ctrl->ul_harq_processes[harq_pid];
...@@ -440,6 +453,16 @@ void abort_nr_ul_harq(NR_UE_info_t *UE, int8_t harq_pid) ...@@ -440,6 +453,16 @@ void abort_nr_ul_harq(NR_UE_info_t *UE, int8_t harq_pid)
sched_ctrl->sched_ul_bytes = 0; sched_ctrl->sched_ul_bytes = 0;
} }
float returnULBLER(void)
{
float BLER = (float) nofErrors / (float) nofBlocks;
nofErrors = 0;
nofBlocks = 0;
return BLER;
}
void handle_nr_ul_harq(const int CC_idP, void handle_nr_ul_harq(const int CC_idP,
module_id_t mod_id, module_id_t mod_id,
frame_t frame, frame_t frame,
...@@ -481,12 +504,15 @@ void handle_nr_ul_harq(const int CC_idP, ...@@ -481,12 +504,15 @@ void handle_nr_ul_harq(const int CC_idP,
} }
harq_pid = sched_ctrl->feedback_ul_harq.head; harq_pid = sched_ctrl->feedback_ul_harq.head;
} }
remove_front_nr_list(&sched_ctrl->feedback_ul_harq); remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
NR_UE_ul_harq_t *harq = &sched_ctrl->ul_harq_processes[harq_pid]; NR_UE_ul_harq_t *harq = &sched_ctrl->ul_harq_processes[harq_pid];
DevAssert(harq->is_waiting); DevAssert(harq->is_waiting);
harq->feedback_slot = -1; harq->feedback_slot = -1;
harq->is_waiting = false; harq->is_waiting = false;
if (!crc_pdu->tb_crc_status) { if (!crc_pdu->tb_crc_status) {
nofBlocks++;
harq->ndi ^= 1; harq->ndi ^= 1;
harq->round = 0; harq->round = 0;
LOG_D(NR_MAC, LOG_D(NR_MAC,
...@@ -494,7 +520,11 @@ void handle_nr_ul_harq(const int CC_idP, ...@@ -494,7 +520,11 @@ void handle_nr_ul_harq(const int CC_idP,
harq_pid, harq_pid,
crc_pdu->rnti); crc_pdu->rnti);
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid);
} else if (harq->round >= RC.nrmac[mod_id]->ul_bler.harq_round_max - 1) { } else if (harq->round >= RC.nrmac[mod_id]->ul_bler.harq_round_max - 1) {
} else if (harq->round >= RC.nrmac[mod_id]->harq_round_max - 1) {
nofBlocks++;
abort_nr_ul_harq(UE, harq_pid); abort_nr_ul_harq(UE, harq_pid);
LOG_D(NR_MAC, LOG_D(NR_MAC,
"RNTI %04x: Ulharq id %d crc failed in all rounds\n", "RNTI %04x: Ulharq id %d crc failed in all rounds\n",
...@@ -508,6 +538,8 @@ void handle_nr_ul_harq(const int CC_idP, ...@@ -508,6 +538,8 @@ void handle_nr_ul_harq(const int CC_idP,
crc_pdu->rnti); crc_pdu->rnti);
add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid);
} }
printf("nofBlocks: %i, nofErrors: %i, rnti: %u \n", nofBlocks, nofErrors, crc_pdu->rnti);
} }
/* /*
......
...@@ -438,6 +438,7 @@ void handle_nr_ul_harq(const int CC_idP, ...@@ -438,6 +438,7 @@ void handle_nr_ul_harq(const int CC_idP,
sub_frame_t slot, sub_frame_t slot,
const nfapi_nr_crc_t *crc_pdu); const nfapi_nr_crc_t *crc_pdu);
void handle_nr_srs_measurements(const module_id_t module_id, void handle_nr_srs_measurements(const module_id_t module_id,
const frame_t frame, const frame_t frame,
const sub_frame_t slot, const sub_frame_t slot,
...@@ -448,6 +449,8 @@ void handle_nr_srs_measurements(const module_id_t module_id, ...@@ -448,6 +449,8 @@ void handle_nr_srs_measurements(const module_id_t module_id,
const uint8_t num_reported_symbols, const uint8_t num_reported_symbols,
nfapi_nr_srs_indication_reported_symbol_t* reported_symbol_list); nfapi_nr_srs_indication_reported_symbol_t* reported_symbol_list);
float returnULBLER(void);
int16_t ssb_index_from_prach(module_id_t module_idP, int16_t ssb_index_from_prach(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP, sub_frame_t slotP,
......
...@@ -42,7 +42,11 @@ ...@@ -42,7 +42,11 @@
#include "common/ran_context.h" #include "common/ran_context.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "openair1/PHY/TOOLS/phy_scope_interface.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
static float DL_BLER = 0.0;
static float DL_MCS = 0.0;
#define MACSTATSSTRLEN 16000 #define MACSTATSSTRLEN 16000
...@@ -73,6 +77,12 @@ void *nrmac_stats_thread(void *arg) { ...@@ -73,6 +77,12 @@ void *nrmac_stats_thread(void *arg) {
return NULL; return NULL;
} }
void getKPIgNB(extended_kpi_gNB* kpiStructure)
{
kpiStructure->DL_BLER = DL_BLER;
kpiStructure->DL_MCS = DL_MCS;
}
void clear_mac_stats(gNB_MAC_INST *gNB) { void clear_mac_stats(gNB_MAC_INST *gNB) {
UE_iterator(gNB->UE_info.list, UE) { UE_iterator(gNB->UE_info.list, UE) {
memset(&UE->mac_stats,0,sizeof(UE->mac_stats)); memset(&UE->mac_stats,0,sizeof(UE->mac_stats));
...@@ -124,6 +134,10 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset ...@@ -124,6 +134,10 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
stats->pucch0_DTX, stats->pucch0_DTX,
sched_ctrl->dl_bler_stats.bler, sched_ctrl->dl_bler_stats.bler,
sched_ctrl->dl_bler_stats.mcs); sched_ctrl->dl_bler_stats.mcs);
DL_BLER = sched_ctrl->dl_bler_stats.bler;
DL_MCS = sched_ctrl->dl_bler_stats.mcs;
if (reset_rsrp) { if (reset_rsrp) {
stats->num_rsrp_meas = 0; stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0; stats->cumul_rsrp = 0;
......
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