10#include "ns3/boolean.h"
11#include "ns3/double.h"
13#include "ns3/ff-mac-scheduler.h"
15#include "ns3/lte-chunk-processor.h"
16#include "ns3/lte-enb-net-device.h"
17#include "ns3/lte-enb-phy.h"
18#include "ns3/lte-global-pathloss-database.h"
19#include "ns3/lte-helper.h"
20#include "ns3/lte-ue-net-device.h"
21#include "ns3/lte-ue-phy.h"
22#include "ns3/mobility-helper.h"
23#include "ns3/simulator.h"
24#include "ns3/string.h"
51 double beamwidthDegrees,
64 double beamwidthDegrees,
67 double antennaGainDb);
72 void DoRun()
override;
83 double beamwidthDegrees,
87 std::ostringstream oss;
88 oss <<
"o=" << orientationDegrees <<
", bw=" << beamwidthDegrees <<
", x=" << x <<
", y=" << y;
93 double beamwidthDegrees,
125 lteHelper->SetAttribute(
"PathlossModel",
126 StringValue(
"ns3::ConstantSpectrumPropagationLossModel"));
127 lteHelper->SetPathlossModelAttribute(
"Loss",
DoubleValue(0.0));
138 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
139 positionAlloc->Add(Vector(
m_x,
m_y, 0.0));
141 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
142 mobility.SetPositionAllocator(positionAlloc);
143 mobility.Install(allNodes);
148 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
150 lteHelper->SetEnbAntennaModelType(
"ns3::CosineAntennaModel");
153 lteHelper->SetEnbAntennaModelAttribute(
"MaxGain",
DoubleValue(0.0));
156 lteHelper->SetEnbDeviceAttribute(
"DlBandwidth",
UintegerValue(25));
157 lteHelper->SetEnbDeviceAttribute(
"UlBandwidth",
UintegerValue(25));
159 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
160 ueDevs = lteHelper->InstallUeDevice(ueNodes);
163 lteHelper->Attach(ueDevs, enbDevs.
Get(0));
168 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
176 uePhy->GetDownlinkSpectrumPhy()->AddDataSinrChunkProcessor(testDlSinr);
183 enbphy->GetUplinkSpectrumPhy()->AddDataSinrChunkProcessor(testUlSinr);
191 "/ChannelList/0/PathLoss",
199 const double enbTxPowerDbm = 30;
200 const double ueTxPowerDbm = 10;
201 const double ktDbm = -174;
202 const double noisePowerDbm =
203 ktDbm + 10 * std::log10(25 * 180000);
204 const double ueNoiseFigureDb = 9.0;
205 const double enbNoiseFigureDb = 5.0;
210 double expectedSinrDl = enbTxPowerDbm +
m_antennaGainDb - noisePowerDbm + ueNoiseFigureDb;
211 if (expectedSinrDl > 0)
213 double calculatedSinrDbDl = -INFINITY;
216 calculatedSinrDbDl = 10.0 * std::log10(dlSinrCatcher.
GetValue()->operator[](0));
219 double calculatedAntennaGainDbDl =
220 -(enbTxPowerDbm - calculatedSinrDbDl - noisePowerDbm - ueNoiseFigureDb);
222 <<
" tol " << tolerance);
226 "Wrong DL antenna gain!");
228 double expectedSinrUl = ueTxPowerDbm +
m_antennaGainDb - noisePowerDbm + enbNoiseFigureDb;
229 if (expectedSinrUl > 0)
231 double calculatedSinrDbUl = -INFINITY;
234 calculatedSinrDbUl = 10.0 * std::log10(ulSinrCatcher.
GetValue()->operator[](0));
236 double calculatedAntennaGainDbUl =
237 -(ueTxPowerDbm - calculatedSinrDbUl - noisePowerDbm - enbNoiseFigureDb);
241 "Wrong UL antenna gain!");
245 double measuredLossDl = dlPathlossDb.
GetPathloss(1, 1);
247 double measuredLossUl = ulPathlossDb.
GetPathloss(1, 1);
Lte Enb Antenna Test Suite.
Tests that the propagation model and the antenna parameters are generate the correct values.
double m_orientationDegrees
antenna orientation in degrees
double m_antennaGainDb
antenna gain in dB
static std::string BuildNameString(double orientationDegrees, double beamwidthDegrees, double x, double y)
Build name string.
LteEnbAntennaTestCase(double orientationDegrees, double beamwidthDegrees, double x, double y, double antennaGainDb)
Constructor.
double m_x
x position of the UE
double m_beamwidthDegrees
antenna beamwidth in degrees
~LteEnbAntennaTestCase() override
double m_y
y position of the UE
void DoRun() override
Implementation to actually run this TestCase.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Store the last pathloss value for each TX-RX pair for downlink.
void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb) override
update the pathloss value
Hold variables of type enum.
This class contains the specification of EPS Bearers.
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
The eNodeB device implementation.
double GetPathloss(uint16_t cellId, uint64_t imsi)
The LtePhy models the physical layer of LTE.
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
Ptr< SpectrumValue > GetValue()
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
static constexpr auto SYSTEM
Hold an unsigned integer type.
Store the last pathloss value for each TX-RX pair for uplink.
void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb) override
update the pathloss value
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static LteAntennaTestSuite g_lteAntennaTestSuite
Static variable for test initialization.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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...
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...