22 #include "ns3/simulator.h"
24 #include "ns3/string.h"
25 #include "ns3/double.h"
27 #include "ns3/boolean.h"
29 #include "ns3/mobility-helper.h"
30 #include "ns3/lte-helper.h"
32 #include "ns3/lte-ue-phy.h"
33 #include "ns3/lte-ue-net-device.h"
34 #include "ns3/lte-enb-phy.h"
35 #include "ns3/lte-enb-net-device.h"
36 #include "ns3/ff-mac-scheduler.h"
38 #include "ns3/lte-global-pathloss-database.h"
51 static std::string
BuildNameString (
double orientationDegrees,
double beamwidthDegrees,
double x,
double y);
52 LteEnbAntennaTestCase (
double orientationDegrees,
double beamwidthDegrees,
double x,
double y,
double antennaGainDb);
57 virtual void DoRun (
void);
71 std::ostringstream oss;
72 oss <<
"o=" << orientationDegrees
73 <<
", bw=" << beamwidthDegrees
81 :
TestCase (BuildNameString (orientationDegrees, beamwidthDegrees, x, y)),
82 m_orientationDegrees (orientationDegrees),
83 m_beamwidthDegrees (beamwidthDegrees),
86 m_antennaGainDb (antennaGainDb)
105 lteHelper->SetAttribute (
"PathlossModel",
StringValue (
"ns3::ConstantSpectrumPropagationLossModel"));
106 lteHelper->SetPathlossModelAttribute (
"Loss",
DoubleValue (0.0));
117 positionAlloc->Add (
Vector (0.0, 0.0, 0.0));
127 lteHelper->SetSchedulerType (
"ns3::RrFfMacScheduler");
129 lteHelper->SetEnbAntennaModelType (
"ns3::CosineAntennaModel");
132 lteHelper->SetEnbAntennaModelAttribute (
"MaxGain",
DoubleValue (0.0));
134 enbDevs = lteHelper->InstallEnbDevice (enbNodes);
135 ueDevs = lteHelper->InstallUeDevice (ueNodes);
138 lteHelper->Attach (ueDevs, enbDevs.
Get (0));
143 lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
149 uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr);
153 enbphy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr);
169 const double enbTxPowerDbm = 30;
170 const double ueTxPowerDbm = 10;
171 const double ktDbm = -174;
172 const double noisePowerDbm = ktDbm + 10 * std::log10 (25 * 180000);
173 const double ueNoiseFigureDb = 9.0;
174 const double enbNoiseFigureDb = 5.0;
179 double expectedSinrDl = enbTxPowerDbm +
m_antennaGainDb - noisePowerDbm + ueNoiseFigureDb;
180 if (expectedSinrDl > 0)
182 double calculatedSinrDbDl = -INFINITY;
183 if (testDlSinr->GetSinr () != 0)
185 calculatedSinrDbDl = 10.0 * std::log10 (testDlSinr->GetSinr ()->operator[] (0));
188 double calculatedAntennaGainDbDl = - (enbTxPowerDbm - calculatedSinrDbDl - noisePowerDbm - ueNoiseFigureDb);
191 double expectedSinrUl = ueTxPowerDbm +
m_antennaGainDb - noisePowerDbm + enbNoiseFigureDb;
192 if (expectedSinrUl > 0)
194 double calculatedSinrDbUl = -INFINITY;
195 if (testUlSinr->GetSinr () != 0)
197 calculatedSinrDbUl = 10.0 * std::log10 (testUlSinr->GetSinr ()->operator[] (0));
199 double calculatedAntennaGainDbUl = - (ueTxPowerDbm - calculatedSinrDbUl - noisePowerDbm - enbNoiseFigureDb);
205 double measuredLossDl = dlPathlossDb.
GetPathloss (1, 1);
207 double measuredLossUl = ulPathlossDb.
GetPathloss (1, 1);
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
double m_beamwidthDegrees
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
hold variables of type string
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
static void Run(void)
Run the simulation until one of:
void Connect(std::string path, const CallbackBase &cb)
virtual void UpdatePathloss(std::string context, Ptr< SpectrumPhy > txPhy, Ptr< SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
This class contains the specification of EPS Bearers.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
hold variables of type 'enum'
static std::string BuildNameString(double orientationDegrees, double beamwidthDegrees, double x, double y)
static LteAntennaTestSuite lteAntennaTestSuite
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
double m_orientationDegrees
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
void SetDefault(std::string name, const AttributeValue &value)
keep track of a set of node pointers.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
NS_LOG_COMPONENT_DEFINE("LteAntennaTest")
double GetPathloss(uint16_t cellId, uint64_t imsi)
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Helper class used to assign positions and mobility models to nodes.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Hold a floating point type.
The eNodeB device implementation.
Ptr< T > GetObject(void) const
virtual void UpdatePathloss(std::string context, Ptr< SpectrumPhy > txPhy, Ptr< SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
virtual ~LteEnbAntennaTestCase()
The LtePhy models the physical layer of LTE.
The LteUeNetDevice class implements the UE net device.