fix ca sched test

This commit is contained in:
Francisco Paisana 2020-11-13 12:57:53 +00:00 committed by Andre Puschmann
parent e8ac98d06f
commit 3407ac6741
7 changed files with 33 additions and 22 deletions

View File

@ -190,7 +190,7 @@ void ue_sim::update_ul_harqs(const sf_output_res_t& sf_out)
void ue_sim::update_conn_state(const sf_output_res_t& sf_out) void ue_sim::update_conn_state(const sf_output_res_t& sf_out)
{ {
if (ctxt.msg4_tti_rx.is_valid()) { if (ctxt.conres_rx) {
return; return;
} }
@ -244,6 +244,12 @@ void ue_sim::update_conn_state(const sf_output_res_t& sf_out)
} }
} }
} }
if (ctxt.msg4_tti_rx.is_valid()) {
if (to_tx_dl(ctxt.msg4_tti_rx) >= sf_out.tti_rx) {
ctxt.conres_rx = true;
}
}
} }
void ue_db_sim::add_user(uint16_t rnti, void ue_db_sim::add_user(uint16_t rnti,

View File

@ -44,6 +44,7 @@ struct ue_cc_ctxt_t {
std::array<ue_harq_ctxt_t, SRSLTE_FDD_NOF_HARQ> ul_harqs; std::array<ue_harq_ctxt_t, SRSLTE_FDD_NOF_HARQ> ul_harqs;
}; };
struct sim_ue_ctxt_t { struct sim_ue_ctxt_t {
bool conres_rx = false;
uint16_t rnti; uint16_t rnti;
uint32_t preamble_idx, msg3_riv; uint32_t preamble_idx, msg3_riv;
srslte::tti_point prach_tti_rx, rar_tti_rx, msg3_tti_rx, msg4_tti_rx; srslte::tti_point prach_tti_rx, rar_tti_rx, msg3_tti_rx, msg4_tti_rx;

View File

@ -121,11 +121,6 @@ int test_ul_sched_result(const sim_enb_ctxt_t& enb_ctxt, const sf_output_res_t&
const auto& ue = *ue_pair.second; const auto& ue = *ue_pair.second;
uint16_t rnti = ue.rnti; uint16_t rnti = ue.rnti;
int ue_cc_idx = ue.enb_to_ue_cc_idx(cc); int ue_cc_idx = ue.enb_to_ue_cc_idx(cc);
const auto& h = ue.cc_list[ue_cc_idx].ul_harqs[pid];
// TEST: Check if CC is configured and active
CONDERROR(ue_cc_idx < 0 or not ue.ue_cfg.supported_cc_list[ue_cc_idx].active,
"PUSCH allocation for disabled or unavailable cc\n");
const phich_t* phich_ptr = const phich_t* phich_ptr =
std::find_if(phich_begin, phich_end, [rnti](const phich_t& phich) { return phich.rnti == rnti; }); std::find_if(phich_begin, phich_end, [rnti](const phich_t& phich) { return phich.rnti == rnti; });
@ -134,8 +129,16 @@ int test_ul_sched_result(const sim_enb_ctxt_t& enb_ctxt, const sf_output_res_t&
std::find_if(pusch_begin, pusch_end, [rnti](const pusch_t& pusch) { return pusch.dci.rnti == rnti; }); std::find_if(pusch_begin, pusch_end, [rnti](const pusch_t& pusch) { return pusch.dci.rnti == rnti; });
pusch_ptr = pusch_ptr == pusch_end ? nullptr : pusch_ptr; pusch_ptr = pusch_ptr == pusch_end ? nullptr : pusch_ptr;
bool phich_ack = phich_ptr != nullptr and phich_ptr->phich == phich_t::ACK; // TEST: Check that idle CCs do not receive PUSCH grants or PHICH
bool is_msg3 = h.first_tti_rx == ue.msg3_tti_rx and h.nof_txs == h.nof_retxs + 1; if (ue_cc_idx < 0 or not ue.ue_cfg.supported_cc_list[ue_cc_idx].active) {
CONDERROR(phich_ptr != nullptr, "PHICH cannot be allocated in idle cells\n");
CONDERROR(pusch_ptr != nullptr, "PUSCH cannot be allocated in idle cells\n");
continue;
}
const auto& h = ue.cc_list[ue_cc_idx].ul_harqs[pid];
bool phich_ack = phich_ptr != nullptr and phich_ptr->phich == phich_t::ACK;
bool is_msg3 = h.first_tti_rx == ue.msg3_tti_rx and h.nof_txs == h.nof_retxs + 1;
bool last_retx = h.nof_retxs + 1 >= (is_msg3 ? sf_out.cc_params[0].cfg.maxharq_msg3tx : ue.ue_cfg.maxharq_tx); bool last_retx = h.nof_retxs + 1 >= (is_msg3 ? sf_out.cc_params[0].cfg.maxharq_msg3tx : ue.ue_cfg.maxharq_tx);
bool h_inactive = (not h.active) or (phich_ack or last_retx); bool h_inactive = (not h.active) or (phich_ack or last_retx);

View File

@ -134,16 +134,16 @@ int test_scell_activation(test_scell_activation_params params)
TESTASSERT(tester.ue_tester->user_exists(rnti1)); TESTASSERT(tester.ue_tester->user_exists(rnti1));
// Event (TTI=prach_tti+msg4_tot_delay): First Tx (Msg4). Goes in SRB0 and contains ConRes // Event (TTI=prach_tti+msg4_tot_delay): First Tx (Msg4). Goes in SRB0 and contains ConRes
while (not tester.ue_tester->get_user_ctxt(rnti1)->msg3_tti.is_valid() or while (not tester.ue_tester->get_user_ctxt(rnti1)->ue_ctxt->get_ctxt().msg3_tti_rx.is_valid() or
tester.ue_tester->get_user_ctxt(rnti1)->msg3_tti.to_uint() > generator.tti_counter) { srsenb::to_tx_ul(tester.ue_tester->get_user_ctxt(rnti1)->ue_ctxt->get_ctxt().msg3_tti_rx).to_uint() >
generator.tti_counter) {
generator.step_tti(); generator.step_tti();
tester.test_next_ttis(generator.tti_events); tester.test_next_ttis(generator.tti_events);
} }
generator.step_tti(); generator.step_tti();
generator.add_dl_data(rnti1, msg4_size); generator.add_dl_data(rnti1, msg4_size);
tester.test_next_ttis(generator.tti_events); tester.test_next_ttis(generator.tti_events);
while (not tester.ue_tester->get_user_ctxt(rnti1)->msg4_tti.is_valid() or while (not tester.ue_tester->get_user_ctxt(rnti1)->ue_ctxt->get_ctxt().conres_rx) {
tester.ue_tester->get_user_ctxt(rnti1)->msg4_tti.to_uint() > generator.tti_counter) {
generator.step_tti(); generator.step_tti();
tester.test_next_ttis(generator.tti_events); tester.test_next_ttis(generator.tti_events);
} }

View File

@ -304,7 +304,7 @@ void user_state_sched_tester::rem_user(uint16_t rnti)
sim_users.rem_user(rnti); sim_users.rem_user(rnti);
} }
int user_state_sched_tester::test_all(const sf_output_res_t& sf_out, uint32_t enb_cc_idx) int user_state_sched_tester::test_all(const sf_output_res_t& sf_out)
{ {
// Perform UE-dedicated sched result tests // Perform UE-dedicated sched result tests
sim_enb_ctxt_t enb_ctxt; sim_enb_ctxt_t enb_ctxt;
@ -315,9 +315,11 @@ int user_state_sched_tester::test_all(const sf_output_res_t& sf_out, uint32_t en
// Update Simulated UEs state // Update Simulated UEs state
sim_users.update(sf_out); sim_users.update(sf_out);
for (auto& u : users) { for (uint32_t enb_cc_idx = 0; enb_cc_idx < enb_ctxt.cell_params->size(); ++enb_cc_idx) {
TESTASSERT(u.second.test_sched_result( for (auto& u : users) {
enb_cc_idx, sf_out.dl_cc_result[enb_cc_idx], sf_out.ul_cc_result[enb_cc_idx]) == SRSLTE_SUCCESS); TESTASSERT(u.second.test_sched_result(
enb_cc_idx, sf_out.dl_cc_result[enb_cc_idx], sf_out.ul_cc_result[enb_cc_idx]) == SRSLTE_SUCCESS);
}
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
@ -444,9 +446,8 @@ int common_sched_tester::process_results()
tti_info.dl_sched_result}; tti_info.dl_sched_result};
TESTASSERT(test_all_common(sf_out) == SRSLTE_SUCCESS); TESTASSERT(test_all_common(sf_out) == SRSLTE_SUCCESS);
for (uint32_t i = 0; i < sched_cell_params.size(); ++i) { TESTASSERT(ue_tester->test_all(sf_out) == SRSLTE_SUCCESS);
TESTASSERT(ue_tester->test_all(sf_out, i) == SRSLTE_SUCCESS);
}
sched_stats->process_results(tti_info.tti_params, tti_info.dl_sched_result, tti_info.ul_sched_result); sched_stats->process_results(tti_info.tti_params, tti_info.dl_sched_result, tti_info.ul_sched_result);
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;

View File

@ -126,7 +126,7 @@ public:
int bearer_cfg(uint16_t rnti, uint32_t lcid, const srsenb::sched_interface::ue_bearer_cfg_t& bearer_cfg); int bearer_cfg(uint16_t rnti, uint32_t lcid, const srsenb::sched_interface::ue_bearer_cfg_t& bearer_cfg);
void rem_user(uint16_t rnti); void rem_user(uint16_t rnti);
int test_all(const sf_output_res_t& sf_out, uint32_t enb_cc_idx); int test_all(const sf_output_res_t& sf_out);
private: private:
const std::vector<srsenb::sched::cell_cfg_t>& cell_params; const std::vector<srsenb::sched::cell_cfg_t>& cell_params;

View File

@ -201,7 +201,7 @@ int sched_tester::process_results()
TESTASSERT(test_pdsch_collisions(sf_out, CARRIER_IDX, &cc_result->dl_mask) == SRSLTE_SUCCESS); TESTASSERT(test_pdsch_collisions(sf_out, CARRIER_IDX, &cc_result->dl_mask) == SRSLTE_SUCCESS);
// UE dedicated tests // UE dedicated tests
TESTASSERT(ue_tester->test_all(sf_out, CARRIER_IDX) == SRSLTE_SUCCESS); TESTASSERT(ue_tester->test_all(sf_out) == SRSLTE_SUCCESS);
assert_no_empty_allocs(); assert_no_empty_allocs();
test_harqs(); test_harqs();
update_ue_stats(); update_ue_stats();
@ -399,7 +399,7 @@ int main()
srsenb::set_randseed(seed); srsenb::set_randseed(seed);
printf("This is the chosen seed: %u\n", seed); printf("This is the chosen seed: %u\n", seed);
srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_DEBUG); srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_INFO);
uint32_t N_runs = 1, nof_ttis = 10240 + 10; uint32_t N_runs = 1, nof_ttis = 10240 + 10;
for (uint32_t n = 0; n < N_runs; ++n) { for (uint32_t n = 0; n < N_runs; ++n) {