Commit e3878906 authored by General ABS's avatar General ABS Committed by rmagueta

Implementation of L3 measurement filtering

parent 6050c55a
...@@ -848,3 +848,10 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id, ...@@ -848,3 +848,10 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id,
// Setup the SSB to Rach Occasions mapping according to the config // Setup the SSB to Rach Occasions mapping according to the config
build_ssb_to_ro_map(mac); build_ssb_to_ro_map(mac);
} }
void nr_rrc_mac_config_req_meas(module_id_t module_id, const NR_MeasConfig_t *measConfig)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
config_measConfig(mac, measConfig);
mac->if_module->phy_config_request(&mac->phy_config);
}
\ No newline at end of file
...@@ -112,6 +112,8 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, ...@@ -112,6 +112,8 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
int cc_idP, int cc_idP,
NR_ServingCellConfigCommonSIB_t *scc); NR_ServingCellConfigCommonSIB_t *scc);
void nr_rrc_mac_config_req_meas(module_id_t module_id, const NR_MeasConfig_t *measConfig);
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst); NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
......
...@@ -1001,52 +1001,70 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, ...@@ -1001,52 +1001,70 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
// TODO: Improve this function that is all hardcoded // TODO: This function is only implemented for event A3
uint16_t do_nrMeasurementReport_SA(NR_MeasurementReport_t *measurementReport, uint8_t *buffer, size_t buffer_size, uint8_t rsrp_s) { uint16_t do_nrMeasurementReport_SA(NR_MeasurementReport_t *measurementReport, l3_measurements_t *l3_measurements, uint8_t *buffer, size_t buffer_size)
{
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg; NR_UL_DCCH_Message_t ul_dcch_msg;
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t)); memset((void *)&ul_dcch_msg, 0, sizeof(NR_UL_DCCH_Message_t));
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_UL_DCCH_MessageType__c1)); ul_dcch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_UL_DCCH_MessageType__c1));
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_measurementReport; ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_measurementReport;
memset(measurementReport, 0, sizeof(struct NR_MeasurementReport)); memset(measurementReport, 0, sizeof(struct NR_MeasurementReport));
ul_dcch_msg.message.choice.c1->choice.measurementReport = measurementReport; ul_dcch_msg.message.choice.c1->choice.measurementReport = measurementReport;
measurementReport->criticalExtensions.present = NR_MeasurementReport__criticalExtensions_PR_measurementReport; measurementReport->criticalExtensions.present = NR_MeasurementReport__criticalExtensions_PR_measurementReport;
NR_MeasurementReport_IEs_t *measurementReport_ie = CALLOC(1,sizeof(struct NR_MeasurementReport_IEs)); NR_MeasurementReport_IEs_t *measurementReport_ie = CALLOC(1, sizeof(struct NR_MeasurementReport_IEs));
measurementReport->criticalExtensions.choice.measurementReport = measurementReport_ie; measurementReport->criticalExtensions.choice.measurementReport = measurementReport_ie;
measurementReport_ie->measResults.measId = 3; measurementReport_ie->measResults.measId = l3_measurements->trigger_to_measid;
NR_MeasResultServMO_t *measResultServMo = CALLOC(1,sizeof(struct NR_MeasResultServMO)); NR_MeasResultServMO_t *measResultServMo = CALLOC(1, sizeof(struct NR_MeasResultServMO));
measResultServMo->measResultServingCell.physCellId = CALLOC(1,sizeof(NR_PhysCellId_t));
*measResultServMo->measResultServingCell.physCellId = 0; meas_t *active_cell = &l3_measurements->active_cell;
measResultServMo->measResultServingCell.measResult.cellResults.resultsCSI_RS_Cell = CALLOC(1,sizeof(struct NR_MeasQuantityResults)); NR_MeasResultNR_t *measResultServingCell = &measResultServMo->measResultServingCell;
measResultServMo->measResultServingCell.measResult.cellResults.resultsCSI_RS_Cell->rsrp = CALLOC(1,sizeof(NR_RSRP_Range_t)); measResultServingCell->physCellId = CALLOC(1, sizeof(NR_PhysCellId_t));
*measResultServMo->measResultServingCell.measResult.cellResults.resultsCSI_RS_Cell->rsrp = rsrp_s - 10; // FIXME: This -10 is just to trigger the HO *measResultServingCell->physCellId = active_cell->Nid_cell;
measResultServMo->measResultBestNeighCell = CALLOC(1,sizeof(struct NR_MeasResultNR));
measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell = CALLOC(1,sizeof(struct NR_MeasQuantityResults)); meas_t *neighboring_cell = &l3_measurements->neighboring_cell[0];
measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell->rsrp = CALLOC(1,sizeof(NR_RSRP_Range_t)); struct NR_MeasResultNR *measResultBestNeighCell = CALLOC(1, sizeof(struct NR_MeasResultNR));
*measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell->rsrp = rsrp_s; // FIXME measResultServMo->measResultBestNeighCell = measResultBestNeighCell;
measResultBestNeighCell->physCellId = CALLOC(1, sizeof(NR_PhysCellId_t));
*measResultBestNeighCell->physCellId = neighboring_cell->Nid_cell;
struct NR_MeasQuantityResults *active_mq_res = CALLOC(1, sizeof(struct NR_MeasQuantityResults));
struct NR_MeasQuantityResults *neighboring_mq_res = CALLOC(1, sizeof(struct NR_MeasQuantityResults));
if (l3_measurements->trigger_quantity == NR_MeasTriggerQuantityOffset_PR_rsrp) {
active_mq_res->rsrp = CALLOC(1, sizeof(NR_RSRP_Range_t));
neighboring_mq_res->rsrp = CALLOC(1, sizeof(NR_RSRP_Range_t));
if (l3_measurements->rs_type == NR_NR_RS_Type_ssb) {
*active_mq_res->rsrp = active_cell->ss_rsrp_dBm + 157;
measResultServingCell->measResult.cellResults.resultsSSB_Cell = active_mq_res;
*neighboring_mq_res->rsrp = neighboring_cell->ss_rsrp_dBm + 157;
measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsSSB_Cell = neighboring_mq_res;
} else {
*active_mq_res->rsrp = active_cell->csi_rsrp_dBm + 157;
measResultServingCell->measResult.cellResults.resultsCSI_RS_Cell = active_mq_res;
*neighboring_mq_res->rsrp = neighboring_cell->csi_rsrp_dBm + 157;
measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell = neighboring_mq_res;
}
}
ASN_SEQUENCE_ADD(&measurementReport_ie->measResults.measResultServingMOList.list, measResultServMo); ASN_SEQUENCE_ADD(&measurementReport_ie->measResults.measResultServingMOList.list, measResultServMo);
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg); xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, NULL, (void *)&ul_dcch_msg, buffer, buffer_size);
NULL,
(void *)&ul_dcch_msg,
buffer,
buffer_size);
AssertFatal(enc_rval.encoded > 0, AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name,enc_rval.encoded);
LOG_I(NR_RRC,"MeasurementReport Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); LOG_I(NR_RRC, "MeasurementReport Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded + 7) / 8);
return((enc_rval.encoded+7)/8); return ((enc_rval.encoded + 7) / 8);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -1739,14 +1739,7 @@ nr_rrc_ue_establish_srb2( ...@@ -1739,14 +1739,7 @@ nr_rrc_ue_establish_srb2(
return(0); return(0);
} }
//----------------------------------------------------------------------------- void nr_rrc_ue_process_measConfig(const protocol_ctxt_t *ctxt_pP, const uint8_t gNB_index, const NR_MeasConfig_t *measConfig)
void
nr_rrc_ue_process_measConfig(
const protocol_ctxt_t *const ctxt_pP,
const uint8_t gNB_index,
NR_MeasConfig_t *const measConfig
)
//-----------------------------------------------------------------------------
{ {
int i; int i;
long ind; long ind;
...@@ -1764,24 +1757,18 @@ nr_rrc_ue_establish_srb2( ...@@ -1764,24 +1757,18 @@ nr_rrc_ue_establish_srb2(
LOG_I(NR_RRC, "Measurement Object List is present\n"); LOG_I(NR_RRC, "Measurement Object List is present\n");
for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) { for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) {
measObj = measConfig->measObjectToAddModList->list.array[i]; measObj = measConfig->measObjectToAddModList->list.array[i];
ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId; ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId;
if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind - 1]) {
LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind); LOG_D(NR_RRC, "Modifying measurement object %ld\n", ind);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1], memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind - 1], (char *)measObj, sizeof(NR_MeasObjectToAddMod_t));
(char *)measObj,
sizeof(NR_MeasObjectToAddMod_t));
} else { } else {
LOG_I(NR_RRC, "Adding measurement object %ld\n", ind); LOG_I(NR_RRC, "Adding measurement object %ld\n", ind);
if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) {
if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) { NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind - 1] = measObj;
NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj; }
}
} }
} }
LOG_I(NR_RRC, "call rrc_mac_config_req \n");
// rrc_mac_config_req_ue
} }
if (measConfig->reportConfigToRemoveList != NULL) { if (measConfig->reportConfigToRemoveList != NULL) {
...@@ -1836,14 +1823,28 @@ nr_rrc_ue_establish_srb2( ...@@ -1836,14 +1823,28 @@ nr_rrc_ue_establish_srb2(
if (measConfig->quantityConfig != NULL) { if (measConfig->quantityConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) {
LOG_D(NR_RRC,"Modifying Quantity Configuration \n"); LOG_D(NR_RRC, "Modifying Quantity Configuration \n");
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index], memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index], (char *)measConfig->quantityConfig, sizeof(NR_QuantityConfig_t));
(char *)measConfig->quantityConfig,
sizeof(NR_QuantityConfig_t));
} else { } else {
LOG_D(NR_RRC, "Adding Quantity configuration\n"); LOG_D(NR_RRC, "Adding Quantity configuration\n");
NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig; NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig;
} }
if (measConfig->quantityConfig->quantityConfigNR_List->list.count > 0) {
// TODO: This is only valid if the values are all equal
NR_QuantityConfigNR_t *qcnr = measConfig->quantityConfig->quantityConfigNR_List->list.array[0];
long filterCoefficientRSRP = 0;
if (qcnr->quantityConfigCell.ssb_FilterConfig.filterCoefficientRSRP) {
filterCoefficientRSRP = *qcnr->quantityConfigCell.ssb_FilterConfig.filterCoefficientRSRP;
} else if (qcnr->quantityConfigCell.csi_RS_FilterConfig.filterCoefficientRSRP) {
filterCoefficientRSRP = *qcnr->quantityConfigCell.csi_RS_FilterConfig.filterCoefficientRSRP;
}
l3_measurements_t *l3_measurements = &NR_UE_rrc_inst[ctxt_pP->module_id].l3_measurements;
l3_measurements->filter_coeff_rsrp = 1./pow(2,filterCoefficientRSRP/4); // TS 38.331: Section 5.5.3.2 - Layer 3 filtering
LOG_I(NR_RRC, "Filter coefficient for RSRP is set to %f\n", l3_measurements->filter_coeff_rsrp);
}
} }
if (measConfig->measGapConfig != NULL) { if (measConfig->measGapConfig != NULL) {
...@@ -1856,11 +1857,15 @@ nr_rrc_ue_establish_srb2( ...@@ -1856,11 +1857,15 @@ nr_rrc_ue_establish_srb2(
} }
} }
if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) { if (measConfig->s_MeasureConfig != NULL) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP; if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) {
} else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) { NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP;
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP; } else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP;
}
} }
nr_rrc_mac_config_req_meas(ctxt_pP->module_id, measConfig);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -2050,7 +2055,7 @@ nr_rrc_ue_establish_srb2( ...@@ -2050,7 +2055,7 @@ nr_rrc_ue_establish_srb2(
ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration;
if (ie->measConfig != NULL) { if (ie->measConfig != NULL) {
LOG_I(NR_RRC, "Measurement Configuration is present\n"); LOG_I(NR_RRC, "Measurement Configuration is present\n");
// nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig);
} }
if((ie->nonCriticalExtension) && (ie->nonCriticalExtension->masterCellGroup!=NULL)) { if((ie->nonCriticalExtension) && (ie->nonCriticalExtension->masterCellGroup!=NULL)) {
...@@ -2240,8 +2245,157 @@ nr_rrc_ue_establish_srb2( ...@@ -2240,8 +2245,157 @@ nr_rrc_ue_establish_srb2(
return 0; return 0;
} }
void nr_ue_meas_filtering(unsigned int ue_mod_id, uint8_t is_neighboring_cell, uint16_t Nid_cell, uint8_t meas_type, int rsrp_dBm)
{
l3_measurements_t *l3_measurements = &NR_UE_rrc_inst[ue_mod_id].l3_measurements;
meas_t *meas_cell = NULL;
if (is_neighboring_cell == 0) {
meas_cell = &l3_measurements->active_cell;
} else {
meas_cell = &l3_measurements->neighboring_cell[0];
}
meas_cell->Nid_cell = Nid_cell;
double a = l3_measurements->filter_coeff_rsrp;
if (meas_type == 0) {
if (meas_cell->ss_rsrp_dBm_initialized == true) {
meas_cell->ss_rsrp_dBm = (1.0 - a) * meas_cell->ss_rsrp_dBm + a * rsrp_dBm;
} else {
meas_cell->ss_rsrp_dBm = rsrp_dBm;
meas_cell->ss_rsrp_dBm_initialized = true;
}
} else {
if (meas_cell->csi_rsrp_dBm_initialized == true) {
meas_cell->csi_rsrp_dBm = (1.0 - a) * meas_cell->csi_rsrp_dBm + a * rsrp_dBm;
} else {
meas_cell->csi_rsrp_dBm = rsrp_dBm;
meas_cell->csi_rsrp_dBm_initialized = true;
}
}
}
int get_time_to_trigger(const long time_to_trigger)
{
switch (time_to_trigger) {
case NR_TimeToTrigger_ms40:
return 40;
case NR_TimeToTrigger_ms64:
return 64;
case NR_TimeToTrigger_ms80:
return 80;
case NR_TimeToTrigger_ms100:
return 100;
case NR_TimeToTrigger_ms128:
return 128;
case NR_TimeToTrigger_ms160:
return 160;
case NR_TimeToTrigger_ms256:
return 256;
case NR_TimeToTrigger_ms320:
return 320;
case NR_TimeToTrigger_ms480:
return 480;
case NR_TimeToTrigger_ms512:
return 512;
case NR_TimeToTrigger_ms640:
return 640;
case NR_TimeToTrigger_ms1024:
return 1024;
case NR_TimeToTrigger_ms1280:
return 1280;
case NR_TimeToTrigger_ms2560:
return 2560;
case NR_TimeToTrigger_ms5120:
return 5120;
default:
return 0;
}
}
void nr_ue_ckeck_meas_report(const unsigned int ue_mod_id, const uint8_t gnb_index)
{
l3_measurements_t *l3_measurements = &NR_UE_rrc_inst[ue_mod_id].l3_measurements;
for (int i = 0; i < MAX_MEAS_CONFIG; i++) {
NR_ReportConfigToAddMod_t *report_config = NR_UE_rrc_inst[ue_mod_id].ReportConfig[gnb_index][i];
if (report_config == NULL) {
continue;
}
if (report_config->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) {
NR_ReportConfigNR_t *report_config_nr = report_config->reportConfig.choice.reportConfigNR;
if (report_config_nr->reportType.present == NR_ReportConfigNR__reportType_PR_eventTriggered) {
NR_EventTriggerConfig_t *event_trigger_config = report_config_nr->reportType.choice.eventTriggered;
if (event_trigger_config->eventId.present == NR_EventTriggerConfig__eventId_PR_eventA3) {
struct NR_EventTriggerConfig__eventId__eventA3 *event_A3 = event_trigger_config->eventId.choice.eventA3;
if (event_A3->a3_Offset.present == NR_MeasTriggerQuantityOffset_PR_rsrp) {
meas_t *active_cell = &l3_measurements->active_cell;
meas_t *neighboring_cell = &l3_measurements->neighboring_cell[0];
int active_cell_rsrp = INT_MAX;
if (active_cell->ss_rsrp_dBm_initialized == true) {
active_cell_rsrp = active_cell->ss_rsrp_dBm;
} else if (active_cell->csi_rsrp_dBm_initialized == true) {
active_cell_rsrp = active_cell->csi_rsrp_dBm;
} else {
LOG_E(NR_RRC, "There are no RSRP measurements taken for the active cell\n");
}
int neighboring_cell_rsrp = INT_MIN;
if (neighboring_cell->ss_rsrp_dBm_initialized == true && event_trigger_config->rsType == NR_NR_RS_Type_ssb) {
neighboring_cell_rsrp = neighboring_cell->ss_rsrp_dBm;
}
int rsrp_offset = event_A3->a3_Offset.choice.rsrp >> 1;
int rsrp_hysteresis = event_A3->hysteresis;
if (neighboring_cell_rsrp > active_cell_rsrp + rsrp_offset + rsrp_hysteresis) {
if (NR_UE_rrc_inst[ue_mod_id].timers_and_constants.slots_to_trigger_active == 0) {
NR_UE_rrc_inst[ue_mod_id].timers_and_constants.slots_to_trigger_active = 1;
uint8_t scs = NR_UE_rrc_inst[ue_mod_id].mib->subCarrierSpacingCommon; // TODO: Improve this
int time_to_trigger = get_time_to_trigger(event_A3->timeToTrigger);
int slots_to_trigger = time_to_trigger << scs;
NR_UE_rrc_inst[ue_mod_id].timers_and_constants.slots_to_trigger_cnt = slots_to_trigger;
int report_config_id = report_config->reportConfigId;
int meas_id = -1;
for (int j = 0; j < MAX_MEAS_ID; j++) {
NR_MeasIdToAddMod_t *meas_id_toAddMod = NR_UE_rrc_inst[ue_mod_id].MeasId[gnb_index][j];
if (meas_id_toAddMod == NULL) {
continue;
}
if (meas_id_toAddMod->reportConfigId == report_config_id) {
meas_id = meas_id_toAddMod->measId;
}
}
AssertFatal(meas_id > 0, "meas_id did not found for report_config_id %i\n", report_config_id);
l3_measurements->trigger_to_measid = meas_id;
l3_measurements->trigger_quantity = event_A3->a3_Offset.present;
l3_measurements->rs_type = event_trigger_config->rsType;
LOG_W(NR_RRC, "(neighboring_cell_rsrp) %i > (active_cell_rsrp %i) + (rsrp_offset) %i + (rsrp_hysteresis) %i\n",
neighboring_cell_rsrp, active_cell_rsrp, rsrp_offset, rsrp_hysteresis);
}
} else {
NR_UE_rrc_inst[ue_mod_id].timers_and_constants.slots_to_trigger_active = 0;
}
}
}
}
}
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int number_of_received_meas = 0;
void *rrc_nrue_task( void *args_p ) { void *rrc_nrue_task( void *args_p ) {
MessageDef *msg_p; MessageDef *msg_p;
instance_t instance; instance_t instance;
...@@ -2286,15 +2440,13 @@ nr_rrc_ue_establish_srb2( ...@@ -2286,15 +2440,13 @@ nr_rrc_ue_establish_srb2(
NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type == 0 ? "SS" : "CSI", NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type == 0 ? "SS" : "CSI",
NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm-157); NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm-157);
// FIXME: Add a correct criterion nr_ue_meas_filtering(ue_mod_id,
if (number_of_received_meas == 200) { NR_RRC_MAC_MEAS_DATA_IND(msg_p).is_neighboring_cell,
rrc_ue_generate_measurementReport(&ctxt, NR_RRC_MAC_MEAS_DATA_IND(msg_p).Nid_cell,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).gnb_index, NR_RRC_MAC_MEAS_DATA_IND(msg_p).meas_type,
NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm); NR_RRC_MAC_MEAS_DATA_IND(msg_p).rsrp_dBm-157);
number_of_received_meas = 0;
}
number_of_received_meas++; nr_ue_ckeck_meas_report(ue_mod_id, NR_RRC_MAC_MEAS_DATA_IND(msg_p).gnb_index);
break; break;
case NR_RRC_MAC_CCCH_DATA_IND: case NR_RRC_MAC_CCCH_DATA_IND:
...@@ -2772,6 +2924,17 @@ void *nr_rrc_timers_update() { ...@@ -2772,6 +2924,17 @@ void *nr_rrc_timers_update() {
timers->T304_cnt--; timers->T304_cnt--;
} }
// Timer to send the measurement report
if (timers->slots_to_trigger_active == 1) {
timers->slots_to_trigger_cnt--;
if (timers->slots_to_trigger_cnt == 0) {
timers->slots_to_trigger_active = 0;
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, GNB_FLAG_NO, NR_UE_rrc_inst[mod_id].rnti, 0, 0, i);
rrc_ue_generate_measurementReport(&ctxt, i);
}
}
} }
} }
......
...@@ -172,6 +172,8 @@ typedef struct NR_UE_Timers_Constants_s { ...@@ -172,6 +172,8 @@ typedef struct NR_UE_Timers_Constants_s {
// counters // counters
uint32_t N310_cnt; uint32_t N310_cnt;
uint32_t N311_cnt; uint32_t N311_cnt;
uint32_t slots_to_trigger_active;
uint32_t slots_to_trigger_cnt;
// constants (limits configured by the network) // constants (limits configured by the network)
uint32_t N310_k; uint32_t N310_k;
uint32_t N311_k; uint32_t N311_k;
...@@ -183,6 +185,23 @@ typedef struct NR_UE_Timers_Constants_s { ...@@ -183,6 +185,23 @@ typedef struct NR_UE_Timers_Constants_s {
uint32_t T319_k; uint32_t T319_k;
} NR_UE_Timers_Constants_t; } NR_UE_Timers_Constants_t;
typedef struct meas_s {
uint16_t Nid_cell;
int ss_rsrp_dBm;
bool ss_rsrp_dBm_initialized;
int csi_rsrp_dBm;
bool csi_rsrp_dBm_initialized;
} meas_t;
typedef struct l3_measurements_s {
double filter_coeff_rsrp;
meas_t active_cell;
meas_t neighboring_cell[1];
long trigger_to_measid;
long trigger_quantity;
long rs_type;
} l3_measurements_t;
typedef struct NR_UE_RRC_INST_s { typedef struct NR_UE_RRC_INST_s {
NR_MeasConfig_t *meas_config; NR_MeasConfig_t *meas_config;
...@@ -191,6 +210,7 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -191,6 +210,7 @@ typedef struct NR_UE_RRC_INST_s {
NR_CellGroupConfig_t *scell_group_config; NR_CellGroupConfig_t *scell_group_config;
NR_RadioBearerConfig_t *radio_bearer_config; NR_RadioBearerConfig_t *radio_bearer_config;
NR_MeasurementReport_t *measurementReport; NR_MeasurementReport_t *measurementReport;
l3_measurements_t l3_measurements;
NR_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; NR_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
NR_ReportConfigToAddMod_t *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; NR_ReportConfigToAddMod_t *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
......
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