diff --git a/lib/include/srslte/phy/phch/pusch.h b/lib/include/srslte/phy/phch/pusch.h index fe2f10f4d..99f844f9d 100644 --- a/lib/include/srslte/phy/phch/pusch.h +++ b/lib/include/srslte/phy/phch/pusch.h @@ -96,6 +96,7 @@ typedef struct SRSLTE_API { bool crc; float avg_iterations_block; float evm; + float epre_dbfs; } srslte_pusch_res_t; SRSLTE_API int srslte_pusch_init_ue(srslte_pusch_t* q, uint32_t max_prb); diff --git a/lib/include/srslte/phy/phch/pusch_cfg.h b/lib/include/srslte/phy/phch/pusch_cfg.h index 1062a1a2c..ff8dd899d 100644 --- a/lib/include/srslte/phy/phch/pusch_cfg.h +++ b/lib/include/srslte/phy/phch/pusch_cfg.h @@ -78,6 +78,7 @@ typedef struct SRSLTE_API { bool meas_time_en; uint32_t meas_time_value; + bool meas_epre_en; bool meas_ta_en; bool meas_evm_en; diff --git a/lib/src/phy/phch/pusch.c b/lib/src/phy/phch/pusch.c index 91cc396b8..17c1ec478 100644 --- a/lib/src/phy/phch/pusch.c +++ b/lib/src/phy/phch/pusch.c @@ -489,6 +489,13 @@ int srslte_pusch_decode(srslte_pusch_t* q, return SRSLTE_ERROR; } + // Measure Energy per Resource Element + if (cfg->meas_epre_en) { + out->epre_dbfs = srslte_convert_power_to_dB(srslte_vec_avg_power_cf(q->d, n)); + } else { + out->epre_dbfs = NAN; + } + /* extract channel estimates */ n = pusch_get(q, &cfg->grant, channel->ce, q->ce, sf->shortened); if (n != cfg->grant.nof_re) { @@ -602,6 +609,11 @@ uint32_t srslte_pusch_rx_info(srslte_pusch_cfg_t* cfg, len = srslte_print_check(str, str_len, len, ", snr=%.1f dB", chest_res->snr_db); + // Append Energy Per Resource Element + if (cfg->meas_epre_en) { + len = srslte_print_check(str, str_len, len, ", epre=%.1f dBfs", res->epre_dbfs); + } + // Append Time Aligment information if available if (cfg->meas_ta_en) { len = srslte_print_check(str, str_len, len, ", ta=%.1f us", chest_res->ta_us); diff --git a/srsenb/hdr/phy/phy_interfaces.h b/srsenb/hdr/phy/phy_interfaces.h index 00d061d2e..4164f2ae3 100644 --- a/srsenb/hdr/phy/phy_interfaces.h +++ b/srsenb/hdr/phy/phy_interfaces.h @@ -53,6 +53,7 @@ struct phy_args_t { std::string equalizer_mode = "mmse"; float estimator_fil_w = 1.0f; bool pregenerate_signals = false; + bool pusch_meas_epre = true; bool pusch_meas_evm = true; bool pusch_meas_ta = true; diff --git a/srsenb/src/phy/phy_ue_db.cc b/srsenb/src/phy/phy_ue_db.cc index 19c54c3f1..59c6d2b06 100644 --- a/srsenb/src/phy/phy_ue_db.cc +++ b/srsenb/src/phy/phy_ue_db.cc @@ -101,6 +101,7 @@ inline void phy_ue_db::_set_common_config_rnti(uint16_t rnti) scell_info.phy_cfg.ul_cfg.pucch.rnti = rnti; scell_info.phy_cfg.ul_cfg.pusch.rnti = rnti; scell_info.phy_cfg.ul_cfg.pusch.meas_time_en = true; + scell_info.phy_cfg.ul_cfg.pusch.meas_epre_en = phy_args->pusch_meas_epre; scell_info.phy_cfg.ul_cfg.pusch.meas_ta_en = phy_args->pusch_meas_ta; scell_info.phy_cfg.ul_cfg.pusch.meas_evm_en = phy_args->pusch_meas_evm; scell_info.phy_cfg.ul_cfg.pucch.threshold_format1 = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1;