15#include "ns3/boolean.h"
17#include "ns3/lte-helper.h"
18#include "ns3/lte-phy-tag.h"
19#include "ns3/lte-spectrum-signal-parameters.h"
20#include "ns3/simulator.h"
21#include "ns3/spectrum-test.h"
22#include <ns3/lte-chunk-processor.h>
23#include <ns3/lte-control-messages.h>
65 (*rxPsd1)[0] = 1.255943215755e-15;
66 (*rxPsd1)[1] = 7.204059965732e-16;
69 (*theoreticalSinr1)[0] = 3.72589167251055;
70 (*theoreticalSinr1)[1] = 3.72255684126076;
73 TestCase::Duration::QUICK);
75 TestCase::Duration::QUICK);
82 (*rxPsd2)[0] = 2.505936168136e-17;
83 (*rxPsd2)[1] = 3.610582885110e-17;
86 (*theoreticalSinr2)[0] = 0.0743413124381667;
87 (*theoreticalSinr2)[1] = 0.1865697965291756;
90 TestCase::Duration::QUICK);
92 TestCase::Duration::QUICK);
108 :
TestCase(
"SINR calculation in downlink Data frame: " + name),
110 m_sm(sv->GetSpectrumModel()),
130 uint16_t cellId = 100;
131 dlPhy->SetCellId(cellId);
132 ulPhy->SetCellId(cellId);
136 chunkProcessor->AddCallback(
138 dlPhy->AddDataSinrChunkProcessor(chunkProcessor);
149 constexpr int numOfPbs = 5;
152 constexpr int numOfPkts = 10;
161 uint16_t pbCellId[numOfPbs];
166 for (
int pb = 0; pb < numOfPbs; pb++)
170 pbCellId[pb] = cellId * (pb + 1);
173 for (
int i = 0; i < numOfPkts; i++)
177 packetBursts[pb]->AddPacket(pkt[pb][i]);
187 (*noisePsd)[0] = 5.000000000000e-19;
188 (*noisePsd)[1] = 4.545454545455e-19;
190 (*i1)[0] = 5.000000000000e-18;
191 (*i2)[0] = 5.000000000000e-16;
192 (*i3)[0] = 1.581138830084e-16;
193 (*i4)[0] = 7.924465962306e-17;
194 (*i1)[1] = 1.437398936440e-18;
195 (*i2)[1] = 5.722388235428e-16;
196 (*i3)[1] = 7.204059965732e-17;
197 (*i4)[1] = 5.722388235428e-17;
210 dlPhy->SetNoisePowerSpectralDensity(noisePsd);
219 sp1->txPhy =
nullptr;
221 sp1->packetBurst = packetBursts[0];
222 sp1->cellId = pbCellId[0];
227 ip1->txPhy =
nullptr;
229 ip1->packetBurst = packetBursts[1];
230 ip1->cellId = pbCellId[1];
235 ip2->txPhy =
nullptr;
237 ip2->packetBurst = packetBursts[2];
238 ip2->cellId = pbCellId[2];
243 ip3->txPhy =
nullptr;
245 ip3->packetBurst = packetBursts[3];
246 ip3->cellId = pbCellId[3];
251 ip4->txPhy =
nullptr;
253 ip4->packetBurst = packetBursts[4];
254 ip4->cellId = pbCellId[4];
266 "Data Frame - Wrong SINR !");
278 :
TestCase(
"SINR calculation in downlink Ctrl Frame: " + name),
280 m_sm(sv->GetSpectrumModel()),
283 NS_LOG_INFO(
"Creating LenaDownlinkCtrlSinrTestCase");
300 uint16_t cellId = 100;
301 dlPhy->SetCellId(cellId);
302 ulPhy->SetCellId(cellId);
306 chunkProcessor->AddCallback(
308 dlPhy->AddCtrlSinrChunkProcessor(chunkProcessor);
318 const int numOfUes = 5;
321 const int numOfCtrlMsgs = 10;
324 std::list<Ptr<LteControlMessage>> ctrlMsgList[numOfUes];
327 uint16_t pbCellId[numOfUes];
332 for (
int pb = 0; pb < numOfUes; pb++)
334 pbCellId[pb] = cellId * (pb + 1);
337 for (
int i = 0; i < numOfCtrlMsgs; i++)
342 ctrlMsgList[pb].emplace_back(msg);
352 (*noisePsd)[0] = 5.000000000000e-19;
353 (*noisePsd)[1] = 4.545454545455e-19;
355 (*i1)[0] = 5.000000000000e-18;
356 (*i2)[0] = 5.000000000000e-16;
357 (*i3)[0] = 1.581138830084e-16;
358 (*i4)[0] = 7.924465962306e-17;
359 (*i1)[1] = 1.437398936440e-18;
360 (*i2)[1] = 5.722388235428e-16;
361 (*i3)[1] = 7.204059965732e-17;
362 (*i4)[1] = 5.722388235428e-17;
375 dlPhy->SetNoisePowerSpectralDensity(noisePsd);
385 sp1->txPhy =
nullptr;
387 sp1->ctrlMsgList = ctrlMsgList[0];
388 sp1->cellId = pbCellId[0];
395 ip1->txPhy =
nullptr;
397 ip1->ctrlMsgList = ctrlMsgList[1];
398 ip1->cellId = pbCellId[1];
405 ip2->txPhy =
nullptr;
407 ip2->ctrlMsgList = ctrlMsgList[2];
408 ip2->cellId = pbCellId[2];
415 ip3->txPhy =
nullptr;
417 ip3->ctrlMsgList = ctrlMsgList[3];
418 ip3->cellId = pbCellId[3];
425 ip4->txPhy =
nullptr;
427 ip4->ctrlMsgList = ctrlMsgList[4];
428 ip4->cellId = pbCellId[4];
441 "Data Frame - Wrong SINR !");
Test compares if the generated SINR is equal to estimated SINR value.
Ptr< SpectrumValue > m_expectedSinr
the expected SINR
LteDownlinkCtrlSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
Constructor.
Ptr< const SpectrumModel > m_sm
the spectrum model
void DoRun() override
Implementation to actually run this TestCase.
~LteDownlinkCtrlSinrTestCase() override
Ptr< SpectrumValue > m_sv
the spectrum value
Test compares if the generated SINR is equal to estimated SINR value.
~LteDownlinkDataSinrTestCase() override
Ptr< const SpectrumModel > m_sm
the spectrum model
Ptr< SpectrumValue > m_expectedSinr
the expected SINR
LteDownlinkDataSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< SpectrumValue > m_sv
the spectrum value
Test 1.1 SINR calculation in downlink.
LteDownlinkSinrTestSuite()
Test 1.1 SINR calculation in downlink.
void StartRx(Ptr< SpectrumSignalParameters > params) override
Notify the SpectrumPhy instance of an incoming signal.
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 ()
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
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 LteDownlinkSinrTestSuite lteDownlinkSinrTestSuite
Static variable for test initialization.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumValue instances are equal within a given tolerance.
Time Seconds(double value)
Construct a Time in the indicated unit.
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...
std::vector< BandInfo > Bands
Container of BandInfo.
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
See section 4.3.1 dlDciListElement.