mirror of https://github.com/PentHertz/srsLTE.git
Minor aesthetic changes in intra measure class and changed scell_search test arguments
This commit is contained in:
parent
344016ef0a
commit
6672f6df0f
|
@ -170,7 +170,18 @@ private:
|
||||||
|
|
||||||
internal_state state;
|
internal_state state;
|
||||||
|
|
||||||
void run_thread() override;
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
///< 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 = {};
|
||||||
|
|
|
@ -140,79 +140,98 @@ 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) {
|
active_pci_mutex.lock();
|
||||||
// Start measuring
|
cells_to_measure = active_pci;
|
||||||
active_pci_mutex.lock();
|
active_pci_mutex.unlock();
|
||||||
cells_to_measure = active_pci;
|
|
||||||
active_pci_mutex.unlock();
|
|
||||||
|
|
||||||
// Read data from buffer and find cells in it
|
// Read data from buffer and find cells in it
|
||||||
srslte_ringbuffer_read(&ring_buffer, search_buffer, intra_freq_meas_len_ms * current_sflen * sizeof(cf_t));
|
srslte_ringbuffer_read(&ring_buffer, search_buffer, intra_freq_meas_len_ms * current_sflen * sizeof(cf_t));
|
||||||
|
|
||||||
// Go to receive before finishing, so new samples can be enqueued before the thread finishes
|
// Go to receive before finishing, so new samples can be enqueued before the thread finishes
|
||||||
if (state.get_state() == internal_state::measure) {
|
if (state.get_state() == internal_state::measure) {
|
||||||
// Prevents transition to wait if state has changed while reading the ring-buffer
|
// Prevents transition to wait if state has changed while reading the ring-buffer
|
||||||
state.set_state(internal_state::wait);
|
state.set_state(internal_state::wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect new cells using PSS/SSS
|
// Detect new cells using PSS/SSS
|
||||||
std::set<uint32_t> detected_cells = scell.find_cells(search_buffer, serving_cell, intra_freq_meas_len_ms);
|
std::set<uint32_t> detected_cells = scell.find_cells(search_buffer, serving_cell, intra_freq_meas_len_ms);
|
||||||
|
|
||||||
// Add detected cells to the list of cells to measure
|
// Add detected cells to the list of cells to measure
|
||||||
for (auto& c : detected_cells) {
|
for (auto& c : detected_cells) {
|
||||||
cells_to_measure.insert(c);
|
cells_to_measure.insert(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise empty neighbour cell list
|
// Initialise empty neighbour cell list
|
||||||
std::vector<rrc_interface_phy_lte::phy_meas_t> neighbour_cells = {};
|
std::vector<rrc_interface_phy_lte::phy_meas_t> neighbour_cells = {};
|
||||||
|
|
||||||
// Use Cell Reference signal to measure cells in the time domain for all known active PCI
|
// Use Cell Reference signal to measure cells in the time domain for all known active PCI
|
||||||
for (auto id : cells_to_measure) {
|
for (auto id : cells_to_measure) {
|
||||||
// Do not measure serving cell here since it's measured by workers
|
// Do not measure serving cell here since it's measured by workers
|
||||||
if (id == serving_cell.id) {
|
if (id == serving_cell.id) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
srslte_cell_t cell = serving_cell;
|
srslte_cell_t cell = serving_cell;
|
||||||
cell.id = id;
|
cell.id = id;
|
||||||
|
|
||||||
srslte_refsignal_dl_sync_set_cell(&refsignal_dl_sync, cell);
|
srslte_refsignal_dl_sync_set_cell(&refsignal_dl_sync, cell);
|
||||||
srslte_refsignal_dl_sync_run(&refsignal_dl_sync, search_buffer, intra_freq_meas_len_ms * current_sflen);
|
srslte_refsignal_dl_sync_run(&refsignal_dl_sync, search_buffer, intra_freq_meas_len_ms * current_sflen);
|
||||||
|
|
||||||
if (refsignal_dl_sync.found) {
|
if (refsignal_dl_sync.found) {
|
||||||
rrc_interface_phy_lte::phy_meas_t m = {};
|
rrc_interface_phy_lte::phy_meas_t m = {};
|
||||||
m.pci = cell.id;
|
m.pci = cell.id;
|
||||||
m.earfcn = current_earfcn;
|
m.earfcn = current_earfcn;
|
||||||
m.rsrp = refsignal_dl_sync.rsrp_dBfs - rx_gain_offset_db;
|
m.rsrp = refsignal_dl_sync.rsrp_dBfs - rx_gain_offset_db;
|
||||||
m.rsrq = refsignal_dl_sync.rsrq_dB;
|
m.rsrq = refsignal_dl_sync.rsrq_dB;
|
||||||
neighbour_cells.push_back(m);
|
neighbour_cells.push_back(m);
|
||||||
|
|
||||||
Info("INTRA: Found neighbour cell: EARFCN=%d, PCI=%03d, RSRP=%5.1f dBm, RSRQ=%5.1f, peak_idx=%5d, "
|
Info("INTRA: Found neighbour cell: EARFCN=%d, PCI=%03d, RSRP=%5.1f dBm, RSRQ=%5.1f, peak_idx=%5d, "
|
||||||
"CFO=%+.1fHz\n",
|
"CFO=%+.1fHz\n",
|
||||||
m.earfcn,
|
m.earfcn,
|
||||||
m.pci,
|
m.pci,
|
||||||
m.rsrp,
|
m.rsrp,
|
||||||
m.rsrq,
|
m.rsrq,
|
||||||
refsignal_dl_sync.peak_index,
|
refsignal_dl_sync.peak_index,
|
||||||
refsignal_dl_sync.cfo_Hz);
|
refsignal_dl_sync.cfo_Hz);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send measurements to RRC
|
|
||||||
if (not neighbour_cells.empty()) {
|
|
||||||
rrc->new_cell_meas(neighbour_cells);
|
|
||||||
}
|
|
||||||
|
|
||||||
meas_sync.increase();
|
|
||||||
} else if (state.get_state() != internal_state::quit) {
|
|
||||||
// Wait for changing state
|
|
||||||
state.wait_change();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send measurements to RRC if any cell found
|
||||||
|
if (not neighbour_cells.empty()) {
|
||||||
|
rrc->new_cell_meas(neighbour_cells);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inform that measurement has finished
|
||||||
|
meas_sync.increase();
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue