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,
// Setup the SSB to Rach Occasions mapping according to the config
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,
int cc_idP,
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*/
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,
return((enc_rval.encoded+7)/8);
}
// TODO: Improve this function that is all hardcoded
uint16_t do_nrMeasurementReport_SA(NR_MeasurementReport_t *measurementReport, uint8_t *buffer, size_t buffer_size, uint8_t rsrp_s) {
// TODO: This function is only implemented for event A3
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;
NR_UL_DCCH_Message_t ul_dcch_msg;
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
NR_UL_DCCH_Message_t ul_dcch_msg;
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.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;
memset(measurementReport, 0, sizeof(struct NR_MeasurementReport));
ul_dcch_msg.message.choice.c1->choice.measurementReport = 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_ie->measResults.measId = 3;
NR_MeasResultServMO_t *measResultServMo = CALLOC(1,sizeof(struct NR_MeasResultServMO));
measResultServMo->measResultServingCell.physCellId = CALLOC(1,sizeof(NR_PhysCellId_t));
*measResultServMo->measResultServingCell.physCellId = 0;
measResultServMo->measResultServingCell.measResult.cellResults.resultsCSI_RS_Cell = CALLOC(1,sizeof(struct NR_MeasQuantityResults));
measResultServMo->measResultServingCell.measResult.cellResults.resultsCSI_RS_Cell->rsrp = CALLOC(1,sizeof(NR_RSRP_Range_t));
*measResultServMo->measResultServingCell.measResult.cellResults.resultsCSI_RS_Cell->rsrp = rsrp_s - 10; // FIXME: This -10 is just to trigger the HO
measResultServMo->measResultBestNeighCell = CALLOC(1,sizeof(struct NR_MeasResultNR));
measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell = CALLOC(1,sizeof(struct NR_MeasQuantityResults));
measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell->rsrp = CALLOC(1,sizeof(NR_RSRP_Range_t));
*measResultServMo->measResultBestNeighCell->measResult.cellResults.resultsCSI_RS_Cell->rsrp = rsrp_s; // FIXME
measurementReport_ie->measResults.measId = l3_measurements->trigger_to_measid;
NR_MeasResultServMO_t *measResultServMo = CALLOC(1, sizeof(struct NR_MeasResultServMO));
meas_t *active_cell = &l3_measurements->active_cell;
NR_MeasResultNR_t *measResultServingCell = &measResultServMo->measResultServingCell;
measResultServingCell->physCellId = CALLOC(1, sizeof(NR_PhysCellId_t));
*measResultServingCell->physCellId = active_cell->Nid_cell;
meas_t *neighboring_cell = &l3_measurements->neighboring_cell[0];
struct NR_MeasResultNR *measResultBestNeighCell = CALLOC(1, sizeof(struct NR_MeasResultNR));
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);
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,
NULL,
(void *)&ul_dcch_msg,
buffer,
buffer_size);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, NULL, (void *)&ul_dcch_msg, buffer, buffer_size);
AssertFatal(enc_rval.encoded > 0,
"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name,enc_rval.encoded);
AssertFatal(enc_rval.encoded > 0, "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);
}
//------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -172,6 +172,8 @@ typedef struct NR_UE_Timers_Constants_s {
// counters
uint32_t N310_cnt;
uint32_t N311_cnt;
uint32_t slots_to_trigger_active;
uint32_t slots_to_trigger_cnt;
// constants (limits configured by the network)
uint32_t N310_k;
uint32_t N311_k;
......@@ -183,6 +185,23 @@ typedef struct NR_UE_Timers_Constants_s {
uint32_t T319_k;
} 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 {
NR_MeasConfig_t *meas_config;
......@@ -191,6 +210,7 @@ typedef struct NR_UE_RRC_INST_s {
NR_CellGroupConfig_t *scell_group_config;
NR_RadioBearerConfig_t *radio_bearer_config;
NR_MeasurementReport_t *measurementReport;
l3_measurements_t l3_measurements;
NR_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
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