diff --git a/src/lte/examples/lena-dual-stripe.cc b/src/lte/examples/lena-dual-stripe.cc index 96dceffaf..82c225c49 100644 --- a/src/lte/examples/lena-dual-stripe.cc +++ b/src/lte/examples/lena-dual-stripe.cc @@ -26,6 +26,10 @@ // 3GPP R4-092042, Section 4.2.1 Dual Stripe Model // note that the term "apartments" used in that document matches with // the term "room" used in the BuildingsMobilityModel +// +// A user can pass the command-line --ns3::LteHexGridEnbTopologyHelper::EnableWraparound=1 +// to setup and use the hexagonal wraparound model, which causes all cells to receive +// similar interference, rather than central cells receiving a lot more than edge cells. using namespace ns3; @@ -272,7 +276,7 @@ static ns3::GlobalValue g_nFloors("nFloors", /// How many macro sites there are static ns3::GlobalValue g_nMacroEnbSites("nMacroEnbSites", "How many macro sites there are", - ns3::UintegerValue(3), + ns3::UintegerValue(7), ns3::MakeUintegerChecker()); /// (minimum) number of sites along the X-axis of the hex grid @@ -638,7 +642,12 @@ main(int argc, char* argv[]) lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(macroEnbBandwidth)); NetDeviceContainer macroEnbDevs = lteHexGridEnbTopologyHelper->SetPositionAndInstallEnbDevice(macroEnbs); - + Ptr wraparoundModel = lteHexGridEnbTopologyHelper->GetWraparoundModel(); + if (wraparoundModel) + { + lteHelper->GetDownlinkSpectrumChannel()->UnidirectionalAggregateObject(wraparoundModel); + lteHelper->GetUplinkSpectrumChannel()->UnidirectionalAggregateObject(wraparoundModel); + } if (epc) { // this enables handover for macro eNBs diff --git a/src/lte/helper/lte-hex-grid-enb-topology-helper.cc b/src/lte/helper/lte-hex-grid-enb-topology-helper.cc index 795772f75..1ce49f56b 100644 --- a/src/lte/helper/lte-hex-grid-enb-topology-helper.cc +++ b/src/lte/helper/lte-hex-grid-enb-topology-helper.cc @@ -12,6 +12,7 @@ #include "ns3/abort.h" #include "ns3/double.h" +#include "ns3/hexagonal-wraparound-model.h" #include "ns3/log.h" #include "ns3/pointer.h" @@ -72,7 +73,12 @@ LteHexGridEnbTopologyHelper::GetTypeId() "The number of sites in even rows (odd rows will have one additional site).", UintegerValue(1), MakeUintegerAccessor(&LteHexGridEnbTopologyHelper::m_gridWidth), - MakeUintegerChecker()); + MakeUintegerChecker()) + .AddAttribute("EnableWraparound", + "Enable hexagonal wraparound model.", + BooleanValue(false), + MakeBooleanAccessor(&LteHexGridEnbTopologyHelper::m_installWraparound), + MakeBooleanChecker()); return tid; } @@ -95,6 +101,13 @@ LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(NodeContainer c) { NS_LOG_FUNCTION(this); NetDeviceContainer enbDevs; + Ptr wraparoundModel; + if (m_installWraparound) + { + wraparoundModel = CreateObject(); + wraparoundModel->SetSiteDistance(m_d); + wraparoundModel->SetNumSites(c.GetN() / 3); + } const double xydfactor = std::sqrt(0.75); double yd = xydfactor * m_d; for (uint32_t n = 0; n < c.GetN(); ++n) @@ -155,8 +168,22 @@ LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(NodeContainer c) mm->SetPosition(Vector(x, y, m_siteHeight)); m_lteHelper->SetEnbAntennaModelAttribute("Orientation", DoubleValue(antennaOrientation)); enbDevs.Add(m_lteHelper->InstallEnbDevice(node)); + if (m_installWraparound && (n % 3 == 0)) + { + wraparoundModel->AddSitePosition(mm->GetPosition()); + } + } + if (m_installWraparound) + { + m_wraparoundModel = wraparoundModel; } return enbDevs; } +Ptr +LteHexGridEnbTopologyHelper::GetWraparoundModel() const +{ + return m_wraparoundModel; +} + } // namespace ns3 diff --git a/src/lte/helper/lte-hex-grid-enb-topology-helper.h b/src/lte/helper/lte-hex-grid-enb-topology-helper.h index 383f01031..e2e8961a2 100644 --- a/src/lte/helper/lte-hex-grid-enb-topology-helper.h +++ b/src/lte/helper/lte-hex-grid-enb-topology-helper.h @@ -11,6 +11,8 @@ #include "lte-helper.h" +#include "ns3/wraparound-model.h" + namespace ns3 { @@ -59,6 +61,13 @@ class LteHexGridEnbTopologyHelper : public Object */ NetDeviceContainer SetPositionAndInstallEnbDevice(NodeContainer c); + /** + * @brief Get the configured wraparound model. + * If wraparound is not enabled, a null pointer is returned instead. + * @return a pointer to the wraparound model + */ + Ptr GetWraparoundModel() const; + private: /** * Pointer to LteHelper object @@ -96,6 +105,16 @@ class LteHexGridEnbTopologyHelper : public Object * The height [m] of each site */ uint32_t m_siteHeight; + + /** + * Boolean flag indicating whether to install or not wraparound model + */ + bool m_installWraparound; + + /** + * Wraparound model pointer + */ + Ptr m_wraparoundModel; }; } // namespace ns3