merge traces
authorManuel Requena <manuel.requena@cttc.es>
Tue, 29 Nov 2011 16:30:11 +0100
changeset 8424 ff9ac3a2ae04
parent 8423 721b6be6b47d (current diff)
parent 8419 91691fb3ca34 (diff)
child 8426 a3a8c6a8a5b9
child 8428 18b75acf693b
merge traces
--- a/src/buildings/test/buildings-pathloss-test.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/buildings/test/buildings-pathloss-test.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -203,6 +203,7 @@
   NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
  
   NS_TEST_ASSERT_MSG_EQ_TOL (loss, m_lossRef, 0.1, "Wrong loss !");
+  Simulator::Destroy ();
 }
 
 Ptr<MobilityModel>
--- a/src/buildings/test/buildings-shadowing-test.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/buildings/test/buildings-shadowing-test.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -135,6 +135,7 @@
   NS_LOG_INFO ("Mean from simulation " << mean << ", sigma " << sigma << ", reference value " << m_sigmaRef << ", CI(99%) " << ci);
 
   NS_TEST_ASSERT_MSG_EQ_TOL (fabs (mean), 0.0, ci, "Wrong shadowing distribution !");
+  Simulator::Destroy ();
 }
 
 
--- a/src/lte/examples/lena-epc-first.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/examples/lena-epc-first.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -56,7 +56,7 @@
   Ptr<LenaHelper> lteHelper = CreateObject<LenaHelper> ();
   Ptr<EpcHelper>  epcHelper = CreateObject<EpcHelper> ();
   lteHelper->SetEpcHelper (epcHelper);
-  //lteHelper->SetSchedulerType("ns3::RrFfMacScheduler");
+  lteHelper->SetSchedulerType("ns3::RrFfMacScheduler");
 
   ConfigStore inputConfig;
   inputConfig.ConfigureDefaults();
--- a/src/lte/helper/lena-helper.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/helper/lena-helper.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -539,8 +539,24 @@
   std::string propModelStr = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
  
   const char* propModel = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
-  LogComponentEnable (propModel, LOG_LEVEL_ALL);
-  if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
+  if (propModelStr.compare ("RandomPropagationLossModel") ||
+    propModelStr.compare ("FriisPropagationLossModel")||
+    propModelStr.compare ("TwoRayGroundPropagationLossModel")||
+    propModelStr.compare ("LogDistancePropagationLossModel")||
+    propModelStr.compare ("ThreeLogDistancePropagationLossModel")||
+    propModelStr.compare ("NakagamiPropagationLossModel")||
+    propModelStr.compare ("FixedRssLossModel")||
+    propModelStr.compare ("MatrixPropagationLossModel")||
+    propModelStr.compare ("RangePropagationLossModel"))
+    {
+      LogComponentEnable ("PropagationLossModel", LOG_LEVEL_ALL);
+    }
+  else
+    {
+      LogComponentEnable (propModel, LOG_LEVEL_ALL);
+    }
+    
+  if (m_fadingModelType.compare ("ns3::TraceFadingLossModel") == 0)
     {
       const char* fadingModel = m_fadingModelType.erase (0,5).c_str ();
       LogComponentEnable (fadingModel, LOG_LEVEL_ALL);
--- a/src/lte/model/lte-enb-mac.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/model/lte-enb-mac.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -538,7 +538,15 @@
     }
   else
     {
-      (*it).second.m_ulReception.at (tag.GetLcid () - 1) += p->GetSize ();
+      if ((*it).second.m_ulReception.size () < tag.GetLcid ())
+        {
+          std::vector <uint16_t>::iterator itV = (*it).second.m_ulReception.begin ();
+          (*it).second.m_ulReception.insert (itV + (tag.GetLcid () - 1), p->GetSize ());
+        }
+      else
+        {
+          (*it).second.m_ulReception.at (tag.GetLcid () - 1) += p->GetSize ();
+        }
       (*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
     }
 
--- a/src/lte/model/lte-enb-phy.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/model/lte-enb-phy.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -397,8 +397,6 @@
     }
 
   // trigger the MAC
-  Ptr<LteEnbMac> macEntity = GetDevice ()->GetObject<LteEnbNetDevice> ()->GetMac ();
-
   m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);
 
 
--- a/src/lte/model/lte-ue-mac.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/model/lte-ue-mac.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -31,6 +31,7 @@
 #include "lte-mac-tag.h"
 #include <ns3/ff-mac-common.h>
 #include <ns3/ideal-control-messages.h>
+#include <ns3/simulator.h>
 
 
 NS_LOG_COMPONENT_DEFINE ("LteUeMac");
@@ -161,7 +162,7 @@
 void
 UeMemberLteUePhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
 {
-  NS_LOG_LOGIC (this << " UE-MAC does not yet support this primitive");
+  m_mac->DoSubframeIndication (frameNo, subframeNo);
 }
 
 void
@@ -189,6 +190,9 @@
 
 
 LteUeMac::LteUeMac ()
+  :  m_bsrPeriodicity (MilliSeconds (1)), // ideal behavior
+  m_bsrLast (MilliSeconds (0))
+  
 {
   NS_LOG_FUNCTION (this);
   m_macSapProvider = new UeMemberLteMacSapProvider (this);
@@ -263,24 +267,51 @@
 LteUeMac::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters params)
 {
   NS_LOG_FUNCTION (this);
+  
+  std::map <uint8_t, long uint>::iterator it;
+  
+  
+  it = m_ulBsrReceived.find (params.lcid);
+  if (it!=m_ulBsrReceived.end ())
+    {
+      // update entry
+      (*it).second = params.txQueueSize + params.retxQueueSize + params.statusPduSize;
+    }
+  else
+    {
+      m_ulBsrReceived.insert (std::pair<uint8_t, long uint> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize));
+    }
+}
+
+
+void
+LteUeMac::SendReportBufferStatus (void)
+{
+  NS_LOG_FUNCTION (this);
   MacCeListElement_s bsr;
   bsr.m_rnti = m_rnti;
   bsr.m_macCeType = MacCeListElement_s::BSR;
-  // short BSR
-  int queue = params.txQueueSize;
-  int index = 0;
-  if (BufferSizeLevelBsr[63] < queue)
+  // BSR
+  std::map <uint8_t, long uint>::iterator it;
+  NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
+  
+  for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
     {
-      index = 63;
+      int queue = (*it).second;
+      int index = 0;
+      if (BufferSizeLevelBsr[63] < queue)
+        {
+          index = 63;
+        }
+      else
+        {
+          while (BufferSizeLevelBsr[index] < queue)
+            {
+              index++;
+            }
+        }
+      bsr.m_macCeValue.m_bufferStatus.push_back (index);
     }
-  else
-    {
-      while (BufferSizeLevelBsr[index] < queue)
-        {
-          index++;
-        }
-    }
-  bsr.m_macCeValue.m_bufferStatus.push_back (index);
 
   // create the feedback to eNB
   Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
@@ -336,9 +367,33 @@
     {
       Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
       UlDciListElement_s dci = msg2->GetDci ();
-      std::map <uint8_t, LteMacSapUser*>::iterator it; 
-      it = m_macSapUserMap.begin ();  // use only the first LC --> UE-SCHEDULER??
-      (*it).second->NotifyTxOpportunity (dci.m_tbSize);
+      std::map <uint8_t, long uint>::iterator itBsr;
+      NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
+      int activeLcs = 0;
+      for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++)
+        {
+          if ((*itBsr).second > 0)
+            {
+              activeLcs++;
+            }
+        }
+      if (activeLcs <= 0)
+        {
+          NS_LOG_ERROR (this << " No active flows for this UL-DCI");
+          return;
+        }
+      std::map <uint8_t, LteMacSapUser*>::iterator it;
+      NS_LOG_FUNCTION (this << " UE: UL-CQI notified TxOpportunity of " << dci.m_tbSize);
+      for (it = m_macSapUserMap.begin (); it!=m_macSapUserMap.end (); it++)
+        {
+          itBsr = m_ulBsrReceived.find ((*it).first);
+          if (itBsr!=m_ulBsrReceived.end ())
+            {
+              NS_LOG_FUNCTION (this << "\t" << dci.m_tbSize / m_macSapUserMap.size () << " bytes to LC " << (uint16_t)(*it).first << " queue " << (*itBsr).second);
+              (*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs);
+              (*itBsr).second -= dci.m_tbSize / activeLcs;
+            }
+        }
 
     }
   else
@@ -348,4 +403,16 @@
 }
 
 
+void
+LteUeMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
+{
+  NS_LOG_FUNCTION (this);
+  if (Simulator::Now () >= m_bsrLast + m_bsrPeriodicity)
+    {
+      SendReportBufferStatus ();
+      m_bsrLast = Simulator::Now ();
+    }
+}
+
+
 } // namespace ns3
--- a/src/lte/model/lte-ue-mac.h	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/model/lte-ue-mac.h	Tue Nov 29 16:30:11 2011 +0100
@@ -29,6 +29,7 @@
 #include <ns3/lte-mac-sap.h>
 #include <ns3/lte-ue-cmac-sap.h>
 #include <ns3/lte-ue-phy-sap.h>
+#include <ns3/nstime.h>
 
 
 namespace ns3 {
@@ -62,6 +63,14 @@
   * \param s a pointer to the PHY SAP Provider
   */
   void SetLteUePhySapProvider (LteUePhySapProvider* s);
+  
+  /**
+  * \brief Forwarded from LteUePhySapUser: trigger the start from a new frame
+  *
+  * \param frameNo frame number
+  * \param subframeNo subframe number
+  */
+  void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
 
 private:
   // forwarded from MAC SAP
@@ -76,6 +85,8 @@
   // forwarded from PHY SAP
   void DoReceivePhyPdu (Ptr<Packet> p);
   void DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  
+  void SendReportBufferStatus (void);
 
 private:
   // end of temporary hack
@@ -87,6 +98,11 @@
 
   LteUePhySapProvider* m_uePhySapProvider;
   LteUePhySapUser* m_uePhySapUser;
+  
+  std::map <uint8_t, long uint> m_ulBsrReceived; // BSR received from RLC (BSR up to now)
+  
+  Time m_bsrPeriodicity;
+  Time m_bsrLast;
 
 
   uint16_t m_rnti;
--- a/src/lte/model/lte-ue-phy.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/model/lte-ue-phy.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -491,6 +491,9 @@
     {
       m_uplinkSpectrumPhy->StartTx (pb);
     }
+    
+  // trigger the MAC
+  m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
 
 }
 
--- a/src/lte/model/rr-ff-mac-scheduler.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/model/rr-ff-mac-scheduler.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -321,16 +321,20 @@
 {
   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::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
+  std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
   bool newLc = true;
-  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
+  while (it != m_rlcBufferReq.end ())
     {
       // remove old entries of this UE-LC
       if (((*it).m_rnti == params.m_rnti)&&((*it).m_logicalChannelIdentity == params.m_logicalChannelIdentity))
         {
-          m_rlcBufferReq.erase (it);
+          it = m_rlcBufferReq.erase (it);
           newLc = false;
         }
+      else
+        {
+          ++it;
+        }
     }
   // add the new parameters
   m_rlcBufferReq.insert (it, params);
--- a/src/lte/test/lte-test-downlink-sinr.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/test/lte-test-downlink-sinr.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -252,7 +252,6 @@
 
   Simulator::Stop (Seconds (5.0));
   Simulator::Run ();
-  Simulator::Destroy ();
 
   /**
    * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
@@ -264,4 +263,6 @@
   NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
  
   NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
+  dlPhy->Dispose ();
+  Simulator::Destroy ();
 }
--- a/src/lte/test/lte-test-interference.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/test/lte-test-interference.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -113,7 +113,7 @@
 LteInterferenceTestCase::DoRun (void)
 {
   Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
-  //   lena->EnableLogComponents ();
+//   lena->EnableLogComponents ();
   lena->EnableMacTraces ();
   lena->EnableRlcTraces ();
   lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
@@ -163,7 +163,6 @@
   lena->ActivateEpsBearer (ueDevs1, bearer, LteTft::Default ());
   lena->ActivateEpsBearer (ueDevs2, bearer, LteTft::Default ());
 
-
   // Use testing chunk processor in the PHY layer
   // It will be used to test that the SNR is as intended
   // we plug in two instances, one for DL and one for UL
@@ -200,8 +199,9 @@
                    MakeBoundCallback (&LteTestUlSchedulingCallback, this));
 
 
-  Simulator::Stop (Seconds (0.005));
+  Simulator::Stop (Seconds (0.006));
   Simulator::Run ();
+  
 
   double dlSinr1Db = 10.0 * log10 (testDlSinr1->GetSinr ()[0]);
   NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr1Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB1 --> UE1)");
@@ -211,7 +211,7 @@
 
   double dlSinr2Db = 10.0 * log10 (testDlSinr2->GetSinr ()[0]);
   NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr2Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB2 --> UE2)");
-
+  
   double ulSinr2Db = 10.0 * log10 (testUlSinr2->GetSinr ()[0]);
   NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr2Db, m_ulSinrDb, 0.01, "Wrong SINR in UL!  (UE2 --> eNB2)");
 
@@ -241,10 +241,10 @@
 {
   /**
    * Note:
-   *    For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
+   *    For first 5 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
    *    because CQI feedback is still not available at the eNB.
    */
-  if ( (frameNo > 1) || (subframeNo > 4) )
+  if ( (frameNo > 1) || (subframeNo > 5) )
     {
       NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcs, m_ulMcs, "Wrong UL MCS");
     }
--- a/src/lte/test/lte-test-uplink-sinr.cc	Tue Nov 29 16:27:59 2011 +0100
+++ b/src/lte/test/lte-test-uplink-sinr.cc	Tue Nov 29 16:30:11 2011 +0100
@@ -292,7 +292,6 @@
 
   Simulator::Stop (Seconds (5.0));
   Simulator::Run ();
-  Simulator::Destroy ();
 
   /**
    * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
@@ -304,4 +303,7 @@
   NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
   
   NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
+  ulPhy->Dispose ();
+  Simulator::Destroy ();
+  
 }