HO working

master
Ismael Gomez 7 years ago
parent edd9cbf4dc
commit ff1269add3

@ -772,7 +772,6 @@ int rf_uhd_recv_with_time_multi(void *h,
trials++; trials++;
if (error_code == UHD_RX_METADATA_ERROR_CODE_OVERFLOW) { if (error_code == UHD_RX_METADATA_ERROR_CODE_OVERFLOW) {
printf("OVERFLOW\n");
log_overflow(handler); log_overflow(handler);
} else if (error_code == UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND) { } else if (error_code == UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND) {
log_late(handler, true); log_late(handler, true);

@ -259,7 +259,6 @@ private:
bool running; bool running;
// Objects for internal use // Objects for internal use
measure measure_p;
search search_p; search search_p;
sfn_sync sfn_p; sfn_sync sfn_p;
intra_measure intra_freq_meas; intra_measure intra_freq_meas;

@ -26,6 +26,8 @@
#include <unistd.h> #include <unistd.h>
#include <algorithm> #include <algorithm>
#include <srsue/hdr/phy/phch_recv.h>
#include <srslte/srslte.h>
#include "srslte/srslte.h" #include "srslte/srslte.h"
#include "srslte/common/log.h" #include "srslte/common/log.h"
#include "srsue/hdr/phy/phch_worker.h" #include "srsue/hdr/phy/phch_worker.h"
@ -90,9 +92,6 @@ void phch_recv::init(srslte::radio_multi *_radio_handler, mac_interface_phy *_ma
// Initialize SFN synchronizer // Initialize SFN synchronizer
sfn_p.init(&ue_sync, sf_buffer, log_h); sfn_p.init(&ue_sync, sf_buffer, log_h);
// Initialize measurement class for the primary cell
measure_p.init(sf_buffer, log_h, nof_rx_antennas);
// Start intra-frequency measurement // Start intra-frequency measurement
intra_freq_meas.init(worker_com, rrc, log_h); intra_freq_meas.init(worker_com, rrc, log_h);
@ -137,7 +136,6 @@ void phch_recv::reset()
srate_mode = SRATE_NONE; srate_mode = SRATE_NONE;
current_earfcn = -1; current_earfcn = -1;
sfn_p.reset(); sfn_p.reset();
measure_p.reset();
search_p.reset(); search_p.reset();
phy_state.go_idle(); phy_state.go_idle();
@ -289,7 +287,6 @@ bool phch_recv::cell_select(phy_interface_rrc::phy_cell_t *new_cell) {
worker_com->reset(); worker_com->reset();
sfn_p.reset(); sfn_p.reset();
search_p.reset(); search_p.reset();
measure_p.reset();
srslte_ue_sync_reset(&ue_sync); srslte_ue_sync_reset(&ue_sync);
/* Reconfigure cell if necessary */ /* Reconfigure cell if necessary */
@ -351,8 +348,7 @@ bool phch_recv::cell_is_camping() {
* *
* It has 3 states: Cell search, SFN syncrhonization, intial measurement and camping. * It has 3 states: Cell search, SFN syncrhonization, intial measurement and camping.
* - CELL_SEARCH: Initial Cell id and MIB acquisition. Uses 1.92 MHz sampling rate * - CELL_SEARCH: Initial Cell id and MIB acquisition. Uses 1.92 MHz sampling rate
* - CELL_SFN_SYNC: Full sampling rate, uses MIB to obtain SFN. When SFN is obtained, moves to CELL_MEASURE or CELL_CAMP * - CELL_SYNC: Full sampling rate, uses MIB to obtain SFN. When SFN is obtained, moves to CELL_CAMP
* - CELL_MEASURE: RSRP/SNR measurement to determine suitability for camping.
* - CELL_CAMP: Cell camping state. Calls the PHCH workers to process subframes and mantains cell synchronization. * - CELL_CAMP: Cell camping state. Calls the PHCH workers to process subframes and mantains cell synchronization.
* - IDLE: Receives and discards received samples. Does not mantain synchronization. * - IDLE: Receives and discards received samples. Does not mantain synchronization.
* *
@ -550,7 +546,6 @@ void phch_recv::run_thread()
* *
*/ */
void phch_recv::radio_overflow() { void phch_recv::radio_overflow() {
log_h->warning("Overflow\n");
radio_is_overflow = true; radio_is_overflow = true;
} }
@ -677,7 +672,6 @@ bool phch_recv::set_cell() {
Error("SYNC: Setting cell: initiating ue_sync\n"); Error("SYNC: Setting cell: initiating ue_sync\n");
return false; return false;
} }
measure_p.set_cell(cell);
sfn_p.set_cell(cell); sfn_p.set_cell(cell);
worker_com->set_cell(cell); worker_com->set_cell(cell);
intra_freq_meas.set_primay_cell(current_earfcn, cell); intra_freq_meas.set_primay_cell(current_earfcn, cell);
@ -1075,6 +1069,7 @@ void phch_recv::measure::init(cf_t *buffer[SRSLTE_MAX_PORTS], srslte::log *log_h
Error("SYNC: Initiating ue_dl_measure\n"); Error("SYNC: Initiating ue_dl_measure\n");
return; return;
} }
srslte_chest_dl_set_rsrp_neighbour(&ue_dl.chest, true);
reset(); reset();
} }
@ -1148,6 +1143,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_multiple_subframes(cf_t *in
offset = offset-sf_len/2; offset = offset-sf_len/2;
while (offset < 0 && sf_idx < max_sf) { while (offset < 0 && sf_idx < max_sf) {
Info("INTRA: offset=%d, sf_idx=%d\n", offset, sf_idx);
offset += sf_len; offset += sf_len;
sf_idx ++; sf_idx ++;
} }
@ -1205,6 +1201,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_multiple_subframes(cf_t *in
} }
} else { } else {
Info("INTRA: not running because offset=%d, sf_len*max_sf=%d*%d\n", offset, sf_len, max_sf); Info("INTRA: not running because offset=%d, sf_len*max_sf=%d*%d\n", offset, sf_len, max_sf);
ret = ERROR;
} }
return ret; return ret;
} }
@ -1372,7 +1369,7 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset,
if (cell_id >= 0) { if (cell_id >= 0) {
// We found the same cell as before, look another N_id_2 // We found the same cell as before, look another N_id_2
if ((uint32_t) cell_id == found_cell.id || (uint32_t) cell_id == cell.id) { if ((uint32_t) cell_id == found_cell.id || (uint32_t) cell_id == cell.id) {
Info("n_id_2=%d, PCI=%d, found_cell.id=%d, cell.id=%d\n", n_id_2, cell_id, found_cell.id, cell.id); Debug("INTRA: n_id_2=%d, PCI=%d, found_cell.id=%d, cell.id=%d\n", n_id_2, cell_id, found_cell.id, cell.id);
sync_res = SRSLTE_SYNC_NOFOUND; sync_res = SRSLTE_SYNC_NOFOUND;
} else { } else {
// We found a new cell ID // We found a new cell ID
@ -1390,7 +1387,7 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset,
switch(measure_p.run_multiple_subframes(input_buffer, peak_idx, sf_idx, nof_sf)) switch(measure_p.run_multiple_subframes(input_buffer, peak_idx, sf_idx, nof_sf))
{ {
case measure::MEASURE_OK: default:
// Consider a cell to be detectable 8.1.2.2.1.1 from 36.133. Currently only using first condition // Consider a cell to be detectable 8.1.2.2.1.1 from 36.133. Currently only using first condition
if (measure_p.rsrp() > ABSOLUTE_RSRP_THRESHOLD_DBM) { if (measure_p.rsrp() > ABSOLUTE_RSRP_THRESHOLD_DBM) {
cells[nof_cells].pci = found_cell.id; cells[nof_cells].pci = found_cell.id;
@ -1409,13 +1406,13 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset,
if (sic_pss_enabled) { if (sic_pss_enabled) {
srslte_pss_sic(&sync_find.pss, &input_buffer[sf5_cnt * 5 * sf_len + sf_len / 2 - fft_sz]); srslte_pss_sic(&sync_find.pss, &input_buffer[sf5_cnt * 5 * sf_len + sf_len / 2 - fft_sz]);
}*/ }*/
} else {
Info("INTRA: Found neighbour cell but RSRP=%.1f dBm is below threshold (%.1f dBm)\n",
measure_p.rsrp(), ABSOLUTE_RSRP_THRESHOLD_DBM);
} }
break; break;
default:
Info("INTRA: Not enough samples to measure PCI=%d\n", cell_id);
break;
case measure::ERROR: case measure::ERROR:
Error("Measuring neighbour cell\n"); Error("INTRA: Measuring neighbour cell\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
} }

@ -282,7 +282,7 @@ bool ue::deattach() {
bool ue::is_attached() bool ue::is_attached()
{ {
return nas.is_attached(); return rrc.is_connected();
} }
void ue::start_plot() { void ue::start_plot() {

@ -280,7 +280,7 @@ void gw::run_thread()
if (!attach_wait) { if (!attach_wait) {
gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", cfg.lcid, attach_wait, ATTACH_WAIT_TOUT); gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", cfg.lcid, attach_wait, ATTACH_WAIT_TOUT);
if (!nas->attach_request()) { if (!nas->attach_request()) {
gw_log->console("Could not re-establish the connection\n"); gw_log->info("Could not re-establish the connection\n");
break; break;
} }
} }

@ -470,16 +470,21 @@ bool rrc::configure_serving_cell() {
* Queue the values of the measurements and process them from the RRC thread * Queue the values of the measurements and process them from the RRC thread
*/ */
void rrc::new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn_i, int pci_i) { void rrc::new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn_i, int pci_i) {
uint32_t pci = 0;
uint32_t earfcn = 0;
if (earfcn_i < 0) { if (earfcn_i < 0) {
earfcn_i = (int) serving_cell->get_earfcn(); earfcn = (uint32_t) serving_cell->get_earfcn();
} else {
earfcn = (uint32_t) earfcn_i;
} }
if (pci_i < 0) { if (pci_i < 0) {
pci_i = (int) serving_cell->get_pci(); pci = (uint32_t) serving_cell->get_pci();
} else {
pci = (uint32_t) pci_i;
} }
phy_meas_t new_meas = {rsrp, rsrq, tti, earfcn, pci};
phy_meas_t new_meas = {rsrp, rsrq, tti, (uint32_t) earfcn_i, (uint32_t) pci_i};
phy_meas_q.push(new_meas); phy_meas_q.push(new_meas);
rrc_log->info("MEAS: New measurement pci=%d, rsrp=%.1f dBm.\n", pci_i, rsrp); rrc_log->info("MEAS: New measurement pci=%d, rsrp=%.1f dBm.\n", pci, rsrp);
} }
/* Processes all pending PHY measurements in queue. Must be called from a mutexed function /* Processes all pending PHY measurements in queue. Must be called from a mutexed function
@ -1311,6 +1316,9 @@ bool rrc::ho_prepare() {
neighbour_cells[target_cell_idx]->get_pci()); neighbour_cells[target_cell_idx]->get_pci());
return false; return false;
} }
set_serving_cell(target_cell_idx);
if (mob_reconf.mob_ctrl_info.rach_cnfg_ded_present) { if (mob_reconf.mob_ctrl_info.rach_cnfg_ded_present) {
rrc_log->info("Starting non-contention based RA with preamble_idx=%d, mask_idx=%d\n", rrc_log->info("Starting non-contention based RA with preamble_idx=%d, mask_idx=%d\n",
mob_reconf.mob_ctrl_info.rach_cnfg_ded.preamble_index, mob_reconf.mob_ctrl_info.rach_cnfg_ded.preamble_index,

Loading…
Cancel
Save