LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
authorMarco Miozzo <marco.miozzo@cttc.es>
Thu, 09 Jun 2011 12:44:39 +0200
changeset 8141 b3a8a85ee6f0
parent 8140 a38afb54cba1
child 8142 4befd86cb176
child 8183 da3984b7522b
LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
src/lte/model/pf-ff-mac-scheduler.cc
src/lte/model/pf-ff-mac-scheduler.h
--- a/src/lte/model/pf-ff-mac-scheduler.cc	Mon Jun 06 11:03:01 2011 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.cc	Thu Jun 09 12:44:39 2011 +0200
@@ -674,6 +674,38 @@
   return;
 }
 
+
+double
+PfFfMacScheduler::EstimateUlSinr(uint16_t rnti, uint16_t rb)
+{
+  std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find (rnti);
+  if (itCqi == m_ueCqi.end ())
+  {
+    // no cqi info about this UE
+    return (NO_SINR);
+    
+  }
+  else
+  {
+    // take the average SINR value among the available 
+    double sinrSum = 0;
+    int sinrNum = 0;
+    for (uint32_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
+      {
+        double sinr = (*itCqi).second.at(i);
+        if (sinr != NO_SINR)
+          {
+            sinrSum += sinr;
+            sinrNum++;
+          }
+      }
+    double estimatedSinr = sinrSum / (double)sinrNum;
+    // store the value
+    (*itCqi).second.at(rb) = estimatedSinr;
+    return (estimatedSinr);
+  }
+}
+
 void
 PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
 {
@@ -757,9 +789,18 @@
         {
           // take the lowest CQI value (worst RB)
           double minSinr = (*itCqi).second.at(uldci.m_rbStart);
+          if (minSinr == NO_SINR)
+            {
+              minSinr = EstimateUlSinr ((*it).first, uldci.m_rbStart);
+            }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
               //NS_LOG_DEBUG (this << " UE " << (*it).first << " has CQI " << (*itCqi).second.at(i));
+              double sinr = (*itCqi).second.at(i);
+              if (sinr == NO_SINR)
+                {
+                  sinr = EstimateUlSinr ((*it).first, i);
+                }
               if ((*itCqi).second.at(i) < minSinr)
                 {
                   minSinr = (*itCqi).second.at(i);
@@ -937,8 +978,8 @@
 		 	    	  	}
   	    	  	else
   	    	  	  {
-  	    	  	  	// initialize with minumum values according to the fixed point notation
-  	    	  	  	newCqi.push_back (LteFfConverter::getMinFpS11dot3Value ());
+                  // initialize with NO_SINR value.
+  	    	  	  	newCqi.push_back (NO_SINR);
   	    	  	  }
   	    	  	
   	    	  }
--- a/src/lte/model/pf-ff-mac-scheduler.h	Mon Jun 06 11:03:01 2011 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.h	Thu Jun 09 12:44:39 2011 +0200
@@ -30,6 +30,10 @@
 #include <ns3/nstime.h>
 
 
+// value for SINR outside the range defined by FF-API, used to indicate that there
+// is no CQI for this element
+#define NO_SINR -5000
+
 namespace ns3 {
 
 
@@ -129,6 +133,8 @@
   int GetRbgSize (int dlbandwidth);
   
   int LcActivePerFlow(uint16_t rnti);
+  
+  double EstimateUlSinr(uint16_t rnti, uint16_t rb);
 
   /*
    * Vectors of UE's LC info