MultiModelSpectrumChannel working with LTE
authorNicola Baldo <nbaldo@cttc.es>
Wed, 21 Mar 2012 18:16:31 +0100
changeset 8693 478733ab87b7
parent 8692 cf87a7eec08e
child 8695 4d1b067a4582
MultiModelSpectrumChannel working with LTE
src/lte/examples/lena-dual-stripe.cc
src/lte/helper/lte-helper.cc
src/lte/helper/lte-helper.h
src/lte/helper/radio-environment-map-helper.cc
src/lte/helper/radio-environment-map-helper.h
src/lte/model/lte-enb-net-device.cc
src/lte/model/lte-spectrum-phy.cc
src/lte/model/lte-spectrum-phy.h
src/lte/model/rem-spectrum-phy.cc
src/lte/model/rem-spectrum-phy.h
--- a/src/lte/examples/lena-dual-stripe.cc	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/examples/lena-dual-stripe.cc	Wed Mar 21 18:16:31 2012 +0100
@@ -141,19 +141,23 @@
 main (int argc, char *argv[])
 {
   // scenario parameters
-  uint32_t nBlocks = 1;
+  uint32_t nBlocks = 10;
   uint32_t nApartmentsX = 10;
   uint32_t nFloors = 1;
-  double homeEnbDeploymentRatio = 0.2;
-  double homeEnbActivationRatio = 0.5;
-  double macroUeDensity = 0.0001;
   uint32_t nMacroEnbSites = 3;
   uint32_t nMacroEnbSitesX = 1;
   double interSiteDistance = 500;
+  double areaMarginFactor = 0.5; 
+  double macroUeDensity = 0.0001;
+  double homeEnbDeploymentRatio = 0.2;
+  double homeEnbActivationRatio = 0.5;
   double homeUesHomeEnbRatio = 1;
+  double macroEnbTxPowerDbm = 46.0;
   double homeEnbTxPowerDbm = 20.0;
-  double macroEnbTxPowerDbm = 46.0;
-  double areaMarginFactor = 0.5; 
+  uint16_t macroEnbDlEarfcn = 100;
+  uint16_t homeEnbDlEarfcn = 100;
+  uint8_t macroEnbBandwidth = 25;
+  uint8_t homeEnbBandwidth = 25;
   double simTime = 0.01;
   bool generateRem = false;
   
@@ -161,18 +165,29 @@
   cmd.AddValue ("nBlocks", "Number of femtocell blocks", nBlocks);
   cmd.AddValue ("nApartmentsX", "Number of apartments along the X axis in a femtocell block", nApartmentsX);
   cmd.AddValue ("nFloors", "Number of floors", nFloors);
-  cmd.AddValue ("macroUeDensity", "How many macrocell UEs there are per square meter", macroUeDensity);
   cmd.AddValue ("nMacroEnbSites", "How many macro sites there are", nMacroEnbSites);
-  cmd.AddValue ("nMacroEnbSitesX", "(minimum) number of sites along the X-axis of the hex grid", nMacroEnbSitesX);
-  cmd.AddValue ("homeEnbDeploymentRatio", "The HeNB deployment ratio as per 3GPP R4-092042", homeEnbDeploymentRatio);
-  cmd.AddValue ("homeEnbActivationRatio", "The HeNB activation ratio as per 3GPP R4-092042", homeEnbActivationRatio);
-  cmd.AddValue ("homeUesHomeEnbRatio", "How many (on average) home UEs per HeNB there are in the simulation", homeUesHomeEnbRatio);
-  cmd.AddValue ("homeEnbTxPowerDbm", "TX power [dBm] used by HeNBs", homeEnbTxPowerDbm);
-  cmd.AddValue ("macroEnbTxPowerDbm", "TX power [dBm] used by macro eNBs", macroEnbTxPowerDbm);
+  cmd.AddValue ("nMacroEnbSitesX", 
+                "(minimum) number of sites along the X-axis of the hex grid", nMacroEnbSitesX);
+  cmd.AddValue ("interSiteDistance", "min distance between two nearby macro cell sites", interSiteDistance);
   cmd.AddValue ("areaMarginFactor", "how much the UE area extends outside the macrocell grid, "
                 "expressed as fraction of the interSiteDistance", areaMarginFactor);
+  cmd.AddValue ("macroUeDensity", "How many macrocell UEs there are per square meter", macroUeDensity);
+  cmd.AddValue ("homeEnbDeploymentRatio", 
+                "The HeNB deployment ratio as per 3GPP R4-092042", homeEnbDeploymentRatio);
+  cmd.AddValue ("homeEnbActivationRatio", 
+                "The HeNB activation ratio as per 3GPP R4-092042", homeEnbActivationRatio);
+  cmd.AddValue ("homeUesHomeEnbRatio", 
+                "How many (on average) home UEs per HeNB there are in the simulation", 
+                homeUesHomeEnbRatio);
+  cmd.AddValue ("macroEnbTxPowerDbm", "TX power [dBm] used by macro eNBs", macroEnbTxPowerDbm);
+  cmd.AddValue ("homeEnbTxPowerDbm", "TX power [dBm] used by HeNBs", homeEnbTxPowerDbm);
+  cmd.AddValue ("macroEnbDlEarfcn", "DL EARFCN used by macro eNBs", macroEnbDlEarfcn);
+  cmd.AddValue ("homeEnbDlEarfcn", "DL EARFCN used by HeNBs", homeEnbDlEarfcn);
+  cmd.AddValue ("macroEnbBandwidth", "bandwdith [num RBs] used by macro eNBs", macroEnbBandwidth);
+  cmd.AddValue ("homeEnbBandwidth", "bandwdith [num RBs] used by HeNBs", homeEnbBandwidth);
   cmd.AddValue ("simTime", "Total duration of the simulation [s]", simTime);
-  cmd.AddValue ("generateRem", "if true, will generate a REM and then abort the simulation; if false, will run the simulation normally (without generating any REM)", generateRem);
+  cmd.AddValue ("generateRem", "if true, will generate a REM and then abort the simulation;"
+                "if false, will run the simulation normally (without generating any REM)", generateRem);
 
   cmd.Parse (argc, argv);
 
@@ -230,6 +245,7 @@
   lteHelper->SetPathlossModelAttribute ("ShadowSigmaIndoor", DoubleValue (1.5));
   // use always LOS model
   lteHelper->SetPathlossModelAttribute ("Los2NlosThr", DoubleValue (1e6));
+  lteHelper->SetSpectrumChannelType ("ns3::MultiModelSpectrumChannel");
 
 
 
@@ -245,6 +261,10 @@
   lteHelper->SetEnbAntennaModelType ("ns3::ParabolicAntennaModel");
   lteHelper->SetEnbAntennaModelAttribute ("Beamwidth",   DoubleValue (70));
   lteHelper->SetEnbAntennaModelAttribute ("MaxAttenuation",     DoubleValue (20.0));
+  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (macroEnbDlEarfcn));
+  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (macroEnbDlEarfcn + 18000));
+  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (macroEnbBandwidth));
+  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (macroEnbBandwidth));
   NetDeviceContainer macroEnbDevs = lteHexGridEnbTopologyHelper->SetPositionAndInstallEnbDevice (macroEnbs);
 
   
@@ -254,6 +274,11 @@
   mobility.SetPositionAllocator (positionAlloc);
   mobility.Install (homeEnbs);
   Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (homeEnbTxPowerDbm));
+  lteHelper->SetEnbAntennaModelType ("ns3::IsotropicAntennaModel");
+  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (homeEnbDlEarfcn));
+  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (homeEnbDlEarfcn + 18000));
+  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (homeEnbBandwidth));
+  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (homeEnbBandwidth));
   NetDeviceContainer homeEnbDevs  = lteHelper->InstallEnbDevice (homeEnbs);
   
 
--- a/src/lte/helper/lte-helper.cc	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/helper/lte-helper.cc	Wed Mar 21 18:16:31 2012 +0100
@@ -62,14 +62,15 @@
   m_enbNetDeviceFactory.SetTypeId (LteEnbNetDevice::GetTypeId ());
   m_enbAntennaModelFactory.SetTypeId (IsotropicAntennaModel::GetTypeId ());
   m_ueAntennaModelFactory.SetTypeId (IsotropicAntennaModel::GetTypeId ());
+  m_channelFactory.SetTypeId (SingleModelSpectrumChannel::GetTypeId ());
 }
 
 void 
 LteHelper::DoStart (void)
 {
   NS_LOG_FUNCTION (this);
-  m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
-  m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
+  m_downlinkChannel = m_channelFactory.Create<SpectrumChannel> ();
+  m_uplinkChannel = m_channelFactory.Create<SpectrumChannel> ();
 
   m_downlinkPathlossModel = m_dlPathlossModelFactory.Create ();
   Ptr<SpectrumPropagationLossModel> dlSplm = m_downlinkPathlossModel->GetObject<SpectrumPropagationLossModel> ();
@@ -264,6 +265,19 @@
   m_fadingModelFactory.Set (n, v);
 }
 
+void 
+LteHelper::SetSpectrumChannelType (std::string type) 
+{
+  NS_LOG_FUNCTION (this << type);
+  m_channelFactory.SetTypeId (type);
+}
+
+void 
+LteHelper::SetSpectrumChannelAttribute (std::string n, const AttributeValue &v)
+{
+  m_channelFactory.Set (n, v);
+}
+
 
 NetDeviceContainer
 LteHelper::InstallEnbDevice (NodeContainer c)
@@ -316,7 +330,6 @@
   NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
   dlPhy->SetMobility (mm);
   ulPhy->SetMobility (mm);
-  m_uplinkChannel->AddRx (ulPhy);
 
   Ptr<AntennaModel> antenna = (m_enbAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
   NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
@@ -377,6 +390,8 @@
 
   dev->Start ();
 
+  m_uplinkChannel->AddRx (ulPhy);
+
   if (m_epcHelper != 0)
     {
       NS_LOG_INFO ("adding this eNB to the EPC");
@@ -409,7 +424,6 @@
   dlPhy->SetMobility (mm);
   ulPhy->SetMobility (mm);
 
-  m_downlinkChannel->AddRx (dlPhy);
 
   Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
   NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
@@ -489,6 +503,8 @@
                       enbDevice->GetObject<LteEnbNetDevice> ()->GetUlEarfcn ());
 
   ueDevice->Start ();
+  
+  m_downlinkChannel->AddRx (uePhy->GetDownlinkSpectrumPhy ());
 }
 
 void
--- a/src/lte/helper/lte-helper.h	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/helper/lte-helper.h	Wed Mar 21 18:16:31 2012 +0100
@@ -138,6 +138,19 @@
    */
   void SetUeAntennaModelAttribute (std::string n, const AttributeValue &v);
 
+  /** 
+   * 
+   * \param type the type of SpectrumChannel to be used for the UEs
+   */
+  void SetSpectrumChannelType (std::string type);
+
+  /**
+   * set an attribute for the SpectrumChannel to be used for the UEs
+   * 
+   * \param n the name of the attribute
+   * \param v the value of the attribute
+   */
+  void SetSpectrumChannelAttribute (std::string n, const AttributeValue &v);
   /**
    * create a set of eNB devices
    *
@@ -322,6 +335,8 @@
   ObjectFactory m_dlPathlossModelFactory;
   ObjectFactory m_ulPathlossModelFactory;
 
+  ObjectFactory m_channelFactory;
+
   std::string m_fadingModelType;
   ObjectFactory m_fadingModelFactory;
 
--- a/src/lte/helper/radio-environment-map-helper.cc	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/helper/radio-environment-map-helper.cc	Wed Mar 21 18:16:31 2012 +0100
@@ -34,6 +34,7 @@
 #include <ns3/simulator.h>
 #include <ns3/node.h>
 #include <ns3/buildings-helper.h>
+#include <ns3/lte-spectrum-value-helper.h>
 
 #include <fstream>
 #include <limits>
@@ -119,11 +120,49 @@
                    UintegerValue (20000),
                    MakeUintegerAccessor (&RadioEnvironmentMapHelper::m_maxPointsPerIteration),
                    MakeUintegerChecker<uint32_t> (1,std::numeric_limits<uint32_t>::max ()))
+    .AddAttribute ("Earfcn",
+                   "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
+                   "as per 3GPP 36.101 Section 5.7.3. ",
+                   UintegerValue (100),
+                   MakeUintegerAccessor (&RadioEnvironmentMapHelper::m_earfcn),
+                   MakeUintegerChecker<uint16_t> ())
+    .AddAttribute ("Bandwidth",
+                   "Transmission Bandwidth Configuration (in number of RBs) over which the SINR will be calculated",
+                   UintegerValue (25),
+                   MakeUintegerAccessor (&RadioEnvironmentMapHelper::SetBandwidth, 
+                                         &RadioEnvironmentMapHelper::GetBandwidth),
+                   MakeUintegerChecker<uint16_t> ())
   ;
   return tid;
 }
 
 
+uint8_t 
+RadioEnvironmentMapHelper::GetBandwidth () const
+{
+  return m_bandwidth;
+}
+
+void 
+RadioEnvironmentMapHelper::SetBandwidth (uint8_t bw)
+{
+  switch (bw)
+    { 
+    case 6:
+    case 15:
+    case 25:
+    case 50:
+    case 75:
+    case 100:
+      m_bandwidth = bw;
+      break;
+
+    default:
+      NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw);
+      break;
+    }
+}
+
 
 
 void 
@@ -172,6 +211,7 @@
       RemPoint p;
       p.phy = CreateObject<RemSpectrumPhy> ();
       p.bmm = CreateObject<BuildingsMobilityModel> ();
+      p.phy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (m_earfcn, m_bandwidth));
       p.phy->SetMobility (p.bmm); 
       m_channel->AddRx (p.phy);
       m_rem.push_back (p);
--- a/src/lte/helper/radio-environment-map-helper.h	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/helper/radio-environment-map-helper.h	Wed Mar 21 18:16:31 2012 +0100
@@ -36,7 +36,7 @@
 class BuildingsMobilityModel;
 
 /** 
- * Generates a 2D map of the SINR from the strongest transmitter. 
+ * Generates a 2D map of the SINR from the strongest transmitter in the downlink of an LTE FDD system.
  * 
  */
 class RadioEnvironmentMapHelper : public Object
@@ -51,6 +51,17 @@
   static TypeId GetTypeId (void);
 
   /** 
+   * \return the bandwidth (in num of RBs) over which SINR is calculated
+   */
+  uint8_t GetBandwidth () const;
+
+  /** 
+   *
+   * \param bw  the bandwidth (in num of RBs) over which SINR is calculated
+   */
+  void SetBandwidth (uint8_t bw);
+
+  /** 
    * Deploy the RemSpectrumPhy objects that generate the map according to the specified settings.
    * 
    */
@@ -83,7 +94,10 @@
   double m_yStep;
 
   uint32_t m_maxPointsPerIteration;
-  
+
+  uint16_t m_earfcn;
+  uint16_t m_bandwidth;
+ 
   double m_z;
 
   std::string m_channelPath;
--- a/src/lte/model/lte-enb-net-device.cc	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/model/lte-enb-net-device.cc	Wed Mar 21 18:16:31 2012 +0100
@@ -99,13 +99,13 @@
                    "as per 3GPP 36.101 Section 5.7.3. ",
                    UintegerValue (100),
                    MakeUintegerAccessor (&LteEnbNetDevice::m_dlEarfcn),
-                   MakeUintegerChecker<uint16_t> ())
+                   MakeUintegerChecker<uint16_t> (0, 6149))
     .AddAttribute ("UlEarfcn",
                    "Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
                    "as per 3GPP 36.101 Section 5.7.3. ",
                    UintegerValue (18100),
                    MakeUintegerAccessor (&LteEnbNetDevice::m_ulEarfcn),
-                   MakeUintegerChecker<uint16_t> ())
+                   MakeUintegerChecker<uint16_t> (18000, 24149))
   ;
   return tid;
 }
--- a/src/lte/model/lte-spectrum-phy.cc	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/model/lte-spectrum-phy.cc	Wed Mar 21 18:16:31 2012 +0100
@@ -167,14 +167,7 @@
 Ptr<const SpectrumModel>
 LteSpectrumPhy::GetRxSpectrumModel () const
 {
-  if (m_txPsd)
-    {
-      return m_txPsd->GetSpectrumModel ();
-    }
-  else
-    {
-      return 0;
-    }
+  return m_rxSpectrumModel;
 }
 
 
@@ -192,6 +185,7 @@
 {
   NS_LOG_FUNCTION (this << noisePsd);
   NS_ASSERT (noisePsd);
+  m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
   m_interference->SetNoisePowerSpectralDensity (noisePsd);
 }
 
--- a/src/lte/model/lte-spectrum-phy.h	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/model/lte-spectrum-phy.h	Wed Mar 21 18:16:31 2012 +0100
@@ -197,6 +197,7 @@
 
   Ptr<SpectrumChannel> m_channel;
 
+  Ptr<const SpectrumModel> m_rxSpectrumModel;
   Ptr<SpectrumValue> m_txPsd;
   Ptr<PacketBurst> m_txPacketBurst;
   std::list<Ptr<PacketBurst> > m_rxPacketBurstList;
--- a/src/lte/model/rem-spectrum-phy.cc	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/model/rem-spectrum-phy.cc	Wed Mar 21 18:16:31 2012 +0100
@@ -105,8 +105,7 @@
 Ptr<const SpectrumModel>
 RemSpectrumPhy::GetRxSpectrumModel () const
 {
-  // supports any SpectrumModel
-  return 0;
+  return m_rxSpectrumModel;
 }
 
 Ptr<AntennaModel>
@@ -133,6 +132,13 @@
     }
 }
 
+void
+RemSpectrumPhy::SetRxSpectrumModel (Ptr<const SpectrumModel> m)
+{
+  NS_LOG_FUNCTION (this << m);
+  m_rxSpectrumModel = m;
+}
+
 double
 RemSpectrumPhy::GetSinr (double noisePower)
 {
--- a/src/lte/model/rem-spectrum-phy.h	Wed Mar 21 10:21:35 2012 +0100
+++ b/src/lte/model/rem-spectrum-phy.h	Wed Mar 21 18:16:31 2012 +0100
@@ -70,7 +70,13 @@
   void StartRx (Ptr<SpectrumSignalParameters> params);
 
   /** 
+   * set the RX spectrum model to be used
    * 
+   * \param m 
+   */
+  void SetRxSpectrumModel (Ptr<const SpectrumModel> m);
+
+  /** 
    * 
    * \return the Signal to Noise Ratio calculated 
    */
@@ -96,6 +102,7 @@
 
 private:
   Ptr<MobilityModel> m_mobility;
+  Ptr<const SpectrumModel> m_rxSpectrumModel;
 
   double m_referenceSignalPower;
   double m_sumPower;