21#include "ns3/boolean.h"
22#include "ns3/double.h"
24#include "ns3/ff-mac-scheduler.h"
26#include "ns3/lte-enb-net-device.h"
27#include "ns3/lte-enb-phy.h"
28#include "ns3/lte-global-pathloss-database.h"
29#include "ns3/lte-helper.h"
30#include "ns3/lte-ue-net-device.h"
31#include "ns3/lte-ue-phy.h"
32#include "ns3/mobility-helper.h"
33#include "ns3/simulator.h"
34#include "ns3/string.h"
36#include <ns3/lte-chunk-processor.h>
63 double beamwidthDegrees,
76 double beamwidthDegrees,
79 double antennaGainDb);
84 void DoRun()
override;
95 double beamwidthDegrees,
99 std::ostringstream oss;
100 oss <<
"o=" << orientationDegrees <<
", bw=" << beamwidthDegrees <<
", x=" << x <<
", y=" << y;
105 double beamwidthDegrees,
108 double antennaGainDb)
109 :
TestCase(BuildNameString(orientationDegrees, beamwidthDegrees, x, y)),
110 m_orientationDegrees(orientationDegrees),
111 m_beamwidthDegrees(beamwidthDegrees),
114 m_antennaGainDb(antennaGainDb)
138 StringValue(
"ns3::ConstantSpectrumPropagationLossModel"));
150 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
151 positionAlloc->Add(Vector(
m_x,
m_y, 0.0));
153 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
154 mobility.SetPositionAllocator(positionAlloc);
175 lteHelper->
Attach(ueDevs, enbDevs.
Get(0));
187 testDlSinr->AddCallback(
MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlSinrCatcher));
188 uePhy->GetDownlinkSpectrumPhy()->AddDataSinrChunkProcessor(testDlSinr);
194 testUlSinr->AddCallback(
MakeCallback(&LteSpectrumValueCatcher::ReportValue, &ulSinrCatcher));
195 enbphy->GetUplinkSpectrumPhy()->AddDataSinrChunkProcessor(testUlSinr);
203 "/ChannelList/0/PathLoss",
204 MakeCallback(&DownlinkLteGlobalPathlossDatabase::UpdatePathloss, &dlPathlossDb));
206 MakeCallback(&UplinkLteGlobalPathlossDatabase::UpdatePathloss, &ulPathlossDb));
208 Simulator::Stop(
Seconds(0.035));
211 const double enbTxPowerDbm = 30;
212 const double ueTxPowerDbm = 10;
213 const double ktDbm = -174;
214 const double noisePowerDbm =
215 ktDbm + 10 * std::log10(25 * 180000);
216 const double ueNoiseFigureDb = 9.0;
217 const double enbNoiseFigureDb = 5.0;
222 double expectedSinrDl = enbTxPowerDbm +
m_antennaGainDb - noisePowerDbm + ueNoiseFigureDb;
223 if (expectedSinrDl > 0)
225 double calculatedSinrDbDl = -INFINITY;
228 calculatedSinrDbDl = 10.0 * std::log10(dlSinrCatcher.
GetValue()->operator[](0));
231 double calculatedAntennaGainDbDl =
232 -(enbTxPowerDbm - calculatedSinrDbDl - noisePowerDbm - ueNoiseFigureDb);
234 <<
" tol " << tolerance);
238 "Wrong DL antenna gain!");
240 double expectedSinrUl = ueTxPowerDbm +
m_antennaGainDb - noisePowerDbm + enbNoiseFigureDb;
241 if (expectedSinrUl > 0)
243 double calculatedSinrDbUl = -INFINITY;
246 calculatedSinrDbUl = 10.0 * std::log10(ulSinrCatcher.
GetValue()->operator[](0));
248 double calculatedAntennaGainDbUl =
249 -(ueTxPowerDbm - calculatedSinrDbUl - noisePowerDbm - enbNoiseFigureDb);
253 "Wrong UL antenna gain!");
257 double measuredLossDl = dlPathlossDb.
GetPathloss(1, 1);
259 double measuredLossUl = ulPathlossDb.
GetPathloss(1, 1);
262 Simulator::Destroy();
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.
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.
AttributeValue implementation for Boolean.
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.
Hold variables of type enum.
This class contains the specification of EPS Bearers.
The eNodeB device implementation.
double GetPathloss(uint16_t cellId, uint64_t imsi)
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
void SetEnbAntennaModelType(std::string type)
Set the type of antenna model to be used by eNodeB devices.
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB antenna model to be created.
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
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()
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.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
Store the last pathloss value for each TX-RX pair for uplink.
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.
#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...
static LteAntennaTestSuite lteAntennaTestSuite