src/lte/model/pf-ff-mac-scheduler.cc
changeset 8148 09e2d03022a2
parent 8141 b3a8a85ee6f0
child 8181 755c91d2c8d5
--- a/src/lte/model/pf-ff-mac-scheduler.cc	Fri Jun 17 17:15:35 2011 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.cc	Fri Jun 17 17:32:20 2011 +0200
@@ -211,8 +211,9 @@
   :   m_cschedSapUser (0),
     m_schedSapUser (0),
     m_timeWindow (99.0),
-    m_schedTtiDelay (2), // WILD ACK: based on a m_macChTtiDelay = 1 
-    m_nextRntiUl(0)
+    m_schedTtiDelay (2),
+    // WILD ACK: based on a m_macChTtiDelay = 1
+    m_nextRntiUl (0)
 {
   m_cschedSapProvider = new PfSchedulerMemberCschedSapProvider (this);
   m_schedSapProvider = new PfSchedulerMemberSchedSapProvider (this);
@@ -290,12 +291,12 @@
 PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params)
 {
   NS_LOG_FUNCTION (this << " New LC, rnti: "  << params.m_rnti);
-  
+
   std::map <uint16_t, pfsFlowPerf_t>::iterator it;
   for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++)
-    {      
+    {
       it = m_flowStatsDl.find (params.m_rnti);
-      
+
       if (it == m_flowStatsDl.end ())
         {
           pfsFlowPerf_t flowStatsDl;
@@ -316,7 +317,7 @@
           NS_LOG_ERROR ("RNTI already exists");
         }
     }
-  
+
   return;
 }
 
@@ -342,13 +343,13 @@
 {
   NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
   // API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
-  
+
   std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
-  
+
   LteFlowId_t flow (params.m_rnti, params.m_logicalChannelIdentity);
-  
+
   it =  m_rlcBufferReq.find (flow);
-  
+
   if (it == m_rlcBufferReq.end ())
     {
       m_rlcBufferReq.insert (std::pair <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> (flow, params));
@@ -356,8 +357,8 @@
   else
     {
       (*it).second = params;
-    }  
-  
+    }
+
   return;
 }
 
@@ -393,15 +394,15 @@
 
 
 int 
-PfFfMacScheduler::LcActivePerFlow(uint16_t rnti)
+PfFfMacScheduler::LcActivePerFlow (uint16_t rnti)
 {
   std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
   int lcActive = 0;
-  for (it = m_rlcBufferReq.begin (); it!= m_rlcBufferReq.end (); it++)
+  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
     {
-      if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize>0) || 
-        ((*it).second.m_rlcRetransmissionQueueSize>0) || 
-        ((*it).second.m_rlcStatusPduSize>0) ))
+      if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0)
+                                           || ((*it).second.m_rlcRetransmissionQueueSize > 0)
+                                           || ((*it).second.m_rlcStatusPduSize > 0) ))
         {
           lcActive++;
         }
@@ -418,10 +419,10 @@
 void
 PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
 {
-  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf>>4) << " subframe no. " << (0xF & params.m_sfnSf));
+  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
   // API generated by RLC for triggering the scheduling of a DL subframe
-  
-  
+
+
   // evaluate the relative channel quality indicator for each UE per each RBG 
   // (since we are using allocation type 0 the small unit of allocation is RBG)
   // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
@@ -456,19 +457,19 @@
                 {
                   // this UE has data to transmit
                   uint8_t mcs = LteAmc::GetMcsFromCqi (cqi);
-                  double achievableRate = ((LteAmc::GetTbSizeFromMcs (mcs, 1) / 8)/0.001); // = TB size / TTI
+                  double achievableRate = ((LteAmc::GetTbSizeFromMcs (mcs, 1) / 8) / 0.001); // = TB size / TTI
                   double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
 //                   NS_LOG_DEBUG (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi);
-                  
+
                   if (rcqi > rcqiMax)
                     {
                       rcqiMax = rcqi;
                       itMax = it;
                     }
                 }
-              } // end if cqi
+            }   // end if cqi
         } // end for m_rlcBufferReq
-      
+
       if (itMax == m_flowStatsDl.end ())
         {
           // no UE available for this RB
@@ -492,14 +493,14 @@
 //           NS_LOG_DEBUG (this << " UE assigned " << (*itMax).first);
         }
     } // end for RBGs
-  
+
   // reset TTI stats of users
   std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
   for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
     {
       (*itStats).second.lastTtiBytesTrasmitted = 0;
     }
-  
+
   // generate the transmission opportunities by grouping the RBGs of the same RNTI and
   // creating the correspondent DCIs
   FfMacSchedSapUser::SchedDlConfigIndParameters ret;
@@ -513,7 +514,7 @@
       DlDciListElement_s newDci;
       std::vector <struct RlcPduListElement_s> newRlcPduLe;
       newDci.m_rnti = (*itMap).first;
-      
+
       uint16_t lcActives = LcActivePerFlow ((*itMap).first);
 //       NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
       uint16_t RgbPerRnti = (*itMap).second.size ();
@@ -521,20 +522,20 @@
       itCqi = m_a30CqiRxed.find ((*itMap).first);
       uint8_t worstCqi = 15;
       for (uint16_t k = 0; k < (*itMap).second.size (); k++)
-      {
-        if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
-          {
+        {
+          if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
+            {
 //             NS_LOG_DEBUG (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) );
-            if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) < worstCqi)
-              {
-                worstCqi = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0));
-              }
-          }
-        else
-          {
-            worstCqi = 1; // try with lowest MCS in RBG with no info on channel
-          }
-      }
+              if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) < worstCqi)
+                {
+                  worstCqi = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0));
+                }
+            }
+          else
+            {
+              worstCqi = 1; // try with lowest MCS in RBG with no info on channel
+            }
+        }
 //       NS_LOG_DEBUG (this << " CQI " << (uint16_t)worstCqi);
       newDci.m_mcs.push_back (LteAmc::GetMcsFromCqi (worstCqi));
       int tbSize = (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (0), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
@@ -553,11 +554,11 @@
       // create the rlc PDUs -> equally divide resources among actives LCs
       int rlcPduSize = tbSize / lcActives;
       std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itBufReq;
-      for (itBufReq = m_rlcBufferReq.begin (); itBufReq!= m_rlcBufferReq.end (); itBufReq++)
+      for (itBufReq = m_rlcBufferReq.begin (); itBufReq != m_rlcBufferReq.end (); itBufReq++)
         {
-          if (((*itBufReq).first.m_rnti == (*itMap).first) && (((*itBufReq).second.m_rlcTransmissionQueueSize>0) || 
-            ((*itBufReq).second.m_rlcRetransmissionQueueSize>0) || 
-            ((*itBufReq).second.m_rlcStatusPduSize>0) ))
+          if (((*itBufReq).first.m_rnti == (*itMap).first) && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
+                                                               || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
+                                                               || ((*itBufReq).second.m_rlcStatusPduSize > 0) ))
             {
               RlcPduListElement_s newRlcEl;
               newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
@@ -572,33 +573,33 @@
         }
       newDci.m_ndi.push_back (1); // TBD (new data indicator)
       newDci.m_rv.push_back (0); // TBD (redundancy version)
-      
+
       newEl.m_dci = newDci;
       // ...more parameters -> ingored in this version
-      
+
       newEl.m_rlcPduList.push_back (newRlcPduLe);
       ret.m_buildDataList.push_back (newEl);
-      
+
       // update UE stats
       std::map <uint16_t, pfsFlowPerf_t>::iterator it;
       it = m_flowStatsDl.find ((*itMap).first);
-      if (it != m_flowStatsDl.end())
+      if (it != m_flowStatsDl.end ())
         {
           (*it).second.lastTtiBytesTrasmitted = tbSize;
 //           NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
-         
-          
+
+
         }
       else
         {
-            NS_LOG_DEBUG (this << " No Stats for this allocated UE");
+          NS_LOG_DEBUG (this << " No Stats for this allocated UE");
         }
-    
+
       itMap++;
     } // end while allocation
   ret.m_nrOfPdcchOfdmSymbols = 1;   // TODO: check correct value according the DCIs txed
-  
-  
+
+
   // update UEs stats
   for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
     {
@@ -609,9 +610,9 @@
 //       NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput);
       (*itStats).second.lastTtiBytesTrasmitted = 0;
     }
-      
+
   m_schedSapUser->SchedDlConfigInd (ret);
-  
+
  
   return;
 }
@@ -676,84 +677,84 @@
 
 
 double
-PfFfMacScheduler::EstimateUlSinr(uint16_t rnti, uint16_t rb)
+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);
-    
-  }
+    {
+      // 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);
-  }
+    {
+      // 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)
 {
-  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf>>4) << " subframe no. " << (0xF & params.m_sfnSf));
+  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
  
-  
+
   std::map <uint16_t,uint8_t>::iterator it; 
   int nflows = 0;
-  
+
   for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
     {
       // remove old entries of this UE-LC
       if ((*it).second > 0)
-      {
-        nflows++;
-      }
+        {
+          nflows++;
+        }
     }
-  
-  if (nflows==0)
-  {
-    return ;  // no flows to be scheduled
-  } 
-   
-  
+
+  if (nflows == 0)
+    {
+      return ; // no flows to be scheduled
+    }
+
+
   // Divide the resource equally among the active users
   int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows;
   if (rbPerFlow == 0)
-  {
-    rbPerFlow = 1;                // at least 1 rbg per flow (till available resource)
-  }
+    {
+      rbPerFlow = 1;              // at least 1 rbg per flow (till available resource)
+    }
   int rbAllocated = 0;
-  
+
   FfMacSchedSapUser::SchedUlConfigIndParameters ret;
   std::vector <uint16_t> rbgAllocationMap;
   std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
-  if (m_nextRntiUl!=0)
+  if (m_nextRntiUl != 0)
     {
       for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
         {
-          if ((*it).first == m_nextRntiUl)    
+          if ((*it).first == m_nextRntiUl)
             {
               break;
             }
         }
-        if (it == m_ceBsrRxed.end ())
-          {
-            NS_LOG_ERROR (this << " no user found");
-          }
+      if (it == m_ceBsrRxed.end ())
+        {
+          NS_LOG_ERROR (this << " no user found");
+        }
     }
   else
     {
@@ -767,10 +768,10 @@
           // limit to physical resources last resource assignment
           rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
         }
-       // store info on allocation for managing ul-cqi interpretation
+      // store info on allocation for managing ul-cqi interpretation
       for (int i = 0; i < rbPerFlow; i++)
         {
-        	rbgAllocationMap.push_back ((*it).first);
+          rbgAllocationMap.push_back ((*it).first);
         }
       UlDciListElement_s uldci;
       uldci.m_rnti = (*it).first;
@@ -781,14 +782,14 @@
       int cqi = 0;
       if (itCqi == m_ueCqi.end ())
         {
-        	// no cqi info about this UE
+          // no cqi info about this UE
           uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
           //NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first );
         }
       else
         {
           // take the lowest CQI value (worst RB)
-          double minSinr = (*itCqi).second.at(uldci.m_rbStart);
+          double minSinr = (*itCqi).second.at (uldci.m_rbStart);
           if (minSinr == NO_SINR)
             {
               minSinr = EstimateUlSinr ((*it).first, uldci.m_rbStart);
@@ -796,26 +797,26 @@
           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);
+              double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
                   sinr = EstimateUlSinr ((*it).first, i);
                 }
-              if ((*itCqi).second.at(i) < minSinr)
+              if ((*itCqi).second.at (i) < minSinr)
                 {
-                  minSinr = (*itCqi).second.at(i);
+                  minSinr = (*itCqi).second.at (i);
                 }
             }
-            
+
           // translate SINR -> cqi: WILD ACK: same as DL
           double s = log2 ( 1 + (
-                          pow (10, minSinr / 10 )  /
-                          ( (-log (5.0 * 0.00005 )) / 1.5) ));
+                              pow (10, minSinr / 10 )  /
+                              ( (-log (5.0 * 0.00005 )) / 1.5) ));
           cqi = LteAmc::GetCqiFromSpectralEfficiency (s);
           if (cqi == 0)
             {
               it++;
-              if (it==m_ceBsrRxed.end ())
+              if (it == m_ceBsrRxed.end ())
                 {
                   // restart from the first
                   it = m_ceBsrRxed.begin ();
@@ -824,7 +825,7 @@
             }
           uldci.m_mcs = LteAmc::GetMcsFromCqi (cqi);
           //NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
-        	
+
         }
       uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
 //             NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize);
@@ -841,24 +842,24 @@
       uldci.m_freqHopping = 0;
       uldci.m_pdcchPowerOffset = 0; // not used
       ret.m_dciList.push_back (uldci);
-      
+
       // update TTI  UE stats
       itStats = m_flowStatsUl.find ((*it).first);
-      if (itStats != m_flowStatsUl.end())
+      if (itStats != m_flowStatsUl.end ())
         {
           (*itStats).second.lastTtiBytesTrasmitted =  uldci.m_tbSize;
           //           NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
-          
-          
+
+
         }
       else
         {
           NS_LOG_DEBUG (this << " No Stats for this allocated UE");
         }
-      
-      
+
+
       it++;
-      if (it==m_ceBsrRxed.end ())
+      if (it == m_ceBsrRxed.end ())
         {
           // restart from the first
           it = m_ceBsrRxed.begin ();
@@ -869,9 +870,10 @@
           m_nextRntiUl = (*it).first;
           break;
         }
-    } while ((*it).first != m_nextRntiUl);
-    
-    
+    }
+  while ((*it).first != m_nextRntiUl);
+
+
   // Update global UE stats
   // update UEs stats
   for (itStats = m_flowStatsUl.begin (); itStats != m_flowStatsUl.end (); itStats++)
@@ -908,30 +910,30 @@
 PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-  
+
   std::map <uint16_t,uint8_t>::iterator it;
-  
+
   for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
-  {
-    if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
     {
-      // buffer status report
-      uint16_t rnti = params.m_macCeList.at (i).m_rnti;
-      it = m_ceBsrRxed.find(rnti);
-      if (it==m_ceBsrRxed.end())
-      {
-        // create the new entry
-        uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
-        m_ceBsrRxed.insert( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
-      }
-      else
-      {
-        // update the CQI value
-        (*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
-      }
+      if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
+        {
+          // buffer status report
+          uint16_t rnti = params.m_macCeList.at (i).m_rnti;
+          it = m_ceBsrRxed.find (rnti);
+          if (it == m_ceBsrRxed.end ())
+            {
+              // create the new entry
+              uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
+              m_ceBsrRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
+            }
+          else
+            {
+              // update the CQI value
+              (*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
+            }
+        }
     }
-  }
-  
+
   return;
 }
 
@@ -945,9 +947,9 @@
   uint32_t subframeNo = (0xF & params.m_sfnSf);
   //NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
   if (subframeNo - m_schedTtiDelay < 0)
-  {
-  	frameNo--;
-  }
+    {
+      frameNo--;
+    }
   subframeNo = (subframeNo - m_schedTtiDelay) % 10;
   //NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo);
   uint16_t sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo);
@@ -955,46 +957,46 @@
   std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
   std::map <uint16_t, std::vector <double> >::iterator itCqi;
   itMap = m_allocationMaps.find (sfnSf);
-  if (itMap == m_allocationMaps.end())
-  {
-  	NS_LOG_DEBUG (this << " Does not find info on allocation");
-  	return;
-  }
+  if (itMap == m_allocationMaps.end ())
+    {
+      NS_LOG_DEBUG (this << " Does not find info on allocation");
+      return;
+    }
   for (uint32_t i = 0; i < (*itMap).second.size (); i++)
     {
-  	  // convert from fixed point notation Sxxxxxxxxxxx.xxx to double    	
-    	double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
-  	  //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
-  	  itCqi = m_ueCqi.find ((*itMap).second.at (i));
-  	  if (itCqi == m_ueCqi.end ())
-  	    {
-  	    	// create a new entry
-  	    	std::vector <double> newCqi;
-  	    	for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
-  	    	  {
-  	    	  	if (i==j)
-		 	    	  	{
-		 	    	  		newCqi.push_back (sinr);
-		 	    	  	}
-  	    	  	else
-  	    	  	  {
+      // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
+      double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
+      //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
+      itCqi = m_ueCqi.find ((*itMap).second.at (i));
+      if (itCqi == m_ueCqi.end ())
+        {
+          // create a new entry
+          std::vector <double> newCqi;
+          for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+            {
+              if (i == j)
+                {
+                  newCqi.push_back (sinr);
+                }
+              else
+                {
                   // initialize with NO_SINR value.
-  	    	  	  	newCqi.push_back (NO_SINR);
-  	    	  	  }
-  	    	  	
-  	    	  }
-  	    	m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
-  	    }
-  	  else
-  	    {
-  	      // update the value
-  	      (*itCqi).second.at (i) = sinr;
-  	    }
-  	  
-  	}
+                  newCqi.push_back (NO_SINR);
+                }
+
+            }
+          m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
+        }
+      else
+        {
+          // update the value
+          (*itCqi).second.at (i) = sinr;
+        }
+
+    }
   // remove obsolete info on allocation
   m_allocationMaps.erase (m_allocationMaps.begin (), ++itMap);
-   
+
   return;
 }