From 3d14d5716afc11e42b9083842a24f40a70635c33 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 16 Oct 2017 17:23:41 +0200
Subject: [PATCH] trying to get better power management

- change target values
- change upper/lower limit to trigger a tpc
- don't use ul_cqi from SR

The value of ul_cqi is not convincing, for both PUSCH and PUCCH,
more work/analysis is required.
---
 openair2/LAYER2/MAC/eNB_scheduler_dlsch.c      | 7 ++++---
 openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 3 +++
 openair2/LAYER2/MAC/eNB_scheduler_ulsch.c      | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index c38adca4fb..80c35adbce 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -1181,8 +1181,9 @@ schedule_ue_spec(
           // this is the normalized RX power
 	  eNB_UE_stats =  &UE_list->eNB_UE_stats[CC_id][UE_id];
 
+          /* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
 	  normalized_rx_power = ue_sched_ctl->pucch1_snr[CC_id];
-	  target_rx_power = 20;
+	  target_rx_power = 208;
 	    
           // this assumes accumulated tpc
 	  // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
@@ -1195,10 +1196,10 @@ schedule_ue_spec(
 	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP;
 	      UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP;
 	      
-	      if (normalized_rx_power>(target_rx_power+1)) {
+	      if (normalized_rx_power>(target_rx_power+4)) {
 		tpc = 0; //-1
 		tpc_accumulated--;
-	      } else if (normalized_rx_power<(target_rx_power-1)) {
+	      } else if (normalized_rx_power<(target_rx_power-4)) {
 		tpc = 2; //+1
 		tpc_accumulated++;
 	      } else {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index db368cde2e..3097a0c094 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -3606,8 +3606,11 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t
 
     UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
+#if 0
+    /* for the moment don't use ul_cqi from SR, value is too different from harq */
     sched_ctl->pucch1_snr[cc_idP]        = ul_cqi;
     sched_ctl->pucch1_cqi_update[cc_idP] = 1;
+#endif
 
     UE_list->UE_template[cc_idP][UE_id].ul_SR = 1;
     UE_list->UE_template[cc_idP][UE_id].ul_active = TRUE;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index af86640a24..5b9c025442 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -1008,7 +1008,7 @@ abort();
 	  
           // this is the normalized RX power and this should be constant (regardless of mcs
           normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
-          target_rx_power = 200;
+          target_rx_power = 178;
 	  
           // this assumes accumulated tpc
 	  // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
@@ -1018,10 +1018,10 @@ abort();
 	    {
 	      UE_template->pusch_tpc_tx_frame=frameP;
 	      UE_template->pusch_tpc_tx_subframe=subframeP;
-	      if (normalized_rx_power>(target_rx_power+1)) {
+	      if (normalized_rx_power>(target_rx_power+4)) {
 		tpc = 0; //-1
 		tpc_accumulated--;
-	      } else if (normalized_rx_power<(target_rx_power-1)) {
+	      } else if (normalized_rx_power<(target_rx_power-4)) {
 		tpc = 2; //+1
 		tpc_accumulated++;
 	      } else {
-- 
GitLab