Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
authorMarco Miozzo <marco.miozzo@cttc.es>
Fri, 15 Jun 2012 16:49:51 +0200
changeset 9035 e40974228d94
parent 9034 6f40a766b37f
child 9036 5e09b29d4af5
Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
src/lte/helper/lte-helper.cc
src/lte/model/ideal-control-messages.cc
src/lte/model/ideal-control-messages.h
src/lte/model/lte-enb-mac.cc
src/lte/model/lte-enb-mac.h
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-interference.cc
src/lte/model/lte-net-device.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-sinr-chunk-processor.h
src/lte/model/lte-spectrum-phy.cc
src/lte/model/lte-spectrum-phy.h
src/lte/model/lte-spectrum-signal-parameters.cc
src/lte/model/lte-spectrum-signal-parameters.h
src/lte/model/lte-ue-mac.cc
src/lte/model/lte-ue-mac.h
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/pf-ff-mac-scheduler.cc
src/lte/model/rem-spectrum-phy.cc
src/lte/test/lte-test-downlink-sinr.cc
src/lte/test/lte-test-downlink-sinr.h
src/lte/test/lte-test-interference.cc
src/lte/test/lte-test-link-adaptation.cc
src/lte/test/lte-test-pathloss-model.cc
src/lte/test/lte-test-phy-error-model.cc
src/lte/test/lte-test-sinr-chunk-processor.cc
src/lte/test/lte-test-ue-phy.cc
src/lte/test/lte-test-ue-phy.h
src/lte/test/lte-test-uplink-sinr.cc
src/lte/test/lte-test-uplink-sinr.h
src/lte/test/test-lte-antenna.cc
src/lte/wscript
--- a/src/lte/helper/lte-helper.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/helper/lte-helper.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -317,11 +317,12 @@
 
   Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
 
-  Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
-  ulPhy->AddSinrChunkProcessor (p);
+  Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> ());
+//   CQIs are still evaluated with PUSCH, this will be used for SRS ones
+//   ulPhy->AddDataSinrChunkProcessor (pCtrl);
 
-  Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (ulPhy);
-  ulPhy->AddSinrChunkProcessor (pPem);
+  Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (ulPhy, phy);
+  ulPhy->AddDataSinrChunkProcessor (pData);
 
   dlPhy->SetChannel (m_downlinkChannel);
   ulPhy->SetChannel (m_uplinkChannel);
@@ -367,7 +368,8 @@
   ulPhy->SetDevice (dev);
 
   n->AddDevice (dev);
-  ulPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
+  ulPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
+  ulPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteEnbPhy::ReceiveLteControlMessageList, phy));
   rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev));
 
   NS_LOG_LOGIC ("set the propagation model frequencies");
@@ -409,11 +411,11 @@
 
   Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
 
-  Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
-  dlPhy->AddSinrChunkProcessor (p);
+  Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> ());
+  dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
 
-  Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (dlPhy);
-  dlPhy->AddSinrChunkProcessor (pPem);
+  Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (dlPhy);
+  dlPhy->AddDataSinrChunkProcessor (pData);
 
   dlPhy->SetChannel (m_downlinkChannel);
   ulPhy->SetChannel (m_uplinkChannel);
@@ -446,7 +448,8 @@
   ulPhy->SetDevice (dev);
 
   n->AddDevice (dev);
-  dlPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
+  dlPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
+  dlPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteUePhy::ReceiveLteControlMessageList, phy));
   rrc->SetForwardUpCallback (MakeCallback (&LteUeNetDevice::Receive, dev));
 
   return dev;
--- a/src/lte/model/ideal-control-messages.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/ideal-control-messages.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -19,26 +19,26 @@
  *         Marco Miozzo <marco.miozzo@cttc.es>
  */
 
-#include "ideal-control-messages.h"
+#include "lte-control-messages.h"
 #include "ns3/address-utils.h"
 #include "ns3/uinteger.h"
 #include "ns3/log.h"
 #include "lte-net-device.h"
 #include "lte-ue-net-device.h"
 
-NS_LOG_COMPONENT_DEFINE ("IdealControlMessage");
+NS_LOG_COMPONENT_DEFINE ("LteControlMessage");
 
 
 namespace ns3 {
 
-IdealControlMessage::IdealControlMessage (void)
+LteControlMessage::LteControlMessage (void)
   : m_source (0),
     m_destination (0)
 {
 }
 
 
-IdealControlMessage::~IdealControlMessage (void)
+LteControlMessage::~LteControlMessage (void)
 {
   m_source = 0;
   m_destination = 0;
@@ -46,42 +46,14 @@
 
 
 void
-IdealControlMessage::SetSourceDevice (Ptr<LteNetDevice> src)
-{
-  m_source = src;
-}
-
-
-void
-IdealControlMessage::SetDestinationDevice (Ptr<LteNetDevice> dst)
-{
-  m_destination = dst;
-}
-
-
-Ptr<LteNetDevice>
-IdealControlMessage::GetSourceDevice (void)
-{
-  return m_source;
-}
-
-
-Ptr<LteNetDevice>
-IdealControlMessage::GetDestinationDevice (void)
-{
-  return m_destination;
-}
-
-
-void
-IdealControlMessage::SetMessageType (IdealControlMessage::MessageType type)
+LteControlMessage::SetMessageType (LteControlMessage::MessageType type)
 {
   m_type = type;
 }
 
 
-IdealControlMessage::MessageType
-IdealControlMessage::GetMessageType (void)
+LteControlMessage::MessageType
+LteControlMessage::GetMessageType (void)
 {
   return m_type;
 }
@@ -90,19 +62,19 @@
 // ----------------------------------------------------------------------------------------------------------
 
 
-DlDciIdealControlMessage::DlDciIdealControlMessage (void)
+DlDciLteControlMessage::DlDciLteControlMessage (void)
 {
-  SetMessageType (IdealControlMessage::DL_DCI);
+  SetMessageType (LteControlMessage::DL_DCI);
 }
 
 
-DlDciIdealControlMessage::~DlDciIdealControlMessage (void)
+DlDciLteControlMessage::~DlDciLteControlMessage (void)
 {
 
 }
 
 void
-DlDciIdealControlMessage::SetDci (DlDciListElement_s dci)
+DlDciLteControlMessage::SetDci (DlDciListElement_s dci)
 {
   m_dci = dci;
 
@@ -110,7 +82,7 @@
 
 
 DlDciListElement_s
-DlDciIdealControlMessage::GetDci (void)
+DlDciLteControlMessage::GetDci (void)
 {
   return m_dci;
 }
@@ -119,19 +91,19 @@
 // ----------------------------------------------------------------------------------------------------------
 
 
-UlDciIdealControlMessage::UlDciIdealControlMessage (void)
+UlDciLteControlMessage::UlDciLteControlMessage (void)
 {
-  SetMessageType (IdealControlMessage::UL_DCI);
+  SetMessageType (LteControlMessage::UL_DCI);
 }
 
 
-UlDciIdealControlMessage::~UlDciIdealControlMessage (void)
+UlDciLteControlMessage::~UlDciLteControlMessage (void)
 {
 
 }
 
 void
-UlDciIdealControlMessage::SetDci (UlDciListElement_s dci)
+UlDciLteControlMessage::SetDci (UlDciListElement_s dci)
 {
   m_dci = dci;
 
@@ -139,7 +111,7 @@
 
 
 UlDciListElement_s
-UlDciIdealControlMessage::GetDci (void)
+UlDciLteControlMessage::GetDci (void)
 {
   return m_dci;
 }
@@ -148,19 +120,19 @@
 // ----------------------------------------------------------------------------------------------------------
 
 
-DlCqiIdealControlMessage::DlCqiIdealControlMessage (void)
+DlCqiLteControlMessage::DlCqiLteControlMessage (void)
 {
-  SetMessageType (IdealControlMessage::DL_CQI);
+  SetMessageType (LteControlMessage::DL_CQI);
 }
 
 
-DlCqiIdealControlMessage::~DlCqiIdealControlMessage (void)
+DlCqiLteControlMessage::~DlCqiLteControlMessage (void)
 {
 
 }
 
 void
-DlCqiIdealControlMessage::SetDlCqi (CqiListElement_s dlcqi)
+DlCqiLteControlMessage::SetDlCqi (CqiListElement_s dlcqi)
 {
   m_dlCqi = dlcqi;
 
@@ -168,7 +140,7 @@
 
 
 CqiListElement_s
-DlCqiIdealControlMessage::GetDlCqi (void)
+DlCqiLteControlMessage::GetDlCqi (void)
 {
   return m_dlCqi;
 }
@@ -178,19 +150,19 @@
 // ----------------------------------------------------------------------------------------------------------
 
 
-BsrIdealControlMessage::BsrIdealControlMessage (void)
+BsrLteControlMessage::BsrLteControlMessage (void)
 {
-  SetMessageType (IdealControlMessage::BSR);
+  SetMessageType (LteControlMessage::BSR);
 }
 
 
-BsrIdealControlMessage::~BsrIdealControlMessage (void)
+BsrLteControlMessage::~BsrLteControlMessage (void)
 {
 
 }
 
 void
-BsrIdealControlMessage::SetBsr (MacCeListElement_s bsr)
+BsrLteControlMessage::SetBsr (MacCeListElement_s bsr)
 {
   m_bsr = bsr;
 
@@ -198,7 +170,7 @@
 
 
 MacCeListElement_s
-BsrIdealControlMessage::GetBsr (void)
+BsrLteControlMessage::GetBsr (void)
 {
   return m_bsr;
 }
--- a/src/lte/model/ideal-control-messages.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/ideal-control-messages.h	Fri Jun 15 16:49:51 2012 +0200
@@ -19,8 +19,8 @@
  * Author: Marco Miozzo <marco.miozzo@cttc.es>
  */
 
-#ifndef IDEAL_CONTROL_MESSAGES_H
-#define IDEAL_CONTROL_MESSAGES_H
+#ifndef LTE_CONTROL_MESSAGES_H
+#define LTE_CONTROL_MESSAGES_H
 
 #include "ns3/ptr.h"
 #include "ns3/simple-ref-count.h"
@@ -34,11 +34,11 @@
 /**
  * \ingroup lte
  *
- * The IdealControlMessage provides a basic implementations for
+ * The LteControlMessage provides a basic implementations for
  * control messages (such as PDCCH allocation map, CQI feedbacks)
  * that are exchanged among eNodeB and UEs.
  */
-class IdealControlMessage : public SimpleRefCount<IdealControlMessage>
+class LteControlMessage : public SimpleRefCount<LteControlMessage>
 {
 public:
   /**
@@ -46,36 +46,13 @@
    */
   enum MessageType
   {
-    CQI_FEEDBACKS, ALLOCATION_MAP,
     DL_DCI, UL_DCI, // Downlink/Uplink Data Control Indicator
     DL_CQI, UL_CQI, // Downlink/Uplink Channel Quality Indicator
     BSR // Buffer Status Report
   };
 
-  IdealControlMessage (void);
-  virtual ~IdealControlMessage (void);
-
-  /**
-   * \brief Set the source  device of the message
-   * \param src the device that sends the message
-   */
-  void SetSourceDevice (Ptr<LteNetDevice> src);
-  /**
-   * \brief Set the destination  device of the message
-   * \param dst the device that receives the message
-   */
-  void SetDestinationDevice (Ptr<LteNetDevice> dst);
-
-  /**
-   * \brief Get the source  device of the message
-   * \return the pointer to the device that sends the message
-   */
-  Ptr<LteNetDevice> GetSourceDevice (void);
-  /**
-   * \brief Get the destination device of the message
-   * \return the pointer to the device that receives the message
-   */
-  Ptr<LteNetDevice> GetDestinationDevice (void);
+  LteControlMessage (void);
+  virtual ~LteControlMessage (void);
 
   /**
    * \brief Set the type of the message
@@ -95,7 +72,7 @@
 };
 } // namespace ns3
 
-#endif /* IDEAL_CONTROL_MESSAGES_H */
+#endif /* LTE_CONTROL_MESSAGES_H */
 
 
 
@@ -103,8 +80,8 @@
 // ----------------------------------------------------------------------------------------------------------
 
 
-#ifndef DL_DCI_IDEAL_CONTROL_MESSAGES_H
-#define DL_DCI_IDEAL_CONTROL_MESSAGES_H
+#ifndef DL_DCI_LTE_CONTROL_MESSAGES_H
+#define DL_DCI_LTE_CONTROL_MESSAGES_H
 
 #include <ns3/object.h>
 #include <ns3/ff-mac-common.h>
@@ -116,11 +93,11 @@
  * The Downlink Data Control Indicator messages defines the RB allocation for the
  * users in the downlink
  */
-class DlDciIdealControlMessage : public IdealControlMessage
+class DlDciLteControlMessage : public LteControlMessage
 {
 public:
-  DlDciIdealControlMessage (void);
-  virtual ~DlDciIdealControlMessage (void);
+  DlDciLteControlMessage (void);
+  virtual ~DlDciLteControlMessage (void);
 
   /**
   * \brief add a DCI into the message
@@ -140,14 +117,14 @@
 };
 } // namespace ns3
 
-#endif /* DL_DCI_IDEAL_CONTROL_MESSAGES_H */
+#endif /* DL_DCI_LTE_CONTROL_MESSAGES_H */
 
 
 // ----------------------------------------------------------------------------------------------------------
 
 
-#ifndef UL_DCI_IDEAL_CONTROL_MESSAGES_H
-#define UL_DCI_IDEAL_CONTROL_MESSAGES_H
+#ifndef UL_DCI_LTE_CONTROL_MESSAGES_H
+#define UL_DCI_LTE_CONTROL_MESSAGES_H
 
 #include <ns3/object.h>
 #include <ns3/ff-mac-common.h>
@@ -159,11 +136,11 @@
  * The Uplink Data Control Indicator messages defines the RB allocation for the
  * users in the uplink
  */
-class UlDciIdealControlMessage : public IdealControlMessage
+class UlDciLteControlMessage : public LteControlMessage
 {
 public:
-  UlDciIdealControlMessage (void);
-  virtual ~UlDciIdealControlMessage (void);
+  UlDciLteControlMessage (void);
+  virtual ~UlDciLteControlMessage (void);
 
   /**
   * \brief add a DCI into the message
@@ -183,7 +160,7 @@
 };
 } // namespace ns3
 
-#endif /* UL_DCI_IDEAL_CONTROL_MESSAGES_H */
+#endif /* UL_DCI_LTE_CONTROL_MESSAGES_H */
 
 
 
@@ -191,8 +168,8 @@
 
 
 
-#ifndef DLCQI_IDEAL_CONTROL_MESSAGES_H
-#define DLCQI_IDEAL_CONTROL_MESSAGES_H
+#ifndef DLCQI_LTE_CONTROL_MESSAGES_H
+#define DLCQI_LTE_CONTROL_MESSAGES_H
 
 #include <ns3/object.h>
 #include <ns3/ff-mac-common.h>
@@ -203,14 +180,14 @@
 
 /**
  * \ingroup lte
- * The downlink CqiIdealControlMessage defines an ideal list of
+ * The downlink CqiLteControlMessage defines an ideal list of
  * feedback about the channel quality sent by the UE to the eNodeB.
  */
-class DlCqiIdealControlMessage : public IdealControlMessage
+class DlCqiLteControlMessage : public LteControlMessage
 {
 public:
-  DlCqiIdealControlMessage (void);
-  virtual ~DlCqiIdealControlMessage (void);
+  DlCqiLteControlMessage (void);
+  virtual ~DlCqiLteControlMessage (void);
 
   /**
   * \brief add a DL-CQI feedback record into the message.
@@ -230,13 +207,13 @@
 };
 } // namespace ns3
 
-#endif /* DLCQI_IDEAL_CONTROL_MESSAGES_H */
+#endif /* DLCQI_LTE_CONTROL_MESSAGES_H */
 
 
 // ----------------------------------------------------------------------------------------------------------
 
-#ifndef BSR_IDEAL_CONTROL_MESSAGES_H
-#define BSR_IDEAL_CONTROL_MESSAGES_H
+#ifndef BSR_LTE_CONTROL_MESSAGES_H
+#define BSR_LTE_CONTROL_MESSAGES_H
 
 #include <ns3/object.h>
 #include <ns3/ff-mac-common.h>
@@ -247,14 +224,14 @@
 
 /**
  * \ingroup lte
- * The uplink BsrIdealControlMessage defines the specific
+ * The uplink BsrLteControlMessage defines the specific
  * extension of the CE element for reporting the buffer status report
  */
-class BsrIdealControlMessage : public IdealControlMessage
+class BsrLteControlMessage : public LteControlMessage
 {
 public:
-  BsrIdealControlMessage (void);
-  virtual ~BsrIdealControlMessage (void);
+  BsrLteControlMessage (void);
+  virtual ~BsrLteControlMessage (void);
 
   /**
   * \brief add a BSR feedback record into the message.
@@ -276,5 +253,5 @@
 };
 } // namespace ns3
 
-#endif /* BSR_IDEAL_CONTROL_MESSAGES_H */
+#endif /* LTE_CONTROL_MESSAGES_H */
 
--- a/src/lte/model/lte-enb-mac.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-enb-mac.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -25,7 +25,7 @@
 #include <ns3/packet.h>
 
 #include "lte-amc.h"
-#include "ideal-control-messages.h"
+#include "lte-control-messages.h"
 #include "lte-enb-net-device.h"
 #include "lte-ue-net-device.h"
 
@@ -225,7 +225,7 @@
   // inherited from LteEnbPhySapUser
   virtual void ReceivePhyPdu (Ptr<Packet> p);
   virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
   virtual void UlCqiReport (UlCqi_s ulcqi);
 
 private:
@@ -250,9 +250,9 @@
 }
 
 void
-EnbMacMemberLteEnbPhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+EnbMacMemberLteEnbPhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
 {
-  m_mac->DoReceiveIdealControlMessage (msg);
+  m_mac->DoReceiveLteControlMessage (msg);
 }
 
 void
@@ -507,22 +507,22 @@
 }
 
 void
-LteEnbMac::DoReceiveIdealControlMessage  (Ptr<IdealControlMessage> msg)
+LteEnbMac::DoReceiveLteControlMessage  (Ptr<LteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this << msg);
-  if (msg->GetMessageType () == IdealControlMessage::DL_CQI)
+  if (msg->GetMessageType () == LteControlMessage::DL_CQI)
     {
-      Ptr<DlCqiIdealControlMessage> dlcqi = DynamicCast<DlCqiIdealControlMessage> (msg);
-      ReceiveDlCqiIdealControlMessage (dlcqi);
+      Ptr<DlCqiLteControlMessage> dlcqi = DynamicCast<DlCqiLteControlMessage> (msg);
+      ReceiveDlCqiLteControlMessage (dlcqi);
     }
-  else if (msg->GetMessageType () == IdealControlMessage::BSR)
+  else if (msg->GetMessageType () == LteControlMessage::BSR)
     {
-      Ptr<BsrIdealControlMessage> bsr = DynamicCast<BsrIdealControlMessage> (msg);
+      Ptr<BsrLteControlMessage> bsr = DynamicCast<BsrLteControlMessage> (msg);
       ReceiveBsrMessage (bsr->GetBsr ());
     }
   else
     {
-      NS_LOG_LOGIC (this << " IdealControlMessage not recognized");
+      NS_LOG_LOGIC (this << " LteControlMessage not recognized");
     }
 }
 
@@ -540,7 +540,7 @@
 
 
 void
-LteEnbMac::ReceiveDlCqiIdealControlMessage  (Ptr<DlCqiIdealControlMessage> msg)
+LteEnbMac::ReceiveDlCqiLteControlMessage  (Ptr<DlCqiLteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this << msg);
 
@@ -758,9 +758,9 @@
             }
         }
       // send the relative DCI
-      Ptr<DlDciIdealControlMessage> msg = Create<DlDciIdealControlMessage> ();
+      Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> ();
       msg->SetDci (ind.m_buildDataList.at (i).m_dci);
-      m_enbPhySapProvider->SendIdealControlMessage (msg);
+      m_enbPhySapProvider->SendLteControlMessage (msg);
     }
 
   // Fire the trace with the DL information
@@ -802,9 +802,9 @@
   for (unsigned int i = 0; i < ind.m_dciList.size (); i++)
     {
       // send the correspondent ul dci
-      Ptr<UlDciIdealControlMessage> msg = Create<UlDciIdealControlMessage> ();
+      Ptr<UlDciLteControlMessage> msg = Create<UlDciLteControlMessage> ();
       msg->SetDci (ind.m_dciList.at (i));
-      m_enbPhySapProvider->SendIdealControlMessage (msg);
+      m_enbPhySapProvider->SendLteControlMessage (msg);
     }
 
   // Fire the trace with the UL information
--- a/src/lte/model/lte-enb-mac.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-enb-mac.h	Fri Jun 15 16:49:51 2012 +0200
@@ -36,9 +36,9 @@
 
 namespace ns3 {
 
-class DlCqiIdealControlMessage;
-class UlCqiIdealControlMessage;
-class PdcchMapIdealControlMessage;
+class DlCqiLteControlMessage;
+class UlCqiLteControlMessage;
+class PdcchMapLteControlMessage;
 
 
 
@@ -123,9 +123,9 @@
   * \brief Receive a DL CQI ideal control message
   * \param msg the DL CQI message
   */
-  void ReceiveDlCqiIdealControlMessage  (Ptr<DlCqiIdealControlMessage> msg);
+  void ReceiveDlCqiLteControlMessage  (Ptr<DlCqiLteControlMessage> msg);
 
-  void DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  void DoReceiveLteControlMessage (Ptr<LteControlMessage> msg);
 
   /**
   * \brief Receive a CE element containing the buffer status report
--- a/src/lte/model/lte-enb-phy-sap.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-enb-phy-sap.h	Fri Jun 15 16:49:51 2012 +0200
@@ -28,7 +28,7 @@
 
 namespace ns3 {
 
-class IdealControlMessage;
+class LteControlMessage;
 
 /**
  * Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC
@@ -68,10 +68,10 @@
   virtual void SetCellId (uint16_t cellId) = 0;
 
   /**
-   * \brief Send SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+   * \brief Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
    * \param msg the Ideal Control Message to send
    */
-  virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+  virtual void SendLteControlMessage (Ptr<LteControlMessage> msg) = 0;
   
   /**
   * \brief Get the delay from MAC to Channel expressed in TTIs
@@ -110,10 +110,10 @@
   virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo) = 0;
 
   /**
-   * \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+   * \brief Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
    * \param msg the Ideal Control Message to receive
    */
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+  virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg) = 0;
 
   /**
    * \brief Returns to MAC level the UL-CQI evaluated
--- a/src/lte/model/lte-enb-phy.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-enb-phy.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -30,7 +30,7 @@
 #include "lte-enb-phy.h"
 #include "lte-net-device.h"
 #include "lte-spectrum-value-helper.h"
-#include "ideal-control-messages.h"
+#include "lte-control-messages.h"
 #include "lte-enb-net-device.h"
 #include "lte-enb-mac.h"
 #include <ns3/lte-common.h>
@@ -55,7 +55,7 @@
   virtual void SendMacPdu (Ptr<Packet> p);
   virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
   virtual void SetCellId (uint16_t cellId);
-  virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
   virtual uint8_t GetMacChTtiDelay ();
   virtual void SetTransmissionMode (uint16_t  rnti, uint8_t txMode);
   
@@ -89,9 +89,9 @@
 }
 
 void
-EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
+EnbMemberLteEnbPhySapProvider::SendLteControlMessage (Ptr<LteControlMessage> msg)
 {
-  m_phy->DoSendIdealControlMessage (msg);
+  m_phy->DoSendLteControlMessage (msg);
 }
 
 uint8_t
@@ -237,14 +237,14 @@
     {
       Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
       m_packetBurstQueue.push_back (pb);
-      std::list<Ptr<IdealControlMessage> > l;
+      std::list<Ptr<LteControlMessage> > l;
       m_controlMessagesQueue.push_back (l);
-      std::list<UlDciIdealControlMessage> l1;
+      std::list<UlDciLteControlMessage> l1;
       m_ulDciQueue.push_back (l1);
     }
   for (int i = 0; i < UL_PUSCH_TTIS_DELAY; i++)
     {
-      std::list<UlDciIdealControlMessage> l1;
+      std::list<UlDciLteControlMessage> l1;
       m_ulDciQueue.push_back (l1);
     }
 }
@@ -340,7 +340,7 @@
 
 
 void
-LteEnbPhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteEnbPhy::DoSendLteControlMessage (Ptr<LteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this << msg);
   // queues the message (wait for MAC-PHY delay)
@@ -350,10 +350,23 @@
 
 
 void
-LteEnbPhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteEnbPhy::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
 {
+  NS_FATAL_ERROR ("Obsolete function");
   NS_LOG_FUNCTION (this << msg);
-  m_enbPhySapUser->ReceiveIdealControlMessage (msg);
+  m_enbPhySapUser->ReceiveLteControlMessage (msg);
+}
+
+void
+LteEnbPhy::ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList)
+{
+  NS_LOG_FUNCTION (this);
+  std::list<Ptr<LteControlMessage> >::iterator it;
+  for (it = msgList.begin (); it != msgList.end(); it++)
+    {
+      m_enbPhySapUser->ReceiveLteControlMessage (*it);
+    }
+    
 }
 
 
@@ -378,53 +391,52 @@
   ++m_nrSubFrames;
   NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
   
+  
   // update info on TB to be received
-  std::list<UlDciIdealControlMessage> uldcilist = DequeueUlDci ();
-  std::list<UlDciIdealControlMessage>::iterator dciIt = uldcilist.begin ();
+  std::list<UlDciLteControlMessage> uldcilist = DequeueUlDci ();
+  std::list<UlDciLteControlMessage>::iterator dciIt = uldcilist.begin ();
+  m_ulRntiRxed.clear ();
+  NS_LOG_DEBUG (this << " eNB Expected TBs " << uldcilist.size ());
   for (dciIt = uldcilist.begin (); dciIt!=uldcilist.end (); dciIt++)
-  {
-    std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
-    it2 = m_ueAttached.find ((*dciIt).GetDci ().m_rnti);
-    
-    if (it2 == m_ueAttached.end ())
-    {
-      NS_LOG_ERROR ("UE not attached");
-    }
-    else
     {
-      // send info of TB to LteSpectrumPhy 
-      // translate to allocation map
-      std::vector <int> rbMap;
-      for (int i = (*dciIt).GetDci ().m_rbStart; i < (*dciIt).GetDci ().m_rbStart + (*dciIt).GetDci ().m_rbLen; i++)
-      {
-        rbMap.push_back (i);
-      }
-      m_uplinkSpectrumPhy->AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 /* always SISO*/);
+      std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
+      it2 = m_ueAttached.find ((*dciIt).GetDci ().m_rnti);
+      
+      if (it2 == m_ueAttached.end ())
+        {
+          NS_LOG_ERROR ("UE not attached");
+        }
+      else
+        {
+          // send info of TB to LteSpectrumPhy 
+          // translate to allocation map
+          std::vector <int> rbMap;
+          for (int i = (*dciIt).GetDci ().m_rbStart; i < (*dciIt).GetDci ().m_rbStart + (*dciIt).GetDci ().m_rbLen; i++)
+            {
+              rbMap.push_back (i);
+            }
+          m_uplinkSpectrumPhy->AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 /* always SISO*/);
+          m_ulRntiRxed.push_back ((*dciIt).GetDci ().m_rnti);
+        }
     }
-  }
 
-  // send the current burst of control messages
-  std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
-  std::vector <int> dlRb;
+  // process the current burst of control messages
+  std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
+  std::list<DlDciListElement_s> dlDci;
+  std::list<UlDciListElement_s> ulDci;
+//   std::vector <int> dlRb;
+  m_dlDataRbMap.clear ();
   if (ctrlMsg.size () > 0)
     {
-      std::list<Ptr<IdealControlMessage> >::iterator it;
+      std::list<Ptr<LteControlMessage> >::iterator it;
       it = ctrlMsg.begin ();
       while (it != ctrlMsg.end ())
         {
-          Ptr<IdealControlMessage> msg = (*it);
-          if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
+          Ptr<LteControlMessage> msg = (*it);
+          if (msg->GetMessageType () == LteControlMessage::DL_DCI)
             {
-              std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
-              Ptr<DlDciIdealControlMessage> dci = DynamicCast<DlDciIdealControlMessage> (msg);
-              it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
-
-              if (it2 == m_ueAttached.end ())
-                {
-                  NS_LOG_ERROR ("UE not attached");
-                }
-              else
-                {
+              Ptr<DlDciLteControlMessage> dci = DynamicCast<DlDciLteControlMessage> (msg);
+              dlDci.push_back (dci->GetDci ());
                   // get the tx power spectral density according to DL-DCI(s)
                   // translate the DCI to Spectrum framework
                   uint32_t mask = 0x1;
@@ -434,44 +446,33 @@
                         {
                           for (int k = 0; k < GetRbgSize (); k++)
                             {
-                              dlRb.push_back ((i * GetRbgSize ()) + k);
+                              m_dlDataRbMap.push_back ((i * GetRbgSize ()) + k);
                               //NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
                             }
                         }
                       mask = (mask << 1);
                     }
-                  (*it2).second->ReceiveIdealControlMessage (msg);
-                }
             }
-          else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
+          else if (msg->GetMessageType () == LteControlMessage::UL_DCI)
             {
-              std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
-              Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
+              Ptr<UlDciLteControlMessage> dci = DynamicCast<UlDciLteControlMessage> (msg);
               QueueUlDci (*dci);
-              it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
+              ulDci.push_back (dci->GetDci ());
+            }
+          it++;
 
-              if (it2 == m_ueAttached.end ())
-                {
-                  NS_LOG_ERROR ("UE not attached");
-                }
-              else
-                {
-                  (*it2).second->ReceiveIdealControlMessage (msg);
-                  QueueUlDci (*dci);
-                }
-            }
-          ctrlMsg.pop_front ();
-          it = ctrlMsg.begin ();
         }
     }
-  // set the current tx power spectral density
-  SetDownlinkSubChannels (dlRb);
-  // send the current burts of packets
+    
+  SendControlChannels (ctrlMsg);
+  
+  // send data frame
   Ptr<PacketBurst> pb = GetPacketBurst ();
   if (pb)
     {
-      NS_LOG_LOGIC (this << " eNB start TX");
-      m_downlinkSpectrumPhy->StartTx (pb);
+      Simulator::Schedule (Seconds (0.000214286), // ctrl frame fixed to 3 symbols
+                       &LteEnbPhy::SendDataChannels,
+                       this,pb);
     }
 
   // trigger the MAC
@@ -485,12 +486,42 @@
       (*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames);
     }
 
+
   Simulator::Schedule (Seconds (GetTti ()),
                        &LteEnbPhy::EndSubFrame,
                        this);
 
 }
 
+void
+LteEnbPhy::SendControlChannels (std::list<Ptr<LteControlMessage> > ctrlMsgList)
+{
+  NS_LOG_FUNCTION (this << " eNB " << m_cellId << " start tx ctrl frame");
+  // set the current tx power spectral density (full bandwidth)
+  std::vector <int> dlRb;
+  for (uint8_t i = 0; i < m_dlBandwidth; i++)
+    {
+      dlRb.push_back (i);
+    }
+  SetDownlinkSubChannels (dlRb);
+  NS_LOG_LOGIC (this << " eNB start TX CTRL");
+  m_downlinkSpectrumPhy->StartTxDlCtrlFrame (ctrlMsgList);
+  
+}
+
+void
+LteEnbPhy::SendDataChannels (Ptr<PacketBurst> pb)
+{
+  // set the current tx power spectral density
+  SetDownlinkSubChannels (m_dlDataRbMap);
+  // send the current burts of packets
+  NS_LOG_LOGIC (this << " eNB start TX DATA");
+  double dlDataFrame = 0.000785714; // 0.001 / 14 * 11 (fixed to 11 symbols)
+  std::list<Ptr<LteControlMessage> > ctrlMsgList;
+  ctrlMsgList.clear ();
+  m_downlinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsgList, dlDataFrame);
+}
+
 
 void
 LteEnbPhy::EndSubFrame (void)
@@ -519,7 +550,8 @@
 LteEnbPhy::GenerateCqiReport (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this << sinr);
-  m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr));
+  UlCqi_s ulcqi = CreateUlCqiReport (sinr);
+  m_enbPhySapUser->UlCqiReport (ulcqi);
 }
 
 
@@ -552,30 +584,30 @@
 }
 
 void
-LteEnbPhy::QueueUlDci (UlDciIdealControlMessage m)
+LteEnbPhy::QueueUlDci (UlDciLteControlMessage m)
 {
   NS_LOG_FUNCTION (this);
   m_ulDciQueue.at (UL_PUSCH_TTIS_DELAY - 1).push_back (m);
 }
 
-std::list<UlDciIdealControlMessage>
+std::list<UlDciLteControlMessage>
 LteEnbPhy::DequeueUlDci (void)
 {
   NS_LOG_FUNCTION (this);
   if (m_ulDciQueue.at (0).size ()>0)
     {
-      std::list<UlDciIdealControlMessage> ret = m_ulDciQueue.at (0);
+      std::list<UlDciLteControlMessage> ret = m_ulDciQueue.at (0);
       m_ulDciQueue.erase (m_ulDciQueue.begin ());
-      std::list<UlDciIdealControlMessage> l;
+      std::list<UlDciLteControlMessage> l;
       m_ulDciQueue.push_back (l);
       return (ret);
     }
   else
     {
       m_ulDciQueue.erase (m_ulDciQueue.begin ());
-      std::list<UlDciIdealControlMessage> l;
+      std::list<UlDciLteControlMessage> l;
       m_ulDciQueue.push_back (l);
-      std::list<UlDciIdealControlMessage> emptylist;
+      std::list<UlDciLteControlMessage> emptylist;
       return (emptylist);
     }
 }
--- a/src/lte/model/lte-enb-phy.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-enb-phy.h	Fri Jun 15 16:49:51 2012 +0200
@@ -133,12 +133,12 @@
    * \brief Send the control message
    * \param msg the message to send
    */
-  // virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);  // legacy
+  // virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);  // legacy
   /**
    * \brief Receive the control message
    * \param msg the received message
    */
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
 
   /**
   * \brief Create the UL CQI feedback from SINR values perceived at
@@ -148,7 +148,7 @@
   UlCqi_s CreateUlCqiReport (const SpectrumValue& sinr);
 
 
-  void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
+  void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
 
   bool AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy);
 
@@ -156,15 +156,18 @@
   
   virtual void DoSetTransmissionMode (uint16_t  rnti, uint8_t txMode);
   
+  void SendControlChannels (std::list<Ptr<LteControlMessage> > ctrlMsgList);
+  void SendDataChannels (Ptr<PacketBurst> pb);
+  
   /**
   * \param m the UL-CQI to be queued
   */
-  void QueueUlDci (UlDciIdealControlMessage m);
+  void QueueUlDci (UlDciLteControlMessage m);
   
   /**
   * \returns the list of UL-CQI to be processed
   */
-  std::list<UlDciIdealControlMessage> DequeueUlDci (void);
+  std::list<UlDciLteControlMessage> DequeueUlDci (void);
 
 
   /**
@@ -188,6 +191,11 @@
    * \brief PhySpectrum received a new PHY-PDU
    */
   void PhyPduReceived (Ptr<Packet> p);
+  
+  /**
+  * \brief PhySpectrum received a new list of LteControlMessage
+  */
+  virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
 
   // inherited from LtePhy
   virtual void GenerateCqiReport (const SpectrumValue& sinr);
@@ -196,10 +204,14 @@
 private:
   std::map <uint16_t, Ptr<LteUePhy> > m_ueAttached;
   
-  std::vector< std::list<UlDciIdealControlMessage> > m_ulDciQueue; // for storing info on future receptions
+  std::vector <int> m_dlDataRbMap;
+  
+  std::vector< std::list<UlDciLteControlMessage> > m_ulDciQueue; // for storing info on future receptions
 
   LteEnbPhySapProvider* m_enbPhySapProvider;
   LteEnbPhySapUser* m_enbPhySapUser;
+  
+  std::vector <uint16_t> m_ulRntiRxed;
 
   uint32_t m_nrFrames;
   uint32_t m_nrSubFrames;
--- a/src/lte/model/lte-interference.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-interference.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -81,7 +81,7 @@
     }
   else
     {
-      NS_LOG_LOGIC ("additional signal");
+      NS_LOG_LOGIC ("additional signal" << *m_rxSignal);
       // receiving multiple simultaneous signals, make sure they are synchronized
       NS_ASSERT (m_lastChangeTime == Now ());
       // make sure they use orthogonal resource blocks
--- a/src/lte/model/lte-net-device.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-net-device.h	Fri Jun 15 16:49:51 2012 +0200
@@ -28,7 +28,7 @@
 #include <ns3/traced-callback.h>
 #include <ns3/nstime.h>
 #include <ns3/lte-phy.h>
-#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-control-messages.h>
 
 namespace ns3 {
 
--- a/src/lte/model/lte-phy.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-phy.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -248,30 +248,30 @@
 
 
 void
-LtePhy::SetControlMessages (Ptr<IdealControlMessage> m)
+LtePhy::SetControlMessages (Ptr<LteControlMessage> m)
 {
   // In uplink the queue of control messages and packet are of different sizes
   // for avoiding TTI cancellation due to synchronization of subframe triggers
   m_controlMessagesQueue.at (m_controlMessagesQueue.size () - 1).push_back (m);
 }
 
-std::list<Ptr<IdealControlMessage> >
+std::list<Ptr<LteControlMessage> >
 LtePhy::GetControlMessages (void)
 {
   if (m_controlMessagesQueue.at (0).size () > 0)
     {
-      std::list<Ptr<IdealControlMessage> > ret = m_controlMessagesQueue.at (0);
+      std::list<Ptr<LteControlMessage> > ret = m_controlMessagesQueue.at (0);
       m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
-      std::list<Ptr<IdealControlMessage> > newlist;
+      std::list<Ptr<LteControlMessage> > newlist;
       m_controlMessagesQueue.push_back (newlist);
       return (ret);
     }
   else
     {
       m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
-      std::list<Ptr<IdealControlMessage> > newlist;
+      std::list<Ptr<LteControlMessage> > newlist;
       m_controlMessagesQueue.push_back (newlist);
-      std::list<Ptr<IdealControlMessage> > emptylist;
+      std::list<Ptr<LteControlMessage> > emptylist;
       return (emptylist);
     }
 }
--- a/src/lte/model/lte-phy.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-phy.h	Fri Jun 15 16:49:51 2012 +0200
@@ -39,7 +39,9 @@
 
 class PacketBurst;
 class LteNetDevice;
-class IdealControlMessage;
+class LteControlMessage;
+
+
 
 /**
  * \ingroup lte
@@ -154,10 +156,10 @@
   void DoDispose ();
 
   /**
-   * \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+   * \brief Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
    * \param msg the Ideal Control Message to receive
    */
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+//   virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg) = 0;
 
 
   /**
@@ -208,12 +210,12 @@
   /**
   * \param m the control message to be sent
   */
-  void SetControlMessages (Ptr<IdealControlMessage> m);
+  void SetControlMessages (Ptr<LteControlMessage> m);
 
   /**
   * \returns the list of control messages to be sent
   */
-  std::list<Ptr<IdealControlMessage> > GetControlMessages (void);
+  std::list<Ptr<LteControlMessage> > GetControlMessages (void);
 
 
   /** 
@@ -222,6 +224,18 @@
    * \param sinr the SINR vs frequency measured by the device
    */
   virtual void  GenerateCqiReport (const SpectrumValue& sinr) = 0;
+  
+  /** 
+  * Send the control channels (PCFICH and PDCCH in downlink and SRS in uplink)
+  *
+  */
+//   virtual void SendControlChannels (void) = 0;
+  
+  /** 
+  * Send the PDSCH/PUSCH TBs
+  * 
+  */
+//   virtual void SendDataChannels (void) = 0;
 
 
 
@@ -246,7 +260,7 @@
   uint16_t m_ulEarfcn;
 
   std::vector< Ptr<PacketBurst> > m_packetBurstQueue;
-  std::vector< std::list<Ptr<IdealControlMessage> > > m_controlMessagesQueue;
+  std::vector< std::list<Ptr<LteControlMessage> > > m_controlMessagesQueue;
   uint8_t m_macChTtiDelay; // delay between MAC and channel layer in terms of TTIs
 
   uint16_t m_cellId;
--- a/src/lte/model/lte-sinr-chunk-processor.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-sinr-chunk-processor.cc	Fri Jun 15 16:49:51 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>
+ *        (move from CQI to Ctrl and Data SINR Chunk processors
  */
 
 
@@ -33,7 +35,7 @@
 }
 
 
-LteCqiSinrChunkProcessor::LteCqiSinrChunkProcessor (Ptr<LtePhy> p)
+LteCtrlSinrChunkProcessor::LteCtrlSinrChunkProcessor (Ptr<LtePhy> p)
   : m_phy (p)
 {
   NS_LOG_FUNCTION (this << p);
@@ -41,14 +43,14 @@
 }
 
 
-LteCqiSinrChunkProcessor::~LteCqiSinrChunkProcessor ()
+LteCtrlSinrChunkProcessor::~LteCtrlSinrChunkProcessor ()
 {
   NS_LOG_FUNCTION (this);
 }
 
 
 void 
-LteCqiSinrChunkProcessor::Start ()
+LteCtrlSinrChunkProcessor::Start ()
 {
   NS_LOG_FUNCTION (this);
   m_sumSinr = 0;
@@ -57,7 +59,7 @@
 
 
 void 
-LteCqiSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
+LteCtrlSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
 {
   NS_LOG_FUNCTION (this << sinr << duration);
   if (m_sumSinr == 0)
@@ -69,7 +71,7 @@
 }
  
 void 
-LteCqiSinrChunkProcessor::End ()
+LteCtrlSinrChunkProcessor::End ()
 {
   NS_LOG_FUNCTION (this);
   if (m_totDuration.GetSeconds () > 0)
@@ -85,22 +87,34 @@
 
 
 
-LtePemSinrChunkProcessor::LtePemSinrChunkProcessor (Ptr<LteSpectrumPhy> p)
-: m_phy (p)
+LteDataSinrChunkProcessor::LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> s, Ptr<LtePhy> p)
+: m_spectrumPhy (s),
+  m_phy (p)
 {
   NS_LOG_FUNCTION (this << p);
+  NS_ASSERT (m_spectrumPhy);
   NS_ASSERT (m_phy);
 }
 
+LteDataSinrChunkProcessor::LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> p)
+: m_spectrumPhy (p),
+  m_phy (0)
+{
+  NS_LOG_FUNCTION (this << p);
+  NS_ASSERT (m_spectrumPhy);
+  
+}
 
-LtePemSinrChunkProcessor::~LtePemSinrChunkProcessor ()
+
+
+LteDataSinrChunkProcessor::~LteDataSinrChunkProcessor ()
 {
   NS_LOG_FUNCTION (this);
 }
 
 
 void 
-LtePemSinrChunkProcessor::Start ()
+LteDataSinrChunkProcessor::Start ()
 {
   NS_LOG_FUNCTION (this);
   m_sumSinr = 0;
@@ -109,7 +123,7 @@
 
 
 void 
-LtePemSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
+LteDataSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
 {
   NS_LOG_FUNCTION (this << sinr << duration);
   if (m_sumSinr == 0)
@@ -121,12 +135,16 @@
 }
 
 void 
-LtePemSinrChunkProcessor::End ()
+LteDataSinrChunkProcessor::End ()
 {
   NS_LOG_FUNCTION (this);
   if (m_totDuration.GetSeconds () > 0)
   {
-    m_phy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
+    m_spectrumPhy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
+    if (m_phy)
+      {
+        m_phy->GenerateCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
+      }
   }
   else
   {
--- a/src/lte/model/lte-sinr-chunk-processor.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-sinr-chunk-processor.h	Fri Jun 15 16:49:51 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>
+ *        (move from CQI to Ctrl and Data SINR Chunk processors)
  */
 
 
@@ -56,11 +58,11 @@
  * This SinrProcessor averages the calculated SINR over time.
  * 
  */
-class LteCqiSinrChunkProcessor : public LteSinrChunkProcessor
+class LteCtrlSinrChunkProcessor : public LteSinrChunkProcessor
 {
 public:
-  virtual ~LteCqiSinrChunkProcessor ();
-  LteCqiSinrChunkProcessor (Ptr<LtePhy> p);
+  virtual ~LteCtrlSinrChunkProcessor ();
+  LteCtrlSinrChunkProcessor (Ptr<LtePhy> p);
   virtual void Start ();
   virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration);
   virtual void End ();
@@ -76,18 +78,20 @@
 * This SinrProcessor averages the calculated SINR over time for Phy error model
 * 
 */
-class LtePemSinrChunkProcessor : public LteSinrChunkProcessor
+class LteDataSinrChunkProcessor : public LteSinrChunkProcessor
 {
   public:
-    virtual ~LtePemSinrChunkProcessor ();
-    LtePemSinrChunkProcessor (Ptr<LteSpectrumPhy> p);
+    virtual ~LteDataSinrChunkProcessor ();
+    LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> p);
+    LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> s, Ptr<LtePhy> p);
     virtual void Start ();
     virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration);
     virtual void End ();
   private:
     Ptr<SpectrumValue> m_sumSinr;
     Time m_totDuration;
-    Ptr<LteSpectrumPhy> m_phy;
+    Ptr<LteSpectrumPhy> m_spectrumPhy;
+    Ptr<LtePhy> m_phy;
 };
 
 
--- a/src/lte/model/lte-spectrum-phy.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-spectrum-phy.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -73,7 +73,8 @@
   m_transmissionMode (0)
 {
   NS_LOG_FUNCTION (this);
-  m_interference = CreateObject<LteInterference> ();
+  m_interferenceData = CreateObject<LteInterference> ();
+  m_interferenceCtrl = CreateObject<LteInterference> ();
   for (uint8_t i = 0; i < 7; i++)
     {
       m_txModeGain.push_back (1.0);
@@ -94,11 +95,15 @@
   m_channel = 0;
   m_mobility = 0;
   m_device = 0;
-  m_interference->Dispose ();
-  m_interference = 0;
-  m_genericPhyTxEndCallback      = MakeNullCallback< void, Ptr<const Packet> > ();
-  m_genericPhyRxEndErrorCallback = MakeNullCallback< void > ();
-  m_genericPhyRxEndOkCallback    = MakeNullCallback< void, Ptr<Packet> >  ();
+  m_interferenceData->Dispose ();
+  m_interferenceData = 0;
+  m_interferenceCtrl->Dispose ();
+  m_interferenceCtrl = 0;
+  m_ltePhyTxEndCallback      = MakeNullCallback< void, Ptr<const Packet> > ();
+  m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > ();
+  m_ltePhyRxDataEndOkCallback    = MakeNullCallback< void, Ptr<Packet> >  ();
+  m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list<Ptr<LteControlMessage> > > ();
+  m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
   SpectrumPhy::DoDispose ();
 } 
 
@@ -215,34 +220,50 @@
   NS_LOG_FUNCTION (this << noisePsd);
   NS_ASSERT (noisePsd);
   m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
-  m_interference->SetNoisePowerSpectralDensity (noisePsd);
+  m_interferenceData->SetNoisePowerSpectralDensity (noisePsd);
+  m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
 }
 
 
 
 void
-LteSpectrumPhy::SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c)
+LteSpectrumPhy::SetLtePhyTxEndCallback (LtePhyTxEndCallback c)
 {
   NS_LOG_FUNCTION (this);
-  m_genericPhyTxEndCallback = c;
+  m_ltePhyTxEndCallback = c;
+}
+
+
+void
+LteSpectrumPhy::SetLtePhyRxDataEndErrorCallback (LtePhyRxDataEndErrorCallback c)
+{
+  NS_LOG_FUNCTION (this);
+  m_ltePhyRxDataEndErrorCallback = c;
 }
 
 
 void
-LteSpectrumPhy::SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c)
+LteSpectrumPhy::SetLtePhyRxDataEndOkCallback (LtePhyRxDataEndOkCallback c)
 {
   NS_LOG_FUNCTION (this);
-  m_genericPhyRxEndErrorCallback = c;
+  m_ltePhyRxDataEndOkCallback = c;
 }
 
+void
+LteSpectrumPhy::SetLtePhyRxCtrlEndOkCallback (LtePhyRxCtrlEndOkCallback c)
+{
+  NS_LOG_FUNCTION (this);
+  m_ltePhyRxCtrlEndOkCallback = c;
+}
 
 void
-LteSpectrumPhy::SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c)
+LteSpectrumPhy::SetLtePhyRxCtrlEndErrorCallback (LtePhyRxCtrlEndErrorCallback c)
 {
   NS_LOG_FUNCTION (this);
-  m_genericPhyRxEndOkCallback = c;
+  m_ltePhyRxCtrlEndErrorCallback = c;
 }
 
+
 Ptr<AntennaModel>
 LteSpectrumPhy::GetRxAntenna ()
 {
@@ -274,6 +295,7 @@
 bool
 LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
 {
+  NS_LOG_WARN (this << " Obsolete Function");
   NS_LOG_FUNCTION (this << pb);
   NS_LOG_LOGIC (this << " state: " << m_state);
 
@@ -311,26 +333,191 @@
         ChangeState (TX);
         NS_ASSERT (m_channel);
         double tti = 0.001;
-      Ptr<LteSpectrumSignalParameters> txParams = Create<LteSpectrumSignalParameters> ();
-      txParams->duration = Seconds (tti);
-      txParams->txPhy = GetObject<SpectrumPhy> ();
-      txParams->txAntenna = m_antenna;
-      txParams->psd = m_txPsd;
-      txParams->packetBurst = pb;
-      m_channel->StartTx (txParams);
+        Ptr<LteSpectrumSignalParameters> txParams = Create<LteSpectrumSignalParameters> ();
+        txParams->duration = Seconds (tti);
+        txParams->txPhy = GetObject<SpectrumPhy> ();
+        txParams->txAntenna = m_antenna;
+        txParams->psd = m_txPsd;
+        txParams->packetBurst = pb;
+        m_channel->StartTx (txParams);
         Simulator::Schedule (Seconds (tti), &LteSpectrumPhy::EndTx, this);
       }
       return false;
       break;
 
     default:
-      NS_FATAL_ERROR ("uknown state");
+      NS_FATAL_ERROR ("unknown state");
       return true;
       break;
     }
 }
 
 
+bool
+LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, double duration)
+{
+  NS_LOG_FUNCTION (this << pb);
+  NS_LOG_LOGIC (this << " state: " << m_state);
+  
+  m_phyTxStartTrace (pb);
+  
+  switch (m_state)
+  {
+    case RX:
+      NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
+      break;
+      
+    case TX:
+      NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
+      break;
+      
+    case IDLE:
+    {
+      /*
+      m_txPsd must be setted by the device, according to
+      (i) the available subchannel for transmission
+      (ii) the power transmission
+      */
+      NS_ASSERT (m_txPsd);
+      m_txPacketBurst = pb;
+      
+      // we need to convey some PHY meta information to the receiver
+      // to be used for simulation purposes (e.g., the CellId). This
+      // is done by setting the ctrlMsgList parameter of
+      // LteSpectrumSignalParametersDataFrame
+      ChangeState (TX);
+      NS_ASSERT (m_channel);
+      Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
+      txParams->duration = Seconds (duration);
+      txParams->txPhy = GetObject<SpectrumPhy> ();
+      txParams->txAntenna = m_antenna;
+      txParams->psd = m_txPsd;
+      txParams->packetBurst = pb;
+      txParams->ctrlMsgList = ctrlMsgList;
+      txParams->cellId = m_cellId;
+      m_channel->StartTx (txParams);
+      Simulator::Schedule (Seconds (duration), &LteSpectrumPhy::EndTx, this);
+    }
+    return false;
+    break;
+    
+    default:
+      NS_FATAL_ERROR ("unknown state");
+      return true;
+      break;
+  }
+}
+
+bool
+LteSpectrumPhy::StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > ctrlMsgList)
+{
+  NS_LOG_FUNCTION (this << time);
+  NS_LOG_LOGIC (this << " state: " << m_state);
+  
+//   m_phyTxStartTrace (pb);
+  
+  switch (m_state)
+  {
+    case RX:
+      NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
+      break;
+      
+    case TX:
+      NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
+      break;
+      
+    case IDLE:
+    {
+      /*
+      m_txPsd must be setted by the device, according to
+      (i) the available subchannel for transmission
+      (ii) the power transmission
+      */
+      NS_ASSERT (m_txPsd);
+      
+      // we need to convey some PHY meta information to the receiver
+      // to be used for simulation purposes (e.g., the CellId). This
+      // is done by setting the cellId parameter of
+      // LteSpectrumSignalParametersDlCtrlFrame
+      ChangeState (TX);
+      NS_ASSERT (m_channel);
+      double dlCtrlFrame = 0.000214286; // 0.001 / 14 * 3 (fixed to 3 symbols)
+      Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+      txParams->duration = Seconds (dlCtrlFrame);
+      txParams->txPhy = GetObject<SpectrumPhy> ();
+      txParams->txAntenna = m_antenna;
+      txParams->psd = m_txPsd;
+      txParams->cellId = m_cellId;
+      txParams->ctrlMsgList = ctrlMsgList;
+      m_channel->StartTx (txParams);
+      Simulator::Schedule (Seconds (dlCtrlFrame), &LteSpectrumPhy::EndTx, this);
+    }
+    return false;
+    break;
+    
+    default:
+      NS_FATAL_ERROR ("unknown state");
+      return true;
+      break;
+  }
+}
+
+
+bool
+LteSpectrumPhy::StartTxUlSrsFrame ()
+{
+  NS_LOG_FUNCTION (this << time);
+  NS_LOG_LOGIC (this << " state: " << m_state);
+  
+  //   m_phyTxStartTrace (pb);
+  
+  switch (m_state)
+  {
+    case RX:
+      NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
+      break;
+      
+    case TX:
+      NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
+      break;
+      
+    case IDLE:
+    {
+      /*
+      m_txPsd must be setted by the device, according to
+      (i) the available subchannel for transmission
+      (ii) the power transmission
+      */
+      NS_ASSERT (m_txPsd);
+      
+      // we need to convey some PHY meta information to the receiver
+      // to be used for simulation purposes (e.g., the CellId). This
+      // is done by setting the cellId parameter of 
+      // LteSpectrumSignalParametersDlCtrlFrame
+      ChangeState (TX);
+      NS_ASSERT (m_channel);
+      double ulCtrlFrame = 0.000071429; // 0.001 / 14 * 1 (fixed to 1 symbols)
+      Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+      txParams->duration = Seconds (ulCtrlFrame);
+      txParams->txPhy = GetObject<SpectrumPhy> ();
+      txParams->txAntenna = m_antenna;
+      txParams->psd = m_txPsd;
+      txParams->cellId = m_cellId;
+      m_channel->StartTx (txParams);
+      Simulator::Schedule (Seconds (ulCtrlFrame), &LteSpectrumPhy::EndTx, this);
+    }
+    return false;
+    break;
+    
+    default:
+      NS_FATAL_ERROR ("unknown state");
+      return true;
+      break;
+  }
+}
+
+
+
 void
 LteSpectrumPhy::EndTx ()
 {
@@ -341,13 +528,13 @@
 
   m_phyTxEndTrace (m_txPacketBurst);
 
-  if (!m_genericPhyTxEndCallback.IsNull ())
+  if (!m_ltePhyTxEndCallback.IsNull ())
     {
       for (std::list<Ptr<Packet> >::const_iterator iter = m_txPacketBurst->Begin (); iter
            != m_txPacketBurst->End (); ++iter)
         {
           Ptr<Packet> packet = (*iter)->Copy ();
-          m_genericPhyTxEndCallback (packet);
+          m_ltePhyTxEndCallback (packet);
         }
     }
 
@@ -361,85 +548,197 @@
 {
   NS_LOG_FUNCTION (this << spectrumRxParams);
   NS_LOG_LOGIC (this << " state: " << m_state);
-
-  // interference will happen regardless of the type of the signal (could be 3G, GSM, whatever)
+  
   Ptr <const SpectrumValue> rxPsd = spectrumRxParams->psd;
   Time duration = spectrumRxParams->duration;
-            
-  m_interference->AddSignal (rxPsd, duration);
-
+  
   // the device might start RX only if the signal is of a type
   // understood by this device - in this case, an LTE signal.
-  Ptr<LteSpectrumSignalParameters> lteRxParams = DynamicCast<LteSpectrumSignalParameters> (spectrumRxParams);
-  if (lteRxParams != 0)
+  Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
+  if (lteDataRxParams != 0)
+    {
+      m_interferenceData->AddSignal (rxPsd, duration);
+      StartRxData (lteDataRxParams);
+    }
+  else
     {
-      switch (m_state)
+      Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
+      Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
+      if ((lteDlCtrlRxParams!=0)||(lteUlSrsRxParams!=0))
         {
-        case TX:
-          NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
-          break;
+          m_interferenceCtrl->AddSignal (rxPsd, duration);
+          StartRxCtrl (spectrumRxParams);
+        }
+      else
+        {
+          // other type of signal (cuold be 3G, GSM, whatever) -> interference
+          m_interferenceData->AddSignal (rxPsd, duration);
+          m_interferenceCtrl->AddSignal (rxPsd, duration);
+        }
+    }
+
+}
 
-        case IDLE:
-        case RX:
-          // the behavior is similar when
-          // we're IDLE or RX because we can receive more signals
-          // simultaneously (e.g., at the eNB).
+void
+LteSpectrumPhy::StartRxData (Ptr<LteSpectrumSignalParametersDataFrame> params)
+{
+  NS_LOG_FUNCTION (this);
+  switch (m_state)
+    {
+      case TX:
+        NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
+        break;
+        
+      case IDLE:
+      case RX:
+        // the behavior is similar when
+        // we're IDLE or RX because we can receive more signals
+        // simultaneously (e.g., at the eNB).
+        {
+          // To check if we're synchronized to this signal, we check
+          // for the CellId which is reported in the
+          //  LteSpectrumSignalParametersDataFrame
+          if (params->cellId  == m_cellId)
+            {
+              NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << params->cellId << ")");
+              if ((m_rxPacketBurstList.empty ())&&(m_rxControlMessageList.empty ()))
+                {
+                  NS_ASSERT (m_state == IDLE);
+                  // first transmission, i.e., we're IDLE and we
+                  // start RX
+                  m_firstRxStart = Simulator::Now ();
+                  m_firstRxDuration = params->duration;
+                  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration);
+                  Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, this);
+                }
+              else
+                {
+                  NS_ASSERT (m_state == RX);
+                  // sanity check: if there are multiple RX events, they
+                  // should occur at the same time and have the same
+                  // duration, otherwise the interference calculation
+                  // won't be correct
+                  NS_ASSERT ((m_firstRxStart == Simulator::Now ()) 
+                  && (m_firstRxDuration == params->duration));
+                }
+              
+              ChangeState (RX);
+              if (params->packetBurst)
+                {
+                  m_rxPacketBurstList.push_back (params->packetBurst);
+                  m_interferenceData->StartRx (params->psd);
+                  
+                  m_phyRxStartTrace (params->packetBurst);
+                }
+                NS_LOG_DEBUG (this << " insert msgs " << params->ctrlMsgList.size ());
+              m_rxControlMessageList.insert (m_rxControlMessageList.end (), params->ctrlMsgList.begin (), params->ctrlMsgList.end ());
+              
+              NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
+            }
+          else
+            {
+              NS_LOG_LOGIC (this << " not in sync with this signal (cellId=" 
+              << params->cellId  << ", m_cellId=" << m_cellId << ")");
+            }
+        }
+        break;
+        
+        default:
+          NS_FATAL_ERROR ("unknown state");
+          break;
+      }
+      
+   NS_LOG_LOGIC (this << " state: " << m_state);
+}
+
+
+
+void
+LteSpectrumPhy::StartRxCtrl (Ptr<SpectrumSignalParameters> params)
+{
+  NS_LOG_FUNCTION (this);
+  switch (m_state)
+  {
+    case TX:
+      NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
+      break;
+      
+    case IDLE:
+    case RX:
+      // the behavior is similar when
+      // we're IDLE or RX because we can receive more signals
+      // simultaneously (e.g., at the eNB).
+      {
+        // To check if we're synchronized to this signal, we check
+        // for the CellId which is reported in the
+        // LteSpectrumSignalParametersDlCtrlFrame
+        uint16_t cellId;
+        bool dl;
+        Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (params);
+        if (lteDlCtrlRxParams!=0)
           {
-            // To check if we're synchronized to this signal, we check
-            // for the CellId which is reported in the LtePhyTag
-            NS_ASSERT (lteRxParams->packetBurst->Begin () != lteRxParams->packetBurst->End ());
-            LtePhyTag tag;
-            Ptr<Packet> firstPacketInBurst = *(lteRxParams->packetBurst->Begin ());
-            firstPacketInBurst->RemovePacketTag (tag);
-            if (tag.GetCellId () == m_cellId)
+            cellId = lteDlCtrlRxParams->cellId;
+            dl = true;
+          }
+        else
+          {
+            Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (params);
+            cellId = lteUlSrsRxParams->cellId;
+            dl = false;
+          }
+        if (cellId  == m_cellId)
+        {
+          NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
+          if (m_state == IDLE)
+          {
+            // first transmission, i.e., we're IDLE and we
+            // start RX
+            NS_ASSERT (m_rxControlMessageList.empty ());
+            m_firstRxStart = Simulator::Now ();
+            m_firstRxDuration = params->duration;
+            NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration);
+            if (dl==true)
               {
-                NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << tag.GetCellId () << ")");
-                if (m_rxPacketBurstList.empty ())
-                  {
-                    NS_ASSERT (m_state == IDLE);
-                    // first transmission, i.e., we're IDLE and we
-                    // start RX
-                    m_firstRxStart = Simulator::Now ();
-                    m_firstRxDuration = duration;
-                    NS_LOG_LOGIC (this << " scheduling EndRx with delay " << duration);
-                    Simulator::Schedule (duration, &LteSpectrumPhy::EndRx, this);
-                  }
-                else
-                  {
-                    NS_ASSERT (m_state == RX);
-                    // sanity check: if there are multiple RX events, they
-                    // should occur at the same time and have the same
-                    // duration, otherwise the interference calculation
-                    // won't be correct
-                    NS_ASSERT ((m_firstRxStart == Simulator::Now ()) 
-                               && (m_firstRxDuration == duration));
-                  }
-
-                ChangeState (RX);
-                m_interference->StartRx (rxPsd);
-
-                m_phyRxStartTrace (lteRxParams->packetBurst);
-
-                m_rxPacketBurstList.push_back (lteRxParams->packetBurst);
- 
-                NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
+                // store the DCIs
+                m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
+                Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
               }
             else
               {
-                NS_LOG_LOGIC (this << " not in sync with this signal (cellId=" 
-                                   << tag.GetCellId () << ", m_cellId=" << m_cellId << ")");
+                Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxUlSrs, this);
               }
           }
-          break;
+          else if (m_state == RX)
+          {
+            // sanity check: if there are multiple RX events, they
+            // should occur at the same time and have the same
+            // duration, otherwise the interference calculation
+            // won't be correct
+            NS_ASSERT ((m_firstRxStart == Simulator::Now ()) 
+            && (m_firstRxDuration == params->duration));
+          }
+          
+          ChangeState (RX);
+          m_interferenceCtrl->StartRx (params->psd);
+          
+//           NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
+        }
+        else
+        {
+          NS_LOG_LOGIC (this << " not in sync with this signal (cellId=" 
+          << cellId  << ", m_cellId=" << m_cellId << ")");
+        }
+      }
+      break;
+      
+      default:
+        NS_FATAL_ERROR ("unknown state");
+        break;
+  }
+  
+  NS_LOG_LOGIC (this << " state: " << m_state);
+}
 
-        default:
-          NS_FATAL_ERROR ("unknown state");
-          break;
-        }
-
-      NS_LOG_LOGIC (this << " state: " << m_state);
-    }
-}
 
 void
 LteSpectrumPhy::UpdateSinrPerceived (const SpectrumValue& sinr)
@@ -470,7 +769,7 @@
 
 
 void
-LteSpectrumPhy::EndRx ()
+LteSpectrumPhy::EndRxData ()
 {
   NS_LOG_FUNCTION (this);
   NS_LOG_LOGIC (this << " state: " << m_state);
@@ -479,7 +778,7 @@
 
   // this will trigger CQI calculation and Error Model evaluation
   // as a side effect, the error model should update the error status of all TBs
-  m_interference->EndRx ();
+  m_interferenceData->EndRx ();
   NS_LOG_DEBUG (this << " No. of burts " << m_rxPacketBurstList.size ());
   NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
   expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
@@ -504,7 +803,6 @@
 //         }
       itTb++;
     }
-    
     for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin (); 
     i != m_rxPacketBurstList.end (); ++i)
       {
@@ -524,9 +822,9 @@
                   {
                     m_phyRxEndOkTrace (*j);
                 
-                    if (!m_genericPhyRxEndOkCallback.IsNull ())
+                    if (!m_ltePhyRxDataEndOkCallback.IsNull ())
                       {
-                        m_genericPhyRxEndOkCallback (*j);
+                        m_ltePhyRxDataEndOkCallback (*j);
                       }
                   }
                 else
@@ -537,21 +835,85 @@
               }
           }
       }
+      
+  if (!m_rxControlMessageList.empty ())
+    {
+      if (!m_ltePhyRxCtrlEndOkCallback.IsNull ())
+        {
+          m_ltePhyRxCtrlEndOkCallback (m_rxControlMessageList);
+        }
+    }
   ChangeState (IDLE);
   m_rxPacketBurstList.clear ();
+  m_rxControlMessageList.clear ();
   m_expectedTbs.clear ();
 }
 
+
+void
+LteSpectrumPhy::EndRxDlCtrl ()
+{
+  NS_LOG_FUNCTION (this);
+  NS_LOG_LOGIC (this << " state: " << m_state);
+  
+  NS_ASSERT (m_state == RX);
+  
+  // this will trigger CQI calculation and Error Model evaluation
+  // as a side effect, the error model should update the error status of all TBs
+  m_interferenceCtrl->EndRx ();
+  // apply transmission mode gain
+  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
+  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
+  if (m_transmissionMode > 0)
+    {
+      // Control signaling always is tranmissted in Tx diversity mode
+      m_sinrPerceived *= m_txModeGain.at (1);
+    }
+  // TODO: Check correctness
+  bool error = false;
+  if (!error)
+    {
+      if (!m_ltePhyRxCtrlEndOkCallback.IsNull ())
+        {
+          m_ltePhyRxCtrlEndOkCallback (m_rxControlMessageList);
+        }
+    }
+  else
+    {
+      if (!m_ltePhyRxCtrlEndErrorCallback.IsNull ())
+        {
+          m_ltePhyRxCtrlEndErrorCallback ();
+        }
+    }
+  ChangeState (IDLE);
+  m_rxControlMessageList.clear ();
+}
+
+void
+LteSpectrumPhy::EndRxUlSrs ()
+{
+  m_interferenceCtrl->EndRx ();
+  // nothing to do (used only for SRS at this stage)
+  ChangeState (IDLE);
+}
+
 void 
 LteSpectrumPhy::SetCellId (uint16_t cellId)
 {
   m_cellId = cellId;
 }
 
+
 void
-LteSpectrumPhy::AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
+LteSpectrumPhy::AddDataSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
 {
-  m_interference->AddSinrChunkProcessor (p);
+  m_interferenceData->AddSinrChunkProcessor (p);
+}
+
+void
+LteSpectrumPhy::AddCtrlSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
+{
+  m_interferenceCtrl->AddSinrChunkProcessor (p);
 }
 
 void 
--- a/src/lte/model/lte-spectrum-phy.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-spectrum-phy.h	Fri Jun 15 16:49:51 2012 +0200
@@ -38,6 +38,7 @@
 #include <ns3/lte-interference.h>
 #include <ns3/random-variable.h>
 #include <map>
+#include <ns3/ff-mac-common.h>
 
 namespace ns3 {
 
@@ -65,8 +66,54 @@
 
 typedef std::map<TbId_t, tbInfo_t> expectedTbs_t;
 
+
 class LteNetDevice;
 class AntennaModel;
+class LteControlMessage;
+class LteSpectrumSignalParametersDataFrame;
+class LteSpectrumSignalParametersDlCtrlFrame;
+class LteSpectrumSignalParametersUlSrsFrame;
+
+
+/**
+* this method is invoked by the LteSpectrumPhy to notify the PHY that the
+* transmission of a given packet has been completed.
+*
+* @param packet the Packet whose TX has been completed.
+*/
+typedef Callback< void, Ptr<const Packet> > LtePhyTxEndCallback;
+
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX attempt has terminated without success
+*/
+typedef Callback< void > LtePhyRxDataEndErrorCallback;
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX attempt has been successfully completed.
+*
+* @param packet the received Packet
+*/
+typedef Callback< void, Ptr<Packet> > LtePhyRxDataEndOkCallback;
+
+
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX of a control frame attempt has been 
+* successfully completed.
+*
+* @param packet the received Packet
+*/
+typedef Callback< void, std::list<Ptr<LteControlMessage> > > LtePhyRxCtrlEndOkCallback;
+
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX of a control frame attempt has terminated 
+* without success.
+*/
+typedef Callback< void > LtePhyRxCtrlEndErrorCallback;
+
+
 
 /**
  * \ingroup lte
@@ -104,6 +151,8 @@
   Ptr<const SpectrumModel> GetRxSpectrumModel () const;
   Ptr<AntennaModel> GetRxAntenna ();
   void StartRx (Ptr<SpectrumSignalParameters> params);
+  void StartRxData (Ptr<LteSpectrumSignalParametersDataFrame> params);
+  void StartRxCtrl (Ptr<SpectrumSignalParameters> params);
 
   /**
    * set the Power Spectral Density of outgoing signals in W/Hz.
@@ -136,6 +185,43 @@
    * started, false otherwise.
    */
   bool StartTx (Ptr<PacketBurst> pb);
+  
+  /**
+  * Start a transmission of data frame in DL and UL
+  *
+  *
+  * @param pb the burst of packets to be transmitted in PDSCH/PUSCH
+  * @param ctrlMsgList the list of LteControlMessage to send
+  * @param duration the duration of the data frame (in sec.)
+  *
+  * @return true if an error occurred and the transmission was not
+  * started, false otherwise.
+  */
+  bool StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, double duration);
+  
+  /**
+  * Start a transmission of control frame in DL
+  *
+  *
+  * @param dlDci the burst of DL-DCIs to be transmitted
+  * @param ulDci the burst of UL-DCIs to be transmitted
+  *
+  * @return true if an error occurred and the transmission was not
+  * started, false otherwise.
+  */
+  bool StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > ctrlMsgList);
+  
+  
+  /**
+  * Start a transmission of control frame in UL
+  *
+  *
+  * @param pb the burst of control messages to be transmitted
+  *
+  * @return true if an error occurred and the transmission was not
+  * started, false otherwise.
+  */
+  bool StartTxUlSrsFrame ();
 
 
   /**
@@ -144,7 +230,7 @@
    *
    * @param c the callback
    */
-  void SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c);
+  void SetLtePhyTxEndCallback (LtePhyTxEndCallback c);
 
   /**
    * set the callback for the end of a RX in error, as part of the
@@ -152,7 +238,7 @@
    *
    * @param c the callback
    */
-  void SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c);
+  void SetLtePhyRxDataEndErrorCallback (LtePhyRxDataEndErrorCallback c);
 
   /**
    * set the callback for the successful end of a RX, as part of the
@@ -160,7 +246,23 @@
    *
    * @param c the callback
    */
-  void SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c);
+  void SetLtePhyRxDataEndOkCallback (LtePhyRxDataEndOkCallback c);
+  
+  /**
+  * set the callback for the successful end of a RX ctrl frame, as part 
+  * of the interconnections betweenthe LteSpectrumPhy and the PHY
+  *
+  * @param c the callback
+  */
+  void SetLtePhyRxCtrlEndOkCallback (LtePhyRxCtrlEndOkCallback c);
+  
+  /**
+  * set the callback for the erroneous end of a RX ctrl frame, as part 
+  * of the interconnections betweenthe LteSpectrumPhy and the PHY
+  *
+  * @param c the callback
+  */
+  void SetLtePhyRxCtrlEndErrorCallback (LtePhyRxCtrlEndErrorCallback c);
 
   /**
    * \brief Set the state of the phy layer
@@ -177,11 +279,19 @@
 
 
   /** 
-   * 
-   * 
-   * \param p the new LteSinrChunkProcessor to be added to the processing chain
-   */
-  void AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
+  * 
+  * 
+  * \param p the new LteSinrChunkProcessor to be added to the data processing chain
+  */
+  void AddDataSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
+  
+  
+  /** 
+  * 
+  * 
+  * \param p the new LteSinrChunkProcessor to be added to the ctrl processing chain
+  */
+  void AddCtrlSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
   
   /** 
   * 
@@ -214,7 +324,9 @@
 private:
   void ChangeState (State newState);
   void EndTx ();
-  void EndRx ();
+  void EndRxData ();
+  void EndRxDlCtrl ();
+  void EndRxUlSrs ();
   
   void SetTxModeGain (uint8_t txMode, double gain);
   
@@ -229,7 +341,13 @@
   Ptr<SpectrumValue> m_txPsd;
   Ptr<PacketBurst> m_txPacketBurst;
   std::list<Ptr<PacketBurst> > m_rxPacketBurstList;
-
+  
+  std::list<Ptr<LteControlMessage> > m_txControlMessageList;
+  std::list<Ptr<LteControlMessage> > m_rxControlMessageList;
+//   std::list<DlDciListElement_s> m_rxDlDciBurstList;
+//   std::list<UlDciListElement_s> m_rxUlDciBurstList;
+  
+  
   State m_state;
   Time m_firstRxStart;
   Time m_firstRxDuration;
@@ -240,11 +358,15 @@
   TracedCallback<Ptr<const Packet> > m_phyRxEndOkTrace;
   TracedCallback<Ptr<const Packet> > m_phyRxEndErrorTrace;
 
-  GenericPhyTxEndCallback        m_genericPhyTxEndCallback;
-  GenericPhyRxEndErrorCallback   m_genericPhyRxEndErrorCallback;
-  GenericPhyRxEndOkCallback      m_genericPhyRxEndOkCallback;
+  LtePhyTxEndCallback        m_ltePhyTxEndCallback;
+  LtePhyRxDataEndErrorCallback   m_ltePhyRxDataEndErrorCallback;
+  LtePhyRxDataEndOkCallback      m_ltePhyRxDataEndOkCallback;
+  
+  LtePhyRxCtrlEndOkCallback     m_ltePhyRxCtrlEndOkCallback;
+  LtePhyRxCtrlEndErrorCallback  m_ltePhyRxCtrlEndErrorCallback;
 
-  Ptr<LteInterference> m_interference;
+  Ptr<LteInterference> m_interferenceData;
+  Ptr<LteInterference> m_interferenceCtrl;
 
   uint16_t m_cellId;
   
--- a/src/lte/model/lte-spectrum-signal-parameters.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-spectrum-signal-parameters.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -21,7 +21,8 @@
 #include <ns3/log.h>
 #include <ns3/packet-burst.h>
 #include <ns3/ptr.h>
-#include "lte-spectrum-signal-parameters.h"
+#include <ns3/lte-spectrum-signal-parameters.h>
+#include <ns3/lte-control-messages.h>
 
 
 NS_LOG_COMPONENT_DEFINE ("LteSpectrumSignalParameters");
@@ -54,4 +55,99 @@
   return lssp;
 }
 
+
+
+LteSpectrumSignalParametersDataFrame::LteSpectrumSignalParametersDataFrame ()
+{
+  NS_LOG_FUNCTION (this);
+}
+
+LteSpectrumSignalParametersDataFrame::LteSpectrumSignalParametersDataFrame (const LteSpectrumSignalParametersDataFrame& p)
+: SpectrumSignalParameters (p)
+{
+  NS_LOG_FUNCTION (this << &p);
+  cellId = p.cellId;
+  if (p.packetBurst)
+    {
+      packetBurst = p.packetBurst->Copy ();
+    }
+  ctrlMsgList = p.ctrlMsgList;
+}
+
+Ptr<SpectrumSignalParameters>
+LteSpectrumSignalParametersDataFrame::Copy ()
+{
+  NS_LOG_FUNCTION (this);
+  // Ideally we would use:
+  //   return Copy<LteSpectrumSignalParameters> (*this);
+  // but for some reason it doesn't work. Another alternative is 
+  //   return Copy<LteSpectrumSignalParameters> (this);
+  // but it causes a double creation of the object, hence it is less efficient.
+  // The solution below is copied from the implementation of Copy<> (Ptr<>) in ptr.h
+  Ptr<LteSpectrumSignalParametersDataFrame> lssp (new LteSpectrumSignalParametersDataFrame (*this), false);  
+  return lssp;
+}
+
+
+
+LteSpectrumSignalParametersDlCtrlFrame::LteSpectrumSignalParametersDlCtrlFrame ()
+{
+  NS_LOG_FUNCTION (this);
+}
+
+LteSpectrumSignalParametersDlCtrlFrame::LteSpectrumSignalParametersDlCtrlFrame (const LteSpectrumSignalParametersDlCtrlFrame& p)
+: SpectrumSignalParameters (p)
+{
+  NS_LOG_FUNCTION (this << &p);
+  cellId = p.cellId;
+  ctrlMsgList = p.ctrlMsgList;
+}
+
+Ptr<SpectrumSignalParameters>
+LteSpectrumSignalParametersDlCtrlFrame::Copy ()
+{
+  NS_LOG_FUNCTION (this);
+  // Ideally we would use:
+  //   return Copy<LteSpectrumSignalParameters> (*this);
+  // but for some reason it doesn't work. Another alternative is 
+  //   return Copy<LteSpectrumSignalParameters> (this);
+  // but it causes a double creation of the object, hence it is less efficient.
+  // The solution below is copied from the implementation of Copy<> (Ptr<>) in ptr.h
+  Ptr<LteSpectrumSignalParametersDlCtrlFrame> lssp (new LteSpectrumSignalParametersDlCtrlFrame (*this), false);  
+  return lssp;
+}
+
+
+LteSpectrumSignalParametersUlSrsFrame::LteSpectrumSignalParametersUlSrsFrame ()
+{
+  NS_LOG_FUNCTION (this);
+}
+
+LteSpectrumSignalParametersUlSrsFrame::LteSpectrumSignalParametersUlSrsFrame (const LteSpectrumSignalParametersUlSrsFrame& p)
+: SpectrumSignalParameters (p)
+{
+  NS_LOG_FUNCTION (this << &p);
+  cellId = p.cellId;
+}
+
+Ptr<SpectrumSignalParameters>
+LteSpectrumSignalParametersUlSrsFrame::Copy ()
+{
+  NS_LOG_FUNCTION (this);
+  // Ideally we would use:
+  //   return Copy<LteSpectrumSignalParameters> (*this);
+  // but for some reason it doesn't work. Another alternative is 
+  //   return Copy<LteSpectrumSignalParameters> (this);
+  // but it causes a double creation of the object, hence it is less efficient.
+  // The solution below is copied from the implementation of Copy<> (Ptr<>) in ptr.h
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> lssp (new LteSpectrumSignalParametersUlSrsFrame (*this), false);  
+  return lssp;
+}
+
+
+
+
+
+
+
 } // namespace ns3
--- a/src/lte/model/lte-spectrum-signal-parameters.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-spectrum-signal-parameters.h	Fri Jun 15 16:49:51 2012 +0200
@@ -23,10 +23,13 @@
 
 
 #include <ns3/spectrum-signal-parameters.h>
+// #include <ns3/ff-mac-common.h>
 
 namespace ns3 {
 
 class PacketBurst;
+class LteControlMessage;
+
 
 /**
  * \ingroup lte
@@ -55,6 +58,95 @@
   Ptr<PacketBurst> packetBurst;
 };
 
+
+/**
+* \ingroup lte
+*
+* Signal parameters for Lte Data Frame (PDSCH), and eventually after some 
+* control messages through other control channel embedded in PDSCH
+* (i.e. PBCH)
+*/
+struct LteSpectrumSignalParametersDataFrame : public SpectrumSignalParameters
+{
+  
+  // inherited from SpectrumSignalParameters
+  virtual Ptr<SpectrumSignalParameters> Copy ();
+  
+  /**
+  * default constructor
+  */
+  LteSpectrumSignalParametersDataFrame ();
+  
+  /**
+  * copy constructor
+  */
+  LteSpectrumSignalParametersDataFrame (const LteSpectrumSignalParametersDataFrame& p);
+  
+  /**
+  * The packet burst being transmitted with this signal
+  */
+  Ptr<PacketBurst> packetBurst;
+  
+  std::list<Ptr<LteControlMessage> > ctrlMsgList;
+  
+  uint16_t cellId;
+};
+
+
+/**
+* \ingroup lte
+*
+* Signal parameters for Lte DL Ctrl Frame (RS, PCFICH and PDCCH)
+*/
+struct LteSpectrumSignalParametersDlCtrlFrame : public SpectrumSignalParameters
+{
+  
+  // inherited from SpectrumSignalParameters
+  virtual Ptr<SpectrumSignalParameters> Copy ();
+  
+  /**
+  * default constructor
+  */
+  LteSpectrumSignalParametersDlCtrlFrame ();
+  
+  /**
+  * copy constructor
+  */
+  LteSpectrumSignalParametersDlCtrlFrame (const LteSpectrumSignalParametersDlCtrlFrame& p);
+
+
+  std::list<Ptr<LteControlMessage> > ctrlMsgList;
+  
+  uint16_t cellId;
+};
+
+
+
+/**
+* \ingroup lte
+*
+* Signal parameters for Lte SRS Frame
+*/
+struct LteSpectrumSignalParametersUlSrsFrame : public SpectrumSignalParameters
+{
+  
+  // inherited from SpectrumSignalParameters
+  virtual Ptr<SpectrumSignalParameters> Copy ();
+  
+  /**
+  * default constructor
+  */
+  LteSpectrumSignalParametersUlSrsFrame ();
+  
+  /**
+  * copy constructor
+  */
+  LteSpectrumSignalParametersUlSrsFrame (const LteSpectrumSignalParametersUlSrsFrame& p);
+  
+  uint16_t cellId;
+};
+
+
 }  // namespace ns3
 
 
--- a/src/lte/model/lte-ue-mac.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-ue-mac.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -30,7 +30,7 @@
 #include "lte-ue-net-device.h"
 #include "lte-radio-bearer-tag.h"
 #include <ns3/ff-mac-common.h>
-#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-control-messages.h>
 #include <ns3/simulator.h>
 #include <ns3/lte-common.h>
 
@@ -136,7 +136,7 @@
   // inherited from LtePhySapUser
   virtual void ReceivePhyPdu (Ptr<Packet> p);
   virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
 
 private:
   LteUeMac* m_mac;
@@ -161,9 +161,9 @@
 }
 
 void
-UeMemberLteUePhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+UeMemberLteUePhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
 {
-  m_mac->DoReceiveIdealControlMessage (msg);
+  m_mac->DoReceiveLteControlMessage (msg);
 }
 
 
@@ -304,9 +304,9 @@
     }
 
   // create the feedback to eNB
-  Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
+  Ptr<BsrLteControlMessage> msg = Create<BsrLteControlMessage> ();
   msg->SetBsr (bsr);
-  m_uePhySapProvider->SendIdealControlMessage (msg);
+  m_uePhySapProvider->SendLteControlMessage (msg);
 
 }
 
@@ -358,12 +358,12 @@
 
 
 void
-LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteUeMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this);
-  if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
+  if (msg->GetMessageType () == LteControlMessage::UL_DCI)
     {
-      Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
+      Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
       UlDciListElement_s dci = msg2->GetDci ();
       std::map <uint8_t, uint64_t>::iterator itBsr;
       NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
@@ -403,7 +403,7 @@
     }
   else
     {
-      NS_LOG_FUNCTION (this << " IdealControlMessage not recognized");
+      NS_LOG_FUNCTION (this << " LteControlMessage not recognized");
     }
 }
 
--- a/src/lte/model/lte-ue-mac.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-ue-mac.h	Fri Jun 15 16:49:51 2012 +0200
@@ -85,7 +85,7 @@
 
   // forwarded from PHY SAP
   void DoReceivePhyPdu (Ptr<Packet> p);
-  void DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  void DoReceiveLteControlMessage (Ptr<LteControlMessage> msg);
   
   void SendReportBufferStatus (void);
 
--- a/src/lte/model/lte-ue-phy-sap.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-ue-phy-sap.h	Fri Jun 15 16:49:51 2012 +0200
@@ -27,7 +27,7 @@
 
 namespace ns3 {
 
-class IdealControlMessage;
+class LteControlMessage;
 
 /**
 * Service Access Point (SAP) offered by the UE-PHY to the UE-MAC
@@ -59,10 +59,10 @@
   virtual void SetTransmissionMode (uint8_t   txMode) = 0;
 
   /**
-  * \brief Send SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+  * \brief Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
   * \param msg the Ideal Control Message to send
   */
-  virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+  virtual void SendLteControlMessage (Ptr<LteControlMessage> msg) = 0;
 
 
 };
@@ -95,10 +95,10 @@
   virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo) = 0;
 
   /**
-  * \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+  * \brief Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
   * \param msg the Ideal Control Message to receive
   */
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+  virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg) = 0;
 
 };
 
--- a/src/lte/model/lte-ue-phy.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-ue-phy.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -55,7 +55,7 @@
   // inherited from LtePhySapProvider
   virtual void SendMacPdu (Ptr<Packet> p);
   virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
-  virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
   virtual void SetTransmissionMode (uint8_t txMode);
 
 private:
@@ -81,9 +81,9 @@
 }
 
 void
-UeMemberLteUePhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
+UeMemberLteUePhySapProvider::SendLteControlMessage (Ptr<LteControlMessage> msg)
 {
-  m_phy->DoSendIdealControlMessage (msg);
+  m_phy->DoSendLteControlMessage (msg);
 }
 
 void
@@ -119,12 +119,12 @@
 {
   m_amc = CreateObject <LteAmc> ();
   m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
-  m_macChTtiDelay = UL_PUSCH_TTIS_DELAY + 1; // +1 for avoiding UL/DL trigger synchronization remove 1 TTI of delay
+  m_macChTtiDelay = UL_PUSCH_TTIS_DELAY;
   for (int i = 0; i < m_macChTtiDelay; i++)
     {
       Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
       m_packetBurstQueue.push_back (pb);
-      std::list<Ptr<IdealControlMessage> > l;
+      std::list<Ptr<LteControlMessage> > l;
       m_controlMessagesQueue.push_back (l);
     }
   std::vector <int> ulRb;
@@ -350,23 +350,23 @@
   if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
     {
       Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
-      Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
-      DoSendIdealControlMessage (msg);
+      Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
+      DoSendLteControlMessage (msg);
       m_p10CqiLast = Simulator::Now ();
     }
   // check aperiodic high-layer configured subband CQI
   if  (Simulator::Now () > m_a30CqiLast + m_a30CqiPeriocity)
     {
       Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
-      Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
-      DoSendIdealControlMessage (msg);
+      Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
+      DoSendLteControlMessage (msg);
       m_a30CqiLast = Simulator::Now ();
     }
 }
 
 
 
-Ptr<DlCqiIdealControlMessage>
+Ptr<DlCqiLteControlMessage>
 LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
 {
   NS_LOG_FUNCTION (this);
@@ -379,8 +379,8 @@
 
 
 
-  // CREATE DlCqiIdealControlMessage
-  Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
+  // CREATE DlCqiLteControlMessage
+  Ptr<DlCqiLteControlMessage> msg = Create<DlCqiLteControlMessage> ();
   CqiListElement_s dlcqi;
   std::vector<int> cqi;
   if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
@@ -470,87 +470,103 @@
 
 
 void
-LteUePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteUePhy::DoSendLteControlMessage (Ptr<LteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this << msg);
   Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
   Ptr<LteEnbNetDevice> remoteDevice = thisDevice->GetTargetEnb ();
-  msg->SetSourceDevice (thisDevice);
-  msg->SetDestinationDevice (remoteDevice);
   SetControlMessages (msg);
 }
 
 
 void
-LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteUePhy::ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList)
 {
-  NS_LOG_FUNCTION (this << msg);
-
-  if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
+  NS_LOG_FUNCTION (this);
+  
+  std::list<Ptr<LteControlMessage> >::iterator it;
+  for (it = msgList.begin (); it != msgList.end(); it++)
+  {
+    Ptr<LteControlMessage> msg = (*it);
+  
+    if (msg->GetMessageType () == LteControlMessage::DL_DCI)
     {
-      Ptr<DlDciIdealControlMessage> msg2 = DynamicCast<DlDciIdealControlMessage> (msg);
-
+      Ptr<DlDciLteControlMessage> msg2 = DynamicCast<DlDciLteControlMessage> (msg);
+      
       DlDciListElement_s dci = msg2->GetDci ();
-
-      if (dci.m_resAlloc != 0)
+      if (dci.m_rnti != m_rnti)
         {
-          NS_FATAL_ERROR ("Resource Allocation type not implemented");
+          // DCI not for me
+          continue;
         }
-
+      
+      if (dci.m_resAlloc != 0)
+      {
+        NS_FATAL_ERROR ("Resource Allocation type not implemented");
+      }
+      
       std::vector <int> dlRb;
-
+      
       // translate the DCI to Spectrum framework
       uint32_t mask = 0x1;
       for (int i = 0; i < 32; i++)
+      {
+        if (((dci.m_rbBitmap & mask) >> i) == 1)
         {
-          if (((dci.m_rbBitmap & mask) >> i) == 1)
-            {
-              for (int k = 0; k < GetRbgSize (); k++)
-                {
-                  dlRb.push_back ((i * GetRbgSize ()) + k);
-                  //NS_LOG_DEBUG(this << "DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
-                }
-            }
-          mask = (mask << 1);
+          for (int k = 0; k < GetRbgSize (); k++)
+          {
+            dlRb.push_back ((i * GetRbgSize ()) + k);
+            //NS_LOG_DEBUG(this << "DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
+          }
         }
+        mask = (mask << 1);
+      }
       
       // send TB info to LteSpectrumPhy
-      NS_LOG_DEBUG (this << " UE " << m_rnti << " DCI " << dci.m_rnti << " bitmap "  << dci.m_rbBitmap);
+      NS_LOG_DEBUG (this << " UE " << m_rnti << " DL-DCI " << dci.m_rnti << " bitmap "  << dci.m_rbBitmap);
       for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
-        {
-          m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i);
-        }
-
+      {
+        m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i);
+      }
+      
       SetSubChannelsForReception (dlRb);
-
-
+      
+      
     }
-  else if (msg->GetMessageType () == IdealControlMessage::UL_DCI) 
+    else if (msg->GetMessageType () == LteControlMessage::UL_DCI) 
     {
       // set the uplink bandwidht according to the UL-CQI
       NS_LOG_DEBUG (this << " UL DCI");
-      Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
+      Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
       UlDciListElement_s dci = msg2->GetDci ();
+      if (dci.m_rnti != m_rnti)
+        {
+          // DCI not for me
+          continue;
+        }
       std::vector <int> ulRb;
       for (int i = 0; i < dci.m_rbLen; i++)
-        {
-          ulRb.push_back (i + dci.m_rbStart);
-          //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
-        }
-        
+      {
+        ulRb.push_back (i + dci.m_rbStart);
+        //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
+      }
+      
       QueueSubChannelsForTransmission (ulRb);
       // pass the info to the MAC
-      m_uePhySapUser->ReceiveIdealControlMessage (msg);
+      m_uePhySapUser->ReceiveLteControlMessage (msg);
     }
-  else
+    else
     {
       // pass the message to UE-MAC
-      m_uePhySapUser->ReceiveIdealControlMessage (msg);
+      m_uePhySapUser->ReceiveLteControlMessage (msg);
     }
+    
+  }
+  
+  
+}
 
 
-}
-
 void
 LteUePhy::QueueSubChannelsForTransmission (std::vector <int> rbMap)
 {
@@ -573,36 +589,60 @@
   m_subChannelsForTransmissionQueue.at (m_macChTtiDelay-1).clear ();
   
 
-  // send control messages
-  std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
-  if (ctrlMsg.size () > 0)
+  bool srs = false; // TODO: implement periodicity
+  double dataFrame = 0.001;
+  if (srs)
     {
-      Ptr<LtePhy> phy = GetDevice ()->GetObject<LteUeNetDevice> ()->GetTargetEnb ()->GetPhy ();
-      std::list<Ptr<IdealControlMessage> >::iterator it;
-      it = ctrlMsg.begin ();
-      while (it != ctrlMsg.end ())
-        {
-          Ptr<IdealControlMessage> msg = (*it);
-          phy->ReceiveIdealControlMessage (msg);
-          ctrlMsg.pop_front ();
-          it = ctrlMsg.begin ();
-        }
+      dataFrame -= 0.000071429; // subtract 1 symbol reserved for SRS
+      SendSrsChannel ();
     }
 
+
+  std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
   // send packets in queue
   // send the current burts of packets
   Ptr<PacketBurst> pb = GetPacketBurst ();
   if (pb)
     {
-      NS_LOG_LOGIC (this << " UE - start TX");
-      m_uplinkSpectrumPhy->StartTx (pb);
+      NS_LOG_LOGIC (this << " UE - start TX PUSCH + PUCCH");
+      m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, dataFrame);
     }
+  else
+    {
+      // send only PUCCH (ideal: fake full bandwidth signal)
+      if (ctrlMsg.size ()>0)
+        {
+          std::vector <int> dlRb;
+          for (uint8_t i = 0; i < m_ulBandwidth; i++)
+            {
+              dlRb.push_back (i);
+            }
+          SetSubChannelsForTransmission (dlRb);
+          m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, dataFrame);
+        }
+    }
+  
     
   // trigger the MAC
   m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
 
 }
 
+void
+LteUePhy::SendSrsChannel ()
+{
+  NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS");
+  // set the current tx power spectral density (full bandwidth)
+  std::vector <int> dlRb;
+  for (uint8_t i = 0; i < m_ulBandwidth; i++)
+    {
+      dlRb.push_back (i);
+    }
+  SetSubChannelsForTransmission (dlRb);
+  m_uplinkSpectrumPhy->StartTxUlSrsFrame ();
+}
+
+
 
 void
 LteUePhy::SetEnbCellId (uint16_t cellId)
--- a/src/lte/model/lte-ue-phy.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/lte-ue-phy.h	Fri Jun 15 16:49:51 2012 +0200
@@ -26,7 +26,7 @@
 #include <ns3/lte-phy.h>
 #include <ns3/ff-mac-common.h>
 
-#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-control-messages.h>
 #include <ns3/lte-amc.h>
 #include <ns3/lte-ue-phy-sap.h>
 #include <ns3/ptr.h>
@@ -151,15 +151,15 @@
   * the physical layer with the signal received from eNB
   * \param sinr SINR values vector
   */
-  Ptr<DlCqiIdealControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
+  Ptr<DlCqiLteControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
 
 
 
   // inherited from LtePhy
   virtual void GenerateCqiReport (const SpectrumValue& sinr);
 
-  virtual void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
+  virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
   
   virtual void DoSetTransmissionMode (uint8_t txMode);
   
@@ -195,6 +195,9 @@
    */
   void SetEnbCellId (uint16_t cellId);
   
+  void SendSrsChannel ();
+  
+  
 
 
 private:
--- a/src/lte/model/pf-ff-mac-scheduler.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -930,7 +930,7 @@
           rbgAllocationMap.push_back ((*it).first);
         }
       uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
-//       NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated);
+      NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated);
       UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
       uldci.m_ndi = 1;
       uldci.m_cceIndex = 0;
--- a/src/lte/model/rem-spectrum-phy.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/model/rem-spectrum-phy.cc	Fri Jun 15 16:49:51 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> convert to
+ *               LteSpectrumSignalParametersDlCtrlFrame framework
  */
 
 
@@ -24,6 +26,7 @@
 #include <ns3/double.h>
 #include <ns3/simulator.h>
 #include <ns3/trace-source-accessor.h>
+#include <ns3/lte-spectrum-signal-parameters.h>
 #include <ns3/antenna-model.h>
 
 #include "rem-spectrum-phy.h"
@@ -119,15 +122,19 @@
 RemSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> params)
 {
   NS_LOG_FUNCTION ( this << params);
+
   if (m_active)
-    {      
-      double power = Integral (*(params->psd));
-      NS_ASSERT_MSG (params->duration.GetMilliSeconds () == 1, 
-                     "RemSpectrumPhy works only for LTE signals with duration of 1 ms");
-      m_sumPower += power;
-      if (power > m_referenceSignalPower)
+    {
+      Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (params);
+      if (lteDlCtrlRxParams!=0)
         {
-          m_referenceSignalPower = power;
+          double power = Integral (*(params->psd));
+                               
+          m_sumPower += power;
+          if (power > m_referenceSignalPower)
+            {
+              m_referenceSignalPower = power;
+            }
         }
     }
 }
--- a/src/lte/test/lte-test-downlink-sinr.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-downlink-sinr.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ *     Extend to Data and Ctrl frames
  */
 
 #include "ns3/simulator.h"
@@ -26,10 +28,11 @@
 
 #include "ns3/lte-phy-tag.h"
 #include "ns3/lte-test-ue-phy.h"
-#include "ns3/lte-sinr-chunk-processor.h"
+#include "ns3/lte-test-sinr-chunk-processor.h"
 #include "ns3/lte-spectrum-signal-parameters.h"
 
 #include "ns3/lte-test-downlink-sinr.h"
+#include <ns3/lte-control-messages.h>
 
 NS_LOG_COMPONENT_DEFINE ("LteDownlinkSinrTest");
 
@@ -78,7 +81,8 @@
   (*theoreticalSinr1)[0] = 3.72589167251055;
   (*theoreticalSinr1)[1] = 3.72255684126076;
 
-  AddTestCase (new LteDownlinkSinrTestCase (rxPsd1, theoreticalSinr1, "sdBm = [-46 -48]"));
+  AddTestCase (new LteDownlinkDataSinrTestCase (rxPsd1, theoreticalSinr1, "sdBm = [-46 -48]"));
+  AddTestCase (new LteDownlinkCtrlSinrTestCase (rxPsd1, theoreticalSinr1, "sdBm = [-46 -48]"));
 
   /**
    * TX signal #2: Power Spectral Density (W/Hz) of the signal of interest = [-63 -61] dBm and BW = [20 22] MHz
@@ -91,7 +95,9 @@
   (*theoreticalSinr2)[0] = 0.0743413124381667;
   (*theoreticalSinr2)[1] = 0.1865697965291756;
 
-  AddTestCase (new LteDownlinkSinrTestCase (rxPsd2, theoreticalSinr2, "sdBm = [-63 -61]"));
+  AddTestCase (new LteDownlinkDataSinrTestCase (rxPsd2, theoreticalSinr2, "sdBm = [-63 -61]"));
+  AddTestCase (new LteDownlinkCtrlSinrTestCase (rxPsd2, theoreticalSinr2, "sdBm = [-63 -61]"));
+  
 
 }
 
@@ -99,11 +105,11 @@
 
 
 /**
- * TestCase
+ * TestCase Data
  */
 
-LteDownlinkSinrTestCase::LteDownlinkSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name)
-  : TestCase ("SINR calculation in downlink: " + name),
+LteDownlinkDataSinrTestCase::LteDownlinkDataSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name)
+  : TestCase ("SINR calculation in downlink Data frame: " + name),
     m_sv (sv),
     m_sm (sv->GetSpectrumModel ()),
     m_sinr (sinr)
@@ -111,12 +117,12 @@
   NS_LOG_INFO ("Creating LenaDownlinkSinrTestCase");
 }
 
-LteDownlinkSinrTestCase::~LteDownlinkSinrTestCase ()
+LteDownlinkDataSinrTestCase::~LteDownlinkDataSinrTestCase ()
 {
 }
 
 void
-LteDownlinkSinrTestCase::DoRun (void)
+LteDownlinkDataSinrTestCase::DoRun (void)
 {
   /**
    * Instantiate a single receiving LteSpectrumPhy
@@ -124,17 +130,19 @@
   Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
   Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
   Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
-
-  dlPhy->SetCellId (100);
+  uint16_t cellId = 100;
+  dlPhy->SetCellId (cellId);
+  ulPhy->SetCellId (cellId);
 
-  Ptr<LteCqiSinrChunkProcessor> chunkProcessor = Create<LteCqiSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
-  dlPhy->AddSinrChunkProcessor (chunkProcessor);
+  Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+  dlPhy->AddDataSinrChunkProcessor (chunkProcessor);
 
   /**
-   * Generate several calls to LteSpectrumPhy::StartRx corresponding to several signals.
-   * One will be the signal of interest, i.e., the PhyTag of the first Packet in the Packet burst
-   * will have the same CellId of the receiving PHY;
-   * the others will have a different CellId and hence will be the interfering signals
+   * Generate several calls to LteSpectrumPhy::StartRx corresponding to 
+   * several signals. One will be the signal of interest, i.e., the
+   *  LteSpectrumSignalParametersDataFrame of the Packet burst
+   * will have the same CellId of the receiving PHY; the others will have 
+   * a different CellId and hence will be the interfering signals
    */
 
   // Number of packet bursts (1 data + 4 interferences)
@@ -148,9 +156,9 @@
 
   // Packets
   Ptr<Packet> pkt[numOfPbs][numOfPkts];
-
-  // Phy tags
-  LtePhyTag pktTag[numOfPbs];
+  
+  // Packet bursts cellId
+  uint16_t pbCellId[numOfPbs];
 
   /**
    * Build packet burst
@@ -159,20 +167,13 @@
     {
       // Create packet burst
       packetBursts[pb] = CreateObject<PacketBurst> ();
+      pbCellId[pb] = cellId * (pb + 1);
 
       // Create packets and add them to the burst
       for ( int i = 0 ; i < numOfPkts ; i++ )
         {
           pkt[pb][i] = Create<Packet> (1000);
 
-          if ( i == 0 )
-            {
-              // Create phy tag (different for each packet burst)
-              // and add to the first packet
-              pktTag[pb] = LtePhyTag (100 * (pb + 1));
-              pkt[pb][i]->AddPacketTag ( pktTag[pb] );
-            }
-
           packetBursts[pb]->AddPacket ( pkt[pb][i] );
         }
     }
@@ -214,40 +215,45 @@
    */
 
   // eNB sends data to 2 UEs through 2 subcarriers
-  Ptr<LteSpectrumSignalParameters> sp1 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> sp1 = Create<LteSpectrumSignalParametersDataFrame> ();
   sp1->psd = m_sv;
   sp1->txPhy = 0;
   sp1->duration = ds;
   sp1->packetBurst = packetBursts[0];
+  sp1->cellId = pbCellId[0];
   Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
 
 
-  Ptr<LteSpectrumSignalParameters> ip1 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip1 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip1->psd = i1;
   ip1->txPhy = 0;
   ip1->duration = di1;
   ip1->packetBurst = packetBursts[1];
+  ip1->cellId = pbCellId[1];
   Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
 
-  Ptr<LteSpectrumSignalParameters> ip2 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip2 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip2->psd = i2;
   ip2->txPhy = 0;
   ip2->duration = di2;
   ip2->packetBurst = packetBursts[2];
+  ip2->cellId = pbCellId[2];
   Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
 
-  Ptr<LteSpectrumSignalParameters> ip3 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip3 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip3->psd = i3;
   ip3->txPhy = 0;
   ip3->duration = di3;
   ip3->packetBurst = packetBursts[3];
+  ip3->cellId = pbCellId[3];
   Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
 
-  Ptr<LteSpectrumSignalParameters> ip4 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip4 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip4->psd = i4;
   ip4->txPhy = 0;
   ip4->duration = di4;
   ip4->packetBurst = packetBursts[4];
+  ip4->cellId = pbCellId[4];
   Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
 
   Simulator::Stop (Seconds (5.0));
@@ -257,12 +263,180 @@
    * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
    * to known values which have been calculated offline (with octave) for the generated signals
    */
-  SpectrumValue calculatedSinr = uePhy->GetSinr ();
+  Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
 
-  NS_LOG_INFO ("Theoretical SINR: " << *m_sinr);
-  NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
+  NS_LOG_INFO ("Data Frame - Theoretical SINR: " << *m_sinr);
+  NS_LOG_INFO ("Data Frame - Calculated SINR: " << *calculatedSinr);
  
-  NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
+  NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
   dlPhy->Dispose ();
   Simulator::Destroy ();
 }
+
+
+
+/**
+* TestCase CTRL
+*/
+
+LteDownlinkCtrlSinrTestCase::LteDownlinkCtrlSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name)
+: TestCase ("SINR calculation in downlink Ctrl Frame: " + name),
+m_sv (sv),
+m_sm (sv->GetSpectrumModel ()),
+m_sinr (sinr)
+{
+  NS_LOG_INFO ("Creating LenaDownlinkCtrlSinrTestCase");
+}
+
+LteDownlinkCtrlSinrTestCase::~LteDownlinkCtrlSinrTestCase ()
+{
+}
+
+void
+LteDownlinkCtrlSinrTestCase::DoRun (void)
+{
+  /**
+  * Instantiate a single receiving LteSpectrumPhy
+  */
+  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
+  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
+  Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
+  uint16_t cellId = 100;
+  dlPhy->SetCellId (cellId);
+  ulPhy->SetCellId (cellId);
+  
+  Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+  dlPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
+  
+  /**
+  * Generate several calls to LteSpectrumPhy::StartRx corresponding to several signals. One will be the signal of interest, i.e., the
+  *  LteSpectrumSignalParametersDlCtrlFrame of the first signal will have the
+  *  same CellId of the receiving PHY; the others will have a different 
+  *  CellId and hence will be the interfering signals
+  */
+  
+  // Number of ctrl bursts (1 data + 4 interferences)
+  int numOfUes = 5;
+  
+  // Number of control messages in the list
+  int numOfCtrlMsgs = 10;
+  
+  // control messages in the list
+  std::list<Ptr<LteControlMessage> > ctrlMsgList[numOfUes];
+  
+  // signals cellId
+  uint16_t pbCellId[numOfUes];
+  
+  /**
+  * Build ctrl msg lists
+  */
+  for ( int pb = 0 ; pb < numOfUes ; pb++ )
+  {
+    pbCellId[pb] = cellId * (pb + 1);
+    
+    // Create ctrl msg and add them to the list
+    for ( int i = 0 ; i < numOfCtrlMsgs ; i++ )
+      {
+        Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> ();
+        DlDciListElement_s dci;
+        msg->SetDci (dci);
+        ctrlMsgList[pb].push_back (msg);
+      }
+  }
+  
+  
+  Ptr<SpectrumValue> noisePsd = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i1 = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i2 = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i3 = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i4 = Create<SpectrumValue> (m_sm);
+  
+  (*noisePsd)[0] = 5.000000000000e-19;
+  (*noisePsd)[1] = 4.545454545455e-19;
+  
+  (*i1)[0] = 5.000000000000e-18;
+  (*i2)[0] = 5.000000000000e-16;
+  (*i3)[0] = 1.581138830084e-16;
+  (*i4)[0] = 7.924465962306e-17;
+  (*i1)[1] = 1.437398936440e-18;
+  (*i2)[1] = 5.722388235428e-16;
+  (*i3)[1] = 7.204059965732e-17;
+  (*i4)[1] = 5.722388235428e-17;
+  
+  Time ts  = Seconds (1);
+  Time ds  = Seconds (1);
+  Time ti1 = Seconds (0);
+  Time di1 = Seconds (3);
+  Time ti2 = Seconds (0.7);
+  Time di2 = Seconds (1);
+  Time ti3 = Seconds (1.2);
+  Time di3 = Seconds (1);
+  Time ti4 = Seconds (1.5);
+  Time di4 = Seconds (0.1);
+  
+  dlPhy->SetNoisePowerSpectralDensity (noisePsd);
+  
+  /**
+  * Schedule the reception of the data signal plus the interference signals
+  */
+  
+  // eNB sends data to 2 UEs through 2 subcarriers
+  Ptr<LteSpectrumSignalParametersDlCtrlFrame> sp1 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+  sp1->psd = m_sv;
+  sp1->txPhy = 0;
+  sp1->duration = ds;
+  sp1->ctrlMsgList = ctrlMsgList[0];
+  sp1->cellId = pbCellId[0];
+  Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
+  
+  
+  Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip1 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+  ip1->psd = i1;
+  ip1->txPhy = 0;
+  ip1->duration = di1;
+  ip1->ctrlMsgList = ctrlMsgList[1];
+  ip1->cellId = pbCellId[1];
+  Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
+  
+  Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip2 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+  ip2->psd = i2;
+  ip2->txPhy = 0;
+  ip2->duration = di2;
+  ip2->ctrlMsgList = ctrlMsgList[2];
+  ip2->cellId = pbCellId[2];
+  Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
+  
+  Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip3 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+  ip3->psd = i3;
+  ip3->txPhy = 0;
+  ip3->duration = di3;
+  ip3->ctrlMsgList = ctrlMsgList[3];
+  ip3->cellId = pbCellId[3];
+  Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
+  
+  Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip4 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+  ip4->psd = i4;
+  ip4->txPhy = 0;
+  ip4->duration = di4;
+  ip4->ctrlMsgList = ctrlMsgList[4];
+  ip4->cellId = pbCellId[4];
+  Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
+  
+  Simulator::Stop (Seconds (5.0));
+  Simulator::Run ();
+  
+  /**
+  * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
+  * to known values which have been calculated offline (with octave) for the generated signals
+  */
+  Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
+  
+  NS_LOG_INFO ("Ctrl Frame - Theoretical SINR: " << *m_sinr);
+  NS_LOG_INFO ("Ctrl Frame - Calculated SINR: " << *calculatedSinr);
+  
+  NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
+  dlPhy->Dispose ();
+  Simulator::Destroy ();
+}
+
+
--- a/src/lte/test/lte-test-downlink-sinr.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-downlink-sinr.h	Fri Jun 15 16:49:51 2012 +0200
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ *     Extend to Data and Ctrl frames
  */
 
 #ifndef LTE_TEST_DOWNLINK_SINR_H
@@ -39,11 +41,11 @@
 };
 
 
-class LteDownlinkSinrTestCase : public TestCase
+class LteDownlinkDataSinrTestCase : public TestCase
 {
 public:
-  LteDownlinkSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
-  virtual ~LteDownlinkSinrTestCase ();
+  LteDownlinkDataSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
+  virtual ~LteDownlinkDataSinrTestCase ();
 
 private:
   virtual void DoRun (void);
@@ -54,4 +56,19 @@
 };
 
 
+class LteDownlinkCtrlSinrTestCase : public TestCase
+{
+  public:
+    LteDownlinkCtrlSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
+    virtual ~LteDownlinkCtrlSinrTestCase ();
+    
+  private:
+    virtual void DoRun (void);
+    
+    Ptr<SpectrumValue> m_sv;
+    Ptr<const SpectrumModel> m_sm;
+    Ptr<SpectrumValue> m_sinr;
+};
+
+
 #endif /* LTE_TEST_DOWNLINK_SINR_H */
--- a/src/lte/test/lte-test-interference.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-interference.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -172,11 +172,11 @@
 
   Ptr<LtePhy> ue1Phy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testDlSinr1 = Create<LteTestSinrChunkProcessor> (ue1Phy);
-  ue1Phy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testDlSinr1);
+  ue1Phy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr1);
 
   Ptr<LtePhy> enb1phy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testUlSinr1 = Create<LteTestSinrChunkProcessor> (enb1phy);
-  enb1phy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr1);
+  enb1phy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr1);
 
   Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
                    MakeBoundCallback (&LteTestDlSchedulingCallback, this));
@@ -189,11 +189,11 @@
   
   Ptr<LtePhy> ue2Phy = ueDevs2.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testDlSinr2 = Create<LteTestSinrChunkProcessor> (ue2Phy);
-  ue2Phy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testDlSinr2);
+  ue2Phy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr2);
 
   Ptr<LtePhy> enb2phy = enbDevs.Get (1)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testUlSinr2 = Create<LteTestSinrChunkProcessor> (enb2phy);
-  enb1phy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr2);
+  enb1phy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr2);
 
   Config::Connect ("/NodeList/1/DeviceList/0/LteEnbMac/DlScheduling",
                    MakeBoundCallback (&LteTestDlSchedulingCallback, this));
@@ -247,7 +247,7 @@
    *    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 > 6) )
     {
       NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcs, m_ulMcs, "Wrong UL MCS");
     }
--- a/src/lte/test/lte-test-link-adaptation.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-link-adaptation.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -201,7 +201,7 @@
   // It will be used to test that the SNR is as intended
   Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testSinr = Create<LteTestSinrChunkProcessor> (uePhy);
-  uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
+  uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testSinr);
 
   Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
                    MakeBoundCallback (&LteTestDlSchedulingCallback, this));
--- a/src/lte/test/lte-test-pathloss-model.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-pathloss-model.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -270,7 +270,7 @@
   // It will be used to test that the SNR is as intended
   //Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testSinr = Create<LteTestSinrChunkProcessor> (uePhy);
-  uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
+  uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testSinr);
    
 //   Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
 //                    MakeBoundCallback (&LteTestPathlossDlSchedCallback, this));
--- a/src/lte/test/lte-test-phy-error-model.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-phy-error-model.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -218,6 +218,7 @@
     
   lena->EnableRlcTraces ();
   double simulationTime = 1.000;
+
   Simulator::Stop (Seconds (simulationTime));
 
   Ptr<RadioBearerStatsCalculator> rlcStats = lena->GetRlcStats ();
--- a/src/lte/test/lte-test-sinr-chunk-processor.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-sinr-chunk-processor.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -84,6 +84,7 @@
 {
   NS_LOG_FUNCTION (this);
 
+  NS_ASSERT (m_sinr);
   return m_sinr;
 }
 
--- a/src/lte/test/lte-test-ue-phy.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-ue-phy.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -87,7 +87,7 @@
 }
 
 void
-LteTestUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteTestUePhy::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
 {
   NS_LOG_FUNCTION (this << msg);
 }
--- a/src/lte/test/lte-test-ue-phy.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-ue-phy.h	Fri Jun 15 16:49:51 2012 +0200
@@ -23,7 +23,7 @@
 
 #include "ns3/lte-phy.h"
 
-#include "ns3/ideal-control-messages.h"
+#include "ns3/lte-control-messages.h"
 
 namespace ns3 {
 
@@ -60,7 +60,7 @@
 
   virtual void GenerateCqiReport (const SpectrumValue& sinr);
 
-  virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+  virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
 
   SpectrumValue GetSinr ();
 
--- a/src/lte/test/lte-test-uplink-sinr.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-uplink-sinr.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ *     Extend to Data and SRS frames
  */
 
 #include "ns3/simulator.h"
@@ -26,11 +28,13 @@
 
 #include "ns3/lte-phy-tag.h"
 #include "ns3/lte-test-ue-phy.h"
-#include "ns3/lte-sinr-chunk-processor.h"
+#include "ns3/lte-test-sinr-chunk-processor.h"
 #include "ns3/lte-spectrum-signal-parameters.h"
 
 #include "ns3/lte-test-uplink-sinr.h"
 
+#include <ns3/lte-helper.h>
+
 NS_LOG_COMPONENT_DEFINE ("LteUplinkSinrTest");
 
 using namespace ns3;
@@ -81,7 +85,9 @@
   (*theoreticalSinr1)[0] = 3.72589167251055;
   (*theoreticalSinr1)[1] = 3.72255684126076;
 
-  AddTestCase (new LteUplinkSinrTestCase (rxPsd1, rxPsd2, theoreticalSinr1, "sdBm = [-46 -inf] and [-inf -48]"));
+  AddTestCase (new LteUplinkDataSinrTestCase (rxPsd1, rxPsd2, theoreticalSinr1, "sdBm = [-46 -inf] and [-inf -48]"));
+  
+  AddTestCase (new LteUplinkSrsSinrTestCase (rxPsd1, rxPsd2, theoreticalSinr1, "sdBm = [-46 -inf] and [-inf -48]"));
 
   /**
    * TX signals #2: Power Spectral Density of the signals of interest = [-63 -inf] and [-inf -61] dBm and BW = [20 22] MHz
@@ -98,7 +104,9 @@
   (*theoreticalSinr2)[0] = 0.0743413124381667;
   (*theoreticalSinr2)[1] = 0.1865697965291756;
 
-  AddTestCase (new LteUplinkSinrTestCase (rxPsd3, rxPsd4, theoreticalSinr2, "sdBm = [-63 -inf] and [-inf -61]"));
+  AddTestCase (new LteUplinkDataSinrTestCase (rxPsd3, rxPsd4, theoreticalSinr2, "sdBm = [-63 -inf] and [-inf -61]"));
+  
+  AddTestCase (new LteUplinkSrsSinrTestCase (rxPsd3, rxPsd4, theoreticalSinr2, "sdBm = [-63 -inf] and [-inf -61]"));
 
 }
 
@@ -106,25 +114,25 @@
 
 
 /**
- * TestCase
+ * TestCase Data
  */
 
-LteUplinkSinrTestCase::LteUplinkSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name)
-  : TestCase ("SINR calculation in uplink: " + name),
+LteUplinkDataSinrTestCase::LteUplinkDataSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name)
+  : TestCase ("SINR calculation in uplink data frame: " + name),
     m_sv1 (sv1),
     m_sv2 (sv2),
     m_sm (sv1->GetSpectrumModel ()),
     m_sinr (sinr)
 {
-  NS_LOG_INFO ("Creating LteUplinkSinrTestCase");
+  NS_LOG_INFO ("Creating LteUplinkDataSinrTestCase");
 }
 
-LteUplinkSinrTestCase::~LteUplinkSinrTestCase ()
+LteUplinkDataSinrTestCase::~LteUplinkDataSinrTestCase ()
 {
 }
 
 void
-LteUplinkSinrTestCase::DoRun (void)
+LteUplinkDataSinrTestCase::DoRun (void)
 {
   /**
    * Instantiate a single receiving LteSpectrumPhy
@@ -132,18 +140,20 @@
   Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
   Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
   Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
-
-  ulPhy->SetCellId (100);
+  uint16_t cellId = 100;
+  dlPhy->SetCellId (cellId);
+  ulPhy->SetCellId (cellId);
 
-  Ptr<LteCqiSinrChunkProcessor> chunkProcessor = Create<LteCqiSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
-  ulPhy->AddSinrChunkProcessor (chunkProcessor);
+  Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+  ulPhy->AddDataSinrChunkProcessor (chunkProcessor);
 
   /**
-   * Generate several calls to LteSpectrumPhy::StartRx corresponding to several signals.
-   * One will be the signal of interest, i.e., the PhyTag of the first Packet in the Packet burst
-   * will have the same CellId of the receiving PHY;
-   * the others will have a different CellId and hence will be the interfering signals
-   */
+  * Generate several calls to LteSpectrumPhy::StartRx corresponding to 
+  * several signals. One will be the signal of interest, i.e., the
+  *  LteSpectrumSignalParametersDataFrame of the Packet burst
+  * will have the same CellId of the receiving PHY; the others will have 
+  * a different CellId and hence will be the interfering signals
+  */
 
   // Number of packet bursts (2 data + 4 interferences)
   int numOfDataPbs = 2;
@@ -159,8 +169,9 @@
   // Packets
   Ptr<Packet> pkt[numOfPbs][numOfPkts];
 
-  // Phy tags
-  LtePhyTag pktTag[numOfPbs];
+  // Bursts cellId
+  uint16_t pbCellId[numOfPbs];
+  
 
 
   /**
@@ -171,20 +182,12 @@
     {
       // Create packet burst
       packetBursts[pb] = CreateObject<PacketBurst> ();
-
+      pbCellId[pb] = cellId;
       // Create packets and add them to the burst
       for ( int i = 0 ; i < numOfPkts ; i++ )
         {
           pkt[pb][i] = Create<Packet> (1000);
 
-          if ( i == 0 )
-            {
-              // Create phy tag (same for all data packet burst)
-              // and add to the first packet
-              pktTag[pb] = LtePhyTag (100);
-              pkt[pb][i]->AddPacketTag ( pktTag[pb] );
-            }
-
           packetBursts[pb]->AddPacket ( pkt[pb][i] );
         }
     }
@@ -192,20 +195,13 @@
     {
       // Create packet burst
       packetBursts[pb] = CreateObject<PacketBurst> ();
+      pbCellId[pb] = cellId * (pb + 1);
 
       // Create packets and add them to the burst
       for ( int i = 0 ; i < numOfPkts ; i++ )
         {
           pkt[pb][i] = Create<Packet> (1000);
 
-          if ( i == 0 )
-            {
-              // Create phy tag (different for each packet burst)
-              // and add to the first packet
-              pktTag[pb] = LtePhyTag (100 * (pb + 1));
-              pkt[pb][i]->AddPacketTag ( pktTag[pb] );
-            }
-
           packetBursts[pb]->AddPacket ( pkt[pb][i] );
         }
     }
@@ -247,47 +243,53 @@
    */
 
   // 2 UEs send data to the eNB through 2 subcarriers
-  Ptr<LteSpectrumSignalParameters> sp1 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> sp1 = Create<LteSpectrumSignalParametersDataFrame> ();
   sp1->psd = m_sv1;
   sp1->txPhy = 0;
   sp1->duration = ds;
   sp1->packetBurst = packetBursts[0];
+  sp1->cellId = pbCellId[0];
   Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp1);
 
-  Ptr<LteSpectrumSignalParameters> sp2 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> sp2 = Create<LteSpectrumSignalParametersDataFrame> ();
   sp2->psd = m_sv2;
   sp2->txPhy = 0;
   sp2->duration = ds;
   sp2->packetBurst = packetBursts[1];
+  sp2->cellId = pbCellId[1];
   Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp2);
 
 
-  Ptr<LteSpectrumSignalParameters> ip1 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip1 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip1->psd = i1;
   ip1->txPhy = 0;
   ip1->duration = di1;
   ip1->packetBurst = packetBursts[2];
+  ip1->cellId = pbCellId[2];
   Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, ip1);
 
-  Ptr<LteSpectrumSignalParameters> ip2 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip2 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip2->psd = i2;
   ip2->txPhy = 0;
   ip2->duration = di2;
   ip2->packetBurst = packetBursts[3];
+  ip2->cellId = pbCellId[3];
   Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, ip2);
 
-  Ptr<LteSpectrumSignalParameters> ip3 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip3 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip3->psd = i3;
   ip3->txPhy = 0;
   ip3->duration = di3;
   ip3->packetBurst = packetBursts[4];
+  ip3->cellId = pbCellId[4];
   Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, ip3);
 
-  Ptr<LteSpectrumSignalParameters> ip4 = Create<LteSpectrumSignalParameters> ();
+  Ptr<LteSpectrumSignalParametersDataFrame> ip4 = Create<LteSpectrumSignalParametersDataFrame> ();
   ip4->psd = i4;
   ip4->txPhy = 0;
   ip4->duration = di4;
   ip4->packetBurst = packetBursts[5];
+  ip4->cellId = pbCellId[5];
   Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, ip4);
 
   Simulator::Stop (Seconds (5.0));
@@ -297,13 +299,183 @@
    * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
    * to known values which have been calculated offline (with octave) for the generated signals
    */
-  SpectrumValue calculatedSinr = uePhy->GetSinr ();
+  Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
 
-  NS_LOG_INFO ("Theoretical SINR: " << *m_sinr);
-  NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
+  NS_LOG_INFO ("Data Frame - Theoretical SINR: " << *m_sinr);
+  NS_LOG_INFO ("Data Frame - Calculated SINR: " << *calculatedSinr);
   
-  NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
+  NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
   ulPhy->Dispose ();
   Simulator::Destroy ();
   
 }
+
+
+/**
+* TestCase Srs
+*/
+
+LteUplinkSrsSinrTestCase::LteUplinkSrsSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name)
+: TestCase ("SINR calculation in uplink srs frame: " + name),
+m_sv1 (sv1),
+m_sv2 (sv2),
+m_sm (sv1->GetSpectrumModel ()),
+m_sinr (sinr)
+{
+  NS_LOG_INFO ("Creating LteUplinkSrsSinrTestCase");
+}
+
+LteUplinkSrsSinrTestCase::~LteUplinkSrsSinrTestCase ()
+{
+}
+
+void
+LteUplinkSrsSinrTestCase::DoRun (void)
+{
+  /**
+  * Instantiate a single receiving LteSpectrumPhy
+  */
+  
+  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
+  lteHelper->EnableLogComponents ();
+  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
+  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
+  Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
+  uint16_t cellId = 100;
+  dlPhy->SetCellId (cellId);
+  ulPhy->SetCellId (cellId);
+  
+  Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+  ulPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
+  
+  /**
+  * Generate several calls to LteSpectrumPhy::StartRx corresponding to 
+  * several signals.
+  * One will be the signal of interest, i.e., the
+  *  LteSpectrumSignalParametersUlSrsFrame of the first signal will have the
+  *   same CellId of the receiving PHY; the others will have a different 
+  *   CellId and hence will be the interfering signals
+  */
+  
+  // Number of packet bursts (2 data + 4 interferences)
+  int numOfDataSignals = 2;
+  int numOfIntfSignals = 4;
+  int numOfSignals = numOfDataSignals + numOfIntfSignals;
+
+  uint16_t pbCellId[numOfSignals];
+  
+  
+  
+  /**
+  * Build packet burst (Data and interference)
+  */
+  int pb = 0;
+  for ( int dataPb = 0 ; dataPb < numOfDataSignals ; dataPb++, pb++ )
+    {
+      pbCellId[pb] = cellId;
+
+    }
+  for ( int intfPb = 0 ; intfPb < numOfIntfSignals ; intfPb++, pb++ )
+    {
+
+      pbCellId[pb] = cellId * (pb + 1);
+
+    }
+  
+  
+  Ptr<SpectrumValue> noisePsd = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i1 = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i2 = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i3 = Create<SpectrumValue> (m_sm);
+  Ptr<SpectrumValue> i4 = Create<SpectrumValue> (m_sm);
+  
+  (*noisePsd)[0] = 5.000000000000e-19;
+  (*noisePsd)[1] = 4.545454545455e-19;
+  
+  (*i1)[0] = 5.000000000000e-18;
+  (*i2)[0] = 5.000000000000e-16;
+  (*i3)[0] = 1.581138830084e-16;
+  (*i4)[0] = 7.924465962306e-17;
+  (*i1)[1] = 1.437398936440e-18;
+  (*i2)[1] = 5.722388235428e-16;
+  (*i3)[1] = 7.204059965732e-17;
+  (*i4)[1] = 5.722388235428e-17;
+  
+  Time ts  = Seconds (1);
+  Time ds  = Seconds (1);
+  Time ti1 = Seconds (0);
+  Time di1 = Seconds (3);
+  Time ti2 = Seconds (0.7);
+  Time di2 = Seconds (1);
+  Time ti3 = Seconds (1.2);
+  Time di3 = Seconds (1);
+  Time ti4 = Seconds (1.5);
+  Time di4 = Seconds (0.1);
+  
+  ulPhy->SetNoisePowerSpectralDensity (noisePsd);
+  
+  /**
+  * Schedule the reception of the data signals plus the interference signals
+  */
+  
+  // 2 UEs send data to the eNB through 2 subcarriers
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> sp1 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+  sp1->psd = m_sv1;
+  sp1->txPhy = 0;
+  sp1->duration = ds;
+  sp1->cellId = pbCellId[0];
+  Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp1);
+  
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> sp2 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+  sp2->psd = m_sv2;
+  sp2->txPhy = 0;
+  sp2->duration = ds;
+  sp2->cellId = pbCellId[1];
+  Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp2);
+  
+  
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> ip1 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+  ip1->psd = i1;
+  ip1->txPhy = 0;
+  ip1->duration = di1;
+  ip1->cellId = pbCellId[2];
+  Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, ip1);
+  
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> ip2 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+  ip2->psd = i2;
+  ip2->txPhy = 0;
+  ip2->duration = di2;
+  ip2->cellId = pbCellId[3];
+  Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, ip2);
+  
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> ip3 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+  ip3->psd = i3;
+  ip3->txPhy = 0;
+  ip3->duration = di3;
+  ip3->cellId = pbCellId[4];
+  Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, ip3);
+  
+  Ptr<LteSpectrumSignalParametersUlSrsFrame> ip4 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+  ip4->psd = i4;
+  ip4->txPhy = 0;
+  ip4->duration = di4;
+  ip4->cellId = pbCellId[5];
+  Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, ip4);
+  
+  Simulator::Stop (Seconds (5.0));
+  Simulator::Run ();
+  
+  /**
+  * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
+  * to known values which have been calculated offline (with octave) for the generated signals
+  */
+  Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
+  
+  NS_LOG_INFO ("SRS Frame - Theoretical SINR: " << *m_sinr);
+  NS_LOG_INFO ("SRS Frame - Calculated SINR: " << *calculatedSinr);
+  
+  NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
+  ulPhy->Dispose ();
+  Simulator::Destroy ();
+  
+}
--- a/src/lte/test/lte-test-uplink-sinr.h	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/lte-test-uplink-sinr.h	Fri Jun 15 16:49:51 2012 +0200
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ *     Extend to Data and SRS frames
  */
 
 #ifndef LTE_TEST_UPLINK_SINR_H
@@ -39,11 +41,11 @@
 };
 
 
-class LteUplinkSinrTestCase : public TestCase
+class LteUplinkDataSinrTestCase : public TestCase
 {
 public:
-  LteUplinkSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
-  virtual ~LteUplinkSinrTestCase ();
+  LteUplinkDataSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
+  virtual ~LteUplinkDataSinrTestCase ();
 
 private:
   virtual void DoRun (void);
@@ -55,4 +57,20 @@
 };
 
 
+class LteUplinkSrsSinrTestCase : public TestCase
+{
+  public:
+    LteUplinkSrsSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
+    virtual ~LteUplinkSrsSinrTestCase ();
+    
+  private:
+    virtual void DoRun (void);
+    
+    Ptr<SpectrumValue> m_sv1;
+    Ptr<SpectrumValue> m_sv2;
+    Ptr<const SpectrumModel> m_sm;
+    Ptr<SpectrumValue> m_sinr;
+};
+
+
 #endif /* LTE_TEST_UPLINK_SINR_H */
--- a/src/lte/test/test-lte-antenna.cc	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/test/test-lte-antenna.cc	Fri Jun 15 16:49:51 2012 +0200
@@ -137,11 +137,11 @@
   // It will be used to test that the SNR is as intended
   Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testDlSinr = Create<LteTestSinrChunkProcessor> (uePhy);
-  uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testDlSinr);
+  uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr);
 
   Ptr<LtePhy> enbphy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
   Ptr<LteTestSinrChunkProcessor> testUlSinr = Create<LteTestSinrChunkProcessor> (enbphy);
-  enbphy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr);
+  enbphy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr);
 
 
   Simulator::Stop (Seconds (0.020));
--- a/src/lte/wscript	Thu May 24 12:00:57 2012 +0200
+++ b/src/lte/wscript	Fri Jun 15 16:49:51 2012 +0200
@@ -32,7 +32,7 @@
         'model/lte-net-device.cc',
         'model/lte-enb-net-device.cc',
         'model/lte-ue-net-device.cc',
-        'model/ideal-control-messages.cc',
+        'model/lte-control-messages.cc',
         'helper/lte-helper.cc',
         'helper/lte-stats-calculator.cc',
         'helper/epc-helper.cc',
@@ -127,7 +127,7 @@
         'model/lte-net-device.h',
         'model/lte-enb-net-device.h',
         'model/lte-ue-net-device.h',
-        'model/ideal-control-messages.h',
+        'model/lte-control-messages.h',
         'helper/lte-helper.h',
         'helper/lte-stats-calculator.h',
         'helper/epc-helper.h',