21 #include "ns3/simulator.h"
23 #include "ns3/string.h"
24 #include "ns3/double.h"
25 #include "ns3/boolean.h"
28 #include "ns3/mobility-helper.h"
29 #include "ns3/lte-helper.h"
31 #include "ns3/lte-ue-phy.h"
32 #include "ns3/lte-ue-net-device.h"
48 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
49 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
51 testcase->
DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
59 :
TestSuite (
"lte-link-adaptation", SYSTEM)
63 struct SnrEfficiencyMcs
74 SnrEfficiencyMcs snrEfficiencyMcs[] = {
75 { -5.00000, 0.08024, -1},
76 { -4.00000, 0.10030, -1},
77 { -3.00000, 0.12518, -1},
78 { -2.00000, 0.15589, 0},
79 { -1.00000, 0.19365, 0},
80 { 0.00000, 0.23983, 2},
81 { 1.00000, 0.29593, 2},
82 { 2.00000, 0.36360, 2},
83 { 3.00000, 0.44451, 4},
84 { 4.00000, 0.54031, 4},
85 { 5.00000, 0.65251, 6},
86 { 6.00000, 0.78240, 6},
87 { 7.00000, 0.93086, 8},
88 { 8.00000, 1.09835, 8},
89 { 9.00000, 1.28485, 10},
90 { 10.00000, 1.48981, 12},
91 { 11.00000, 1.71229, 12},
92 { 12.00000, 1.95096, 14},
93 { 13.00000, 2.20429, 14},
94 { 14.00000, 2.47062, 16},
95 { 15.00000, 2.74826, 18},
96 { 16.00000, 3.03560, 18},
97 { 17.00000, 3.33115, 20},
98 { 18.00000, 3.63355, 20},
99 { 19.00000, 3.94163, 22},
100 { 20.00000, 4.25439, 22},
101 { 21.00000, 4.57095, 24},
102 { 22.00000, 4.89060, 24},
103 { 23.00000, 5.21276, 26},
104 { 24.00000, 5.53693, 26},
105 { 25.00000, 5.86271, 28},
106 { 26.00000, 6.18980, 28},
107 { 27.00000, 6.51792, 28},
108 { 28.00000, 6.84687, 28},
109 { 29.00000, 7.17649, 28},
110 { 30.00000, 7.50663, 28},
112 int numOfTests =
sizeof (snrEfficiencyMcs) /
sizeof (SnrEfficiencyMcs);
114 double txPowerDbm = 30;
116 double noisePowerDbm = ktDbm + 10 * std::log10 (25 * 180000);
117 double receiverNoiseFigureDb = 9.0;
119 for (
int i = 0 ; i < numOfTests; i++ )
121 double lossDb = txPowerDbm - snrEfficiencyMcs[i].snrDb - noisePowerDbm - receiverNoiseFigureDb;
123 std::ostringstream name;
124 name <<
" snr= " << snrEfficiencyMcs[i].snrDb <<
" dB, "
125 <<
" mcs= " << snrEfficiencyMcs[i].mcsIndex;
142 m_mcsIndex (mcsIndex)
144 std::ostringstream sstream1, sstream2;
145 sstream1 <<
" snr=" << snrDb
146 <<
" mcs=" << mcsIndex;
148 NS_LOG_INFO (
"Creating LteLinkAdaptationTestCase: " + sstream1.str ());
199 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
215 Simulator::Stop (
Seconds (0.040));
218 double calculatedSinrDb = 10.0 * std::log10 (testSinr->GetSinr ()->operator[] (0));
220 Simulator::Destroy ();
226 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
228 static bool firstTime =
true;
void DlScheduling(uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
static LteLinkAdaptationTestSuite lteLinkAdaptationTestSuite
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
AttributeValue implementation for Boolean.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
LteLinkAdaptationTestCase()
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Hold variables of type string.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Test 1.3 Link adaptation.
virtual ~LteLinkAdaptationTestCase()
void Connect(std::string path, const CallbackBase &cb)
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
This class contains the specification of EPS Bearers.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
Hold variables of type enum.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
LteLinkAdaptationTestSuite()
TestSuite.
Hold an unsigned integer type.
#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.
holds a vector of ns3::NetDevice pointers
Ptr< LteSpectrumPhy > GetDownlinkSpectrumPhy()
void LteTestDlSchedulingCallback(LteLinkAdaptationTestCase *testcase, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
Test 1.3 Link Adaptation.
#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 SetDefault(std::string name, const AttributeValue &value)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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())
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Helper class used to assign positions and mobility models to nodes.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void EnableMacTraces(void)
Enable trace sinks for MAC layer.
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.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
virtual void DoRun(void)
Implementation to actually run this TestCase.
The LtePhy models the physical layer of LTE.
The LteUeNetDevice class implements the UE net device.