Enhanced nr_phy_test to assert PRACH detection

master
Xavier Arteaga 3 years ago committed by Andre Puschmann
parent c7940f455c
commit 4e76d7fef6

@ -100,7 +100,6 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB)
--gnb.stack.pusch.slots=none # No PUSCH
--gnb.phy.nof_threads=${NR_PHY_TEST_GNB_NOF_THREADS}
--ue.stack.prach.period=30 # Transmit PRACH every 30 radio frames
--ue.stack.prach.preamble=10 # Use preamble 10
--ue.phy.nof_threads=${NR_PHY_TEST_UE_NOF_THREADS}
)
@ -110,7 +109,6 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB)
--gnb.stack.pdsch.slots=none # No PDSCH
--gnb.stack.pusch.slots=none # No PUSCH
--ue.stack.prach.period=30 # Transmit PRACH every 30 radio frames
--ue.stack.prach.preamble=10 # Use preamble 10
${NR_PHY_TEST_COMMON_ARGS}
)

@ -37,6 +37,7 @@ private:
uint32_t sr_count = 0;
uint32_t prach_period = 0;
uint32_t prach_preamble = 0;
bool prach_pending = false;
metrics_t metrics = {};
srsue::phy_interface_stack_nr& phy;
@ -45,17 +46,12 @@ private:
public:
struct args_t {
uint16_t rnti = 0x1234; ///< C-RNTI for PUSCH and PDSCH transmissions
uint32_t sr_period = 0; ///< Indicates positive SR period in number of opportunities. Set to 0 to disable.
uint32_t prach_period = 0; ///< Requests PHY to transmit PRACH periodically in frames. Set to 0 to disable.
uint32_t prach_preamble = 0; ///< Requests PHY to transmit PRACH periodically in frames. Set to 0 to disable.
uint16_t rnti = 0x1234; ///< C-RNTI for PUSCH and PDSCH transmissions
uint32_t sr_period = 0; ///< Indicates positive SR period in number of opportunities. Set to 0 to disable.
uint32_t prach_period = 0; ///< Requests PHY to transmit PRACH periodically in frames. Set to 0 to disable.
};
ue_dummy_stack(const args_t& args, srsue::phy_interface_stack_nr& phy_) :
rnti(args.rnti),
sr_period(args.sr_period),
prach_period(args.prach_period),
prach_preamble(args.prach_preamble),
phy(phy_)
rnti(args.rnti), sr_period(args.sr_period), prach_period(args.prach_period), phy(phy_)
{
valid = true;
}
@ -68,13 +64,10 @@ public:
if (prach_period != 0) {
uint32_t slot_idx = tti % SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz);
uint32_t sfn = tti / SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz);
if (slot_idx == 0 and sfn % prach_period == 0) {
uint32_t prach_preamble_ = prach_preamble;
if (prach_preamble_ >= 64) {
prach_preamble_ = srsran_random_uniform_int_dist(random_gen, 0, 63);
}
phy.send_prach(0, prach_preamble_, 0.0f, 0.0f);
metrics.prach[prach_preamble_].count++;
if (not prach_pending and slot_idx == 0 and sfn % prach_period == 0) {
prach_preamble = srsran_random_uniform_int_dist(random_gen, 0, 63);
phy.send_prach(0, prach_preamble, 0.0f, 0.0f);
prach_pending = true;
}
}
}
@ -109,6 +102,8 @@ public:
std::unique_lock<std::mutex> lock(rnti_mutex);
dl_rnti_type = srsran_rnti_type_ra;
rnti = 1 + s_id + 14 * t_id + 14 * 80 * f_id + 14 * 80 * 8 * ul_carrier_id;
metrics.prach[prach_preamble].count++;
prach_pending = false;
}
bool sr_opportunity(uint32_t tti, uint32_t sr_id, bool meas_gap, bool ul_sch_tx) override
{

@ -26,6 +26,8 @@ static double assert_cqi_detection_min = 1.000;
static double assert_pusch_bler_max = 0.000;
static double assert_pdsch_bler_max = 0.000;
static double assert_prach_detection_min = 1.000;
static double assert_prach_ta_min = 0.000;
static double assert_prach_ta_max = 0.000;
test_bench::args_t::args_t(int argc, char** argv)
{
@ -90,7 +92,6 @@ test_bench::args_t::args_t(int argc, char** argv)
options_ue_stack.add_options()
("ue.stack.sr.period", bpo::value<uint32_t>(&ue_stack.sr_period)->default_value(ue_stack.sr_period), "SR period in number of opportunities. Set 0 to disable and 1 for all.")
("ue.stack.prach.period", bpo::value<uint32_t>(&ue_stack.prach_period)->default_value(ue_stack.prach_period), "PRACH period in SFN. Set 0 to disable and 1 for all.")
("ue.stack.prach.preamble", bpo::value<uint32_t>(&ue_stack.prach_preamble)->default_value(ue_stack.prach_preamble), "PRACH preamble. Set 0 to disable and 1 for all.")
;
options_assertion.add_options()
@ -98,6 +99,8 @@ test_bench::args_t::args_t(int argc, char** argv)
("assert.cqi.detection.min", bpo::value<double>(&assert_cqi_detection_min)->default_value(assert_cqi_detection_min), "CQI report minimum detection threshold")
("assert.pusch.bler.max", bpo::value<double>(&assert_pusch_bler_max)->default_value(assert_pusch_bler_max), "PUSCH maximum BLER threshold")
("assert.pdsch.bler.max", bpo::value<double>(&assert_pdsch_bler_max)->default_value(assert_pdsch_bler_max), "PDSCH maximum BLER threshold")
("assert.prach.ta.min", bpo::value<double>(&assert_prach_ta_min)->default_value(assert_prach_ta_min), "PRACH estimated TA minimum value threshold")
("assert.prach.ta.max", bpo::value<double>(&assert_prach_ta_max)->default_value(assert_prach_ta_max), "PRACH estimated TA maximum value threshold")
;
options.add(options_gnb_stack).add(options_gnb_phy).add(options_ue_stack).add(options_ue_phy).add_options()
@ -148,7 +151,7 @@ test_bench::args_t::args_t(int argc, char** argv)
gnb_stack.rnti = rnti;
gnb_stack.phy_cfg = phy_cfg;
gnb_stack.wait_preamble = ue_stack.prach_preamble > 0;
gnb_stack.wait_preamble = ue_stack.prach_period > 0;
if (gnb_stack.pdsch.rb_length == 0) {
gnb_stack.pdsch.rb_length = phy_cfg.carrier.nof_prb;
@ -238,6 +241,7 @@ int main(int argc, char** argv)
// Print PRACH
double prach_detection = 0.0;
double prach_ta = 0.0;
uint32_t prach_tx_count = 0;
uint32_t prach_rx_count = 0;
if (metrics.ue_stack.prach.size() > 0) {
@ -265,6 +269,7 @@ int main(int argc, char** argv)
gnb_dummy_stack::prach_metrics_t gnb_prach = {};
if (metrics.gnb_stack.prach.count(p.first) > 0) {
gnb_prach = metrics.gnb_stack.prach[p.first];
prach_ta = SRSRAN_VEC_SAFE_CMA(gnb_prach.avg_ta, prach_ta, prach_rx_count);
} else {
gnb_prach.avg_ta = NAN;
gnb_prach.min_ta = NAN;
@ -438,6 +443,11 @@ int main(int argc, char** argv)
"PRACH detection probability (%f) did not reach the assertion minimum (%f)",
prach_detection,
assert_prach_detection_min);
srsran_assert(prach_tx_count == 0 or (prach_ta >= assert_prach_ta_min and prach_ta <= assert_prach_ta_max),
"PRACH TA average measurement %f is higher than minimum (%d) or above maximum (%f)",
prach_ta,
assert_prach_ta_min,
assert_prach_ta_max);
// If reached here, the test is successful
return SRSRAN_SUCCESS;

Loading…
Cancel
Save