22 #include "lte-hex-grid-enb-topology-helper.h"
23 #include <ns3/double.h>
25 #include <ns3/abort.h>
26 #include <ns3/pointer.h>
27 #include <ns3/epc-helper.h>
35 NS_OBJECT_ENSURE_REGISTERED (LteHexGridEnbTopologyHelper);
37 LteHexGridEnbTopologyHelper::LteHexGridEnbTopologyHelper ()
42 LteHexGridEnbTopologyHelper::~LteHexGridEnbTopologyHelper (
void)
47 TypeId LteHexGridEnbTopologyHelper::GetTypeId (
void)
51 TypeId (
"ns3::LteHexGridEnbTopologyHelper")
53 .AddConstructor<LteHexGridEnbTopologyHelper> ()
54 .AddAttribute (
"InterSiteDistance",
55 "The distance [m] between nearby sites",
57 MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_d),
58 MakeDoubleChecker<double> ())
59 .AddAttribute (
"SectorOffset",
60 "The offset [m] in the position for the node of each sector with respect "
61 "to the center of the three-sector site",
63 MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_offset),
64 MakeDoubleChecker<double> ())
65 .AddAttribute (
"SiteHeight",
66 "The height [m] of each site",
68 MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_siteHeight),
69 MakeDoubleChecker<double> ())
70 .AddAttribute (
"MinX",
"The x coordinate where the hex grid starts.",
72 MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_xMin),
73 MakeDoubleChecker<double> ())
74 .AddAttribute (
"MinY",
"The y coordinate where the hex grid starts.",
76 MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_yMin),
77 MakeDoubleChecker<double> ())
78 .AddAttribute (
"GridWidth",
"The number of sites in even rows (odd rows will have one additional site).",
80 MakeUintegerAccessor (&LteHexGridEnbTopologyHelper::m_gridWidth),
81 MakeUintegerChecker<uint32_t> ())
106 const double xydfactor = std::sqrt (0.75);
107 double yd = xydfactor*m_d;
108 for (uint32_t n = 0; n < c.
GetN (); ++n)
110 uint32_t currentSite = n / 3;
111 uint32_t biRowIndex = (currentSite / (m_gridWidth + m_gridWidth + 1));
112 uint32_t biRowRemainder = currentSite % (m_gridWidth + m_gridWidth + 1);
113 uint32_t rowIndex = biRowIndex*2;
114 uint32_t colIndex = biRowRemainder;
115 if (biRowRemainder >= m_gridWidth)
118 colIndex -= m_gridWidth;
121 <<
" rowIndex " << rowIndex
122 <<
" colIndex " << colIndex
123 <<
" biRowIndex " << biRowIndex
124 <<
" biRowRemainder " << biRowRemainder);
125 double y = m_yMin + yd * rowIndex;
127 double antennaOrientation;
128 if ((rowIndex % 2) == 0)
130 x = m_xMin + m_d * colIndex;
134 x = m_xMin -(0.5*m_d) + m_d * colIndex;
140 antennaOrientation = 0;
145 antennaOrientation = 120;
147 y += m_offset*xydfactor;
151 antennaOrientation = -120;
153 y -= m_offset*xydfactor;
161 Vector pos (x, y, m_siteHeight);
162 NS_LOG_LOGIC (
"node " << n <<
" at " << pos <<
" antennaOrientation " << antennaOrientation);
164 m_lteHelper->SetEnbAntennaModelAttribute (
"Orientation",
DoubleValue (antennaOrientation));
165 enbDevs.
Add (m_lteHelper->InstallEnbDevice (node));
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void DoDispose(void)
void SetLteHelper(Ptr< LteHelper > h)
NetDeviceContainer SetPositionAndInstallEnbDevice(NodeContainer c)
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
Keep track of the current position and velocity of an object.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
holds a vector of ns3::NetDevice pointers
#define NS_LOG_LOGIC(msg)
keep track of a set of node pointers.
virtual void DoDispose(void)
void SetPosition(const Vector &position)
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Hold an floating point type.
Ptr< T > GetObject(void) const