21 #include "ns3/simulator.h"
25 #include "ns3/spectrum-test.h"
27 #include "ns3/lte-phy-tag.h"
28 #include "ns3/lte-sinr-chunk-processor.h"
31 #include <ns3/hybrid-buildings-propagation-loss-model.h>
32 #include <ns3/node-container.h>
33 #include <ns3/mobility-helper.h>
34 #include <ns3/buildings-helper.h>
35 #include <ns3/lte-helper.h>
36 #include <ns3/single-model-spectrum-channel.h>
37 #include "ns3/string.h"
38 #include "ns3/double.h"
39 #include <ns3/building.h>
41 #include <ns3/net-device-container.h>
42 #include <ns3/lte-ue-net-device.h>
43 #include <ns3/lte-enb-net-device.h>
44 #include <ns3/lte-ue-rrc.h>
45 #include <ns3/lte-helper.h>
46 #include <ns3/lte-enb-phy.h>
47 #include <ns3/lte-ue-phy.h>
70 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
71 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
73 testcase->
DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
79 :
TestSuite (
"lte-pathloss-model", SYSTEM)
89 struct SnrEfficiencyMcs
100 SnrEfficiencyMcs snrEfficiencyMcs[] = {
101 { -5.00000, 0.08024, -1},
102 { -4.00000, 0.10030, -1},
103 { -3.00000, 0.12518, -1},
104 { -2.00000, 0.15589, 0},
105 { -1.00000, 0.19365, 0},
106 { 0.00000, 0.23983, 2},
107 { 1.00000, 0.29593, 2},
108 { 2.00000, 0.36360, 2},
109 { 3.00000, 0.44451, 4},
110 { 4.00000, 0.54031, 4},
111 { 5.00000, 0.65251, 6},
112 { 6.00000, 0.78240, 6},
113 { 7.00000, 0.93086, 8},
114 { 8.00000, 1.09835, 8},
115 { 9.00000, 1.28485, 10},
116 { 10.00000, 1.48981, 12},
117 { 11.00000, 1.71229, 12},
118 { 12.00000, 1.95096, 14},
119 { 13.00000, 2.20429, 14},
120 { 14.00000, 2.47062, 16},
121 { 15.00000, 2.74826, 18},
122 { 16.00000, 3.03560, 18},
123 { 17.00000, 3.33115, 20},
124 { 18.00000, 3.63355, 20},
125 { 19.00000, 3.94163, 22},
126 { 20.00000, 4.25439, 22},
127 { 21.00000, 4.57095, 24},
128 { 22.00000, 4.89060, 24},
129 { 23.00000, 5.21276, 26},
130 { 24.00000, 5.53693, 26},
131 { 25.00000, 5.86271, 28},
132 { 26.00000, 6.18980, 28},
133 { 27.00000, 6.51792, 28},
134 { 28.00000, 6.84687, 28},
135 { 29.00000, 7.17649, 28},
136 { 30.00000, 7.50663, 28},
140 double txPowerDbm = 30;
141 double txPowerLin = std::pow (10, (txPowerDbm - 30)/10);
143 double noisePowerDbm = ktDbm + 10 * std::log10 (25 * 180000);
144 double receiverNoiseFigureDb = 9.0;
145 double noiseLin = std::pow (10, (noisePowerDbm-30+receiverNoiseFigureDb)/10);
149 double loss[] = {81.062444, 134.078605, 144.259958};
150 double dist[] = {100.0, 500.0, 1500};
152 int numOfTests =
sizeof (loss) /
sizeof (
double);
153 for (
int i = 0 ; i < numOfTests; i++ )
156 double sinrLin = (txPowerLin/(pow(10, loss[i]/10))) / noiseLin;
158 double sinrDb = 10 * std::log10 (sinrLin);
159 NS_LOG_INFO (
" Ptx " << txPowerDbm <<
" Pn " << noisePowerDbm <<
" Fn " << receiverNoiseFigureDb <<
" Pl " << loss[i] <<
" dist " << dist[i]);
162 int numSnrEfficiencyMcsEntries =
sizeof (snrEfficiencyMcs) /
sizeof (SnrEfficiencyMcs);
163 for (
int j = 0; j < numSnrEfficiencyMcsEntries && snrEfficiencyMcs[j].snrDb < sinrDb; ++j)
165 mcs = snrEfficiencyMcs[j].mcsIndex;
168 std::ostringstream name;
169 name <<
" snr= " << sinrDb <<
" dB, "
170 <<
" mcs= " << snrEfficiencyMcs[i].mcsIndex;
189 m_mcsIndex (mcsIndex)
191 std::ostringstream sstream1, sstream2;
192 sstream1 <<
" snr=" << snrDb
193 <<
" mcs=" << mcsIndex <<
" distance=" << dist;
195 NS_LOG_INFO (
"Creating LtePathlossModelSystemTestCase: " + sstream1.str ());
211 lteHelper->EnableMacTraces ();
212 lteHelper->EnableRlcTraces ();
213 lteHelper->SetAttribute (
"PathlossModel",
StringValue (
"ns3::HybridBuildingsPropagationLossModel"));
216 lteHelper->SetEnbDeviceAttribute (
"DlEarfcn",
UintegerValue (200));
217 lteHelper->SetUeDeviceAttribute (
"DlEarfcn",
UintegerValue (200));
220 lteHelper->SetPathlossModelAttribute (
"ShadowSigmaOutdoor",
DoubleValue (0.0));
221 lteHelper->SetPathlossModelAttribute (
"ShadowSigmaIndoor",
DoubleValue (0.0));
222 lteHelper->SetPathlossModelAttribute (
"ShadowSigmaExtWalls",
DoubleValue (0.0));
241 lteHelper->SetSchedulerType (
"ns3::RrFfMacScheduler");
242 enbDevs = lteHelper->InstallEnbDevice (enbNodes);
243 ueDevs = lteHelper->InstallUeDevice (ueNodes);
252 enbPhy->SetAttribute (
"TxPower",
DoubleValue (30.0));
253 enbPhy->SetAttribute (
"NoiseFigure",
DoubleValue (5.0));
257 uePhy->SetAttribute (
"TxPower",
DoubleValue (23.0));
258 uePhy->SetAttribute (
"NoiseFigure",
DoubleValue (9.0));
262 lteHelper->Attach (ueDevs, enbDevs.
Get (0));
267 lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
273 uePhy->GetDownlinkSpectrumPhy ()->AddCtrlSinrChunkProcessor (testSinr);
281 double calculatedSinrDb = 10.0 * std::log10 (testSinr->GetSinr ()->operator[] (0));
290 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
292 static bool firstTime =
true;
LtePathlossModelTestSuite()
smart pointer class similar to boost::intrusive_ptr
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#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...
static void Run(void)
Run the simulation until one of:
Keep track of the current position and velocity of an object.
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.
LtePathlossModelSystemTestCase()
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
virtual ~LtePathlossModelSystemTestCase()
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
void DlScheduling(uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
keep track of a set of node pointers.
void LteTestPathlossDlSchedCallback(LtePathlossModelSystemTestCase *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.1 Pathloss compound test.
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())
NS_LOG_COMPONENT_DEFINE("LtePathlossModelTest")
static Time Now(void)
Return the "current simulation time".
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
void SetPosition(const Vector &position)
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test 1.1 pathloss calculation.
static LtePathlossModelTestSuite ltePathlossModelTestSuite
Helper class used to assign positions and mobility models to nodes.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Hold a floating point type.
The eNodeB device implementation.
Ptr< T > GetObject(void) const
#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.
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
The LteUeNetDevice class implements the UE net device.