22 #include "ns3/simulator.h"
24 #include "ns3/string.h"
25 #include "ns3/double.h"
27 #include "ns3/boolean.h"
28 #include "ns3/mobility-helper.h"
29 #include "ns3/lte-helper.h"
30 #include "ns3/ff-mac-scheduler.h"
32 #include "ns3/lte-enb-phy.h"
33 #include "ns3/lte-enb-net-device.h"
35 #include "ns3/lte-ue-phy.h"
36 #include "ns3/lte-ue-net-device.h"
38 #include "lte-test-interference.h"
40 #include "lte-test-sinr-chunk-processor.h"
48 LteTestDlSchedulingCallback (LteInterferenceTestCase *testcase, std::string path,
49 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
50 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
52 testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
56 LteTestUlSchedulingCallback (LteInterferenceTestCase *testcase, std::string path,
57 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
58 uint8_t mcs, uint16_t sizeTb)
60 testcase->UlScheduling (frameNo, subframeNo, rnti, mcs, sizeTb);
71 AddTestCase (
new LteInterferenceTestCase (
"d1=3000, d2=6000", 3000.000000, 6000.000000, 3.844681, 1.714583, 0.761558, 0.389662, 6, 4), TestCase::QUICK);
72 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=10", 50.000000, 10.000000, 0.040000, 0.040000, 0.010399, 0.010399, 0, 0), TestCase::QUICK);
73 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=20", 50.000000, 20.000000, 0.160000, 0.159998, 0.041154, 0.041153, 0, 0), TestCase::QUICK);
74 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=50", 50.000000, 50.000000, 0.999997, 0.999907, 0.239828, 0.239808, 2, 2), TestCase::QUICK);
75 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=100", 50.000000, 100.000000, 3.999955, 3.998520, 0.785259, 0.785042, 6, 6), TestCase::QUICK);
76 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=200", 50.000000, 200.000000, 15.999282, 15.976339, 1.961072, 1.959533, 14, 14), TestCase::QUICK);
77 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=500", 50.000000, 500.000000, 99.971953, 99.082845, 4.254003, 4.241793, 22, 22), TestCase::QUICK);
78 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=1000", 50.000000, 1000.000000, 399.551632, 385.718468, 6.194952, 6.144825, 28, 28), TestCase::QUICK);
79 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=10000", 50.000000, 10000.000000, 35964.181431, 8505.970614, 12.667381, 10.588084, 28, 28), TestCase::QUICK);
80 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=100000", 50.000000, 100000.000000, 327284.773828, 10774.181090, 15.853097, 10.928917, 28, 28), TestCase::QUICK);
81 AddTestCase (
new LteInterferenceTestCase (
"d1=50, d2=1000000", 50.000000, 1000000.000000, 356132.574152, 10802.988445, 15.974963, 10.932767, 28, 28), TestCase::QUICK);
82 AddTestCase (
new LteInterferenceTestCase (
"d1=4500, d2=12600", 4500.000000, 12600.000000, 6.654462, 1.139831, 1.139781, 0.270399, 8, 2), TestCase::QUICK);
83 AddTestCase (
new LteInterferenceTestCase (
"d1=5400, d2=12600", 5400.000000, 12600.000000, 4.621154, 0.791549, 0.876368, 0.193019, 6, 0), TestCase::QUICK);
99 m_dlSinrDb (10 * std::log10 (dlSinr)),
100 m_ulSinrDb (10 * std::log10 (ulSinr)),
108 LteInterferenceTestCase::~LteInterferenceTestCase ()
122 lteHelper->SetAttribute (
"PathlossModel",
StringValue (
"ns3::FriisSpectrumPropagationLossModel"));
123 lteHelper->SetAttribute (
"UseIdealRrc",
BooleanValue (
false));
143 positionAlloc->Add (
Vector (0.0, 0.0, 0.0));
144 positionAlloc->Add (
Vector (m_d2, m_d1, 0.0));
145 positionAlloc->Add (
Vector (0.0, m_d1, 0.0));
146 positionAlloc->Add (
Vector (m_d2, 0.0, 0.0));
156 lteHelper->SetSchedulerType (
"ns3::RrFfMacScheduler");
157 lteHelper->SetSchedulerAttribute (
"UlCqiFilter",
EnumValue (FfMacScheduler::PUSCH_UL_CQI));
158 enbDevs = lteHelper->InstallEnbDevice (enbNodes);
159 ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
160 ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
162 lteHelper->Attach (ueDevs1, enbDevs.
Get (0));
163 lteHelper->Attach (ueDevs2, enbDevs.
Get (1));
168 lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
169 lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
177 ue1Phy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr1);
181 enb1phy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr1);
184 MakeBoundCallback (&LteTestDlSchedulingCallback,
this));
187 MakeBoundCallback (&LteTestUlSchedulingCallback,
this));
194 ue2Phy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr2);
198 enb1phy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr2);
201 MakeBoundCallback (&LteTestDlSchedulingCallback,
this));
204 MakeBoundCallback (&LteTestUlSchedulingCallback,
this));
212 double dlSinr1Db = 10.0 * std::log10 (testDlSinr1->GetSinr ()->operator[] (0));
213 NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr1Db, m_dlSinrDb, 0.01,
"Wrong SINR in DL! (eNB1 --> UE1)");
215 double dlSinr2Db = 10.0 * std::log10 (testDlSinr2->GetSinr ()->operator[] (0));
216 NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr2Db, m_dlSinrDb, 0.01,
"Wrong SINR in DL! (eNB2 --> UE2)");
220 double ulSinr1Db = 10.0 * std::log10 (testUlSinr1->GetSinr ()->operator[] (0));
221 NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr1Db, m_ulSinrDb, 0.01,
"Wrong SINR in UL! (UE1 --> eNB1)");
223 double ulSinr2Db = 10.0 * std::log10 (testUlSinr2->GetSinr ()->operator[] (0));
224 NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr2Db, m_ulSinrDb, 0.01,
"Wrong SINR in UL! (UE2 --> eNB2)");
233 LteInterferenceTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
234 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
239 NS_TEST_ASSERT_MSG_EQ ((uint32_t)mcsTb1, (uint32_t)m_dlMcs,
"Wrong DL MCS ");
244 LteInterferenceTestCase::UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
245 uint8_t mcs, uint16_t sizeTb)
250 NS_TEST_ASSERT_MSG_EQ ((uint32_t)mcs, (uint32_t)m_ulMcs,
"Wrong UL MCS");
smart pointer class similar to boost::intrusive_ptr
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
virtual void DoRun(void)
Implementation to actually run this test case.
#define NS_LOG_COMPONENT_DEFINE(name)
void Connect(std::string path, const CallbackBase &cb)
LteInterferenceTestCase(std::string name, double d1, double d2, double dlSinr, double ulSinr, double dlSe, double ulSe, uint16_t dlMcs, uint16_t ulMcs)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
hold variables of type 'enum'
LteInterferenceTestSuite()
holds a vector of ns3::NetDevice pointers
static void Destroy(void)
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())
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
Helper class used to assign positions and mobility models to nodes.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Time MilliSeconds(uint64_t ms)
create ns3::Time instances in units of milliseconds.
std::string GetName(void) const
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Hold an floating point type.
Ptr< T > GetObject(void) const