Commit 5661cba0 authored by alexandr's avatar alexandr

* update the function prototypes and vars for RSRP and RSRQ

* change the trigger functions for handover



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5704 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 8a8fcf1b
...@@ -156,11 +156,11 @@ void lte_ue_measurements_emul(PHY_VARS_UE *phy_vars_ue,uint8_t last_slot,uint8_t ...@@ -156,11 +156,11 @@ void lte_ue_measurements_emul(PHY_VARS_UE *phy_vars_ue,uint8_t last_slot,uint8_t
@returns Path loss in dB @returns Path loss in dB
*/ */
int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); uint32_t get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); uint32_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_n_adj_cells(module_id_t Mod_id,uint8_t CC_id); uint8_t get_n_adj_cells(module_id_t Mod_id,uint8_t CC_id);
int8_t get_rx_total_gain_dB(module_id_t Mod_id,uint8_t CC_id); uint32_t get_rx_total_gain_dB(module_id_t Mod_id,uint8_t CC_id);
int8_t get_RSSI(module_id_t Mod_id,uint8_t CC_id); uint32_t get_RSSI(module_id_t Mod_id,uint8_t CC_id);
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rstq); int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rstq);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "PHY/extern.h" #include "PHY/extern.h"
#include "SCHED/defs.h" #include "SCHED/defs.h"
#include "SCHED/extern.h" #include "SCHED/extern.h"
#include "log.h"
#include "emmintrin.h" #include "emmintrin.h"
...@@ -20,7 +21,7 @@ __m128i zeroPMI; ...@@ -20,7 +21,7 @@ __m128i zeroPMI;
#define k1 ((long long int) 1000) #define k1 ((long long int) 1000)
#define k2 ((long long int) (1024-k1)) #define k2 ((long long int) (1024-k1))
//#define DEBUG_MEAS #define DEBUG_MEAS
#ifdef USER_MODE #ifdef USER_MODE
void print_shorts(char *s,__m128i *x) { void print_shorts(char *s,__m128i *x) {
...@@ -78,36 +79,34 @@ uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id){ ...@@ -78,36 +79,34 @@ uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id){
return 0; return 0;
} }
int8_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id){ uint32_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue) if (phy_vars_ue)
return phy_vars_ue->rx_total_gain_dB; return phy_vars_ue->rx_total_gain_dB;
else return 0xFFFFFFFF;
return -1;
} }
int8_t get_RSSI (uint8_t Mod_id,uint8_t CC_id){ uint32_t get_RSSI (uint8_t Mod_id,uint8_t CC_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue) if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rssi; return phy_vars_ue->PHY_measurements.rssi;
else return 0xFFFFFFFF;
return -1;
} }
uint8_t get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { uint32_t get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue) if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rsrp[eNB_index]; return phy_vars_ue->PHY_measurements.rsrp[eNB_index];
return 0; return 0xFFFFFFFF;
} }
uint8_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { uint32_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue) if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rsrq[eNB_index]; return phy_vars_ue->PHY_measurements.rsrq[eNB_index];
return 0; return 0xFFFFFFFF;
} }
int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp) { int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp) {
...@@ -268,9 +267,9 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -268,9 +267,9 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 3; phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 3;
} }
if (((phy_vars_ue->frame %10) == 0) && (slot == 1)) { //if (((phy_vars_ue->frame %10) == 0) && (slot == 1)) {
#ifdef DEBUG_MEAS #ifdef DEBUG_MEAS
if (eNB_offset == 0) //if (eNB_offset == 0)
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",phy_vars_ue->Mod_id, LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",phy_vars_ue->Mod_id,
phy_vars_ue->frame,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, phy_vars_ue->frame,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB,
10*log10(phy_vars_ue->PHY_measurements.rssi)); 10*log10(phy_vars_ue->PHY_measurements.rssi));
...@@ -281,10 +280,13 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, ...@@ -281,10 +280,13 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
(dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12), (dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12),
(10*log10(phy_vars_ue->PHY_measurements.rx_power_avg[0])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12), (10*log10(phy_vars_ue->PHY_measurements.rx_power_avg[0])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12),
(10*log10(phy_vars_ue->PHY_measurements.rsrq[eNB_offset]))-20); (10*log10(phy_vars_ue->PHY_measurements.rsrq[eNB_offset]))-20);
#endif //LOG_D(PHY,"RSRP_total_dB: %3.2f \n",(dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12));
//LOG_D(PHY,"RSRP_dB: %3.2f \n",(dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0));
} //LOG_D(PHY,"gain_loss_dB: %d \n",phy_vars_ue->rx_total_gain_dB);
//LOG_D(PHY,"gain_fixed_dB: %d \n",dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12));
#endif
//}
} }
} }
......
...@@ -349,11 +349,11 @@ typedef struct ...@@ -349,11 +349,11 @@ typedef struct
//unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //! estimated avg received signal power (dB) //unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //! estimated avg received signal power (dB)
// RRC measurements // RRC measurements
int rssi; uint32_t rssi;
int n_adj_cells; int n_adj_cells;
unsigned int adj_cell_id[6]; unsigned int adj_cell_id[6];
int rsrq[7]; uint32_t rsrq[7];
int rsrp[7]; uint32_t rsrp[7];
float rsrp_filtered[7]; // after layer 3 filtering float rsrp_filtered[7]; // after layer 3 filtering
float rsrq_filtered[7]; float rsrq_filtered[7];
// common measurements // common measurements
......
...@@ -155,7 +155,7 @@ void get_prach_resources(module_id_t module_idP, ...@@ -155,7 +155,7 @@ void get_prach_resources(module_id_t module_idP,
UE_mac_inst[module_idP].RA_usedGroupA = 1; UE_mac_inst[module_idP].RA_usedGroupA = 1;
} }
else if ((Msg3_size < rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->messageSizeGroupA) || else if ((Msg3_size < rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->messageSizeGroupA) ||
(mac_xface->get_PL(module_idP,eNB_index) > UE_mac_inst[module_idP].RA_maxPL)) { (mac_xface->get_PL(module_idP,0,eNB_index) > UE_mac_inst[module_idP].RA_maxPL)) {
// use Group A procedure // use Group A procedure
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA; UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0; UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
......
...@@ -1494,7 +1494,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su ...@@ -1494,7 +1494,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su
} else { } else {
//LOG_D(MAC,"PHR normal operation %d active %d \n", UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].PHR_reporting_active); //LOG_D(MAC,"PHR normal operation %d active %d \n", UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].PHR_reporting_active);
if ((UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF <= 0) && if ((UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF <= 0) &&
((mac_xface->get_PL(module_idP,eNB_indexP) < UE_mac_inst[module_idP].scheduling_info.PathlossChange_db) || ((mac_xface->get_PL(module_idP,0,eNB_indexP) < UE_mac_inst[module_idP].scheduling_info.PathlossChange_db) ||
(UE_mac_inst[module_idP].power_backoff_db[eNB_indexP] > UE_mac_inst[module_idP].scheduling_info.PathlossChange_db))) (UE_mac_inst[module_idP].power_backoff_db[eNB_indexP] > UE_mac_inst[module_idP].scheduling_info.PathlossChange_db)))
// trigger PHR and reset the timer later when the PHR report is sent // trigger PHR and reset the timer later when the PHR report is sent
UE_mac_inst[module_idP].PHR_reporting_active = 1; UE_mac_inst[module_idP].PHR_reporting_active = 1;
......
...@@ -244,28 +244,28 @@ typedef struct ...@@ -244,28 +244,28 @@ typedef struct
UE_MODE_t (*get_ue_mode)(module_id_t Mod_id,int CC_id,uint8_t eNB_index); UE_MODE_t (*get_ue_mode)(module_id_t Mod_id,int CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve measured Path Loss /// Function for UE MAC to retrieve measured Path Loss
int16_t (*get_PL)(module_id_t Mod_id,uint8_t eNB_index); int16_t (*get_PL)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve the rssi /// Function for UE MAC to retrieve the rssi
int8_t (*get_RSSI)(module_id_t Mod_id); uint32_t (*get_RSSI)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve the total gain /// Function for UE MAC to retrieve the total gain
int8_t (*get_rx_total_gain_dB)(module_id_t Mod_id); uint32_t (*get_rx_total_gain_dB)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve the number of adjustent cells /// Function for UE MAC to retrieve the number of adjustent cells
uint8_t (*get_n_adj_cells)(module_id_t Mod_id); uint8_t (*get_n_adj_cells)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements /// Function for UE MAC to retrieve RSRP/RSRQ measurements
uint8_t (*get_RSRP)(module_id_t Mod_id,uint8_t eNB_index); uint32_t (*get_RSRP)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements /// Function for UE MAC to retrieve RSRP/RSRQ measurements
uint8_t (*get_RSRQ)(module_id_t Mod_id,uint8_t eNB_index); uint32_t (*get_RSRQ)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRP_filtered)(module_id_t Mod_id,uint8_t eNB_index,float rsrp); uint8_t (*set_RSRP_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRQ_filtered)(module_id_t Mod_id,uint8_t eNB_index,float rsrq); uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
/// Function for UE/eNB MAC to retrieve number of PRACH in TDD /// Function for UE/eNB MAC to retrieve number of PRACH in TDD
uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms); uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms);
......
...@@ -2196,9 +2196,10 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ ...@@ -2196,9 +2196,10 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
struct MeasResultEUTRA__measResult meas2; struct MeasResultEUTRA__measResult meas2;
// int rsrp_va=10; // int rsrp_va=10;
meas2.rsrpResult=&rsrp_t;
meas2.rsrpResult=&(rsrp_t);
//&rsrp_va; //&rsrp_va;
meas2.rsrqResult=&rsrq_t; meas2.rsrqResult=&(rsrq_t);
measresulteutra2->measResult=meas2; measresulteutra2->measResult=meas2;
...@@ -2210,6 +2211,9 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ ...@@ -2210,6 +2211,9 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
(void*)&ul_dcch_msg, (void*)&ul_dcch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %d)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %d)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
......
...@@ -2360,15 +2360,23 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index) ...@@ -2360,15 +2360,23 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index)
if(UE_rrc_inst[ue_mod_idP].QuantityConfig[0] != NULL) { // Only consider 1 serving cell (index: 0) if(UE_rrc_inst[ue_mod_idP].QuantityConfig[0] != NULL) { // Only consider 1 serving cell (index: 0)
if (UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA != NULL) { if (UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA != NULL) {
if(UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP != NULL) { if(UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP != NULL) {
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP);eNB_offset++) { for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP,0);eNB_offset++) {
//filter_factor = 1/power(2,*UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP/4); //filter_factor = 1/power(2,*UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP/4);
// LOG_N(RRC,"[UE %d] Frame %d : check proper operation in abstraction mode rsrp (%d), rx gain (%d) N_RB_DL (%d)\n", // LOG_N(RRC,"[UE %d] Frame %d : check proper operation in abstraction mode rsrp (%d), rx gain (%d) N_RB_DL (%d)\n",
// ue_mod_idP,frameP,mac_xface->get_RSRP(ue_mod_idP,eNB_offset),mac_xface->get_rx_total_gain_dB(ue_mod_idP),mac_xface->lte_frame_parms->N_RB_DL); // ue_mod_idP,frameP,mac_xface->get_RSRP(ue_mod_idP,0,eNB_offset),mac_xface->get_rx_total_gain_dB(ue_mod_idP,0),mac_xface->lte_frame_parms->N_RB_DL);
UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset] = (dB_fixed_times10(mac_xface->get_RSRP(ue_mod_idP,eNB_offset))/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12); UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset] = (dB_fixed_times10(mac_xface->get_RSRP(ue_mod_idP,0,eNB_offset))/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12);
UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset] = (1.0-a)*UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset] + a*UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset]; UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset] = (1.0-a)*UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset] + a*UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset];
//mac_xface->set_RSRP_filtered(ue_mod_idP,eNB_offset,UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]); //mac_xface->set_RSRP_filtered(ue_mod_idP,eNB_offset,UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]);
LOG_D(RRC,"[UE %d] Frame %d: Meas RSRP: eNB_offset: %d rsrp_coef: %3.2f filter_coef: %d before L3 filtering: rsrp: %3.1f after L3 filtering: rsrp: %3.1f \n ",
//LOG_D(RRC,"RSRP_total_dB: %3.2f \n",(dB_fixed_times10(mac_xface->get_RSRP(ue_mod_idP,0,eNB_offset))/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12));
//LOG_D(RRC,"RSRP_dB: %3.2f \n",(dB_fixed_times10(mac_xface->get_RSRP(ue_mod_idP,0,eNB_offset))/10.0));
//LOG_D(RRC,"gain_loss_dB: %d \n",mac_xface->get_rx_total_gain_dB(ue_mod_idP,0));
//LOG_D(RRC,"gain_fixed_dB: %d \n",dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12));
//LOG_D(PHY,"[UE %d] Frame %d, RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",
//ue_mod_idP, frameP, 10*log10(mac_xface->get_RSSI(ue_mod_idP,0))-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0),10*log10(mac_xface->get_RSSI(ue_mod_idP,0)));
LOG_D(RRC,"[UE %d] Frame %d: Meas RSRP: eNB_offset: %d rsrp_coef: %3.1f filter_coef: %d before L3 filtering: rsrp: %3.1f after L3 filtering: rsrp: %3.1f \n ",
ue_mod_idP, frameP, eNB_offset,a, ue_mod_idP, frameP, eNB_offset,a,
*UE_rrc_inst->QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP, *UE_rrc_inst->QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP,
UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset], UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset],
...@@ -2377,17 +2385,17 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index) ...@@ -2377,17 +2385,17 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index)
} }
} }
else { else {
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP);eNB_offset++) { for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP,0);eNB_offset++) {
UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]= mac_xface->get_RSRP(ue_mod_idP,eNB_offset); UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]= mac_xface->get_RSRP(ue_mod_idP,0,eNB_offset);
// phy_vars_ue->PHY_measurements.rsrp_filtered[eNB_offset]=UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]; // phy_vars_ue->PHY_measurements.rsrp_filtered[eNB_offset]=UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset];
//mac_xface->set_RSRP_filtered(ue_mod_idP,eNB_offset,UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]); //mac_xface->set_RSRP_filtered(ue_mod_idP,eNB_offset,UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]);
} }
} }
if (UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA != NULL) { if (UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA != NULL) {
if(UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRQ != NULL) { if(UE_rrc_inst[ue_mod_idP].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRQ != NULL) {
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP);eNB_offset++) { for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP,0);eNB_offset++) {
// LOG_N(RRC,"[UE %d] Frame %d : check if this operation workes properly in abstraction mode\n",ue_mod_idP,frameP); // LOG_N(RRC,"[UE %d] Frame %d : check if this operation workes properly in abstraction mode\n",ue_mod_idP,frameP);
UE_rrc_inst[ue_mod_idP].rsrq_db[eNB_offset] = (10*log10(mac_xface->get_RSRQ(ue_mod_idP,eNB_offset)))-20; UE_rrc_inst[ue_mod_idP].rsrq_db[eNB_offset] = (10*log10(mac_xface->get_RSRQ(ue_mod_idP,0,eNB_offset)))-20;
UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset]=(1-a1)*UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset] + a1 *UE_rrc_inst[ue_mod_idP].rsrq_db[eNB_offset]; UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset]=(1-a1)*UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset] + a1 *UE_rrc_inst[ue_mod_idP].rsrq_db[eNB_offset];
//mac_xface->set_RSRP_filtered(ue_mod_idP,eNB_offset,UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]); //mac_xface->set_RSRP_filtered(ue_mod_idP,eNB_offset,UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]);
/* /*
...@@ -2395,7 +2403,7 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index) ...@@ -2395,7 +2403,7 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index)
ue_mod_idP, eNB_offset, ue_mod_idP, eNB_offset,
a1, a1,
*UE_rrc_inst->QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRQ, *UE_rrc_inst->QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRQ,
mac_xface->get_RSRQ(ue_mod_idP,eNB_offset), mac_xface->get_RSRQ(ue_mod_idP,0,eNB_offset),
UE_rrc_inst[ue_mod_idP].rsrq_db[eNB_offset], UE_rrc_inst[ue_mod_idP].rsrq_db[eNB_offset],
UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset]); UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset]);
*/ */
...@@ -2403,8 +2411,8 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index) ...@@ -2403,8 +2411,8 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index)
} }
} }
else{ else{
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP);eNB_offset++) { for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP,0);eNB_offset++) {
UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset]= mac_xface->get_RSRQ(ue_mod_idP,eNB_offset); UE_rrc_inst[ue_mod_idP].rsrq_db_filtered[eNB_offset]= mac_xface->get_RSRQ(ue_mod_idP,0,eNB_offset);
} }
} }
} }
...@@ -2425,8 +2433,10 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr ...@@ -2425,8 +2433,10 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr
static frame_t pframe=0; static frame_t pframe=0;
int result; int result;
nElem = 100;
nElem1 = 33;
nElem = 98;
nElem1 = 35;
target_eNB_offset = UE_rrc_inst[UE_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB target_eNB_offset = UE_rrc_inst[UE_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB
for (i=0;i<MAX_MEAS_ID;i++) { for (i=0;i<MAX_MEAS_ID;i++) {
...@@ -2435,24 +2445,27 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr ...@@ -2435,24 +2445,27 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr
// Note: Values in the meas report have to be the mapped values...to implement binary search for LUT // Note: Values in the meas report have to be the mapped values...to implement binary search for LUT
rsrp_filtered = UE_rrc_inst[UE_id].rsrp_db_filtered[eNB_id];//nid_cell]; rsrp_filtered = UE_rrc_inst[UE_id].rsrp_db_filtered[eNB_id];//nid_cell];
rsrp_s = binary_search_float(RSRP_meas_mapping,nElem, rsrp_filtered); //mapped RSRP of serving cell rsrp_s = binary_search_float(RSRP_meas_mapping,nElem, rsrp_filtered);
rsrq_filtered = UE_rrc_inst[UE_id].rsrq_db_filtered[eNB_id];//nid_cell]; //RSRQ of serving cell rsrq_filtered = UE_rrc_inst[UE_id].rsrq_db_filtered[eNB_id];//nid_cell]; //RSRQ of serving cell
rsrq_s = binary_search_float(RSRQ_meas_mapping,nElem1,rsrp_filtered);//mapped RSRQ of serving cell rsrq_s = binary_search_float(RSRQ_meas_mapping,nElem1,rsrq_filtered);//mapped RSRQ of serving cell
LOG_D(RRC,"[UE %d] Frame %d: source eNB %d :rsrp_s: %f rsrq_s: %f rsrp_filtered: %f rsrq_filtered: %f \n", LOG_D(RRC,"[UE %d] Frame %d: source eNB %d :rsrp_s: %ld rsrq_s: %ld rsrp_filtered: %f rsrq_filtered: %f \n",
UE_id, frameP, eNB_id, rsrp_s,rsrq_s,rsrp_filtered,rsrq_filtered); UE_id, frameP, eNB_id, rsrp_s,rsrq_s,rsrp_filtered,rsrq_filtered);
rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[UE_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[UE_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell
rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[UE_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[UE_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell
LOG_D(RRC,"[UE %d] Frame %d: target eNB %d :rsrp_t: %ld rsrq_t: %ld rsrp_filtered: %f rsrq_filtered: %f \n",
UE_id, frameP, target_eNB_offset, rsrp_t,rsrq_t,UE_rrc_inst[UE_id].rsrp_db_filtered[target_eNB_offset],UE_rrc_inst[UE_id].rsrq_db_filtered[target_eNB_offset]);
// if (measFlag == 1) { // if (measFlag == 1) {
cellId = get_adjacent_cell_id(UE_id, eNB_id); //PhycellId of serving cell cellId = get_adjacent_cell_id(UE_id, eNB_id); //PhycellId of serving cell
targetCellId = UE_rrc_inst[UE_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(ue_mod_idP,target_eNB_offset); //PhycellId of target cell targetCellId = UE_rrc_inst[UE_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(ue_mod_idP,target_eNB_offset); //PhycellId of target cell
if (pframe!=frameP){ if (pframe!=frameP){
pframe=frameP; pframe=frameP;
LOG_D(RRC, "[UE %d] Frame %d: doing MeasReport: servingCell(%d) targetCell(%d) rsrp_s(%f) rsrq_s(%f) rsrp_t(%f) rsrq_t(%f) \n", LOG_D(RRC, "[UE %d] Frame %d: doing MeasReport: servingCell(%d) targetCell(%d) rsrp_s(%ld) rsrq_s(%ld) rsrp_t(%ld) rsrq_t(%ld) \n",
UE_id, frameP, cellId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t); UE_id, frameP, cellId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
size = do_MeasurementReport(UE_id, buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t); size = do_MeasurementReport(UE_id, buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
...@@ -2561,35 +2574,44 @@ uint8_t check_trigger_meas_event(module_id_t ue_mod_idP,frame_t frameP, uint8_t ...@@ -2561,35 +2574,44 @@ uint8_t check_trigger_meas_event(module_id_t ue_mod_idP,frame_t frameP, uint8_t
Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt) { Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt) {
uint8_t eNB_offset; uint8_t eNB_offset;
uint8_t currentCellIndex = mac_xface->lte_frame_parms->Nid_cell; uint8_t currentCellIndex = mac_xface->lte_frame_parms->Nid_cell;
uint8_t tmp_offset;
LOG_I(RRC,"[UE %d] ofn(%d) ocn(%d) hys(%d) ofs(%d) ocs(%d) a3_offset(%d) ttt(%d) rssi %3.1f\n", LOG_I(RRC,"[UE %d] ofn(%d) ocn(%d) hys(%d) ofs(%d) ocs(%d) a3_offset(%d) ttt(%d) rssi %3.1f\n",
ue_mod_idP, ue_mod_idP,
ofn,ocn,hys,ofs,ocs,a3_offset,ttt, ofn,ocn,hys,ofs,ocs,a3_offset,ttt,
10*log10(mac_xface->get_RSSI(ue_mod_idP))-mac_xface->get_rx_total_gain_dB(ue_mod_idP)); 10*log10(mac_xface->get_RSSI(ue_mod_idP,0))-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0));
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP,0);eNB_offset++) {
// for (eNB_offset = 0;(eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP))&& (eNB_offset!=eNB_index);eNB_offset++) { //for (eNB_offset = 1;(eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP,0));eNB_offset++) {
for (eNB_offset = 1;(eNB_offset<1+mac_xface->get_n_adj_cells(ue_mod_idP));eNB_offset++) {
/* RHS: Verify that idx 0 corresponds to currentCellIndex in rsrp array */ /* RHS: Verify that idx 0 corresponds to currentCellIndex in rsrp array */
if(UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]+ofn+ocn-hys > UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[0/*eNB_index*/]+ofs+ocs - 1 /*+a3_offset*/) { if((eNB_offset!=eNB_index)&&(eNB_offset<NB_eNB_INST)){
UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1] += 2; //Called every subframe = 2ms if(eNB_offset<eNB_index){
LOG_D(RRC,"[UE %d] Frame %d: Entry measTimer[%d][%d]: %d currentCell: %d betterCell: %d \n", tmp_offset = eNB_offset;
ue_mod_idP, frameP, ue_cnx_index,meas_index,UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1],currentCellIndex,eNB_offset); }
} else
else { {
UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1] = 0; //Exit condition: Resetting the measurement timer tmp_offset = eNB_offset-1;
LOG_D(RRC,"[UE %d] Frame %d: Exit measTimer[%d][%d]: %d currentCell: %d betterCell: %d \n", }
ue_mod_idP, frameP, ue_cnx_index,meas_index,UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1],currentCellIndex,eNB_offset); if(UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_offset]+ofn+ocn-hys > UE_rrc_inst[ue_mod_idP].rsrp_db_filtered[eNB_index]+ofs+ocs-1/*+a3_offset*/) {
} UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset] += 2; //Called every subframe = 2ms
if (UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1] >= ttt) { LOG_D(RRC,"[UE %d] Frame %d: Entry measTimer[%d][%d]: %d currentCell: %d betterCell: %d \n",
UE_rrc_inst->HandoverInfoUe.targetCellId = get_adjacent_cell_id(ue_mod_idP,eNB_offset-1); //check this! ue_mod_idP, frameP, ue_cnx_index,meas_index,UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset],currentCellIndex,eNB_offset);
LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %d currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n", \ }
ue_mod_idP, frameP, eNB_index, else {
UE_rrc_inst->HandoverInfoUe.targetCellId,ue_cnx_index,eNB_offset, UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset] = 0; //Exit condition: Resetting the measurement timer
(dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[0])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12), LOG_D(RRC,"[UE %d] Frame %d: Exit measTimer[%d][%d]: %d currentCell: %d betterCell: %d \n",
(dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12)); ue_mod_idP, frameP, ue_cnx_index,meas_index,UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset],currentCellIndex,eNB_offset);
UE_rrc_inst->Info[0].handoverTarget = eNB_offset; }
return 1; if (UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset] >= ttt) {
} UE_rrc_inst->HandoverInfoUe.targetCellId = get_adjacent_cell_id(ue_mod_idP,tmp_offset); //WARNING!!!...check this!
LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %d currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n", \
ue_mod_idP, frameP, eNB_index,
UE_rrc_inst->HandoverInfoUe.targetCellId,ue_cnx_index,eNB_offset,
(dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[0])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12),
(dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12));
UE_rrc_inst->Info[0].handoverTarget = eNB_offset;
//LOG_D(RRC,"PHY_ID: %d \n",UE_rrc_inst->HandoverInfoUe.targetCellId);
return 1;
}
}
} }
return 0; return 0;
} }
......
...@@ -495,6 +495,9 @@ static module_id_t rrc_eNB_get_next_free_UE_index( ...@@ -495,6 +495,9 @@ static module_id_t rrc_eNB_get_next_free_UE_index(
boolean_t reg = FALSE; boolean_t reg = FALSE;
module_id_t i, first_index = UE_MODULE_INVALID; module_id_t i, first_index = UE_MODULE_INVALID;
LOG_D(RRC,"ENB_ID= %d \n",enb_mod_idP);
LOG_D(RRC,"N_ID= %d \n",NB_eNB_INST);
AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST); AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST);
for (i = 0; i < NUMBER_OF_UE_MAX; i++) { for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
...@@ -1201,7 +1204,7 @@ void rrc_eNB_process_MeasurementReport( ...@@ -1201,7 +1204,7 @@ void rrc_eNB_process_MeasurementReport(
#endif #endif
if (eNB_rrc_inst[enb_mod_idP].handover_info[ue_mod_idP]->ho_prepare != 0xF0) { if (eNB_rrc_inst[enb_mod_idP].handover_info[ue_mod_idP]->ho_prepare != 0xF0) {
rrc_eNB_generate_HandoverPreparationInformation(enb_mod_idP, rrc_eNB_generate_HandoverPreparationInformation(enb_mod_idP,
frameP, frameP,
ue_mod_idP, ue_mod_idP,
measResults2->measResultNeighCells->choice. measResults2->measResultNeighCells->choice.
......
...@@ -120,7 +120,7 @@ uint32_t T304[8] = {50,100,150,200,500,1000,2000,MAX_U32}; ...@@ -120,7 +120,7 @@ uint32_t T304[8] = {50,100,150,200,500,1000,2000,MAX_U32};
uint32_t timeToTrigger_ms[16] = {0,40,64,80,100,128,160,256,320,480,512,640,1024,1280,2560,5120}; uint32_t timeToTrigger_ms[16] = {0,40,64,80,100,128,160,256,320,480,512,640,1024,1280,2560,5120};
/* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */ /* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */
float RSRP_meas_mapping[100] = { float RSRP_meas_mapping[98] = {
-140, -140,
-139, -139,
-138, -138,
...@@ -217,10 +217,11 @@ float RSRP_meas_mapping[100] = { ...@@ -217,10 +217,11 @@ float RSRP_meas_mapping[100] = {
-47, -47,
-46, -46,
-45, -45,
-44 -44,
-43
}; };
float RSRQ_meas_mapping[33] = { float RSRQ_meas_mapping[35] = {
-19, -19,
-18.5, -18.5,
-18, -18,
...@@ -253,7 +254,9 @@ float RSRQ_meas_mapping[33] = { ...@@ -253,7 +254,9 @@ float RSRQ_meas_mapping[33] = {
-4.5, -4.5,
-4, -4,
-3.5, -3.5,
-3 -3,
-2.5,
-2
}; };
#endif #endif
...@@ -94,7 +94,7 @@ int nb_antennas_rx = 2; // // ...@@ -94,7 +94,7 @@ int nb_antennas_rx = 2; // //
uint8_t target_dl_mcs = 0; // not set uint8_t target_dl_mcs = 0; // not set
uint8_t rate_adaptation_flag = 0; uint8_t rate_adaptation_flag = 0;
uint8_t set_sinr = 0; uint8_t set_sinr = 0;
double snr_dB, sinr_dB; double snr_dB=0, sinr_dB=0;
uint8_t set_seed = 0; uint8_t set_seed = 0;
uint8_t cooperation_flag; // for cooperative communication uint8_t cooperation_flag; // for cooperative communication
uint8_t abstraction_flag = 0; uint8_t abstraction_flag = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment