From aadbe6d8803b738e76359727b24824203771c674 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 19 Apr 2021 11:25:58 +0200 Subject: [PATCH] Normalise NR PUSCH to maximum Tx power --- lib/src/phy/ue/ue_ul_nr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/src/phy/ue/ue_ul_nr.c b/lib/src/phy/ue/ue_ul_nr.c index 74b313828..9f61052d7 100644 --- a/lib/src/phy/ue/ue_ul_nr.c +++ b/lib/src/phy/ue/ue_ul_nr.c @@ -123,6 +123,13 @@ int srsran_ue_ul_nr_encode_pusch(srsran_ue_ul_nr_t* q, // Generate signal srsran_ofdm_tx_sf(&q->ifft); + // Normalise to peak + uint32_t max_idx = srsran_vec_max_abs_ci(q->ifft.cfg.out_buffer, q->ifft.sf_sz); + float max_peak = cabsf(q->ifft.cfg.out_buffer[max_idx]); + if (isnormal(max_peak)) { + srsran_vec_sc_prod_cfc(q->ifft.cfg.out_buffer, 0.99f / max_peak, q->ifft.cfg.out_buffer, q->ifft.sf_sz); + } + return SRSRAN_SUCCESS; }