From c229d59efdf8e948fdb2ab399a3631f70cadb92b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 24 Feb 2026 18:44:27 +0100 Subject: [PATCH] Add PUCCH power control T traces --- common/utils/T/T_messages.txt | 4 ++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 16 ++++++++++++++++ tools/plots/README.md | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index c763c691a5..918982a8c8 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -217,6 +217,10 @@ ID = GNB_MAC_PUSCH_POWER_CONTROL DESC = NR MAC PUSCH power control-related data GROUP = ALL:MAC:GNB:CSV FORMAT = int,rnti : int,frame : int,slot : int,snrx10 : int,phr : int,tpc : int,tb_size : int,txpower_calc : int,rbSize : int,mcs : int,rssi +ID = GNB_MAC_PUCCH_POWER_CONTROL + DESC = NR MAC PUCCH power control-related data + GROUP = ALL:MAC:GNB:CSV + FORMAT = int,rnti : int,frame : int,slot : int,snrx10 : int,tpc : int,rssi ID = GNB_MAC_DL_RAR_PDU_WITH_DATA DESC = NR MAC downlink PDU for RAR GROUP = ALL:MAC:GNB:WIRESHARK diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 062bdfc221..21fd5b1776 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -936,6 +936,14 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, slot_t slot, con } else sched_ctrl->tpc1 = 1; sched_ctrl->tpc1 = nr_limit_tpc(sched_ctrl->tpc1, uci_01->rssi, rssi_threshold); + + T(T_GNB_MAC_PUCCH_POWER_CONTROL, + T_INT(uci_01->rnti), + T_INT(frame), + T_INT(slot), + T_INT(sched_ctrl->pucch_snrx10), + T_INT(sched_ctrl->tpc1), + T_INT(uci_01->rssi)); } // check scheduling request result, confidence_level == 0 is good @@ -971,6 +979,14 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, slot_t slot, c sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640; sched_ctrl->tpc1 = nr_get_tpc(nrmac->radio_config.pucch.target_snrx10, uci_234->ul_cqi, 30, 0); sched_ctrl->tpc1 = nr_limit_tpc(sched_ctrl->tpc1, uci_234->rssi, rssi_threshold); + + T(T_GNB_MAC_PUCCH_POWER_CONTROL, + T_INT(uci_234->rnti), + T_INT(frame), + T_INT(slot), + T_INT(sched_ctrl->pucch_snrx10), + T_INT(sched_ctrl->tpc1), + T_INT(uci_234->rssi)); } // TODO: handle SR diff --git a/tools/plots/README.md b/tools/plots/README.md index a83ad93f8d..a04043d097 100644 --- a/tools/plots/README.md +++ b/tools/plots/README.md @@ -55,6 +55,14 @@ a `&`. In that case, it's important to run the `nr-softmodem` at second position, which will receive signals and stop the `csv` tracer when stopping the main process. +The script might also be used to print PUCCH SNR. This can be achieved by only +recording the relevant fields with the `csv` tracer for trace +`GNB_MAC_PUCCH_POWER_CONTROL + + ./common/utils/T/tracer/record -d ../common/utils/T/T_messages.txt -OFF -on GNB_MAC_PUSCH_POWER_CONTROL -on GNB_MAC_PUCCH_POWER_CONTROL -o /tmp/record.raw + +Use the `replay` tracer and `csv` to separate into PUSCH and PUCCH traces. + After recovering the `pusch.csv` file, you could plot it with a script. ./plot-power-control.gp.sh /tmp/pusch.csv