Add a new configuration option that controls PDSCH baseband sample dump to a file on KO.

master
faluco 3 years ago committed by faluco
parent b25681f9de
commit 7b7ecb7983

@ -175,6 +175,7 @@ struct phy_args_nr_t {
srsran_ue_ul_nr_args_t ul = {}; srsran_ue_ul_nr_args_t ul = {};
std::set<uint32_t> fixed_sr = {1}; std::set<uint32_t> fixed_sr = {1};
uint32_t fix_wideband_cqi = 15; // Set to a non-zero value for fixing the wide-band CQI report uint32_t fix_wideband_cqi = 15; // Set to a non-zero value for fixing the wide-band CQI report
bool store_pdsch_ko = false;
phy_args_nr_t() phy_args_nr_t()
{ {

@ -86,6 +86,8 @@ struct phy_args_t {
float force_ul_amplitude = 0.0f; float force_ul_amplitude = 0.0f;
bool detect_cp = false; bool detect_cp = false;
bool nr_store_pdsch_ko = false;
float in_sync_rsrp_dbm_th = -130.0f; float in_sync_rsrp_dbm_th = -130.0f;
float in_sync_snr_db_th = 1.0f; float in_sync_snr_db_th = 1.0f;
uint32_t nof_in_sync_events = 10; uint32_t nof_in_sync_events = 10;
@ -129,8 +131,8 @@ public:
} prach_info_t; } prach_info_t;
virtual void virtual void
prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec = 0.0f) = 0; prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec = 0.0f) = 0;
virtual prach_info_t prach_get_info() = 0; virtual prach_info_t prach_get_info() = 0;
/* Indicates the transmission of a SR signal in the next opportunity */ /* Indicates the transmission of a SR signal in the next opportunity */
virtual void sr_send() = 0; virtual void sr_send() = 0;

@ -405,6 +405,11 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
bpo::value<int>(&args->phy.force_N_id_2)->default_value(-1), bpo::value<int>(&args->phy.force_N_id_2)->default_value(-1),
"Force using a specific PSS (set to -1 to allow all PSSs).") "Force using a specific PSS (set to -1 to allow all PSSs).")
// PHY NR args
("phy.nr.store_pdsch_ko",
bpo::value<bool>(&args->phy.nr_store_pdsch_ko)->default_value(false),
"Dumps the PDSCH baseband samples into a file on KO reception.")
// UE simulation args // UE simulation args
("sim.airplane_t_on_ms", ("sim.airplane_t_on_ms",
bpo::value<int>(&args->stack.nas.sim.airplane_t_on_ms)->default_value(-1), bpo::value<int>(&args->stack.nas.sim.airplane_t_on_ms)->default_value(-1),

@ -13,6 +13,7 @@
#include "srsue/hdr/phy/nr/cc_worker.h" #include "srsue/hdr/phy/nr/cc_worker.h"
#include "srsran/common/band_helper.h" #include "srsran/common/band_helper.h"
#include "srsran/common/buffer_pool.h" #include "srsran/common/buffer_pool.h"
#include "srsran/common/string_helpers.h"
#include "srsran/srsran.h" #include "srsran/srsran.h"
namespace srsue { namespace srsue {
@ -300,6 +301,32 @@ bool cc_worker::decode_pdsch_dl()
} }
} }
if (not pdsch_res.tb[0].crc and phy.args.store_pdsch_ko) {
static unsigned unique_filename_id = 0;
unsigned id = ++unique_filename_id;
fmt::memory_buffer filename;
fmt::format_to(filename, "pdsch_ko_bb_samples_{}.bin", id);
srsran_filesink_t filesink = {};
if (srsran_filesink_init(&filesink, (char*)srsran::to_c_str(filename), SRSRAN_COMPLEX_FLOAT_BIN) == 0) {
srsran_filesink_write(&filesink, (void*)rx_buffer[0], ue_dl.fft[0].sf_sz);
srsran_filesink_free(&filesink);
str_extra_t str_extra;
srsran_sch_cfg_nr_info(&pdsch_cfg, str_extra.data(), (uint32_t)str_extra.size());
logger.info("PDSCH: KO detected, dumping PDSCH baseband samples into file '%s'"
"\n"
"Information: cc_idx=%d pid=%d slot_idx=%d sf_len=%d\n%s",
srsran::to_c_str(filename),
cc_idx,
pid,
dl_slot_cfg.idx,
ue_dl.fft[0].sf_sz,
str_extra.data());
}
}
// Enqueue PDSCH ACK information only if the RNTI is type C // Enqueue PDSCH ACK information only if the RNTI is type C
if (pdsch_cfg.grant.rnti_type == srsran_rnti_type_c) { if (pdsch_cfg.grant.rnti_type == srsran_rnti_type_c) {
phy.set_pending_ack(dl_slot_cfg.idx, ack_resource, pdsch_res.tb[0].crc); phy.set_pending_ack(dl_slot_cfg.idx, ack_resource, pdsch_res.tb[0].crc);

@ -97,6 +97,7 @@ int ue::init(const all_args_t& args_)
phy_args_nr.nof_phy_threads = args.phy.nof_phy_threads; phy_args_nr.nof_phy_threads = args.phy.nof_phy_threads;
phy_args_nr.worker_cpu_mask = args.phy.worker_cpu_mask; phy_args_nr.worker_cpu_mask = args.phy.worker_cpu_mask;
phy_args_nr.log = args.phy.log; phy_args_nr.log = args.phy.log;
phy_args_nr.store_pdsch_ko = args.phy.nr_store_pdsch_ko;
if (lte_phy->init(phy_args_nr, lte_stack.get(), lte_radio.get())) { if (lte_phy->init(phy_args_nr, lte_stack.get(), lte_radio.get())) {
srsran::console("Error initializing NR PHY.\n"); srsran::console("Error initializing NR PHY.\n");
ret = SRSRAN_ERROR; ret = SRSRAN_ERROR;

@ -374,6 +374,15 @@ enable = false
#nof_in_sync_events = 10 #nof_in_sync_events = 10
#nof_out_of_sync_events = 20 #nof_out_of_sync_events = 20
#####################################################################
# PHY NR specific configuration options
#
# store_pdsch_ko: Dumps the PDSCH baseband samples into a file on KO reception
#
#####################################################################
[phy.nr]
#store_pdsch_ko = false
##################################################################### #####################################################################
# Simulation configuration options # Simulation configuration options
# #

Loading…
Cancel
Save