Add SRS signaling
authorMarco Miozzo <marco.miozzo@cttc.es>
Mon, 25 Jun 2012 13:41:13 +0200
changeset 9036 5e09b29d4af5
parent 9035 e40974228d94
child 9037 e3629d54e53a
Add SRS signaling
src/lte/helper/lte-helper.cc
src/lte/model/lte-common.h
src/lte/model/lte-enb-cmac-sap.h
src/lte/model/lte-enb-mac.cc
src/lte/model/lte-enb-mac.h
src/lte/model/lte-enb-net-device.cc
src/lte/model/lte-enb-phy-sap.h
src/lte/model/lte-enb-phy.cc
src/lte/model/lte-enb-phy.h
src/lte/model/lte-enb-rrc.cc
src/lte/model/lte-enb-rrc.h
src/lte/model/lte-phy.cc
src/lte/model/lte-phy.h
src/lte/model/lte-sinr-chunk-processor.cc
src/lte/model/lte-spectrum-phy.cc
src/lte/model/lte-ue-mac.cc
src/lte/model/lte-ue-phy-sap.h
src/lte/model/lte-ue-phy.cc
src/lte/model/lte-ue-phy.h
src/lte/model/lte-ue-rrc.cc
src/lte/test/lte-test-phy-error-model.cc
src/lte/test/lte-test-ue-phy.cc
src/lte/test/lte-test-ue-phy.h
--- a/src/lte/helper/lte-helper.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/helper/lte-helper.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -475,6 +475,7 @@
   uint16_t rnti = enbRrc->AddUe (ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ());
   Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
   ueRrc->ConfigureUe (rnti, enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId () );
+  //enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
 
   // attach UE to eNB
   ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
@@ -498,12 +499,13 @@
     }
  
   // WILD HACK - should be done through PHY SAP, probably passing by RRC
+  NS_LOG_DEBUG ("!Attach eNB " << enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId () << " with UE " << rnti);
   uePhy->SetRnti (rnti);
   uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
                          enbDevice->GetObject<LteEnbNetDevice> ()->GetDlBandwidth ());
   uePhy->DoSetEarfcn (enbDevice->GetObject<LteEnbNetDevice> ()->GetDlEarfcn (),
                       enbDevice->GetObject<LteEnbNetDevice> ()->GetUlEarfcn ());
-
+  enbRrc->ConfigureNewUe (rnti);
   ueDevice->Start ();
   
   m_downlinkChannel->AddRx (uePhy->GetDownlinkSpectrumPhy ());
--- a/src/lte/model/lte-common.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-common.h	Mon Jun 25 13:41:13 2012 +0200
@@ -59,7 +59,9 @@
 struct LteUeConfig_t
 {
   uint16_t  m_rnti;
+  bool      m_reconfigureFlag;
   uint8_t   m_transmissionMode;
+  uint16_t  m_srsConfigurationIndex;
   
   public:
     LteUeConfig_t ();
--- a/src/lte/model/lte-enb-cmac-sap.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-cmac-sap.h	Mon Jun 25 13:41:13 2012 +0200
@@ -26,7 +26,7 @@
 #include <ns3/ff-mac-common.h>
 #include <ns3/eps-bearer.h>
 #include <ns3/lte-common.h>
-#include <ns3/ff-mac-csched-sap.h>
+//#include <ns3/ff-mac-csched-sap.h>
 
 namespace ns3 {
 
@@ -98,7 +98,7 @@
    */
   virtual void ReleaseLc (uint16_t rnti, uint8_t lcid) = 0;
   
-  virtual void RrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params) = 0;
+  virtual void UeUpdateConfigurationReq (LteUeConfig_t params) = 0;
 
 
 };
--- a/src/lte/model/lte-enb-mac.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-mac.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -62,7 +62,7 @@
   virtual void AddLc (LcInfo lcinfo, LteMacSapUser* msu);
   virtual void ReconfigureLc (LcInfo lcinfo);
   virtual void ReleaseLc (uint16_t rnti, uint8_t lcid);
-  virtual void RrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params);
+  virtual void UeUpdateConfigurationReq (LteUeConfig_t params);
 
 private:
   LteEnbMac* m_mac;
@@ -105,9 +105,9 @@
 }
 
 void
-EnbMacMemberLteEnbCmacSapProvider::RrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params)
+EnbMacMemberLteEnbCmacSapProvider::UeUpdateConfigurationReq (LteUeConfig_t params)
 {
-  m_mac->DoRrcUpdateConfigurationReq (params);
+  m_mac->DoUeUpdateConfigurationReq (params);
 }
 
 
@@ -870,11 +870,12 @@
 }
 
 void
-LteEnbMac::DoRrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params)
+LteEnbMac::DoUeUpdateConfigurationReq (LteUeConfig_t params)
 {
   NS_LOG_FUNCTION (this);
   // propagates to PHY layer
   m_enbPhySapProvider->SetTransmissionMode (params.m_rnti, params.m_transmissionMode);
+  m_enbPhySapProvider->SetSrsConfigurationIndex (params.m_rnti, params.m_srsConfigurationIndex);
   // propagates to scheduler
   FfMacCschedSapProvider::CschedUeConfigReqParameters req;
   req.m_rnti = params.m_rnti;
--- a/src/lte/model/lte-enb-mac.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-mac.h	Mon Jun 25 13:41:13 2012 +0200
@@ -163,7 +163,7 @@
   void DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind);
   void DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters params);
   
-  void DoRrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params);
+  void DoUeUpdateConfigurationReq (LteUeConfig_t params);
 
   /**
   * \brief Forwarded from LteEnbPhySapUser: trigger the start from a new frame
--- a/src/lte/model/lte-enb-net-device.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-net-device.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -277,6 +277,7 @@
   NS_LOG_FUNCTION (this);
 
   m_rrc->ConfigureCell (m_ulBandwidth, m_dlBandwidth);
+  m_rrc->SetCellId (m_cellId);
 
   // Configuring directly for now, but ideally we should use the PHY
   // SAP instead. Probably should handle this through the RRC.
--- a/src/lte/model/lte-enb-phy-sap.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-phy-sap.h	Mon Jun 25 13:41:13 2012 +0200
@@ -59,6 +59,12 @@
   * \param txMode the transmissionMode of the user
   */
   virtual void SetTransmissionMode (uint16_t  rnti, uint8_t txMode) = 0;
+  
+  /**
+  * \param rnti the RNTI of the user
+  * \param txMode the SRS Configuration Index of the user
+  */
+  virtual void SetSrsConfigurationIndex (uint16_t  rnti, uint16_t srsCI) = 0;
 
   /** 
    * 
--- a/src/lte/model/lte-enb-phy.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-phy.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -58,6 +58,7 @@
   virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
   virtual uint8_t GetMacChTtiDelay ();
   virtual void SetTransmissionMode (uint16_t  rnti, uint8_t txMode);
+  virtual void SetSrsConfigurationIndex (uint16_t  rnti, uint16_t srsCI);
   
 
 private:
@@ -106,6 +107,12 @@
   m_phy->DoSetTransmissionMode (rnti, txMode);
 }
 
+void
+EnbMemberLteEnbPhySapProvider::SetSrsConfigurationIndex (uint16_t  rnti, uint16_t srsCI)
+{
+  m_phy->DoSetSrsConfigurationIndex (rnti, srsCI);
+}
+
 
 ////////////////////////////////////////
 // generic LteEnbPhy methods
@@ -125,7 +132,8 @@
 LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
   : LtePhy (dlPhy, ulPhy),
     m_nrFrames (0),
-    m_nrSubFrames (0)
+    m_nrSubFrames (0),
+    m_srsPeriodicity (0)
 {
   m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
   Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
@@ -547,16 +555,25 @@
 
 
 void 
-LteEnbPhy::GenerateCqiReport (const SpectrumValue& sinr)
+LteEnbPhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this << sinr);
-  UlCqi_s ulcqi = CreateUlCqiReport (sinr);
+  UlCqi_s ulcqi = CreateSrsCqiReport (sinr);
+  m_enbPhySapUser->UlCqiReport (ulcqi);
+}
+
+void
+LteEnbPhy::GenerateDataCqiReport (const SpectrumValue& sinr)
+{
+  NS_LOG_FUNCTION (this << sinr);
+  UlCqi_s ulcqi = CreatePuschCqiReport (sinr);
   m_enbPhySapUser->UlCqiReport (ulcqi);
 }
 
 
+
 UlCqi_s
-LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr)
+LteEnbPhy::CreatePuschCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this << sinr);
   Values::const_iterator it;
@@ -576,6 +593,28 @@
 	
 }
 
+
+UlCqi_s
+LteEnbPhy::CreateSrsCqiReport (const SpectrumValue& sinr)
+{
+  NS_LOG_FUNCTION (this << sinr);
+  Values::const_iterator it;
+  UlCqi_s ulcqi;
+  ulcqi.m_type = UlCqi_s::PUSCH;
+  int i = 0;
+  for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
+  {
+    double sinrdb = 10 * log10 ((*it));
+    //       NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
+    // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
+    int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
+    ulcqi.m_sinr.push_back (sinrFp);
+    i++;
+  }
+  return (ulcqi);
+  
+}
+
 void
 LteEnbPhy::DoSetTransmissionMode (uint16_t  rnti, uint8_t txMode)
 {
@@ -612,5 +651,22 @@
     }
 }
 
+void
+LteEnbPhy::DoSetSrsConfigurationIndex (uint16_t  rnti, uint16_t srsCI)
+{
+  NS_LOG_FUNCTION (this);
+  m_srsPeriodicity = GetSrsPeriodicity (srsCI);
+  NS_LOG_DEBUG (this << " ENB SRS P " << m_srsPeriodicity << " RNTI " << rnti << " offset " << GetSrsSubframeOffset (srsCI) << " CI " << srsCI);
+  std::map <uint16_t,uint16_t>::iterator it = m_srsCounter.find (rnti);
+  if (it != m_srsCounter.end ())
+    {
+      (*it).second = GetSrsSubframeOffset (srsCI) + 1;
+    }
+    else
+    {
+      m_srsCounter.insert (std::pair<uint16_t, uint16_t> (rnti, GetSrsSubframeOffset (srsCI) + 1));
+    }
+}
+
 
 };
--- a/src/lte/model/lte-enb-phy.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-phy.h	Mon Jun 25 13:41:13 2012 +0200
@@ -112,6 +112,10 @@
   */
   virtual void DoSendMacPdu (Ptr<Packet> p);
   
+  virtual void DoSetTransmissionMode (uint16_t  rnti, uint8_t txMode);
+  
+  virtual void DoSetSrsConfigurationIndex (uint16_t  rnti, uint16_t srsCI);
+    
   virtual uint8_t DoGetMacChTtiDelay ();
 
 
@@ -142,10 +146,17 @@
 
   /**
   * \brief Create the UL CQI feedback from SINR values perceived at
-  * the physical layer with the signal received from eNB
+  * the physical layer with the PUSCH signal received from eNB
   * \param sinr SINR values vector
   */
-  UlCqi_s CreateUlCqiReport (const SpectrumValue& sinr);
+  UlCqi_s CreatePuschCqiReport (const SpectrumValue& sinr);
+  
+  /**
+  * \brief Create the UL CQI feedback from SINR values perceived at
+  * the physical layer with the SRS signal received from eNB
+  * \param sinr SINR values vector
+  */
+  UlCqi_s CreateSrsCqiReport (const SpectrumValue& sinr);
 
 
   void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
@@ -153,9 +164,7 @@
   bool AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy);
 
   bool DeleteUePhy (uint16_t rnti);
-  
-  virtual void DoSetTransmissionMode (uint16_t  rnti, uint8_t txMode);
-  
+    
   void SendControlChannels (std::list<Ptr<LteControlMessage> > ctrlMsgList);
   void SendDataChannels (Ptr<PacketBurst> pb);
   
@@ -198,7 +207,8 @@
   virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
 
   // inherited from LtePhy
-  virtual void GenerateCqiReport (const SpectrumValue& sinr);
+  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
+  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
 
 
 private:
@@ -216,6 +226,9 @@
   uint32_t m_nrFrames;
   uint32_t m_nrSubFrames;
   
+  uint16_t m_srsPeriodicity;
+  std::map <uint16_t,uint16_t> m_srsCounter;
+  
 };
 
 
--- a/src/lte/model/lte-enb-rrc.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-rrc.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -16,7 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Nicola Baldo <nbaldo@cttc.es>
- *         Marco Miozzo <mmiozzo@cttc.es>
+ * Modified by: Marco Miozzo <mmiozzo@cttc.es> 
+ *                add transmission Mode and SRS related functionalities
  */
 
 #include <ns3/fatal-error.h>
@@ -35,6 +36,8 @@
 #include "ns3/object-map.h"
 #include <ns3/ff-mac-csched-sap.h>
 
+#include <ns3/simulator.h>
+
 // WILD HACK for UE-RRC direct communications
 #include <ns3/node-list.h>
 #include <ns3/node.h>
@@ -42,6 +45,7 @@
 #include <ns3/lte-ue-rrc.h>
 
 
+
 NS_LOG_COMPONENT_DEFINE ("LteEnbRrc");
 
 namespace ns3 {
@@ -124,12 +128,31 @@
   : m_lastAllocatedId (0)
 {
   m_imsi = 0;
+  m_srsConfigurationIndex = 0;
+  m_transmissionMode = 0;
 }
 
 UeInfo::UeInfo (uint64_t imsi)
   : m_lastAllocatedId (0)
 {
   m_imsi = imsi;
+  m_srsConfigurationIndex = 0;
+  m_transmissionMode = 0;
+}
+
+UeInfo::UeInfo (uint64_t imsi, uint16_t srsConfIndex)
+: m_lastAllocatedId (0)
+{
+  m_imsi = imsi;
+  m_srsConfigurationIndex = srsConfIndex;
+  m_transmissionMode = 0;
+}
+
+UeInfo::UeInfo (uint64_t imsi, uint16_t srsConfIndex, uint8_t txMode)
+{
+  m_imsi = imsi;
+  m_srsConfigurationIndex = srsConfIndex;
+  m_transmissionMode = txMode;
 }
 
 
@@ -158,6 +181,30 @@
   return m_imsi;
 }
 
+uint16_t
+UeInfo::GetSrsConfigurationIndex (void)
+{
+  return m_srsConfigurationIndex;
+}
+
+uint8_t
+UeInfo::GetTransmissionMode (void)
+{
+  return m_transmissionMode;
+}
+
+void
+UeInfo::SetSrsConfigurationIndex (uint16_t srsConfIndex)
+{
+  m_srsConfigurationIndex = srsConfIndex;
+}
+
+void
+UeInfo::SetTransmissionMode (uint8_t txMode)
+{
+  m_transmissionMode = txMode;
+}
+
 uint8_t
 UeInfo::AddRadioBearer (Ptr<LteRadioBearerInfo> rbi)
 {
@@ -213,7 +260,10 @@
     m_ffMacSchedSapProvider (0),
     m_macSapProvider (0),
     m_configured (false),
-    m_lastAllocatedRnti (0)
+    m_lastAllocatedRnti (0),
+    m_srsCurrentPeriodicityId (0),
+    m_lastAllocatedConfigurationIndex (0),
+    m_reconfigureUes (false)
 {
   NS_LOG_FUNCTION (this);
   m_cmacSapUser = new EnbRrcMemberLteEnbCmacSapUser (this);
@@ -388,12 +438,6 @@
   lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
   lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
   m_cmacSapProvider->AddLc (lcinfo, rlc->GetLteMacSapUser ());
-  
-  // Transmission mode settings
-  LteUeConfig_t ueConfig;
-  ueConfig.m_rnti = rnti;
-  ueConfig.m_transmissionMode = m_defaultTransmissionMode;
-  DoRrcConfigurationUpdateInd (ueConfig);
 
   return lcid;
 }
@@ -461,6 +505,16 @@
 // management of multiple UE info instances
 // /////////////////////////////////////////
 
+// from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
+uint16_t SrsPeriodicity[9] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
+uint16_t SrsCiLow[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+uint16_t SrsCiHigh[9] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
+
+void
+LteEnbRrc::SetCellId (uint16_t cellId)
+{
+  m_cellId = cellId;
+}
 
 uint16_t
 LteEnbRrc::CreateUeInfo (uint64_t imsi)
@@ -473,14 +527,135 @@
           if (m_ueMap.find (rnti) == m_ueMap.end ())
             {
               m_lastAllocatedRnti = rnti;
-              m_ueMap.insert (std::pair<uint16_t, Ptr<UeInfo> > (rnti, CreateObject<UeInfo> (imsi)));
+              Ptr<UeInfo> ueInfo = CreateObject<UeInfo> (imsi, GetNewSrsConfigurationIndex ());
+              m_ueMap.insert (std::pair<uint16_t, Ptr<UeInfo> > (rnti, ueInfo));
+              NS_LOG_DEBUG (this << " New UE RNTI " << rnti << " cellId " << m_cellId << " srs CI " << ueInfo->GetSrsConfigurationIndex ());
               return rnti;
             }
         }
     }
+    
   return 0;
 }
 
+uint16_t
+LteEnbRrc::GetNewSrsConfigurationIndex ()
+{
+  NS_LOG_FUNCTION (this << m_ueSrsConfigurationIndexSet.size ());
+  // SRS
+  if (m_srsCurrentPeriodicityId==0)
+    {
+      // no UEs -> init
+      m_ueSrsConfigurationIndexSet.insert (0);
+      m_lastAllocatedConfigurationIndex = 0;
+      m_srsCurrentPeriodicityId++;
+      
+      return 0;
+    }
+    NS_LOG_DEBUG (this << " SRS p " << SrsPeriodicity[m_srsCurrentPeriodicityId] << " set " << m_ueSrsConfigurationIndexSet.size ());
+  if (m_ueSrsConfigurationIndexSet.size () == SrsPeriodicity[m_srsCurrentPeriodicityId])
+    {
+      NS_LOG_DEBUG (this << " SRS reconfigure CIs " << SrsPeriodicity[m_srsCurrentPeriodicityId] << " to " << SrsPeriodicity[m_srsCurrentPeriodicityId+1] << " at " << Simulator::Now ());
+      // increase the current periocity for having enough CIs
+      m_ueSrsConfigurationIndexSet.clear ();
+      m_srsCurrentPeriodicityId++;
+      // update all the UE's CI
+      uint16_t srsCI = SrsCiLow[m_srsCurrentPeriodicityId];
+      std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+      for (it = m_ueMap.begin (); it != m_ueMap.end (); it++)
+        {
+          (*it).second->SetSrsConfigurationIndex (srsCI);
+          m_ueSrsConfigurationIndexSet.insert (srsCI);
+          m_lastAllocatedConfigurationIndex = srsCI;
+          srsCI++;
+          // send update to peer RRC
+          LteUeConfig_t ueConfig;
+          ueConfig.m_rnti = (*it).first;
+          ueConfig.m_transmissionMode = (*it).second->GetTransmissionMode ();
+          ueConfig.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+          ueConfig.m_reconfigureFlag = false;
+          NS_LOG_DEBUG (this << "\t rnti "<<ueConfig.m_rnti<< " CI " << ueConfig.m_srsConfigurationIndex);
+          SendUeConfigurationUpdate (ueConfig);
+        }
+      m_ueSrsConfigurationIndexSet.insert (m_lastAllocatedConfigurationIndex + 1);
+      m_lastAllocatedConfigurationIndex++;
+    }
+  else
+    {
+      // find a CI from the available ones
+      std::set<uint16_t>::reverse_iterator rit = m_ueSrsConfigurationIndexSet.rbegin ();
+      NS_LOG_DEBUG (this << " lower bound " << (*rit) << " of " << SrsCiHigh[m_srsCurrentPeriodicityId]);
+      if ((*rit) <= SrsCiHigh[m_srsCurrentPeriodicityId])
+        {
+          // got it from the upper bound
+          m_lastAllocatedConfigurationIndex = (*rit) + 1;
+          m_ueSrsConfigurationIndexSet.insert (m_lastAllocatedConfigurationIndex);
+        }
+      else
+        {
+          // look for released ones
+          for (uint16_t srsCI = SrsCiLow[m_srsCurrentPeriodicityId]; srsCI < SrsCiHigh[m_srsCurrentPeriodicityId]; srsCI++) 
+            {
+              std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find (srsCI);
+              if (it==m_ueSrsConfigurationIndexSet.end ())
+                {
+                  m_lastAllocatedConfigurationIndex = srsCI;
+                  m_ueSrsConfigurationIndexSet.insert (srsCI);
+                  break;
+                }
+            }
+        } 
+    }
+  return m_lastAllocatedConfigurationIndex;
+  
+}
+
+
+void
+LteEnbRrc::RemoveSrsConfigurationIndex (uint16_t srsCI)
+{
+  NS_LOG_FUNCTION (this << srsCI);
+  std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find (srsCI);
+  NS_ASSERT_MSG (it != m_ueSrsConfigurationIndexSet.end (), "request to remove unkwown SRS CI " << srsCI);
+  m_ueSrsConfigurationIndexSet.erase (it);
+  if (m_ueSrsConfigurationIndexSet.size () < SrsPeriodicity[m_srsCurrentPeriodicityId - 1])
+    {
+      // reduce the periodicity
+      m_ueSrsConfigurationIndexSet.clear ();
+      m_srsCurrentPeriodicityId--;
+      if (m_srsCurrentPeriodicityId==0)
+        {
+          // no active users : renitialize structures
+          m_lastAllocatedConfigurationIndex = 0;
+        }
+      else
+        {
+          // update all the UE's CI
+          uint16_t srsCI = SrsCiLow[m_srsCurrentPeriodicityId];
+          std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+          for (it = m_ueMap.begin (); it != m_ueMap.end (); it++)
+            {
+              (*it).second->SetSrsConfigurationIndex (srsCI);
+              m_ueSrsConfigurationIndexSet.insert (srsCI);
+              m_lastAllocatedConfigurationIndex = srsCI;
+              srsCI++;
+              // send update to peer RRC
+              LteUeConfig_t ueConfig;
+              ueConfig.m_rnti = (*it).first;
+              ueConfig.m_transmissionMode = (*it).second->GetTransmissionMode ();
+              ueConfig.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+              ueConfig.m_reconfigureFlag = false;
+              NS_LOG_DEBUG (this << "\t rnti "<<ueConfig.m_rnti<< " CI " << ueConfig.m_srsConfigurationIndex);
+              if (Simulator::Now ()!=Seconds(0))
+                {
+                  // avoid multiple reconfiguration during initialization
+                  SendUeConfigurationUpdate (ueConfig);
+                }
+            }
+        }
+    }
+}
+
 Ptr<UeInfo>
 LteEnbRrc::GetUeInfo (uint16_t rnti)
 {
@@ -497,7 +672,9 @@
   NS_LOG_FUNCTION (this << (uint32_t) rnti);
   std::map <uint16_t, Ptr<UeInfo> >::iterator it = m_ueMap.find (rnti);
   NS_ASSERT_MSG (it != m_ueMap.end (), "request to remove UE info with unknown rnti " << rnti);
+  RemoveSrsConfigurationIndex ((*it).second->GetSrsConfigurationIndex ());
   m_ueMap.erase (it);
+  // remove SRS configuration index
 }
 
 
@@ -505,10 +682,46 @@
 LteEnbRrc::DoRrcConfigurationUpdateInd (LteUeConfig_t params)
 {
   NS_LOG_FUNCTION (this);
-  // up tp now only for TxMode change
-  // update the peer UE-RRC on the change
+  // at this stage used only by the scheduler for updating txMode
+  // retrieve UE info
+  std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+  it = m_ueMap.find (params.m_rnti);
+  NS_ASSERT_MSG (it!=m_ueMap.end (), "Unable to find UeInfo");
+  params.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+  // update Tx Mode info
+  (*it).second->SetTransmissionMode (params.m_transmissionMode);
+  params.m_reconfigureFlag = true;
+  // answer to MAC (and scheduler) and forward info to UEs
+  SendUeConfigurationUpdate (params);  
+}
+
+void
+LteEnbRrc::ConfigureNewUe (uint16_t rnti)
+{
+  NS_LOG_FUNCTION (this);
+  // at this stage used only by the scheduler for updating txMode
+  // retrieve UE info
+  std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+  it = m_ueMap.find (rnti);
+  NS_ASSERT_MSG (it!=m_ueMap.end (), "Unable to find UeInfo");
+  LteUeConfig_t params;
+  params.m_rnti = rnti;
+  params.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+  params.m_transmissionMode = (*it).second->GetTransmissionMode ();
+  params.m_reconfigureFlag = false;
+  // answer to MAC (and scheduler) and forward info to UEs
+  SendUeConfigurationUpdate (params);  
+}
+
+void
+LteEnbRrc::SendUeConfigurationUpdate (LteUeConfig_t params)
+{
+  NS_LOG_FUNCTION (this);
+  // send LteUeConfig_t to MAC layer and peer RRCs
+  m_cmacSapProvider->UeUpdateConfigurationReq (params);
   NodeList::Iterator listEnd = NodeList::End ();
   bool done = false;
+  params.m_reconfigureFlag = false;
   for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
     {
       Ptr<Node> node = *i;
@@ -523,7 +736,7 @@
           else
             {
               Ptr<LteUeRrc> ueRrc = uedev->GetRrc ();
-              if (ueRrc->GetRnti () == params.m_rnti)
+              if ((ueRrc->GetRnti () == params.m_rnti)&&(ueRrc->GetCellId () == m_cellId))
                 {
                   ueRrc->DoRrcConfigurationUpdateInd (params);
                   done = true;
@@ -536,12 +749,6 @@
         }
     }
   NS_ASSERT_MSG (done , " Unable to find peer UE-RRC, RNTI " << params.m_rnti);
-  // answer to MAC (and scheduler)
-  FfMacCschedSapProvider::CschedUeConfigReqParameters req;
-  req.m_rnti = params.m_rnti;
-  req.m_transmissionMode = params.m_transmissionMode;
-  m_cmacSapProvider->RrcUpdateConfigurationReq (req);
-  
 }
 
 
--- a/src/lte/model/lte-enb-rrc.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-enb-rrc.h	Mon Jun 25 13:41:13 2012 +0200
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by: Marco Miozzo <mmiozzo@cttc.es> 
+ *                add transmission Mode and SRS related functionalities
  */
 
 #ifndef LTE_ENB_RRC_H
@@ -28,6 +30,7 @@
 #include <ns3/lte-pdcp-sap.h>
 
 #include <map>
+#include <set>
 
 namespace ns3 {
 
@@ -74,16 +77,24 @@
 
   UeInfo (void);
   UeInfo (uint64_t imsi);
+  UeInfo (uint64_t imsi, uint16_t srsConfIndex);
+  UeInfo (uint64_t imsi, uint16_t srsConfIndex, uint8_t txMode);
   virtual ~UeInfo (void);
 
   static TypeId GetTypeId (void);
 
   uint64_t GetImsi (void);
+  uint16_t GetSrsConfigurationIndex (void);
+  uint8_t GetTransmissionMode (void);
+  void SetSrsConfigurationIndex (uint16_t srsConfIndex);
+  void SetTransmissionMode (uint8_t txMode);
 
 private:
   std::map <uint8_t, Ptr<LteRadioBearerInfo> > m_rbMap;
   uint8_t m_lastAllocatedId;
   uint64_t m_imsi;
+  uint16_t m_srsConfigurationIndex;
+  uint8_t  m_transmissionMode;
 };
 
 
@@ -166,6 +177,8 @@
    * \return the C-RNTI of the newly added UE
    */
   uint16_t AddUe (uint64_t imsi);
+  
+  void SetCellId (uint16_t m_cellId);
 
   /**
    * remove a UE from the cell
@@ -218,11 +231,16 @@
    */
   void SetForwardUpCallback (Callback <void, Ptr<Packet> > cb);
   
+//   void DoStart ();
+
+  void ConfigureNewUe (uint16_t rnti);
+  
   
 private:
 
   void DoReceiveRrcPdu (LtePdcpSapUser::ReceiveRrcPduParameters params);
   void DoRrcConfigurationUpdateInd (LteUeConfig_t params);
+  void SendUeConfigurationUpdate (LteUeConfig_t params);
   
   void DoNotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success);
   LtePdcpSapProvider* GetLtePdcpSapProvider (uint16_t rnti, uint8_t lcid);
@@ -231,6 +249,8 @@
   uint16_t CreateUeInfo (uint64_t imsi);
   Ptr<UeInfo> GetUeInfo (uint16_t rnti);
   void RemoveUeInfo (uint16_t rnti);
+  uint16_t GetNewSrsConfigurationIndex (void);
+  void RemoveSrsConfigurationIndex (uint16_t srsCI);
 
   Callback <void, Ptr<Packet> > m_forwardUpCallback;
 
@@ -244,9 +264,17 @@
   bool m_configured;
   uint16_t m_lastAllocatedRnti;
 
-  std::map<uint16_t, Ptr<UeInfo> > m_ueMap;
+  std::map<uint16_t, Ptr<UeInfo> > m_ueMap;  
   
   uint8_t m_defaultTransmissionMode;
+  
+  uint16_t m_cellId;
+  
+  // SRS related attributes
+  uint16_t m_srsCurrentPeriodicityId;
+  std::set<uint16_t> m_ueSrsConfigurationIndexSet;
+  uint16_t m_lastAllocatedConfigurationIndex;
+  bool m_reconfigureUes;
 
 };
 
--- a/src/lte/model/lte-phy.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-phy.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -35,6 +35,7 @@
 
 NS_OBJECT_ENSURE_REGISTERED (LtePhy);
 
+
 LtePhy::LtePhy ()
 {
   NS_LOG_FUNCTION (this);
@@ -48,7 +49,8 @@
     m_ulBandwidth (0),
     m_dlBandwidth (0),
     m_rbgSize (0),
-    m_macChTtiDelay (0)
+    m_macChTtiDelay (0),
+    m_cellId (0)
 {
   NS_LOG_FUNCTION (this);
 }
@@ -209,6 +211,43 @@
     }
 }
 
+
+uint16_t
+LtePhy::GetSrsPeriodicity (uint16_t srsCI) const
+{
+  // from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
+  uint16_t SrsPeriodicity[9] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
+  uint16_t SrsCiLow[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+  uint16_t SrsCiHigh[9] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
+  uint8_t i;
+  for (i = 8; i > 0; i --)
+    {
+      if ((srsCI>=SrsCiLow[i])&&(srsCI<=SrsCiHigh[i]))
+        {
+          break;
+        }
+    }
+  return SrsPeriodicity[i];
+}
+
+uint16_t
+LtePhy::GetSrsSubframeOffset (uint16_t srsCI) const
+{
+  // from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
+  uint16_t SrsSubframeOffset[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+  uint16_t SrsCiLow[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+  uint16_t SrsCiHigh[9] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
+  uint8_t i;
+  for (i = 8; i > 0; i --)
+    {
+      if ((srsCI>=SrsCiLow[i])&&(srsCI<=SrsCiHigh[i]))
+        {
+          break;
+        }
+    }
+  return (srsCI - SrsSubframeOffset[i]);
+}
+
 void 
 LtePhy::DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn)
 {
--- a/src/lte/model/lte-phy.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-phy.h	Mon Jun 25 13:41:13 2012 +0200
@@ -195,6 +195,19 @@
   * \returns the RB gruop size according to the bandwidth
   */
   uint8_t GetRbgSize (void) const;
+  
+  
+  /**
+  * \returns the SRS periodicity (see Table 8.2-1 of 36.213)
+  * \param srsCI the SRS Configuration Index
+  */
+  uint16_t GetSrsPeriodicity (uint16_t srsCI) const;
+  
+  /**
+  * \returns the SRS Subframe offset (see Table 8.2-1 of 36.213)
+  * \param srsCI the SRS Configuration Index
+  */
+  uint16_t GetSrsSubframeOffset (uint16_t srsCI) const;
 
 
   /**
@@ -219,23 +232,19 @@
 
 
   /** 
-   * generate a CQI report based on the given SINR
+   * generate a CQI report based on the given SINR of Ctrl frame
    * 
    * \param sinr the SINR vs frequency measured by the device
    */
-  virtual void  GenerateCqiReport (const SpectrumValue& sinr) = 0;
+  virtual void  GenerateCtrlCqiReport (const SpectrumValue& sinr) = 0;
   
   /** 
-  * Send the control channels (PCFICH and PDCCH in downlink and SRS in uplink)
-  *
+  * generate a CQI report based on the given SINR of Data frame
+  * (used for PUSCH CQIs)
+  * 
+  * \param sinr the SINR vs frequency measured by the device
   */
-//   virtual void SendControlChannels (void) = 0;
-  
-  /** 
-  * Send the PDSCH/PUSCH TBs
-  * 
-  */
-//   virtual void SendDataChannels (void) = 0;
+  virtual void  GenerateDataCqiReport (const SpectrumValue& sinr) = 0;
 
 
 
--- a/src/lte/model/lte-sinr-chunk-processor.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-sinr-chunk-processor.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -76,7 +76,7 @@
   NS_LOG_FUNCTION (this);
   if (m_totDuration.GetSeconds () > 0)
     {
-      m_phy->GenerateCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
+      m_phy->GenerateCtrlCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
     }
   else
     {
@@ -143,7 +143,7 @@
     m_spectrumPhy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
     if (m_phy)
       {
-        m_phy->GenerateCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
+        m_phy->GenerateDataCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
       }
   }
   else
--- a/src/lte/model/lte-spectrum-phy.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-spectrum-phy.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -497,7 +497,7 @@
       ChangeState (TX);
       NS_ASSERT (m_channel);
       double ulCtrlFrame = 0.000071429; // 0.001 / 14 * 1 (fixed to 1 symbols)
-      Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+      Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
       txParams->duration = Seconds (ulCtrlFrame);
       txParams->txPhy = GetObject<SpectrumPhy> ();
       txParams->txAntenna = m_antenna;
@@ -892,9 +892,9 @@
 void
 LteSpectrumPhy::EndRxUlSrs ()
 {
+  ChangeState (IDLE);
   m_interferenceCtrl->EndRx ();
   // nothing to do (used only for SRS at this stage)
-  ChangeState (IDLE);
 }
 
 void 
--- a/src/lte/model/lte-ue-mac.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-ue-mac.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -339,6 +339,7 @@
   NS_LOG_FUNCTION (this << " txMode " << (uint8_t) params.m_transmissionMode);
   // forward info to PHY layer
   m_uePhySapProvider->SetTransmissionMode (params.m_transmissionMode);
+  m_uePhySapProvider->SetSrsConfigurationIndex (params.m_srsConfigurationIndex);
 }
 
 
--- a/src/lte/model/lte-ue-phy-sap.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-ue-phy-sap.h	Mon Jun 25 13:41:13 2012 +0200
@@ -57,6 +57,11 @@
   * \param txMode the transmissionMode of the user
   */
   virtual void SetTransmissionMode (uint8_t   txMode) = 0;
+  
+  /**
+  * \param txMode the transmissionMode of the user
+  */
+  virtual void SetSrsConfigurationIndex (uint16_t   srsCI) = 0;
 
   /**
   * \brief Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
--- a/src/lte/model/lte-ue-phy.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-ue-phy.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -57,6 +57,7 @@
   virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
   virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
   virtual void SetTransmissionMode (uint8_t txMode);
+  virtual void SetSrsConfigurationIndex (uint16_t srsCI);
 
 private:
   LteUePhy* m_phy;
@@ -92,7 +93,11 @@
   m_phy->DoSetTransmissionMode (txMode);
 }
 
-
+void
+UeMemberLteUePhySapProvider::SetSrsConfigurationIndex (uint16_t   srsCI)
+{
+  m_phy->DoSetSrsConfigurationIndex (srsCI);
+}
 
 ////////////////////////////////////////
 // generic LteUePhy methods
@@ -115,7 +120,9 @@
     m_p10CqiLast (MilliSeconds (0)),
     m_a30CqiPeriocity (MilliSeconds (1)),
     // ideal behavior
-    m_a30CqiLast (MilliSeconds (0))
+    m_a30CqiLast (MilliSeconds (0)),
+    m_rnti (0),
+    m_srsPeriodicity (0)
 {
   m_amc = CreateObject <LteAmc> ();
   m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
@@ -343,7 +350,7 @@
 }
 
 void
-LteUePhy::GenerateCqiReport (const SpectrumValue& sinr)
+LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this);
   // check periodic wideband CQI
@@ -364,6 +371,12 @@
     }
 }
 
+void
+LteUePhy::GenerateDataCqiReport (const SpectrumValue& sinr)
+{
+  // Not used by UE, CQI are based only on RS
+}
+
 
 
 Ptr<DlCqiLteControlMessage>
@@ -588,13 +601,22 @@
     }
   m_subChannelsForTransmissionQueue.at (m_macChTtiDelay-1).clear ();
   
-
-  bool srs = false; // TODO: implement periodicity
-  double dataFrame = 0.001;
+  bool srs = false;
+  // check SRS periodicity
+  if (m_srsCounter==1)
+    {
+      srs = true;
+      m_srsCounter = m_srsPeriodicity;
+    }
+  else
+    {
+      m_srsCounter--;
+    }
+  double dataFrame = 0.001 - 0.000071429; // 0.001 - 1 symbol for SRS
   if (srs)
     {
-      dataFrame -= 0.000071429; // subtract 1 symbol reserved for SRS
-      SendSrsChannel ();
+      Simulator::Schedule (Seconds (0.000928572),  // (0.001/14) * 13
+                           &LteUePhy::SendSrsChannel,                         this);
     }
 
 
@@ -631,7 +653,7 @@
 void
 LteUePhy::SendSrsChannel ()
 {
-  NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS");
+  NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS, cell Id " << m_cellId);
   // set the current tx power spectral density (full bandwidth)
   std::vector <int> dlRb;
   for (uint8_t i = 0; i < m_ulBandwidth; i++)
@@ -670,6 +692,15 @@
   m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
 }
 
+void
+LteUePhy::DoSetSrsConfigurationIndex (uint16_t srsCI)
+{
+  NS_LOG_FUNCTION (this << srsCI);
+  m_srsPeriodicity = GetSrsPeriodicity (srsCI);
+  m_srsCounter = GetSrsSubframeOffset (srsCI) + 1;
+  NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << GetSrsSubframeOffset (srsCI) << " cellId " << m_cellId << " CI " << srsCI);
+}
+
 
 void 
 LteUePhy::SetTxMode1Gain (double gain)
--- a/src/lte/model/lte-ue-phy.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-ue-phy.h	Mon Jun 25 13:41:13 2012 +0200
@@ -156,12 +156,14 @@
 
 
   // inherited from LtePhy
-  virtual void GenerateCqiReport (const SpectrumValue& sinr);
+  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
+  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
 
   virtual void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
   virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
   
   virtual void DoSetTransmissionMode (uint8_t txMode);
+  virtual void DoSetSrsConfigurationIndex (uint16_t srsCI);
   
   
 
@@ -238,6 +240,9 @@
   
   uint8_t m_transmissionMode;
   std::vector <double> m_txModeGain;
+  
+  uint16_t m_srsPeriodicity;
+  uint16_t m_srsCounter;
 
 };
 
--- a/src/lte/model/lte-ue-rrc.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/model/lte-ue-rrc.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -99,6 +99,7 @@
 LteUeRrc::LteUeRrc ()
   : m_cmacSapProvider (0),
     m_macSapProvider (0),
+    m_rnti (0),
     m_cellId (0)
 {
   NS_LOG_FUNCTION (this);
@@ -138,7 +139,7 @@
                    MakeUintegerChecker<uint16_t> ())
     .AddAttribute ("C-RNTI",
                    "Cell Radio Network Temporary Identifier",
-                   UintegerValue (1),
+                   UintegerValue (0),
                    MakeUintegerAccessor (&LteUeRrc::m_rnti),
                    MakeUintegerChecker<uint16_t> ())
   ;
--- a/src/lte/test/lte-test-phy-error-model.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/test/lte-test-phy-error-model.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -60,7 +60,7 @@
   NS_LOG_INFO ("creating LenaTestPhyErrorModelTestCase");
 
   // MCS 2 TB size of 256 bits BER 0.33 SINR -5.51
-   AddTestCase (new LenaPhyErrorModelTestCase (4, 1800, 32, 0.33, 29));
+   AddTestCase (new LenaPhyErrorModelTestCase (4, 1800, 32, 0.35, 29));
 // MCS 2 TB size of 528 bits BER 0.11 SINR -5.51
    AddTestCase (new LenaPhyErrorModelTestCase (2, 1800, 66, 0.11, 20));
 // MCS 2 TB size of 1088 bits BER 0.02 SINR -5.51
@@ -151,7 +151,7 @@
 //   LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
 //   
   LogComponentDisableAll (LOG_LEVEL_ALL);
-  
+
   LogComponentEnable ("LenaTestPhyErrorModel", LOG_LEVEL_ALL);
 
 
--- a/src/lte/test/lte-test-ue-phy.cc	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/test/lte-test-ue-phy.cc	Mon Jun 25 13:41:13 2012 +0200
@@ -78,7 +78,7 @@
 }
 
 void
-LteTestUePhy::GenerateCqiReport (const SpectrumValue& sinr)
+LteTestUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this);
 
@@ -87,6 +87,15 @@
 }
 
 void
+LteTestUePhy::GenerateDataCqiReport (const SpectrumValue& sinr)
+{
+  NS_LOG_FUNCTION (this);
+  
+  // Store calculated SINR, it will be retrieved at the end of the test
+  m_sinr = sinr;
+}
+
+void
 LteTestUePhy::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this << msg);
--- a/src/lte/test/lte-test-ue-phy.h	Fri Jun 15 16:49:51 2012 +0200
+++ b/src/lte/test/lte-test-ue-phy.h	Mon Jun 25 13:41:13 2012 +0200
@@ -58,7 +58,9 @@
    */
   virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
 
-  virtual void GenerateCqiReport (const SpectrumValue& sinr);
+  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
+  
+  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
 
   virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);