Minor aesthetic changes in intra measure class and changed scell_search test arguments

This commit is contained in:
Xavier Arteaga 2020-02-13 10:50:41 +01:00 committed by Xavier Arteaga
parent 344016ef0a
commit 6672f6df0f
3 changed files with 91 additions and 61 deletions

View File

@ -170,7 +170,18 @@ private:
internal_state state; internal_state state;
/**
* Measurement process helper method. Encapusulates the neighbour cell measurement functionality
*/
void measure_proc();
/**
* Internal asynchronous low priority thread, waits for measure internal state to execute the measurement process. It
* stops when the internal state transitions to quit.
*/
void run_thread() override; void run_thread() override;
///< Internal Thread priority, low by default
const static int INTRA_FREQ_MEAS_PRIO = DEFAULT_PRIORITY + 5; const static int INTRA_FREQ_MEAS_PRIO = DEFAULT_PRIORITY + 5;
scell_recv scell = {}; scell_recv scell = {};

View File

@ -140,13 +140,11 @@ void intra_measure::write(uint32_t tti, cf_t* data, uint32_t nsamples)
} }
} }
void intra_measure::run_thread() void intra_measure::measure_proc()
{ {
std::set<uint32_t> cells_to_measure = {}; std::set<uint32_t> cells_to_measure = {};
while (state.get_state() != internal_state::quit) { // Load cell list to measure
if (state.get_state() == internal_state::measure) {
// Start measuring
active_pci_mutex.lock(); active_pci_mutex.lock();
cells_to_measure = active_pci; cells_to_measure = active_pci;
active_pci_mutex.unlock(); active_pci_mutex.unlock();
@ -202,17 +200,38 @@ void intra_measure::run_thread()
} }
} }
// Send measurements to RRC // Send measurements to RRC if any cell found
if (not neighbour_cells.empty()) { if (not neighbour_cells.empty()) {
rrc->new_cell_meas(neighbour_cells); rrc->new_cell_meas(neighbour_cells);
} }
// Inform that measurement has finished
meas_sync.increase(); meas_sync.increase();
} else if (state.get_state() != internal_state::quit) { }
// Wait for changing state
void intra_measure::run_thread()
{
bool quit = false;
do {
switch (state.get_state()) {
case internal_state::idle:
case internal_state::wait:
case internal_state::receive:
// Wait for a state change
state.wait_change(); state.wait_change();
break;
case internal_state::measure:
// Run the measurement process
measure_proc();
break;
case internal_state::quit:
// Quit loop
quit = true;
break;
} }
} } while (not quit);
} }
} // namespace scell } // namespace scell

View File

@ -59,4 +59,4 @@ target_link_libraries(scell_search_test
rrc_asn1 rrc_asn1
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES}) ${Boost_LIBRARIES})
add_test(scell_search_test scell_search_test --duration=1 --phy_lib_log_level=0 --intra_meas_log_level=none --nof_enb=2 --cell.nof_prb=25) add_test(scell_search_test scell_search_test --duration=5 --cell.nof_prb=6 --active_cell_list=2,3,4,5,6 --simulation_cell_list=1,2,3,4,5,6 --channel_period_s=30 --channel.hst.fd=750 --channel.delay_max=10000)