GSoC 2012 NS-3 LTE schedulers: updated version based on Tom's comment
authorDizhi Zhou <dizhi.zhou@gmail.com>
Fri, 30 Nov 2012 18:40:56 -0400
changeset 9152 3135c059ff79
parent 9151 bf8c3950df8e
child 9153 f04612961e79
GSoC 2012 NS-3 LTE schedulers: updated version based on Tom's comment
src/lte/doc/source/lte-design.rst
src/lte/doc/source/lte-references.rst
src/lte/model/fdbet-ff-mac-scheduler.cc
src/lte/model/fdmt-ff-mac-scheduler.cc
src/lte/model/fdtbfq-ff-mac-scheduler.cc
src/lte/model/pss-ff-mac-scheduler.cc
src/lte/model/tdbet-ff-mac-scheduler.cc
src/lte/model/tdmt-ff-mac-scheduler.cc
src/lte/model/tdtbfq-ff-mac-scheduler.cc
src/lte/model/tta-ff-mac-scheduler.cc
--- a/src/lte/doc/source/lte-design.rst	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/doc/source/lte-design.rst	Fri Nov 30 18:40:56 2012 -0400
@@ -657,7 +657,7 @@
 
 The Maximum Throughput (MT) scheduler [FCapo2012]_ aims to maximize the overall throughput of eNB.
 It allocates each RB to the user that can achieve the maximum achievable rate in the current TTI.
-Currently, MT scheduler in LENA has two versions: frequency domain (FDMT) and time domain (TDMT).
+Currently, MT scheduler in NS-3 has two versions: frequency domain (FDMT) and time domain (TDMT).
 In FDMT, every TTI, MAC scheduler allocates RBGs to the UE who has highest achievable rate calculated 
 by subband CQI. In TDMT, every TTI, MAC scheduler selects one UE which has highest achievable rate 
 calculated by wideband CQI. Then MAC scheduler allocates all RBGs to this UE in current TTI.
@@ -733,7 +733,7 @@
 Token Bank Fair Queue Scheduler
 -------------------------------
 
-Token Band Fair Queue (TBFQ) is a QoS aware scheduler which derives from the leaky-bucket mechanism. In TBFQ, 
+Token Bank Fair Queue (TBFQ) is a QoS aware scheduler which derives from the leaky-bucket mechanism. In TBFQ, 
 a traffic flow of user :math:`i` is characterized by following parameters: 
 
  * :math:`t_{i}`: packet arrival rate (byte/sec )
--- a/src/lte/doc/source/lte-references.rst	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/doc/source/lte-references.rst	Fri Nov 30 18:40:56 2012 -0400
@@ -86,7 +86,7 @@
 .. [R4-081920] 3GPP R4-081920 `LTE PDCCH/PCFICH Demodulation Performance Results with Implementation Margin
  <http://www.3gpp.org/ftp/tsg_ran/wg4_radio/TSGR4_48/Documents/R4-081920.zip>`_
 
-.. [FCapo2012] F.Capozzi, G.Piro L.A.Grieco, G.Boggia, P.Camarda, "Downlink Packet Scheduling in LTE Cellular Networks: Key Design Issues and a Survey", IEEE Comm. Surveys and Tutorials, to appear 
+.. [FCapo2012] F.Capozzi, G.Piro L.A.Grieco, G.Boggia, P.Camarda, "Downlink Packet Scheduling in LTE Cellular Networks: Key Design Issues and a Survey", IEEE Comm. Surveys and Tutorials, vol.2012, no.99, pp.1-23, Jun. 2012
 
 .. [FABokhari2009] F.A. Bokhari, H. Yanikomeroglu, W.K. Wong, M. Rahman, "Cross-Layer Resource Scheduling for Video Traffic in the Downlink of OFDMA-Based Wireless 4G Networks",EURASIP J. Wirel. Commun. Netw., vol.2009, no.3, pp. 1-10, Jan. 2009. 
 
--- a/src/lte/model/fdbet-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/fdbet-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -246,7 +246,7 @@
                    UintegerValue (1000),
                    MakeUintegerAccessor (&FdBetFfMacScheduler::m_cqiTimersThreshold),
                    MakeUintegerChecker<uint32_t> ())
-  ;
+    ;
   return tid;
 }
 
@@ -341,16 +341,14 @@
 void
 FdBetFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdBetFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -382,16 +380,14 @@
 void
 FdBetFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdBetFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -677,8 +673,7 @@
 void
 FdBetFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -847,7 +842,6 @@
         {
           // 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
         {
@@ -859,7 +853,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -887,8 +880,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
-
         }
       
       rbAllocated += rbPerFlow;
@@ -919,9 +910,6 @@
       if (itStats != m_flowStatsUl.end ())
         {
           (*itStats).second.lastTtiBytesTransmitted =  uldci.m_tbSize;
-//                     NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTransmitted);
-
-
         }
       else
         {
@@ -952,8 +940,6 @@
       (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
       // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley)
       (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
-      //       NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted);
-      //       NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput);
       (*itStats).second.lastTtiBytesTransmitted = 0;
     }
   m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
@@ -964,16 +950,14 @@
 void
 FdBetFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdBetFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -1015,7 +999,6 @@
 FdBetFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -1060,7 +1043,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1253,7 +1235,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1303,7 +1284,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/fdmt-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/fdmt-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -336,16 +336,14 @@
 void
 FdMtFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdMtFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -377,16 +375,14 @@
 void
 FdMtFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdMtFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -661,8 +657,7 @@
 void
 FdMtFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -830,7 +825,6 @@
         {
           // 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
         {
@@ -842,7 +836,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -870,8 +863,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
-
         }
       
       rbAllocated += rbPerFlow;
@@ -922,16 +913,14 @@
 void
 FdMtFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdMtFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -973,7 +962,6 @@
 FdMtFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -1018,7 +1006,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1211,7 +1198,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1261,7 +1247,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/fdtbfq-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/fdtbfq-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -375,16 +375,14 @@
 void
 FdTbfqFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdTbfqFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -416,16 +414,14 @@
 void
 FdTbfqFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdTbfqFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -515,27 +511,27 @@
               continue;
             }
 
-	  std::set <uint16_t>::iterator rnti;
+		      std::set <uint16_t>::iterator rnti;
           rnti = allocatedRnti.find((*it).first);
-	  if (rnti != allocatedRnti.end ())  //  already allocated RBGs to this UE
-	    {
-	      continue;
-	    }
+		      if (rnti != allocatedRnti.end ())  //  already allocated RBGs to this UE
+		        {
+		          continue;
+		        }
   
-          double metric = ( ( (double)(*it).second.counter ) / ( (double)(*it).second.tokenGenerationRate ) );
+		      double metric = ( ( (double)(*it).second.counter ) / ( (double)(*it).second.tokenGenerationRate ) );
   
-          if (firstRnti == true)
-            {
-              metricMax = metric;
-              itMax = it;
-              firstRnti = false;
-              continue;
-	    }
-	  if (metric > metricMax)
-            {
-              metricMax = metric;
-              itMax = it;
-            } 
+		      if (firstRnti == true)
+		        {
+		          metricMax = metric;
+		          itMax = it;
+		          firstRnti = false;
+		          continue;
+		        }
+		      if (metric > metricMax)
+              {
+                metricMax = metric;
+                itMax = it;
+              } 
         } // end for m_flowStatsDl
   
       if (itMax == m_flowStatsDl.end())
@@ -551,37 +547,37 @@
       uint32_t budget = 0;
       if ( bankSize > 0 )
         {
-          budget = (*itMax).second.counter - (*itMax).second.debtLimit;
-          if ( budget > (*itMax).second.burstCredit )
-            budget = (*itMax).second.burstCredit;
-         if ( budget > bankSize )
-            budget = bankSize;
-        }
+		      budget = (*itMax).second.counter - (*itMax).second.debtLimit;
+		      if ( budget > (*itMax).second.burstCredit )
+		        budget = (*itMax).second.burstCredit;
+		      if ( budget > bankSize )
+		        budget = bankSize;
+	      }
       budget = budget + (*itMax).second.tokenPoolSize;
 
       // calcualte how much bytes this UE actally need
       if (budget == 0)
         {
           // there are no tokens for this UE
-          continue;
+ 	        continue;
         }
       else 
         {	
-          // calculate rlc buffer size
-          uint32_t rlcBufSize;
+	      // calculate rlc buffer size
+	        uint32_t rlcBufSize;
           uint8_t lcid;
           std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itRlcBuf;
           for (itRlcBuf = m_rlcBufferReq.begin (); itRlcBuf != m_rlcBufferReq.end (); itRlcBuf++)
-	    {
+	          {
               if ( (*itRlcBuf).first.m_rnti == (*itMax).first )
               lcid = (*itRlcBuf).first.m_lcId;
-	    }
+	          }
           LteFlowId_t flow ((*itMax).first, lcid);
           itRlcBuf = m_rlcBufferReq.find (flow);
           if (itRlcBuf!=m_rlcBufferReq.end ())
-	    rlcBufSize = (*itRlcBuf).second.m_rlcTransmissionQueueSize + (*itRlcBuf).second.m_rlcRetransmissionQueueSize + (*itRlcBuf).second.m_rlcStatusPduSize;
-	  if ( budget > rlcBufSize )
-	    budget = rlcBufSize;
+	          rlcBufSize = (*itRlcBuf).second.m_rlcTransmissionQueueSize + (*itRlcBuf).second.m_rlcRetransmissionQueueSize + (*itRlcBuf).second.m_rlcStatusPduSize;
+	        if ( budget > rlcBufSize )
+	          budget = rlcBufSize;
         }
 
       // assign RBGs to this UE 
@@ -605,12 +601,12 @@
 	        // find RBG with largest achievableRate
           double achievableRateMax = 0.0;
           rbgIndex = rbgNum;
- 	  for (int k = 0; k < rbgNum; k++)
-	    {
+ 	        for (int k = 0; k < rbgNum; k++)
+	          {
        	      std::set <uint8_t>::iterator rbg;
               rbg = allocatedRbg.find (k);
-	      if (rbg != allocatedRbg.end ())  // RBGs are already allocated to this UE
-	        continue;
+	            if (rbg != allocatedRbg.end ())  // RBGs are already allocated to this UE
+	              continue;
 
               std::vector <uint8_t> sbCqi;
               if (itCqi == m_a30CqiRxed.end ())
@@ -636,7 +632,7 @@
                   if (LcActivePerFlow ((*itMax).first) > 0)
                     {
                       // this UE has data to transmit
-	              double achievableRate = 0.0;
+	                    double achievableRate = 0.0;
                       for (uint8_t j = 0; j < nLayer; j++) 
                         {
                           uint8_t mcs = 0; 
@@ -652,26 +648,26 @@
                           achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
                         }
 
-	              if ( achievableRate > achievableRateMax )
-		        {
-		          achievableRateMax = achievableRate;
-		          rbgIndex = k;
-		        }
-		    }  // end of LcActivePerFlow
-		}  // end of cqi
+	   	              if ( achievableRate > achievableRateMax )
+		       	        {
+		                  achievableRateMax = achievableRate;
+		                  rbgIndex = k;
+		                }
+		              }  // end of LcActivePerFlow
+		            }  // end of cqi
             }  // end of for rbgNum
 
-	  if ( rbgIndex == rbgNum)  // impossible
-	    {
-	      // all RBGs are already assigned
-	      totalRbg = rbgNum;
-	      break;
-	    }
-	  else
-	    {
-	      // mark this UE as "allocated"
+	        if ( rbgIndex == rbgNum)  // impossible
+	          {
+	            // all RBGs are already assigned
+	            totalRbg = rbgNum;
+	            break;
+	          }
+	        else
+	          {
+	            // mark this UE as "allocated"
               allocatedRbg.insert (rbgIndex);
-	    }
+	          }
 
           // assign this RBG to UE
           std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
@@ -733,41 +729,41 @@
                 }
             }
  
- 	  bytesTxedTmp = bytesTxed;
+ 	        bytesTxedTmp = bytesTxed;
           bytesTxed = 0;
-	  for (uint8_t j = 0; j < nLayer; j++)
+	        for (uint8_t j = 0; j < nLayer; j++)
             {
               int tbSize = (m_amc->GetTbSizeFromMcs (m_amc->GetMcsFromCqi (worstCqi.at (j)), RbgPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213) 
               bytesTxed += tbSize;
             }
 
-        } // end of while()
+	      } // end of while()
 
-      // remove and unmark last RBG assigned to UE
-      if ( bytesTxed > budget )
-        {
+        // remove and unmark last RBG assigned to UE
+	    if ( bytesTxed > budget )
+	      {
           std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
           itMap = allocationMap.find ((*itMax).first);
           (*itMap).second.pop_back ();
           allocatedRbg.erase (rbgIndex);
-	  bytesTxed = bytesTxedTmp;  // recovery bytesTxed
+	        bytesTxed = bytesTxedTmp;  // recovery bytesTxed
           totalRbg--;
-	}
+	      }
 
-      // update UE stats
+        // update UE stats
       if ( bytesTxed <= (*itMax).second.tokenPoolSize )
         {
-	  (*itMax).second.tokenPoolSize -= bytesTxed;
+	        (*itMax).second.tokenPoolSize -= bytesTxed;
         }
       else
-        {
-          (*itMax).second.counter = (*itMax).second.counter - ( bytesTxed -  (*itMax).second.tokenPoolSize );
-          (*itMax).second.tokenPoolSize = 0;
-          if (bankSize <= ( bytesTxed -  (*itMax).second.tokenPoolSize ))
-            bankSize = 0;
-          else 
-            bankSize = bankSize - ( bytesTxed -  (*itMax).second.tokenPoolSize );
-        }
+	      {
+	        (*itMax).second.counter = (*itMax).second.counter - ( bytesTxed -  (*itMax).second.tokenPoolSize );
+	        (*itMax).second.tokenPoolSize = 0;
+	        if (bankSize <= ( bytesTxed -  (*itMax).second.tokenPoolSize ))
+	          bankSize = 0;
+	        else 
+	          bankSize = bankSize - ( bytesTxed -  (*itMax).second.tokenPoolSize );
+	      }
     } // end of RBGs
 
   // generate the transmission opportunities by grouping the RBGs of the same RNTI and
@@ -896,8 +892,7 @@
 void
 FdTbfqFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -1065,7 +1060,6 @@
         {
           // 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
         {
@@ -1077,7 +1071,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -1105,7 +1098,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
 
         }
       
@@ -1156,16 +1148,14 @@
 void
 FdTbfqFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 FdTbfqFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -1207,7 +1197,6 @@
 FdTbfqFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -1252,7 +1241,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1445,7 +1433,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1495,7 +1482,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/pss-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/pss-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -360,16 +360,14 @@
 void
 PssFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 PssFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -401,16 +399,14 @@
 void
 PssFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 PssFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -555,7 +551,6 @@
       else
         nMux = (int)((ueSet1.size() + ueSet2.size()) / 2) ; // TD scheduler only transfers half selected UE per RTT to TD scheduler
     }
-
   for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it--)
    {
      std::vector <std::pair<double, uint16_t> >::iterator itSet;
@@ -702,38 +697,38 @@
                           sbCqi = 0;
                         }
                       colMetric += (double)sbCqi / (double)(*itSbCqiSum).second;
-   	            } 
+   	                } 
                 }   // end if cqi
 
               double metric;
-	      if (colMetric != 0)
-	        metric= weight * colMetric;
-	      else
-	        metric = 1;
+	            if (colMetric != 0)
+	              metric= weight * colMetric;
+	            else
+	              metric = 1;
 
-    	      if (metric > metricMax )
+    	        if (metric > metricMax )
                 {
                   metricMax = metric;
                   itMax = it;
                 }
-	    } // end of tdUeSet
+	          } // end of tdUeSet
 
           if (itMax == m_flowStatsDl.end ())
             {
               // no UE available for downlink 
-	      return;
+	            return;
             }
           else
             {
               // assign all RBGs to this UE
               std::vector <uint16_t> tempMap;
-	      for (int i = 0; i < rbgNum; i++)
-	        {
+	            for (int i = 0; i < rbgNum; i++)
+	              {
                   tempMap.push_back (i);
-	        }
+	              }
               allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax).first, tempMap));
             }
-        }// end of rbgNum
+	      }// end of rbgNum
 
     }// end of CoIta
  
@@ -748,8 +743,8 @@
             {
               // calculate PF weigth 
               double weight = (*it).second.targetThroughput / (*it).second.lastAveragedThroughput;
-	      if (weight < 1.0)
-	        weight = 1.0;
+	            if (weight < 1.0)
+	              weight = 1.0;
 
               std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
               itCqi = m_a30CqiRxed.find ((*it).first);
@@ -795,9 +790,9 @@
                         {
                           // no info on this subband  -> worst MCS
                           mcs = 0;
-                        }
+                	      }
                       achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
-    	  	    }
+    	  	         }
                   schMetric = achievableRate / (*it).second.secondLastAveragedThroughput;
                 }   // end if cqi
  
@@ -995,8 +990,7 @@
 void
 PssFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -1164,7 +1158,6 @@
         {
           // 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
         {
@@ -1176,7 +1169,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -1204,8 +1196,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
-
         }
       
       rbAllocated += rbPerFlow;
@@ -1255,16 +1245,14 @@
 void
 PssFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 PssFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -1306,7 +1294,6 @@
 PssFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -1351,7 +1338,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1544,7 +1530,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1594,7 +1579,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/tdbet-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/tdbet-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -341,16 +341,14 @@
 void
 TdBetFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdBetFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -382,16 +380,14 @@
 void
 TdBetFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdBetFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -604,8 +600,7 @@
 void
 TdBetFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -774,7 +769,6 @@
         {
           // 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
         {
@@ -786,7 +780,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -814,7 +807,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
 
         }
       
@@ -846,9 +838,6 @@
       if (itStats != m_flowStatsUl.end ())
         {
           (*itStats).second.lastTtiBytesTransmitted =  uldci.m_tbSize;
-//                     NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTransmitted);
-
-
         }
       else
         {
@@ -879,8 +868,6 @@
       (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
       // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley)
       (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
-      //       NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted);
-      //       NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput);
       (*itStats).second.lastTtiBytesTransmitted = 0;
     }
   m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
@@ -891,16 +878,14 @@
 void
 TdBetFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdBetFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -942,7 +927,6 @@
 TdBetFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -987,7 +971,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1180,7 +1163,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1230,7 +1212,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/tdmt-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/tdmt-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -248,7 +248,7 @@
                    UintegerValue (1000),
                    MakeUintegerAccessor (&TdMtFfMacScheduler::m_cqiTimersThreshold),
                    MakeUintegerChecker<uint32_t> ())
-  ;
+    ;
   return tid;
 }
 
@@ -336,16 +336,14 @@
 void
 TdMtFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdMtFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -377,16 +375,14 @@
 void
 TdMtFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdMtFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -458,18 +454,18 @@
           NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it));
         }
       int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
-      uint8_t wbCqi = 0;
-      if (itCqi == m_p10CqiRxed.end())
-        {
-          wbCqi = 1; // start with lowest value
-        }
+	    uint8_t wbCqi = 0;
+	    if (itCqi == m_p10CqiRxed.end())
+	      {
+	        wbCqi = 1; // start with lowest value
+	      }
       else
         {
-          wbCqi = (*itCqi).second;
+	        wbCqi = (*itCqi).second;
         }
 
-      if (wbCqi > 0)
-        {
+	    if (wbCqi > 0)
+	      {
           if (LcActivePerFlow (*it) > 0)
             {
               // this UE has data to transmit
@@ -481,30 +477,30 @@
                   achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
                 }
 
-              double metric = achievableRate;
+			        double metric = achievableRate;
 
               if (metric > metricMax)
                 {
                   metricMax = metric;
                   itMax = it;
                 }
-            }
+           }
         } // end of wbCqi
     } // end for m_flowStatsDl
 
   if (itMax == m_flowStatsDl.end ())
     {
-      // no UE available for downlink  
-      return;
+      // no UE available for downlink 
+	    return;
     }
   else
     {
       // assign all RBGs to this UE
       std::vector <uint16_t> tempMap;
-      for (int i = 0; i < rbgNum; i++)
-        {
+	    for (int i = 0; i < rbgNum; i++)
+	      {
           tempMap.push_back (i);
-        }
+	      }
       allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax), tempMap));
     }
 
@@ -523,8 +519,8 @@
       newDci.m_rnti = (*itMap).first;
 
       uint16_t lcActives = LcActivePerFlow ((*itMap).first);
-      std::map <uint16_t,uint8_t>::iterator itCqi; 
-      itCqi = m_p10CqiRxed.find((*itMap).first);
+      std::map <uint16_t,uint8_t>::iterator itCqi;
+	    itCqi = m_p10CqiRxed.find((*itMap).first);
       std::map <uint16_t,uint8_t>::iterator itTxMode;
       itTxMode = m_uesTxMode.find ((*itMap).first);
       if (itTxMode == m_uesTxMode.end ())
@@ -601,8 +597,7 @@
 void
 TdMtFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -770,7 +765,6 @@
         {
           // 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
         {
@@ -782,7 +776,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -810,7 +803,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
 
         }
       
@@ -862,16 +854,14 @@
 void
 TdMtFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdMtFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -913,7 +903,6 @@
 TdMtFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -958,7 +947,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1151,7 +1139,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1201,7 +1188,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/tdtbfq-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/tdtbfq-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -375,16 +375,14 @@
 void
 TdTbfqFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdTbfqFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -416,16 +414,14 @@
 void
 TdTbfqFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdTbfqFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -661,18 +657,18 @@
       if (it != m_flowStatsDl.end ())
         {
           if ( bytesTxed <= (*it).second.tokenPoolSize )
-	    {
-	      (*it).second.tokenPoolSize -= bytesTxed;
-	    }
-	  else
-	    {
-	      (*it).second.counter = (*it).second.counter - ( bytesTxed -  (*it).second.tokenPoolSize );
-	      (*it).second.tokenPoolSize = 0;
-	      if (bankSize <= ( bytesTxed - (*it).second.tokenPoolSize ))
-	        bankSize = 0;
-	      else 
-	        bankSize = bankSize - ( bytesTxed -  (*it).second.tokenPoolSize );
-	    }
+	          {
+	            (*it).second.tokenPoolSize -= bytesTxed;
+	          }
+	        else
+	          {
+	            (*it).second.counter = (*it).second.counter - ( bytesTxed -  (*it).second.tokenPoolSize );
+	            (*it).second.tokenPoolSize = 0;
+	            if (bankSize <= ( bytesTxed - (*it).second.tokenPoolSize ))
+		            bankSize = 0;
+	            else 
+	              bankSize = bankSize - ( bytesTxed -  (*it).second.tokenPoolSize );
+	          }
         }
       else
         {
@@ -692,8 +688,7 @@
 void
 TdTbfqFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -861,7 +856,6 @@
         {
           // 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
         {
@@ -873,7 +867,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -901,7 +894,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
 
         }
       
@@ -952,16 +944,14 @@
 void
 TdTbfqFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TdTbfqFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -1003,7 +993,6 @@
 TdTbfqFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -1048,7 +1037,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1241,7 +1229,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1291,7 +1278,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;
--- a/src/lte/model/tta-ff-mac-scheduler.cc	Sun Oct 21 21:48:38 2012 -0400
+++ b/src/lte/model/tta-ff-mac-scheduler.cc	Fri Nov 30 18:40:56 2012 -0400
@@ -248,7 +248,7 @@
                    UintegerValue (1000),
                    MakeUintegerAccessor (&TtaFfMacScheduler::m_cqiTimersThreshold),
                    MakeUintegerChecker<uint32_t> ())
-  ;
+    ;
   return tid;
 }
 
@@ -336,16 +336,14 @@
 void
 TtaFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TtaFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -377,16 +375,14 @@
 void
 TtaFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TtaFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -475,14 +471,14 @@
               sbCqi = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
             }
 
-	  uint8_t wbCqi = 0;
-	  if (itWbCqi == m_p10CqiRxed.end())
-	    {
-	      wbCqi = 1; // start with lowest value
-	    }
+	        uint8_t wbCqi = 0;
+	        if (itWbCqi == m_p10CqiRxed.end())
+	          {
+	            wbCqi = 1; // start with lowest value
+	          }
           else
             {
-	      wbCqi = (*itWbCqi).second;
+	            wbCqi = (*itWbCqi).second;
             }
 
           uint8_t cqi1 = sbCqi.at(0);
@@ -497,7 +493,7 @@
               if (LcActivePerFlow (*it) > 0)
                 {
                   // this UE has data to transmit
-	          uint8_t sbMcs = 0; 
+	                uint8_t sbMcs = 0; 
                   uint8_t wbMcs = 0; 
                   double achievableSbRate = 1.0;
                   double achievableWbRate = 1.0;
@@ -519,7 +515,7 @@
 
                   double metric = achievableSbRate / achievableWbRate;
   
-	          if (metric > metricMax)
+		              if (metric > metricMax)
                     {
                       metricMax = metric;
                       itMax = it;
@@ -677,8 +673,7 @@
 void
 TtaFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -846,7 +841,6 @@
         {
           // 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
         {
@@ -858,7 +852,6 @@
             }
           for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
             {
-//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
               double sinr = (*itCqi).second.at (i);
               if (sinr == NO_SINR)
                 {
@@ -886,7 +879,6 @@
               continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
             }
           uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
-//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
 
         }
       
@@ -938,16 +930,14 @@
 void
 TtaFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
 void
 TtaFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
 {
-  NS_LOG_FUNCTION (this);
-  // TODO: Implementation of the API
+  NS_FATAL_ERROR ("unimplemented");
   return;
 }
 
@@ -989,7 +979,6 @@
 TtaFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
 {
   NS_LOG_FUNCTION (this);
-//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
   // retrieve the allocation for this subframe
   switch (m_ulCqiFilter)
     {
@@ -1034,7 +1023,6 @@
             // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
       //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
             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 ())
               {
@@ -1227,7 +1215,6 @@
   it = m_rlcBufferReq.find (flow);
   if (it!=m_rlcBufferReq.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
       // Update queues: RLC tx order Status, ReTx, Tx
       // Update status queue
       if ((*it).second.m_rlcStatusPduSize <= size)
@@ -1277,7 +1264,6 @@
   std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
   if (it!=m_ceBsrRxed.end ())
     {
-//       NS_LOG_DEBUG (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);      
       if ((*it).second >= size)
         {
           (*it).second -= size;