lte: Use hexagonal wraparound model in lena-dual-stripe example

This commit is contained in:
Gabriel Ferreira
2025-07-15 12:32:35 +02:00
parent 7405e41c53
commit 3a75c470b0
3 changed files with 58 additions and 3 deletions

View File

@@ -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<uint32_t>());
/// (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> wraparoundModel = lteHexGridEnbTopologyHelper->GetWraparoundModel();
if (wraparoundModel)
{
lteHelper->GetDownlinkSpectrumChannel()->UnidirectionalAggregateObject(wraparoundModel);
lteHelper->GetUplinkSpectrumChannel()->UnidirectionalAggregateObject(wraparoundModel);
}
if (epc)
{
// this enables handover for macro eNBs

View File

@@ -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<uint32_t>());
MakeUintegerChecker<uint32_t>())
.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<HexagonalWraparoundModel> wraparoundModel;
if (m_installWraparound)
{
wraparoundModel = CreateObject<HexagonalWraparoundModel>();
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<WraparoundModel>
LteHexGridEnbTopologyHelper::GetWraparoundModel() const
{
return m_wraparoundModel;
}
} // namespace ns3

View File

@@ -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<WraparoundModel> 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<WraparoundModel> m_wraparoundModel;
};
} // namespace ns3