From 7986a4de8e6382f5a3c5439eb1522d0b92b8a3c0 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Mon, 30 Sep 2024 20:34:09 +0200 Subject: [PATCH] Time domain samples scope for NR UE Add a new scope data source (ueTimeDomainSamples) which provides time domain samples for antenna 0 to the scope. Add graphical representation of the data in imscope. Removed C-define from ENABLE_IMSCOPE cmake option, the #define was unused and this way code does not have to be recompiled when imscope enable state changes. --- CMakeLists.txt | 2 +- executables/nr-ue.c | 2 ++ openair1/PHY/TOOLS/imscope/imscope.cpp | 10 ++++++++++ openair1/PHY/TOOLS/phy_scope_interface.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 627b87593d..fcae675910 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,7 +293,7 @@ set_property(CACHE KPM_VERSION PROPERTY STRINGS "KPM_V2_03" "KPM_V3_00") message(STATUS "Selected KPM Version: ${KPM_VERSION}") -add_boolean_option(ENABLE_IMSCOPE OFF "Enable phy scope based on imgui" ON) +add_boolean_option(ENABLE_IMSCOPE OFF "Enable phy scope based on imgui" OFF) ################################################## # ASN.1 grammar C code generation & dependencies # diff --git a/executables/nr-ue.c b/executables/nr-ue.c index a742ea2e9d..16fef82eea 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -37,6 +37,7 @@ #include "LAYER2/nr_pdcp/nr_pdcp_oai_api.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR/MESSAGES/asn1_msg.h" +#include "openair1/PHY/TOOLS/phy_scope_interface.h" /* * NR SLOT PROCESSING SEQUENCE @@ -958,6 +959,7 @@ void *UE_thread(void *arg) const int readBlockSize = get_readBlockSize(slot_nr, fp) - iq_shift_to_apply; openair0_timestamp rx_timestamp; int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx); + UEscopeCopy(UE, ueTimeDomainSamples, rxp[0], sizeof(c16_t), 1, readBlockSize, 0); AssertFatal(readBlockSize == tmp, ""); if(slot_nr == (nb_slot_frame - 1)) { diff --git a/openair1/PHY/TOOLS/imscope/imscope.cpp b/openair1/PHY/TOOLS/imscope/imscope.cpp index 8205c85b9e..c216156777 100644 --- a/openair1/PHY/TOOLS/imscope/imscope.cpp +++ b/openair1/PHY/TOOLS/imscope/imscope.cpp @@ -480,6 +480,16 @@ void ShowUeScope(PHY_VARS_NR_UE *ue, float t) pdsch_iq_hist->Draw(iq_data, t, new_data); ImGui::TreePop(); } + if (ImGui::TreeNode("Time domain samples")) { + static auto iq_data = new IQData(); + static auto time_domain_iq = new IQHist("Time domain samples"); + bool new_data = false; + if (time_domain_iq->ShouldReadData()) { + new_data = iq_data->TryCollect(&scope_array[ueTimeDomainSamples], t, time_domain_iq->GetEpsilon()); + } + time_domain_iq->Draw(iq_data, t, new_data); + ImGui::TreePop(); + } if (ImGui::TreeNode("Broadcast channel")) { ImGui::Text("RSRP %d", ue->measurements.ssb_rsrp_dBm[ue->frame_parms.ssb_index]); if (ImGui::TreeNode("IQ")) { diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index 2f8378e7b7..2d648faa90 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -73,6 +73,7 @@ enum scopeDataType { MAX_SCOPE_TYPES, gNBPuschRxIq = MAX_SCOPE_TYPES, gNBPuschLlr, + ueTimeDomainSamples, EXTRA_SCOPE_TYPES };