From c64872924b925491bc7a54cd1bf266f9508fdb87 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 4 Nov 2021 10:02:29 +0100 Subject: [PATCH 1/3] fix for harq value in fapi indication according to scf --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 10 +++++----- openair1/SIMULATION/NR_PHY/pucchsim.c | 8 ++++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index cdc6825d4c..6fae0d058e 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -427,8 +427,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->num_harq = 1; uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); - uci_pdu->harq->harq_list[0].harq_value = index&0x01; - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); + LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); @@ -443,9 +443,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->num_harq = 2; uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); - uci_pdu->harq->harq_list[1].harq_value = index&0x01; - uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01; - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); + uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 0aed6d9780..cb6e31c26b 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -664,11 +664,11 @@ int main(int argc, char **argv) } if(nr_bit>0){ if (nr_bit==1 && do_DTX == 0) - ack_nack_errors+=(actual_payload^uci_pdu.harq->harq_list[0].harq_value); + ack_nack_errors+=(actual_payload^(!uci_pdu.harq->harq_list[0].harq_value)); else if (do_DTX == 0) - ack_nack_errors+=(((actual_payload&1)^uci_pdu.harq->harq_list[0].harq_value)+((actual_payload>>1)^uci_pdu.harq->harq_list[1].harq_value)); - else if ((uci_pdu.harq->harq_confidence_level == 0 && uci_pdu.harq->harq_list[0].harq_value == 1) || - (uci_pdu.harq->harq_confidence_level == 0 && nr_bit == 2 && uci_pdu.harq->harq_list[1].harq_value==1)) + ack_nack_errors+=(((actual_payload&1)^(!uci_pdu.harq->harq_list[0].harq_value))+((actual_payload>>1)^(!uci_pdu.harq->harq_list[1].harq_value))); + else if ((uci_pdu.harq->harq_confidence_level == 0 && uci_pdu.harq->harq_list[0].harq_value == 0) || + (uci_pdu.harq->harq_confidence_level == 0 && nr_bit == 2 && uci_pdu.harq->harq_list[1].harq_value== 0)) ack_nack_errors++; free(uci_pdu.harq->harq_list); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e226a2992d..6cf3097870 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1095,7 +1095,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); const int8_t pid = sched_ctrl->feedback_dl_harq.head; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); + handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++; } } From 094b9bcfe81bd0d10412fc8a71c7262c44f89251 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 16 Nov 2021 08:07:09 +0000 Subject: [PATCH 2/3] change in log level --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index b335a3dc33..b81e655817 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -430,7 +430,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); - LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); From 2a1c6c0543ecaf0f7188c57048c95293ac9a7db2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 22 Nov 2021 16:47:34 +0100 Subject: [PATCH 3/3] improve readability in pucchsim --- openair1/SIMULATION/NR_PHY/pucchsim.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index cb6e31c26b..213924e5fd 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -662,14 +662,19 @@ int main(int argc, char **argv) if (uci_pdu.sr->sr_indication == 0 || uci_pdu.sr->sr_confidence_level == 1) sr_errors+=1; } + // harq value 0 -> pass + // confidence value 0 -> good confidence + const int harq_value0 = uci_pdu.harq->harq_list[0].harq_value; + const int harq_value1 = uci_pdu.harq->harq_list[1].harq_value; + const int confidence_lvl = uci_pdu.harq->harq_confidence_level; if(nr_bit>0){ if (nr_bit==1 && do_DTX == 0) - ack_nack_errors+=(actual_payload^(!uci_pdu.harq->harq_list[0].harq_value)); + ack_nack_errors+=(actual_payload^(!harq_value0)); else if (do_DTX == 0) - ack_nack_errors+=(((actual_payload&1)^(!uci_pdu.harq->harq_list[0].harq_value))+((actual_payload>>1)^(!uci_pdu.harq->harq_list[1].harq_value))); - else if ((uci_pdu.harq->harq_confidence_level == 0 && uci_pdu.harq->harq_list[0].harq_value == 0) || - (uci_pdu.harq->harq_confidence_level == 0 && nr_bit == 2 && uci_pdu.harq->harq_list[1].harq_value== 0)) - ack_nack_errors++; + ack_nack_errors+=(((actual_payload&1)^(!harq_value0))+((actual_payload>>1)^(!harq_value1))); + else if ((!confidence_lvl && !harq_value0) || + (!confidence_lvl && nr_bit == 2 && !harq_value1)) + ack_nack_errors++; free(uci_pdu.harq->harq_list); } }