src/lte/model/pf-ff-mac-scheduler.cc
changeset 8035 d2e70680881a
parent 7983 b91d5a39aabc
child 8047 3741b99462cd
--- a/src/lte/model/pf-ff-mac-scheduler.cc	Tue May 10 13:05:06 2011 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.cc	Tue May 10 16:52:43 2011 +0200
@@ -210,7 +210,7 @@
 PfFfMacScheduler::PfFfMacScheduler ()
   :   m_cschedSapUser (0),
     m_schedSapUser (0),
-    m_timeWindow (0.5),
+    m_timeWindow (10.0),
     m_schedTtiDelay (2) // WILD ACK: based on a m_macChTtiDelay = 1 
 {
   m_cschedSapProvider = new PfSchedulerMemberCschedSapProvider (this);
@@ -411,7 +411,7 @@
 void
 PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
+  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
   
   
@@ -424,7 +424,7 @@
   std::map <uint16_t, std::vector <uint16_t> > allocationMap;
   for (int i = 0; i < rbgNum; i++)
     {
-      //NS_LOG_DEBUG (this << " ALLOCATION for RBG " << i << " of " << rbgNum);
+      NS_LOG_DEBUG (this << " ALLOCATION for RBG " << i << " of " << rbgNum);
       std::map <uint16_t, pfsFlowPerf_t>::iterator it;
       std::map <uint16_t, pfsFlowPerf_t>::iterator itMax = m_flowStats.end ();
       double rcqiMax = 0.0;
@@ -435,7 +435,7 @@
           uint8_t cqi = 0;
           if (itCqi == m_a30CqiRxed.end ())
             {
-              //NS_LOG_DEBUG (this << " No DL-CQI for this UE " << (*it).first);
+              NS_LOG_DEBUG (this << " No DL-CQI for this UE " << (*it).first);
               cqi = 1;  // start with lowest value
             }
           else
@@ -444,17 +444,14 @@
             }
           if (cqi > 0)  // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             {
-              //NS_LOG_DEBUG (this << " LC active " << LcActivePerFlow ((*it).first));
+//               NS_LOG_DEBUG (this << " LC active " << LcActivePerFlow ((*it).first));
               if (LcActivePerFlow ((*it).first) > 0)
                 {
                   // this UE has data to transmit
-                  //NS_LOG_DEBUG (this << " RNTI " << (*it).first);
                   uint8_t mcs = LteAmc::GetMcsFromCqi (cqi);
-                  //NS_LOG_DEBUG (this << " MCS " << (uint32_t)mcs);
                   double achievableRate = ((LteAmc::GetTbSizeFromMcs (mcs, 1) / 8)/0.001); // = TB size / TTI
                   double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
-                  //NS_LOG_DEBUG (this << " achievaleRate " << achievableRate << " avg thr " << (*it).second.lastAveragedThroughput);
-                  //NS_LOG_DEBUG (this << " RCQI " << rcqi);
+                  NS_LOG_DEBUG (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi);
                   
                   if (rcqi > rcqiMax)
                     {
@@ -468,7 +465,7 @@
       if (itMax == m_flowStats.end ())
         {
           // no UE available for this RB
-          //NS_LOG_DEBUG (this << " no UE found");
+          NS_LOG_DEBUG (this << " no UE found");
         }
       else
         {
@@ -485,7 +482,7 @@
             {
               (*itMap).second.push_back (i);
             }
-          //NS_LOG_DEBUG (this << " UE assigned " << (*itMax).first);
+          NS_LOG_DEBUG (this << " UE assigned " << (*itMax).first);
         }
     } // end for RBGs
     
@@ -504,7 +501,7 @@
       newDci.m_rnti = (*itMap).first;
       
       uint16_t lcActives = LcActivePerFlow ((*itMap).first);
-      //NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
+//       NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
       uint16_t RgbPerRnti = (*itMap).second.size ();
       std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
       itCqi = m_a30CqiRxed.find ((*itMap).first);
@@ -513,7 +510,7 @@
       {
         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)) );
+//             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));
@@ -524,7 +521,7 @@
             worstCqi = 1; // try with lowest MCS in RBG with no info on channel
           }
       }
-      //NS_LOG_DEBUG (this << " CQI " << (uint16_t)worstCqi);
+//       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)
       newDci.m_tbsSize.push_back (tbSize);
@@ -535,7 +532,7 @@
       for (uint16_t k = 0; k < (*itMap).second.size (); k++)
         {
           rbgMask = rbgMask + (0x1 << (*itMap).second.at (k));
-          //NS_LOG_DEBUG (this << " Allocated PRB " << (*itMap).second.at (k));
+//           NS_LOG_DEBUG (this << " Allocated PRB " << (*itMap).second.at (k));
         }
       newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213)
 
@@ -550,7 +547,7 @@
             {
               RlcPduListElement_s newRlcEl;
               newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
-              //NS_LOG_DEBUG (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize);
+              NS_LOG_DEBUG (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize);
               newRlcEl.m_size = rlcPduSize;
               newRlcPduLe.push_back (newRlcEl);
             }
@@ -574,19 +571,19 @@
       if (it != m_flowStats.end())
         {
           (*it).second.lastTtiBytesTrasmitted = tbSize;
-          //NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
+          NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
           (*it).second.totalBytesTransmitted += (*it).second.lastTtiBytesTrasmitted;
           // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley)
           (*it).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*it).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*it).second.lastTtiBytesTrasmitted / 0.001));
           (*it).second.lastTtiBytesTrasmitted = 0;
-          //NS_LOG_DEBUG (this << " UE tot bytes " << (*it).second.totalBytesTransmitted);
-          //NS_LOG_DEBUG (this << " UE avg thr " << (*it).second.lastAveragedThroughput);
+          NS_LOG_DEBUG (this << " UE tot bytes " << (*it).second.totalBytesTransmitted);
+          NS_LOG_DEBUG (this << " UE avg thr " << (*it).second.lastAveragedThroughput);
           
         }
-//         else
-//           {
-//             NS_LOG_DEBUG (this << " No Stats for this allocated UE-LC");
-//           }
+      else
+        {
+            NS_LOG_DEBUG (this << " No Stats for this allocated UE");
+        }
     
       itMap++;
     } // end while allocation