merge
authorMarco Miozzo <marco.miozzo@cttc.es>
Wed, 07 Mar 2012 18:15:12 +0100
changeset 8672 d02df5f59a0b
parent 8671 8d0f6849e90c (current diff)
parent 8670 8f63d16fb2e8 (diff)
child 8673 2295a668a11a
child 8674 2bd42ffd4fe8
merge
src/lte/model/lte-ue-mac.cc
--- a/src/lte/doc/source/lte-design.rst	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/doc/source/lte-design.rst	Wed Mar 07 18:15:12 2012 +0100
@@ -1092,12 +1092,19 @@
 the one described in [Piro2011]_, with the following modifications.  The model now includes the 
 inter cell intereference calculation and the simulation of uplink traffic, including both packet transmission and CQI generation. 
 
+
+MAC to Channel delay
+^^^^^^^^^^^^^^^^^^^^
+
+To model the latency of real MAC and PHY implementations, the PHY model simulates a MAC-to-channel delay in multiples of TTIs (1ms). The transmission of both data and control packets are delayed by this amount.
+
+
 CQI feedback
 ^^^^^^^^^^^^
 
 The generation of CQI feedback is done accordingly to what specified in [FFAPI]_. In detail, we considered the generation 
 of periodic wideband CQI (i.e., a single value of channel state that is deemed representative of all RBs 
-in use) and inband CQIs (i.e., a set of value representing the channel state for each RB). 
+in use) and inband CQIs (i.e., a set of value representing the channel state for each RB).
 
 Interference Model
 ^^^^^^^^^^^^^^^^^^
@@ -1174,8 +1181,8 @@
 where :math:`x` is the MI of the TB, :math:`b_{ECR}` represents the "transition center" and :math:`c_{ECR}` is related to the "transition width" of the Gaussian cumulative distribution for each Effective Code Rate (ECR) which is the actual transmission rate according to the channel coding and MCS. For limiting the computational complexity of the model we considered only a subset of the possible ECRs in fact we would have potentially 5076 possible ECRs (i.e., 27 MCSs and 188 CB sizes). On this respect, we will limit the CB sizes to some representative values (i.e., 40, 140, 160, 256, 512, 1024, 2048, 4032, 6144), while for the others the worst one approximating the real one will be used (i.e., the smaller CB size value available respect to the real one). This choice is aligned to the typical performance of turbo codes, where the CB size is not strongly impacting on the BLER. However, it is to be notes that for CB sizes lower than 1000 bits the effect might be relevant (i.e., till 2 dB); therefore, we adopt this unbalanced sampling interval for having more precision where it is necessary. This behaviour is confirmed by the figures presented in the Annes Section.
 
 
-Link Layer Performance
-^^^^^^^^^^^^^^^^^^^^^^
+BLER Curves
+^^^^^^^^^^^
 
 On this respect, we reused part of the curves obtained within [PaduaPEM]_. In detail, we introduced the CB size dependency to the CB BLER curves with the support of the developers of [PaduaPEM]_ and of the LTE Vienna Simulator. In fact, the module released provides the link layer performance only for what concerns the MCSs (i.e, with a given fixed ECR). In detail the new error rate curves for each has been evaluated with a simulation campaign with the link layer simulator for a single link with AWGN noise and for CB size of 104, 140, 256, 512, 1024, 2048, 4032 and 6144. These curves has been mapped with the Gaussian cumulative model formula presented above for obtaining the correspondents :math:`b_{ECR}` and :math:`c_{ECR}` parameters.
 
@@ -1259,8 +1266,8 @@
 
 
 
-Simulator Design
-^^^^^^^^^^^^^^^^
+Integration of the BLER curves in the ns-3 LTE module
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The model implemented uses the curves for the LSM of the recently LTE PHY Error Model released in the ns3 community by the Signet Group [PaduaPEM]_ and the new ones generated for different CB sizes. The ``LteSpectrumPhy`` class is in charge of evaluating the TB BLER thanks to the methods provided by the ``LteMiErrorModel`` class, which is in charge of evaluating the TB BLER according to the vector of the perceived SINR per RB, the MCS and the size in order to proper model the segmentation of the TB in CBs. In order to obtain the vector of the perceived SINR two instances of ``LtePemSinrChunkProcessor`` (child of ``LteSinrChunkProcessor`` dedicated to evaluate the SINR for obtaining physical error performance) have been attached to UE downlink and eNB uplink ``LteSpectrumPhy`` modules for evaluating the error model distribution respectively of PDSCH (UE side) and ULSCH (eNB side).
 
--- a/src/lte/examples/lena-dual-stripe.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/examples/lena-dual-stripe.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -29,7 +29,9 @@
 #include <iomanip>
 #include <string>
 #include <vector>
-#include <ns3/gtk-config-store.h>
+
+// uncomment this to use GtkConfigStore
+//#include <ns3/gtk-config-store.h>
 
 // The topology of this simulation program is inspired from 
 // 3GPP R4-092042, Section 4.2.1 Dual Stripe Model
--- a/src/lte/model/ideal-control-messages.h	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/ideal-control-messages.h	Wed Mar 07 18:15:12 2012 +0100
@@ -289,7 +289,7 @@
 class LteNetDevice;
 
 /**
-* The Fempto forum downlink CqiIdealControlMessage defines an ideal list of
+* The downlink CqiIdealControlMessage defines an ideal list of
 * feedback about the channel quality sent by the UE to the eNodeB.
 */
 class DlCqiIdealControlMessage : public IdealControlMessage
@@ -332,7 +332,7 @@
 class LteNetDevice;
 
 /**
-* The Fempto forum uplink BsrIdealControlMessage defines the specific
+* The uplink BsrIdealControlMessage defines the specific
 * extension of the CE element for reporting the buffer status report
 */
 class BsrIdealControlMessage : public IdealControlMessage
--- a/src/lte/model/lte-enb-phy.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-enb-phy.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -140,6 +140,12 @@
                    MakeDoubleAccessor (&LteEnbPhy::SetNoiseFigure, 
                                        &LteEnbPhy::GetNoiseFigure),
                    MakeDoubleChecker<double> ())
+    .AddAttribute ("MacToChannelDelay",
+                   "The delay in TTI units that occurs between a scheduling decision in the MAC and the actual start of the transmission by the PHY. This is intended to be used to model the latency of real PHY and MAC implementations.",
+                   UintegerValue (1),
+                   MakeUintegerAccessor (&LteEnbPhy::SetMacChDelay, 
+                                         &LteEnbPhy::GetMacChDelay),
+                   MakeUintegerChecker<uint8_t> ())
   ;
   return tid;
 }
@@ -208,6 +214,19 @@
   return m_noiseFigure;
 }
 
+void
+LteEnbPhy::SetMacChDelay (uint8_t delay)
+{
+  m_macChTtiDelay = delay;
+  m_packetBurstQueue.resize (delay);
+}
+
+uint8_t
+LteEnbPhy::GetMacChDelay (void) const
+{
+  return (m_macChTtiDelay);
+}
+
 bool
 LteEnbPhy::AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy)
 {
@@ -447,14 +466,10 @@
 
 
 void 
-LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr)
+LteEnbPhy::GenerateCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this << sinr);
-  Ptr<LteEnbNetDevice> thisDevice = GetDevice ()->GetObject<LteEnbNetDevice> ();
-
   m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr));
-
-
 }
 
 
--- a/src/lte/model/lte-enb-phy.h	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-enb-phy.h	Wed Mar 07 18:15:12 2012 +0100
@@ -85,6 +85,7 @@
    */
   double GetTxPower () const;
 
+
   /**
    * \param pw the noise figure in dB
    */
@@ -96,6 +97,16 @@
   double GetNoiseFigure () const;
 
   /**
+   * \param delay the TTI delay between MAC and channel
+   */
+  void SetMacChDelay (uint8_t delay);
+  
+  /**
+   * \returns the TTI delay between MAC and channel
+   */
+  uint8_t GetMacChDelay (void) const;
+
+  /**
   * \brief Queue the MAC PDU to be sent
   * \param p the MAC PDU to sent
   */
@@ -165,7 +176,7 @@
   void PhyPduReceived (Ptr<Packet> p);
 
   // inherited from LtePhy
-  virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
+  virtual void GenerateCqiReport (const SpectrumValue& sinr);
 
 
 private:
--- a/src/lte/model/lte-phy.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-phy.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -232,21 +232,6 @@
   return m_rbgSize;
 }
 
-
-void
-LtePhy::SetMacChDelay (uint8_t delay)
-{
-  m_macChTtiDelay = delay;
-  m_packetBurstQueue.resize (delay);
-}
-
-
-uint8_t
-LtePhy::GetMacChDelay (void)
-{
-  return (m_macChTtiDelay);
-}
-
 void
 LtePhy::SetMacPdu (Ptr<Packet> p)
 {
--- a/src/lte/model/lte-phy.h	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-phy.h	Wed Mar 07 18:15:12 2012 +0100
@@ -194,14 +194,6 @@
   */
   uint8_t GetRbgSize (void) const;
 
-  /**
-  * \param delay the TTI delay between MAC and channel
-  */
-  void SetMacChDelay (uint8_t delay);
-  /**
-  * \returns the TTI delay between MAC and channel
-  */
-  uint8_t GetMacChDelay (void);
 
   /**
   * \param p queue MAC PDU to be sent
@@ -214,7 +206,7 @@
   Ptr<PacketBurst> GetPacketBurst (void);
 
   /**
-  * \param p queue control message to be sent
+  * \param m the control message to be sent
   */
   void SetControlMessages (Ptr<IdealControlMessage> m);
 
@@ -225,11 +217,11 @@
 
 
   /** 
-   * generate CQI feedback based on the given SINR
+   * generate a CQI report based on the given SINR
    * 
    * \param sinr the SINR vs frequency measured by the device
    */
-  virtual void  GenerateCqiFeedback (const SpectrumValue& sinr) = 0;
+  virtual void  GenerateCqiReport (const SpectrumValue& sinr) = 0;
 
 
 
--- a/src/lte/model/lte-radio-bearer-tag.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-radio-bearer-tag.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -109,7 +109,7 @@
 void
 LteRadioBearerTag::Print (std::ostream &os) const
 {
-  os << "rnti=" << m_rnti << ", lcid=" << m_lcid;
+  os << "rnti=" << m_rnti << ", lcid=" << (uint16_t) m_lcid;
 }
 
 } // namespace ns3
--- a/src/lte/model/lte-rlc-am.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-rlc-am.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -98,7 +98,7 @@
 void
 LteRlcAm::DoTransmitPdcpPdu (Ptr<Packet> p)
 {
-  NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION (this << p->GetSize ());
 
   /** Store arrival time */
   Time now = Simulator::Now ();
@@ -191,11 +191,15 @@
   else if ( m_retxBufferSize > 0 )
     {
       NS_LOG_LOGIC ("Sending data from Retransmission Buffer");
-
-      Ptr<Packet> packet = m_retxBuffer.at (m_vtA.GetValue ()).m_pdu;
+      
+      Ptr<Packet> packet = m_retxBuffer.at (m_vtA.GetValue ()).m_pdu->Copy ();
 
       if ( packet->GetSize () <= bytes )
         {
+          LteRlcAmHeader rlcAmHeader;
+          packet->PeekHeader (rlcAmHeader);
+          NS_LOG_LOGIC ("AM RLC header: " << rlcAmHeader);
+
           // Send RLC PDU to MAC layer
           LteMacSapProvider::TransmitPduParameters params;
           params.pdu = packet;
@@ -205,6 +209,12 @@
           m_macSapProvider->TransmitPdu (params);
           return;
         }
+      else
+        {
+          NS_LOG_LOGIC ("Tx opportunity too small for retransmission of the packet (" << packet->GetSize () << " bytes)");
+          NS_LOG_LOGIC ("Waiting for bigger tx opportunity");
+          return;
+        }
     }
   else if ( m_txonBufferSize > 0 )
     {
@@ -478,7 +488,12 @@
   // Store new PDU into the Transmitted PDU Buffer
   NS_LOG_LOGIC ("Put transmitted PDU in the txedBuffer");
   m_txedBufferSize += packet->GetSize ();
-  m_txedBuffer.at ( rlcAmHeader.GetSequenceNumber ().GetValue () ) = packet;
+  m_txedBuffer.at ( rlcAmHeader.GetSequenceNumber ().GetValue () ) = packet->Copy ();
+  
+  // Sender timestamp
+  RlcTag rlcTag (Simulator::Now ());
+  packet->AddByteTag (rlcTag);
+  m_txPdu (m_rnti, m_lcid, packet->GetSize ());
 
   // Send RLC PDU to MAC layer
   LteMacSapProvider::TransmitPduParameters params;
@@ -498,11 +513,21 @@
 void
 LteRlcAm::DoReceivePdu (Ptr<Packet> p)
 {
-  NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION (this << p->GetSize ());
+
+  // Receiver timestamp
+  RlcTag rlcTag;
+  Time delay;
+  if (p->FindFirstMatchingByteTag (rlcTag))
+    {
+      delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
+    }
+  m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());
 
   // Get RLC header parameters
   LteRlcAmHeader rlcAmHeader;
   p->PeekHeader (rlcAmHeader);
+  NS_LOG_LOGIC ("AM RLC header: " << rlcAmHeader);
 
   if ( rlcAmHeader.IsDataPdu () )
     {
@@ -893,7 +918,7 @@
           if (m_txedBuffer.at (seqNumberValue))
             {
               NS_LOG_INFO ("Move SN = " << seqNumberValue << " to retxBuffer");
-              m_retxBuffer.at (seqNumberValue).m_pdu = m_txedBuffer.at (seqNumberValue);
+              m_retxBuffer.at (seqNumberValue).m_pdu = m_txedBuffer.at (seqNumberValue)->Copy ();
               m_retxBuffer.at (seqNumberValue).m_retxCount = 0;
               m_retxBufferSize += m_retxBuffer.at (seqNumberValue).m_pdu->GetSize ();
 
--- a/src/lte/model/lte-rlc-um.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-rlc-um.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -382,7 +382,7 @@
     {
       delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
     }
-  m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());
+  m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());
 
   // 5.1.2.2 Receive operations
 
--- a/src/lte/model/lte-sinr-chunk-processor.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-sinr-chunk-processor.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -74,7 +74,7 @@
   NS_LOG_FUNCTION (this);
   if (m_totDuration.GetSeconds () > 0)
     {
-      m_phy->GenerateCqiFeedback ((*m_sumSinr) / m_totDuration.GetSeconds ());
+      m_phy->GenerateCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
     }
   else
     {
--- a/src/lte/model/lte-spectrum-value-helper.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-spectrum-value-helper.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -65,7 +65,7 @@
   { 17, 734, 5730, 5730, 5849, 704, 23730, 23730, 23849},
   { 18, 860, 5850, 5850, 5999, 815, 23850, 23850, 23999},
   { 19, 875, 6000, 6000, 6149, 830, 24000, 24000, 24149},
-  { 20, 791, 6150, 6150, 6449, 832, 24150, 24150 - 24449},
+  { 20, 791, 6150, 6150, 6449, 832, 24150, 24150, 24449},
   { 21, 1495.9, 6450, 6450, 6599, 1447.9, 24450, 24450, 24599},
   { 33, 1900, 36000, 36000, 36199, 1900, 36000, 36000, 36199},
   { 34, 2010, 36200, 36200, 36349, 2010, 36200, 36200, 36349},
--- a/src/lte/model/lte-ue-mac.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-ue-mac.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -314,7 +314,7 @@
 void
 LteUeMac::DoAddLc (uint8_t lcId, LteMacSapUser* msu)
 {
-  NS_LOG_FUNCTION (this << " lcId" << lcId);
+  NS_LOG_FUNCTION (this << " lcId" << (uint16_t) lcId);
   NS_ASSERT_MSG (m_macSapUserMap.find (lcId) == m_macSapUserMap.end (), "cannot add channel because LCID " << lcId << " is already present");
   m_macSapUserMap[lcId] = msu;
 }
--- a/src/lte/model/lte-ue-phy.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-ue-phy.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -152,6 +152,12 @@
                    MakeDoubleAccessor (&LteUePhy::SetNoiseFigure, 
                                        &LteUePhy::GetNoiseFigure),
                    MakeDoubleChecker<double> ())
+    .AddAttribute ("MacToChannelDelay",
+                   "The delay in TTI units that occurs between a scheduling decision in the MAC and the actual start of the transmission by the PHY. This is intended to be used to model the latency of real PHY and MAC implementations.",
+                   UintegerValue (1),
+                   MakeUintegerAccessor (&LteUePhy::SetMacChDelay, 
+                                         &LteUePhy::GetMacChDelay),
+                   MakeUintegerChecker<uint8_t> ())
   ;
   return tid;
 }
@@ -208,6 +214,19 @@
 }
 
 void
+LteUePhy::SetMacChDelay (uint8_t delay)
+{
+  m_macChTtiDelay = delay;
+  m_packetBurstQueue.resize (delay);
+}
+
+uint8_t
+LteUePhy::GetMacChDelay (void) const
+{
+  return (m_macChTtiDelay);
+}
+
+void
 LteUePhy::DoSendMacPdu (Ptr<Packet> p)
 {
   NS_LOG_FUNCTION (this);
@@ -282,7 +301,7 @@
 }
 
 void
-LteUePhy::GenerateCqiFeedback (const SpectrumValue& sinr)
+LteUePhy::GenerateCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this);
   // check periodic wideband CQI
--- a/src/lte/model/lte-ue-phy.h	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/model/lte-ue-phy.h	Wed Mar 07 18:15:12 2012 +0100
@@ -102,6 +102,16 @@
   double GetNoiseFigure () const;
 
   /**
+   * \param delay the TTI delay between MAC and channel
+   */
+  void SetMacChDelay (uint8_t delay);
+
+  /**
+   * \returns the TTI delay between MAC and channel
+   */
+  uint8_t GetMacChDelay (void) const;
+
+  /**
    * \brief Queue the MAC PDU to be sent
    * \param p the MAC PDU to sent
    */
@@ -151,7 +161,7 @@
 
 
   // inherited from LtePhy
-  virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
+  virtual void GenerateCqiReport (const SpectrumValue& sinr);
 
   virtual void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
   virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
--- a/src/lte/test/lte-test-ue-phy.cc	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/test/lte-test-ue-phy.cc	Wed Mar 07 18:15:12 2012 +0100
@@ -78,7 +78,7 @@
 }
 
 void
-LteTestUePhy::GenerateCqiFeedback (const SpectrumValue& sinr)
+LteTestUePhy::GenerateCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this);
 
--- a/src/lte/test/lte-test-ue-phy.h	Wed Mar 07 18:07:35 2012 +0100
+++ b/src/lte/test/lte-test-ue-phy.h	Wed Mar 07 18:15:12 2012 +0100
@@ -58,7 +58,7 @@
    */
   virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
 
-  virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
+  virtual void GenerateCqiReport (const SpectrumValue& sinr);
 
   virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);