added LteHexGridEnbTopologyHelper
This commit is contained in:
171
src/lte/helper/lte-hex-grid-enb-topology-helper.cc
Normal file
171
src/lte/helper/lte-hex-grid-enb-topology-helper.cc
Normal file
@@ -0,0 +1,171 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Nicola Baldo <nbaldo@cttc.es>
|
||||
*/
|
||||
|
||||
|
||||
#include "lte-hex-grid-enb-topology-helper.h"
|
||||
#include <ns3/double.h>
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/abort.h>
|
||||
#include <ns3/pointer.h>
|
||||
#include <ns3/epc-helper.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LteHexGridEnbTopologyHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (LteHexGridEnbTopologyHelper);
|
||||
|
||||
LteHexGridEnbTopologyHelper::LteHexGridEnbTopologyHelper ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
LteHexGridEnbTopologyHelper::~LteHexGridEnbTopologyHelper (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
TypeId LteHexGridEnbTopologyHelper::GetTypeId (void)
|
||||
{
|
||||
static TypeId
|
||||
tid =
|
||||
TypeId ("ns3::LteHexGridEnbTopologyHelper")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<LteHexGridEnbTopologyHelper> ()
|
||||
.AddAttribute ("InterSiteDistance",
|
||||
"The distance [m] between nearby sites",
|
||||
DoubleValue (500),
|
||||
MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_d),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("SectorOffset",
|
||||
"The offset [m] in the position for the node of each sector with respect "
|
||||
"to the center of the three-sector site",
|
||||
DoubleValue (0.5),
|
||||
MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_offset),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("SiteHeight",
|
||||
"The height [m] of each site",
|
||||
DoubleValue (30),
|
||||
MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_siteHeight),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("MinX", "The x coordinate where the hex grid starts.",
|
||||
DoubleValue (0.0),
|
||||
MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_xMin),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("MinY", "The y coordinate where the hex grid starts.",
|
||||
DoubleValue (0.0),
|
||||
MakeDoubleAccessor (&LteHexGridEnbTopologyHelper::m_yMin),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("GridWidth", "The number of sites in even rows (odd rows will have one additional site).",
|
||||
UintegerValue (1),
|
||||
MakeUintegerAccessor (&LteHexGridEnbTopologyHelper::m_gridWidth),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
void
|
||||
LteHexGridEnbTopologyHelper::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LteHexGridEnbTopologyHelper::SetLteHelper (Ptr<LteHelper> h)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << h);
|
||||
m_lteHelper = h;
|
||||
}
|
||||
|
||||
NetDeviceContainer
|
||||
LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice (NodeContainer c)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NetDeviceContainer enbDevs;
|
||||
const double xydfactor = sqrt (0.75);
|
||||
double yd = xydfactor*m_d;
|
||||
for (uint32_t n = 0; n < c.GetN (); ++n)
|
||||
{
|
||||
uint32_t currentSite = n / 3;
|
||||
uint32_t biRowIndex = (currentSite / (m_gridWidth + m_gridWidth + 1));
|
||||
uint32_t biRowRemainder = currentSite % (m_gridWidth + m_gridWidth + 1);
|
||||
uint32_t rowIndex = biRowIndex*2;
|
||||
uint32_t colIndex = biRowRemainder;
|
||||
if (biRowRemainder >= m_gridWidth)
|
||||
{
|
||||
++rowIndex;
|
||||
colIndex -= m_gridWidth;
|
||||
}
|
||||
NS_LOG_LOGIC ("node " << n << " site " << currentSite
|
||||
<< " rowIndex " << rowIndex
|
||||
<< " colIndex " << colIndex
|
||||
<< " biRowIndex " << biRowIndex
|
||||
<< " biRowRemainder " << biRowRemainder);
|
||||
double y = m_yMin + yd * rowIndex;
|
||||
double x;
|
||||
double antennaOrientation;
|
||||
if ((rowIndex % 2) == 0)
|
||||
{
|
||||
x = m_xMin + m_d * colIndex;
|
||||
}
|
||||
else // row is odd
|
||||
{
|
||||
x = m_xMin -(0.5*m_d) + m_d * colIndex;
|
||||
}
|
||||
|
||||
switch (n%3)
|
||||
{
|
||||
case 0:
|
||||
antennaOrientation = 0;
|
||||
x += m_offset;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
antennaOrientation = 120;
|
||||
x -= m_offset/2.0;
|
||||
y += m_offset*xydfactor;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
antennaOrientation = -120;
|
||||
x -= m_offset/2.0;
|
||||
y -= m_offset*xydfactor;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Ptr<Node> node = c.Get (n);
|
||||
Ptr<MobilityModel> mm = node->GetObject<MobilityModel> ();
|
||||
Vector pos (x, y, m_siteHeight);
|
||||
NS_LOG_LOGIC ("node " << n << " at " << pos << " antennaOrientation " << antennaOrientation);
|
||||
mm->SetPosition (Vector (x, y, m_siteHeight));
|
||||
m_lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (antennaOrientation));
|
||||
enbDevs.Add (m_lteHelper->InstallEnbDevice (node));
|
||||
}
|
||||
return enbDevs;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
87
src/lte/helper/lte-hex-grid-enb-topology-helper.h
Normal file
87
src/lte/helper/lte-hex-grid-enb-topology-helper.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Nicola Baldo <nbaldo@cttc.es>
|
||||
*/
|
||||
|
||||
#ifndef LTE_HEX_GRID_ENB_TOPOLOGY_HELPER_H
|
||||
#define LTE_HEX_GRID_ENB_TOPOLOGY_HELPER_H
|
||||
|
||||
#include <ns3/lte-helper.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This helper class allows to easily create a topology with eNBs
|
||||
* grouped in three-sector sites layed out on an hexagonal grid. The
|
||||
* layout is done row-wise.
|
||||
*
|
||||
*/
|
||||
class LteHexGridEnbTopologyHelper : public Object
|
||||
{
|
||||
public:
|
||||
LteHexGridEnbTopologyHelper (void);
|
||||
virtual ~LteHexGridEnbTopologyHelper (void);
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
|
||||
/**
|
||||
* Set the LteHelper to be used to actually create the EnbNetDevices
|
||||
*
|
||||
* \note if no EpcHelper is ever set, then LteHexGridEnbTopologyHelper will default
|
||||
* to creating an LTE-only simulation with no EPC, using LteRlcSm as
|
||||
* the RLC model, and without supporting any IP networking. In other
|
||||
* words, it will be a radio-level simulation involving only LTE PHY
|
||||
* and MAC and the FF Scheduler, with a saturation traffic model for
|
||||
* the RLC.
|
||||
*
|
||||
* \param h a pointer to the EpcHelper to be used
|
||||
*/
|
||||
void SetLteHelper (Ptr<LteHelper> h);
|
||||
|
||||
/**
|
||||
* Position the nodes on a hex grid and install the corresponding
|
||||
* EnbNetDevices with antenna boresight configured properly
|
||||
*
|
||||
* \param c the node container where the devices are to be installed
|
||||
*
|
||||
* \return the NetDeviceContainer with the newly created devices
|
||||
*/
|
||||
NetDeviceContainer SetPositionAndInstallEnbDevice (NodeContainer c);
|
||||
|
||||
private:
|
||||
|
||||
Ptr<LteHelper> m_lteHelper;
|
||||
double m_offset;
|
||||
double m_d;
|
||||
double m_xMin;
|
||||
double m_yMin;
|
||||
uint32_t m_gridWidth;
|
||||
uint32_t m_siteHeight;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
|
||||
#endif // LTE_HEX_GRID_ENB_TOPOLOGY_HELPER_H
|
||||
@@ -39,6 +39,7 @@ def build(bld):
|
||||
'helper/radio-bearer-stats-calculator.cc',
|
||||
'helper/mac-stats-calculator.cc',
|
||||
'helper/radio-environment-map-helper.cc',
|
||||
'helper/lte-hex-grid-enb-topology-helper.cc',
|
||||
'model/rem-spectrum-phy.cc',
|
||||
'model/ff-mac-csched-sap.cc',
|
||||
'model/ff-mac-sched-sap.cc',
|
||||
@@ -132,6 +133,7 @@ def build(bld):
|
||||
'helper/mac-stats-calculator.h',
|
||||
'helper/radio-bearer-stats-calculator.h',
|
||||
'helper/radio-environment-map-helper.h',
|
||||
'helper/lte-hex-grid-enb-topology-helper.h',
|
||||
'model/rem-spectrum-phy.h',
|
||||
'model/ff-mac-common.h',
|
||||
'model/ff-mac-csched-sap.h',
|
||||
|
||||
Reference in New Issue
Block a user