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" 40 #include <ns3/lte-chunk-processor.h> 68 static std::string BuildNameString (
double orientationDegrees,
double beamwidthDegrees,
double x,
double y);
78 LteEnbAntennaTestCase (
double orientationDegrees,
double beamwidthDegrees,
double x,
double y,
double antennaGainDb);
83 virtual void DoRun (
void);
97 std::ostringstream oss;
98 oss <<
"o=" << orientationDegrees
99 <<
", bw=" << beamwidthDegrees
107 :
TestCase (BuildNameString (orientationDegrees, beamwidthDegrees,
x, y)),
108 m_orientationDegrees (orientationDegrees),
109 m_beamwidthDegrees (beamwidthDegrees),
112 m_antennaGainDb (antennaGainDb)
147 positionAlloc->
Add (Vector (0.0, 0.0, 0.0));
148 positionAlloc->
Add (Vector (
m_x,
m_y, 0.0));
150 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
151 mobility.SetPositionAllocator (positionAlloc);
168 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
180 testDlSinr->AddCallback (
MakeCallback (&LteSpectrumValueCatcher::ReportValue, &dlSinrCatcher));
186 testUlSinr->AddCallback (
MakeCallback (&LteSpectrumValueCatcher::ReportValue, &ulSinrCatcher));
196 MakeCallback (&DownlinkLteGlobalPathlossDatabase::UpdatePathloss, &dlPathlossDb));
198 MakeCallback (&UplinkLteGlobalPathlossDatabase::UpdatePathloss, &ulPathlossDb));
200 Simulator::Stop (
Seconds (0.035));
203 const double enbTxPowerDbm = 30;
204 const double ueTxPowerDbm = 10;
205 const double ktDbm = -174;
206 const double noisePowerDbm = ktDbm + 10 * std::log10 (25 * 180000);
207 const double ueNoiseFigureDb = 9.0;
208 const double enbNoiseFigureDb = 5.0;
213 double expectedSinrDl = enbTxPowerDbm +
m_antennaGainDb - noisePowerDbm + ueNoiseFigureDb;
214 if (expectedSinrDl > 0)
216 double calculatedSinrDbDl = -INFINITY;
217 if (dlSinrCatcher.GetValue () != 0)
219 calculatedSinrDbDl = 10.0 * std::log10 (dlSinrCatcher.GetValue ()->operator[] (0));
222 double calculatedAntennaGainDbDl = - (enbTxPowerDbm - calculatedSinrDbDl - noisePowerDbm - ueNoiseFigureDb);
225 double expectedSinrUl = ueTxPowerDbm +
m_antennaGainDb - noisePowerDbm + enbNoiseFigureDb;
226 if (expectedSinrUl > 0)
228 double calculatedSinrDbUl = -INFINITY;
229 if (ulSinrCatcher.GetValue () != 0)
231 calculatedSinrDbUl = 10.0 * std::log10 (ulSinrCatcher.GetValue ()->operator[] (0));
233 double calculatedAntennaGainDbUl = - (ueTxPowerDbm - calculatedSinrDbUl - noisePowerDbm - enbNoiseFigureDb);
239 double measuredLossDl = dlPathlossDb.
GetPathloss (1, 1);
241 double measuredLossUl = ulPathlossDb.
GetPathloss (1, 1);
245 Simulator::Destroy ();
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
double m_antennaGainDb
antenna gain in dB
double m_x
x position of the UE
AttributeValue implementation for Boolean.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Hold variables of type string.
virtual ~LteEnbAntennaTestCase()
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
double m_beamwidthDegrees
antenna beamwidth in degrees
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< LteSpectrumPhy > GetUplinkSpectrumPhy()
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Lte Enb Antenna Test Suite.
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Store the last pathloss value for each TX-RX pair for uplink.
This class contains the specification of EPS Bearers.
Hold variables of type enum.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Tests that the propagation model and the antenna parameters are generate the correct values...
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
Ptr< LteSpectrumPhy > GetDownlinkSpectrumPhy()
#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...
void Connect(std::string path, const CallbackBase &cb)
void SetEnbAntennaModelType(std::string type)
Set the type of antenna model to be used by eNodeB devices.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
double m_orientationDegrees
antenna orientation in degrees
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
double m_y
y position of the UE
static std::string BuildNameString(double orientationDegrees, double beamwidthDegrees, double x, double y)
Build name string.
double GetPathloss(uint16_t cellId, uint64_t imsi)
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Helper class used to assign positions and mobility models to nodes.
static LteAntennaTestSuite lteAntennaTestSuite
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
void Add(Vector v)
Add a position to the list of positions.
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB antenna model to be created.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
virtual void DoRun(void)
Implementation to actually run this TestCase.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
The eNodeB device implementation.
The LtePhy models the physical layer of LTE.
Store the last pathloss value for each TX-RX pair for downlink.
The LteUeNetDevice class implements the UE net device.