Add new UE CQI Measurement and AMC module based on LteMiErrorModel
authorMarco Miozzo <marco.miozzo@cttc.es>
Tue, 21 Feb 2012 17:43:38 +0100
changeset 8646 4b341d8f2f61
parent 8645 830ef9489c92
child 8647 f6fad6b36154
Add new UE CQI Measurement and AMC module based on LteMiErrorModel
src/lte/doc/source/lte-design.rst
src/lte/doc/source/lte-user.rst
src/lte/model/lte-amc.cc
src/lte/model/lte-amc.h
src/lte/model/lte-mi-error-model.cc
src/lte/model/lte-mi-error-model.h
src/lte/model/lte-ue-phy.cc
src/lte/test/lte-test-interference.cc
src/lte/test/lte-test-link-adaptation.cc
src/lte/test/lte-test-pf-ff-mac-scheduler.cc
src/lte/test/lte-test-phy-error-model.cc
src/lte/test/lte-test-rr-ff-mac-scheduler.cc
--- a/src/lte/doc/source/lte-design.rst	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/doc/source/lte-design.rst	Tue Feb 21 17:43:38 2012 +0100
@@ -543,8 +543,9 @@
 Adaptive Modulation and Coding
 ------------------------------
 
-The Adaptive Modulation and Coding (AMC) model that we provide in the
-simulator is a modified version of the model described in [Piro2011]_,
+The simulator provides two Adaptive Modulation and Coding (AMC) models: one based on the GSoC model [Piro2011]_ and one based on the physical error model (described in the following sections).
+
+The former model is a modified version of the model described in [Piro2011]_,
 which in turn is inspired from [Seo2004]_. Our version is described in the
 following. Let :math:`i` denote the
 generic user, and let :math:`\gamma_i` be its SINR. We get the spectral efficiency
@@ -560,7 +561,7 @@
 
 The procedure described in [R1-081483]_ is used to get
 the corresponding MCS scheme. The spectral efficiency is quantized based on the
-CQI (rounding to the lowest value) and is mapped to the corresponding MCS
+channel quality indicator (CQI), rounding to the lowest value, and is mapped to the corresponding MCS
 scheme. 
 
 Finally, we note that there are some discrepancies between the MCS index
@@ -572,6 +573,8 @@
 is 1. Hence to get the value as intended by the standard we need to subtract 1
 from the index reported in [R1-081483]_. 
 
+The alternative model is based on the physical error model developed for this simulator and explained in the following subsections. This scheme is able to adapt the MCS selection to the actual PHY layer performance according to the specific CQI report. According to their definition, a CQI index is assigned when a single PDSCH TB with the modulation coding scheme and code rate correspondent to that CQI index in table 7.2.3-1 of [TS36.213]_ can be received with an error probability less than 0.1. In case of wideband CQIs, the reference TB includes all the RBGs available in order to have a reference based on the whole available resources; while, for subband CQIs, the reference TB is sized as the RBGs.
+
 
 Round Robin (RR) Scheduler
 --------------------------
--- a/src/lte/doc/source/lte-user.rst	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/doc/source/lte-user.rst	Tue Feb 21 17:43:38 2012 +0100
@@ -532,6 +532,24 @@
   
 
 
+AMC Model and CQI Calculation
+-----------------------------
+
+The simulator provides two possible schemes for what concerns the selection of the MCSs and correspondly the generation of the CQIs. The first one is based on the GSoC module [Piro2011]_ and works per RB basis. This model can be activated with the ns3 attribute system, as presented in the following::
+
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+
+While, the solution based on the physical error model can be controlled with:
+
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::MiErrorModel));
+
+Finally, the required BER can be setted for fine tuning of the AMC module thanks to the ``Ber`` attribute, for instance:
+
+  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
+
+We note that the model ``PiroEW2010`` is designed for working with a BER of 0.00005, while ``MiErrorModel`` with a BER of 0.1.
+
+
 
 Evolved Packet Core (EPC)
 -------------------------
--- a/src/lte/model/lte-amc.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/model/lte-amc.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -25,6 +25,7 @@
 #include <ns3/log.h>
 #include <ns3/assert.h>
 #include <math.h>
+#include <vector>
 #include <ns3/spectrum-value.h>
 #include <ns3/double.h>
 #include "ns3/enum.h"
@@ -223,15 +224,15 @@
   .AddConstructor<LteAmc> ()
   .AddAttribute ("Ber",
                  "The requested BER in assigning MCS (default is 0.00005).",
-                 DoubleValue (0.00005),
+                 DoubleValue (0.1),
                  MakeDoubleAccessor (&LteAmc::m_ber),
                  MakeDoubleChecker<double> ())
   .AddAttribute ("AmcModel",
                 "AMC model used to assign CQI",
-                 EnumValue (LteAmc::Piro),
+                 EnumValue (LteAmc::MiErrorModel),
                  MakeEnumAccessor (&LteAmc::m_amcModel),
-                 MakeEnumChecker (LteAmc::Vienna, "Vienna",
-                                  LteAmc::Piro, "Piro"));
+                 MakeEnumChecker (LteAmc::MiErrorModel, "Vienna",
+                                  LteAmc::PiroEW2010, "PiroEW2010"));
   return tid;
 }
 
@@ -297,7 +298,7 @@
   std::vector<int> cqi;
   Values::const_iterator it;
   
-  if (m_amcModel == Piro)
+  if (m_amcModel == PiroEW2010)
     {
 
       for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
@@ -332,52 +333,54 @@
             }
         }
     }
-  else if (m_amcModel == Vienna)
+  else if (m_amcModel == MiErrorModel)
     {
-      uint8_t rbgNum = 1;//ceil ((double)sinr.length () / (double)rbgSize);
-
-      for (uint8_t i = 0; i < rbgNum; i++)
+      NS_LOG_DEBUG (this << " AMC-VIENNA RBG size " << (uint16_t)rbgSize);
+      NS_ASSERT_MSG (rbgSize > 0, " LteAmc-Vienna: RBG size must be greater than 0");
+      std::vector <int> rbgMap;
+      int rbId = 0;
+      for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
       {
-        std::vector <int> rbgMap;
-        for (uint8_t j = 0; j < rbgSize; j++)
-          {
-            rbgMap.push_back ((i * rbgSize) + j);
-            
-          }
-        uint8_t mcs = 0;
-        double ber = 0.0;
-        while (mcs < 28)
-          {
-//             ber = LteMiErrorModel::GetTbError (sinr, rbgMap, GetTbSizeFromMcs (mcs, rbgSize), mcs);
-            if (ber > 0.1)
-              break;
-            mcs++;
-            
-          }
-        int rbgCqi = 0;
-        if ((ber > 0.1)&&(mcs==0))
-          {
-            rbgCqi = 0; // any MCS can guarantee the 10 % of BER
-          }
-        else if (mcs == 28)
-          {
-            rbgCqi = 15; // best MCS
-          }
-        else
-          {
-            double s = SpectralEfficiencyForMcs[mcs];
-            rbgCqi = 0;
-            while ((rbgCqi < 15) && (SpectralEfficiencyForCqi[rbgCqi + 1] < s))
-            {
-              ++rbgCqi;
-            }
-          }
-        
-        // fill the cqi vector (per RB basis)
-        for (uint8_t j = 0; j < rbgSize; j++)
-          {
-            cqi.push_back (rbgCqi);
-          }
+        rbgMap.push_back (rbId++);
+        if ((rbId % rbgSize == 0)||((it+1)==sinr.ConstValuesEnd ()))
+         {
+            uint8_t mcs = 0;
+            double ber = 0.0;
+            while (mcs < 28)
+              {
+                ber = LteMiErrorModel::GetTbError (sinr, rbgMap, (uint16_t)GetTbSizeFromMcs (mcs, rbgSize), mcs);
+                if (ber > m_ber)
+                  break;
+                mcs++;
+                
+              }
+            NS_LOG_DEBUG (this << "\t RBG " << rbId << " MCS " << (uint16_t)mcs << " BER " << ber);
+            int rbgCqi = 0;
+            if ((ber > 0.1)&&(mcs==0))
+              {
+                rbgCqi = 0; // any MCS can guarantee the 10 % of BER
+              }
+            else if (mcs == 28)
+              {
+                rbgCqi = 15; // all MCSs can guarantee the 10 % of BER
+              }
+            else
+              {
+                double s = SpectralEfficiencyForMcs[mcs];
+                rbgCqi = 0;
+                while ((rbgCqi < 15) && (SpectralEfficiencyForCqi[rbgCqi + 1] < s))
+                {
+                  ++rbgCqi;
+                }
+              }
+            NS_LOG_DEBUG (this << "\t CQI " << rbgCqi);
+            // fill the cqi vector (per RB basis)
+            for (uint8_t j = 0; j < rbgSize; j++)
+              {
+                cqi.push_back (rbgCqi);
+              }
+            rbgMap.clear ();
+         }
         
       }
       
--- a/src/lte/model/lte-amc.h	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/model/lte-amc.h	Tue Feb 21 17:43:38 2012 +0100
@@ -51,8 +51,11 @@
   
   enum AmcModel
     {
-      Piro, // model based on GSoC code from 3GPP R1-081483 "Conveying MCS and TB size via PDCCH")
-      Vienna // model based on 10% of BER according to LteMiErrorModel based on Lte Vienna link level simulator BLER curves
+      PiroEW2010, // BER should be set at 0.00005
+      // model based on Piro, G.; Grieco, L.A.; Boggia, G.; Camarda, P.;
+      //A two-level scheduling algorithm for QoS support in the downlink of 
+      //LTE cellular networks European Wireless Conference (EW), 2010
+      MiErrorModel // model based on 10% of BER according to LteMiErrorModel
     };
   
   /**
--- a/src/lte/model/lte-mi-error-model.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/model/lte-mi-error-model.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -203,7 +203,7 @@
 
 
 double 
-LteMiErrorModel::Mib (SpectrumValue& sinr, const std::vector<int>& map, uint8_t mcs)
+LteMiErrorModel::Mib (const SpectrumValue& sinr, const std::vector<int>& map, uint8_t mcs)
 {
   NS_LOG_FUNCTION (sinr << &map << (uint32_t) mcs);
   
@@ -212,8 +212,8 @@
   
   for (uint i = 0; i < map.size (); i++)
     {
-//       int id = map.at (i);
-      double sinrLin = sinr[map.at (i)];
+      SpectrumValue sinrCopy = sinr;
+      double sinrLin = sinrCopy[map.at (i)];
       double sinr_db = 10*log10 (sinrLin);
       if (mcs <= 10) // QPSK
         {
@@ -324,7 +324,7 @@
 
 
 double
-LteMiErrorModel::GetTbError (SpectrumValue& sinr, const std::vector<int>& map, uint16_t size, uint8_t mcs)
+LteMiErrorModel::GetTbError (const SpectrumValue& sinr, const std::vector<int>& map, uint16_t size, uint8_t mcs)
 {
   NS_LOG_FUNCTION (sinr << &map << (uint32_t) size << (uint32_t) mcs);
   
--- a/src/lte/model/lte-mi-error-model.h	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/model/lte-mi-error-model.h	Tue Feb 21 17:43:38 2012 +0100
@@ -57,7 +57,7 @@
    * \param cms the MCS of the TB
    * \return the mmib
    */
-  static double Mib (SpectrumValue& sinr, const std::vector<int>& map, uint8_t mcs);
+  static double Mib (const SpectrumValue& sinr, const std::vector<int>& map, uint8_t mcs);
   /** 
    * \brief map the mmib (mean mutual information per bit) for different MCS
    * \param mmib mean mutual information per bit of a code-block
@@ -72,7 +72,7 @@
    * \param modulation the modulations (qpsk, 16-qam, 64-qam)
    * \param code block-size and code-rate
    */  
-  static double GetTbError (SpectrumValue& sinr, const std::vector<int>& map, uint16_t size, uint8_t mcs);
+  static double GetTbError (const SpectrumValue& sinr, const std::vector<int>& map, uint16_t size, uint8_t mcs);
 
 
 //private:
--- a/src/lte/model/lte-ue-phy.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/model/lte-ue-phy.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -310,7 +310,7 @@
 {
   NS_LOG_FUNCTION (this);
 
-  std::vector<int> cqi = m_amc->CreateCqiFeedbacks (sinr);
+  std::vector<int> cqi = m_amc->CreateCqiFeedbacks (sinr, GetRbgSize ());
 
   // CREATE DlCqiIdealControlMessage
   Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
--- a/src/lte/test/lte-test-interference.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/test/lte-test-interference.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -23,6 +23,7 @@
 #include "ns3/log.h"
 #include "ns3/string.h"
 #include "ns3/double.h"
+#include <ns3/enum.h>
 
 #include "ns3/mobility-helper.h"
 #include "ns3/lte-helper.h"
@@ -112,6 +113,8 @@
 void
 LteInterferenceTestCase::DoRun (void)
 {
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
   Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
 //   lteHelper->EnableLogComponents ();
   lteHelper->EnableMacTraces ();
--- a/src/lte/test/lte-test-link-adaptation.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/test/lte-test-link-adaptation.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -22,6 +22,7 @@
 #include "ns3/log.h"
 #include "ns3/string.h"
 #include "ns3/double.h"
+#include <ns3/enum.h>
 
 #include "ns3/mobility-helper.h"
 #include "ns3/lte-helper.h"
@@ -154,6 +155,9 @@
 void
 LteLinkAdaptationTestCase::DoRun (void)
 {
+  
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
   /**
     * Simulation Topology
     */
--- a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -47,6 +47,7 @@
 #include <ns3/lte-enb-phy.h>
 #include <ns3/lte-ue-phy.h>
 #include <ns3/boolean.h>
+#include <ns3/enum.h>
 
 
 NS_LOG_COMPONENT_DEFINE ("LenaTestPfFfMacCheduler");
@@ -206,6 +207,8 @@
 void
 LenaPfFfMacSchedulerTestCase1::DoRun (void)
 {
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
   Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
   LogComponentDisableAll (LOG_LEVEL_ALL);
   //   LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
--- a/src/lte/test/lte-test-phy-error-model.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/test/lte-test-phy-error-model.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -45,7 +45,7 @@
 #include <ns3/lte-ue-phy.h>
 #include <ns3/config.h>
 #include <ns3/boolean.h>
-
+#include <ns3/enum.h>
 
 
 NS_LOG_COMPONENT_DEFINE ("LenaTestPhyErrorModel");
@@ -109,6 +109,7 @@
   
    double ber = 0.01;
   Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (ber));
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
   Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (true));
   
 //   LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
--- a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc	Mon Feb 20 15:58:05 2012 +0100
+++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc	Tue Feb 21 17:43:38 2012 +0100
@@ -43,6 +43,7 @@
 #include <ns3/lte-enb-phy.h>
 #include <ns3/lte-ue-phy.h>
 #include <ns3/boolean.h>
+#include <ns3/enum.h>
 
 
 NS_LOG_COMPONENT_DEFINE ("LenaTestRrFfMacCheduler");
@@ -191,6 +192,8 @@
 LenaRrFfMacSchedulerTestCase::DoRun (void)
 {
   Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
+  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
   LogComponentDisableAll (LOG_LEVEL_ALL);
 //   LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
 //   LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);