23 #include "ns3/boolean.h"
24 #include "ns3/double.h"
25 #include "ns3/ff-mac-scheduler.h"
27 #include "ns3/lte-enb-net-device.h"
28 #include "ns3/lte-enb-phy.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>
60 testcase->
UlScheduling(frameNo, subframeNo, rnti, mcs, sizeTb);
212 m_expectedDlSinrDb(10 * std::log10(dlSinr)),
213 m_expectedUlSinrDb(10 * std::log10(ulSinr)),
258 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
259 positionAlloc->Add(Vector(
m_d2,
m_d1, 0.0));
260 positionAlloc->Add(Vector(0.0,
m_d1, 0.0));
261 positionAlloc->Add(Vector(
m_d2, 0.0, 0.0));
263 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
264 mobility.SetPositionAllocator(positionAlloc);
277 lteHelper->
Attach(ueDevs1, enbDevs.
Get(0));
278 lteHelper->
Attach(ueDevs2, enbDevs.
Get(1));
293 testDlSinr1->AddCallback(
MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlSinr1Catcher));
294 ue1Phy->GetDownlinkSpectrumPhy()->AddDataSinrChunkProcessor(testDlSinr1);
300 testUlSinr1->AddCallback(
MakeCallback(&LteSpectrumValueCatcher::ReportValue, &ulSinr1Catcher));
301 enb1phy->GetUplinkSpectrumPhy()->AddDataSinrChunkProcessor(testUlSinr1);
303 Config::Connect(
"/NodeList/0/DeviceList/0/ComponentCarrierMap/*/LteEnbMac/DlScheduling",
306 Config::Connect(
"/NodeList/0/DeviceList/0/ComponentCarrierMap/*/LteEnbMac/UlScheduling",
314 testDlSinr2->AddCallback(
MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlSinr2Catcher));
315 ue2Phy->GetDownlinkSpectrumPhy()->AddDataSinrChunkProcessor(testDlSinr2);
321 testUlSinr2->AddCallback(
MakeCallback(&LteSpectrumValueCatcher::ReportValue, &ulSinr2Catcher));
322 enb1phy->GetUplinkSpectrumPhy()->AddDataSinrChunkProcessor(testUlSinr2);
324 Config::Connect(
"/NodeList/1/DeviceList/0/ComponentCarrierMap/*/LteEnbMac/DlScheduling",
327 Config::Connect(
"/NodeList/1/DeviceList/0/ComponentCarrierMap/*/LteEnbMac/UlScheduling",
331 Simulator::Stop(
Seconds(0.100));
336 double dlSinr1Db = 10.0 * std::log10(dlSinr1Catcher.
GetValue()->operator[](0));
340 "Wrong SINR in DL! (eNB1 --> UE1)");
342 double dlSinr2Db = 10.0 * std::log10(dlSinr2Catcher.
GetValue()->operator[](0));
346 "Wrong SINR in DL! (eNB2 --> UE2)");
350 double ulSinr1Db = 10.0 * std::log10(ulSinr1Catcher.
GetValue()->operator[](0));
354 "Wrong SINR in UL! (UE1 --> eNB1)");
356 double ulSinr2Db = 10.0 * std::log10(ulSinr2Catcher.
GetValue()->operator[](0));
360 "Wrong SINR in UL! (UE2 --> eNB2)");
363 Simulator::Destroy();
386 NS_LOG_FUNCTION(frameNo << subframeNo << rnti << (uint32_t)mcs << sizeTb);
Test that SINR calculation and MCS selection works fine in a multi-cell interference scenario.
LteInterferenceTestCase(std::string name, double d1, double d2, double dlSinr, double ulSinr, double dlSe, double ulSe, uint16_t dlMcs, uint16_t ulMcs)
Constructor.
~LteInterferenceTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
double m_expectedDlSinrDb
expected DL SINR in dB
uint16_t m_dlMcs
the DL MCS
void UlScheduling(uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t sizeTb)
UL scheduling function.
double m_expectedUlSinrDb
expected UL SINR in dB
void DlScheduling(DlSchedulingCallbackInfo dlInfo)
DL scheduling function.
double m_d2
distance between UE and other ENB
uint16_t m_ulMcs
the UL MCS
double m_d1
distance between UE and ENB
Test suite for interference test.
LteInterferenceTestSuite()
TestSuite.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
This class contains the specification of EPS Bearers.
The eNodeB device implementation.
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 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 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.
std::string GetName() const
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 LteInterferenceTestSuite lteLinkAdaptationWithInterferenceTestSuite
Static variable for test initialization.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void LteTestDlSchedulingCallback(LteInterferenceTestCase *testcase, std::string path, DlSchedulingCallbackInfo dlInfo)
void LteTestUlSchedulingCallback(LteInterferenceTestCase *testcase, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t sizeTb, uint8_t ccId)
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...
DlSchedulingCallbackInfo structure.
uint32_t subframeNo
subframe number
uint32_t frameNo
frame number