24#include "ns3/double.h"
26#include "ns3/lte-chunk-processor.h"
27#include "ns3/lte-phy-tag.h"
28#include "ns3/simulator.h"
29#include "ns3/spectrum-test.h"
30#include "ns3/string.h"
31#include <ns3/boolean.h>
32#include <ns3/building.h>
33#include <ns3/buildings-helper.h>
35#include <ns3/hybrid-buildings-propagation-loss-model.h>
36#include <ns3/lte-enb-net-device.h>
37#include <ns3/lte-enb-phy.h>
38#include <ns3/lte-helper.h>
39#include <ns3/lte-ue-net-device.h>
40#include <ns3/lte-ue-phy.h>
41#include <ns3/lte-ue-rrc.h>
42#include <ns3/mobility-helper.h>
43#include <ns3/net-device-container.h>
44#include <ns3/node-container.h>
45#include <ns3/single-model-spectrum-channel.h>
79 struct SnrEfficiencyMcs
90 SnrEfficiencyMcs snrEfficiencyMcs[] = {
91 {-5.00000, 0.08024, -1}, {-4.00000, 0.10030, -1}, {-3.00000, 0.12518, -1},
92 {-2.00000, 0.15589, 0}, {-1.00000, 0.19365, 0}, {0.00000, 0.23983, 2},
93 {1.00000, 0.29593, 2}, {2.00000, 0.36360, 2}, {3.00000, 0.44451, 4},
94 {4.00000, 0.54031, 4}, {5.00000, 0.65251, 6}, {6.00000, 0.78240, 6},
95 {7.00000, 0.93086, 8}, {8.00000, 1.09835, 8}, {9.00000, 1.28485, 10},
96 {10.00000, 1.48981, 12}, {11.00000, 1.71229, 12}, {12.00000, 1.95096, 14},
97 {13.00000, 2.20429, 14}, {14.00000, 2.47062, 16}, {15.00000, 2.74826, 18},
98 {16.00000, 3.03560, 18}, {17.00000, 3.33115, 20}, {18.00000, 3.63355, 20},
99 {19.00000, 3.94163, 22}, {20.00000, 4.25439, 22}, {21.00000, 4.57095, 24},
100 {22.00000, 4.89060, 24}, {23.00000, 5.21276, 26}, {24.00000, 5.53693, 26},
101 {25.00000, 5.86271, 28}, {26.00000, 6.18980, 28}, {27.00000, 6.51792, 28},
102 {28.00000, 6.84687, 28}, {29.00000, 7.17649, 28}, {30.00000, 7.50663, 28},
105 double txPowerDbm = 30;
106 double txPowerLin = std::pow(10, (txPowerDbm - 30) / 10);
108 double noisePowerDbm =
109 ktDbm + 10 * std::log10(25 * 180000);
110 double receiverNoiseFigureDb = 9.0;
111 double noiseLin = std::pow(10, (noisePowerDbm - 30 + receiverNoiseFigureDb) / 10);
115 double loss[] = {81.062444, 134.078605, 144.259958};
116 double dist[] = {100.0, 500.0, 1500};
118 int numOfTests =
sizeof(loss) /
sizeof(
double);
119 for (
int i = 0; i < numOfTests; i++)
123 double sinrLin = (txPowerLin / (pow(10, loss[i] / 10))) / noiseLin;
125 double sinrDb = 10 * std::log10(sinrLin);
126 NS_LOG_INFO(
" Ptx " << txPowerDbm <<
" Pn " << noisePowerDbm <<
" Fn "
127 << receiverNoiseFigureDb <<
" Pl " << loss[i] <<
" dist " << dist[i]);
130 int numSnrEfficiencyMcsEntries =
sizeof(snrEfficiencyMcs) /
sizeof(SnrEfficiencyMcs);
131 for (
int j = 0; j < numSnrEfficiencyMcsEntries && snrEfficiencyMcs[j].snrDb < sinrDb; ++j)
133 mcs = snrEfficiencyMcs[j].mcsIndex;
136 std::ostringstream name;
137 name <<
" snr= " << sinrDb <<
" dB, "
138 <<
" mcs= " << snrEfficiencyMcs[i].mcsIndex;
159 std::ostringstream sstream1;
160 std::ostringstream sstream2;
161 sstream1 <<
" snr=" << snrDb <<
" mcs=" << mcsIndex <<
" distance=" << dist;
163 NS_LOG_INFO(
"Creating LtePathlossModelSystemTestCase: " + sstream1.str());
189 lteHelper->SetAttribute(
"PathlossModel",
190 StringValue(
"ns3::HybridBuildingsPropagationLossModel"));
193 lteHelper->SetEnbDeviceAttribute(
"DlEarfcn",
UintegerValue(200));
194 lteHelper->SetEnbDeviceAttribute(
"UlEarfcn",
UintegerValue(18200));
195 lteHelper->SetUeDeviceAttribute(
"DlEarfcn",
UintegerValue(200));
198 lteHelper->SetPathlossModelAttribute(
"ShadowSigmaOutdoor",
DoubleValue(0.0));
199 lteHelper->SetPathlossModelAttribute(
"ShadowSigmaIndoor",
DoubleValue(0.0));
200 lteHelper->SetPathlossModelAttribute(
"ShadowSigmaExtWalls",
DoubleValue(0.0));
211 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
212 mobility.Install(allNodes);
218 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
219 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
220 ueDevs = lteHelper->InstallUeDevice(ueNodes);
223 mm_enb->SetPosition(Vector(0.0, 0.0, 30.0));
225 mm_ue->SetPosition(Vector(
m_distance, 0.0, 1.0));
229 enbPhy->SetAttribute(
"TxPower",
DoubleValue(30.0));
230 enbPhy->SetAttribute(
"NoiseFigure",
DoubleValue(5.0));
235 uePhy->SetAttribute(
"NoiseFigure",
DoubleValue(9.0));
238 lteHelper->Attach(ueDevs, enbDevs.
Get(0));
243 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
252 uePhy->GetDownlinkSpectrumPhy()->AddCtrlSinrChunkProcessor(testSinr);
257 lteHelper->EnableMacTraces();
258 lteHelper->EnableRlcTraces();
263 double calculatedSinrDb = 10.0 * std::log10(sinrCatcher.
GetValue()->operator[](0));
273 static bool firstTime =
true;
Tests that the BuildingPathlossModel works according to the expected theoretical values.
double m_snrDb
the SNR in dB
double m_distance
the distance
void DlScheduling(DlSchedulingCallbackInfo dlInfo)
DL scheduling function.
void DoRun() override
Implementation to actually run this TestCase.
LtePathlossModelSystemTestCase()
~LtePathlossModelSystemTestCase() override
uint16_t m_mcsIndex
the MCS index
Test 1.1 pathloss calculation.
LtePathlossModelTestSuite()
AttributeValue implementation for Boolean.
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
This class contains the specification of EPS Bearers.
@ GBR_CONV_VOICE
GBR Conversational Voice.
The eNodeB device implementation.
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
Ptr< SpectrumValue > GetValue()
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static LtePathlossModelTestSuite ltePathlossModelTestSuite
Static variable for test initialization.
#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 LteTestPathlossDlSchedCallback(LtePathlossModelSystemTestCase *testcase, std::string path, DlSchedulingCallbackInfo dlInfo)
Test 1.1 Pathloss compound test.
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.