From d153208fc09116022c898abb998ebc4b7a070be2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas <x.foukas@sms.ed.ac.uk> Date: Thu, 3 Mar 2016 17:39:10 +0000 Subject: [PATCH] Added p0_PUCCH support in the agent --- .../ENB_APP/MESSAGES/V2/stats_common.proto | 6 ++++- openair2/ENB_APP/enb_agent_common.c | 20 ++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 +++ openair2/ENB_APP/enb_agent_mac.c | 26 +++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 3aaa018184..50d66a620c 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -154,15 +154,19 @@ message prp_ul_cqi { optional prp_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; - optional int32 p0_pucch_dbm = 4; } // Full UL CQI report for a specific UE message prp_ul_cqi_report { optional uint32 sfn_sn = 1; repeated prp_ul_cqi cqi_meas = 2; + repeated prp_pucch_dbm pucch_dbm = 3; } +message prp_pucch_dbm { + optional int32 p0_pucch_dbm = 1; + optional uint32 serv_cell_index = 2; +} // // Cell related statistics diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f890ba829c..64b51238f1 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -647,6 +647,26 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + if(eNB_UE_stats->Po_PUCCH_update == 1) + { + return eNB_UE_stats->Po_PUCCH_dBm; + } + else + return -1; +} + +int get_p0_nominal_pucch(mid_t mod_id, int CC_id) +{ + int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); + return pucch_rx_received; +} + /* * ************************************ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index e8fbf3afb8..1c4d478aab 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -210,6 +210,10 @@ int get_tpc(mid_t mod_id, mid_t ue_id); int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status); +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); + +int get_p0_nominal_pucch(mid_t mod_id, int CC_id); + /* * ************************************ * Get Messages for UE Configuration Reply diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0957bd94f2..29347b152b 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -657,8 +657,27 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set the servCellIndex for this report ul_report[j]->serv_cell_index = 0; ul_report[j]->has_serv_cell_index = 1; + + /*if(get_p0_pucch_dbm(enb_id,i) != -1){ + ul_report[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i); + ul_report[j]->has_p0_pucch_dbm = 1; + }*/ //Set the list of UL reports of this UE to the full UL report full_ul_report->cqi_meas = ul_report; + full_ul_report->n_pucch_dbm = MAX_NUM_CCs; + full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); + + for (j = 0; j < MAX_NUM_CCs; j++) { + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); + protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; + full_ul_report->pucch_dbm[j]->serv_cell_index = j; + if(get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; + } + } + //Add full UL CQI report to the UE report ue_report[i]->ul_cqi_report = full_ul_report; } @@ -701,6 +720,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Thermal noise power in dbm ni_report->tnp = 0; ni_report->has_tnp = 1; + + ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); + ni_report->has_p0_nominal_pucch = 1; cell_report[i]->noise_inter_report = ni_report; } } @@ -822,6 +844,10 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(ul_report->cqi_meas); } + for (j = 0; j < ul_report->n_pucch_dbm; j++) { + free(ul_report->pucch_dbm[j]); + } + free(ul_report->pucch_dbm); free(reply->ue_report[i]); } free(reply->ue_report); -- GitLab