26#include "ns3/boolean.h"
28#include "ns3/lte-helper.h"
29#include "ns3/lte-phy-tag.h"
30#include "ns3/lte-spectrum-signal-parameters.h"
31#include "ns3/simulator.h"
32#include "ns3/spectrum-test.h"
33#include <ns3/lte-chunk-processor.h>
34#include <ns3/lte-control-messages.h>
69 sm = Create<SpectrumModel>(bands);
76 (*rxPsd1)[0] = 1.255943215755e-15;
77 (*rxPsd1)[1] = 7.204059965732e-16;
80 (*theoreticalSinr1)[0] = 3.72589167251055;
81 (*theoreticalSinr1)[1] = 3.72255684126076;
93 (*rxPsd2)[0] = 2.505936168136e-17;
94 (*rxPsd2)[1] = 3.610582885110e-17;
97 (*theoreticalSinr2)[0] = 0.0743413124381667;
98 (*theoreticalSinr2)[1] = 0.1865697965291756;
115 :
TestCase(
"SINR calculation in downlink Data frame: " + name),
117 m_sm(sv->GetSpectrumModel()),
137 uint16_t cellId = 100;
138 dlPhy->SetCellId(cellId);
139 ulPhy->SetCellId(cellId);
143 chunkProcessor->AddCallback(
144 MakeCallback(&LteSpectrumValueCatcher::ReportValue, &actualSinrCatcher));
145 dlPhy->AddDataSinrChunkProcessor(chunkProcessor);
156 const int numOfPbs = 5;
159 const int numOfPkts = 10;
168 uint16_t pbCellId[numOfPbs];
173 for (
int pb = 0; pb < numOfPbs; pb++)
176 packetBursts[pb] = CreateObject<PacketBurst>();
177 pbCellId[pb] = cellId * (pb + 1);
180 for (
int i = 0; i < numOfPkts; i++)
182 pkt[pb][i] = Create<Packet>(1000);
184 packetBursts[pb]->AddPacket(pkt[pb][i]);
194 (*noisePsd)[0] = 5.000000000000e-19;
195 (*noisePsd)[1] = 4.545454545455e-19;
197 (*i1)[0] = 5.000000000000e-18;
198 (*i2)[0] = 5.000000000000e-16;
199 (*i3)[0] = 1.581138830084e-16;
200 (*i4)[0] = 7.924465962306e-17;
201 (*i1)[1] = 1.437398936440e-18;
202 (*i2)[1] = 5.722388235428e-16;
203 (*i3)[1] = 7.204059965732e-17;
204 (*i4)[1] = 5.722388235428e-17;
217 dlPhy->SetNoisePowerSpectralDensity(noisePsd);
226 sp1->txPhy =
nullptr;
228 sp1->packetBurst = packetBursts[0];
229 sp1->cellId = pbCellId[0];
230 Simulator::Schedule(ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
234 ip1->txPhy =
nullptr;
236 ip1->packetBurst = packetBursts[1];
237 ip1->cellId = pbCellId[1];
238 Simulator::Schedule(ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
242 ip2->txPhy =
nullptr;
244 ip2->packetBurst = packetBursts[2];
245 ip2->cellId = pbCellId[2];
246 Simulator::Schedule(ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
250 ip3->txPhy =
nullptr;
252 ip3->packetBurst = packetBursts[3];
253 ip3->cellId = pbCellId[3];
254 Simulator::Schedule(ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
258 ip4->txPhy =
nullptr;
260 ip4->packetBurst = packetBursts[4];
261 ip4->cellId = pbCellId[4];
262 Simulator::Schedule(ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
273 "Data Frame - Wrong SINR !");
275 Simulator::Destroy();
285 :
TestCase(
"SINR calculation in downlink Ctrl Frame: " + name),
287 m_sm(sv->GetSpectrumModel()),
290 NS_LOG_INFO(
"Creating LenaDownlinkCtrlSinrTestCase");
307 uint16_t cellId = 100;
308 dlPhy->SetCellId(cellId);
309 ulPhy->SetCellId(cellId);
313 chunkProcessor->AddCallback(
314 MakeCallback(&LteSpectrumValueCatcher::ReportValue, &actualSinrCatcher));
315 dlPhy->AddCtrlSinrChunkProcessor(chunkProcessor);
325 const int numOfUes = 5;
328 const int numOfCtrlMsgs = 10;
331 std::list<Ptr<LteControlMessage>> ctrlMsgList[numOfUes];
334 uint16_t pbCellId[numOfUes];
339 for (
int pb = 0; pb < numOfUes; pb++)
341 pbCellId[pb] = cellId * (pb + 1);
344 for (
int i = 0; i < numOfCtrlMsgs; i++)
349 ctrlMsgList[pb].emplace_back(msg);
359 (*noisePsd)[0] = 5.000000000000e-19;
360 (*noisePsd)[1] = 4.545454545455e-19;
362 (*i1)[0] = 5.000000000000e-18;
363 (*i2)[0] = 5.000000000000e-16;
364 (*i3)[0] = 1.581138830084e-16;
365 (*i4)[0] = 7.924465962306e-17;
366 (*i1)[1] = 1.437398936440e-18;
367 (*i2)[1] = 5.722388235428e-16;
368 (*i3)[1] = 7.204059965732e-17;
369 (*i4)[1] = 5.722388235428e-17;
382 dlPhy->SetNoisePowerSpectralDensity(noisePsd);
390 Create<LteSpectrumSignalParametersDlCtrlFrame>();
392 sp1->txPhy =
nullptr;
394 sp1->ctrlMsgList = ctrlMsgList[0];
395 sp1->cellId = pbCellId[0];
397 Simulator::Schedule(ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
400 Create<LteSpectrumSignalParametersDlCtrlFrame>();
402 ip1->txPhy =
nullptr;
404 ip1->ctrlMsgList = ctrlMsgList[1];
405 ip1->cellId = pbCellId[1];
407 Simulator::Schedule(ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
410 Create<LteSpectrumSignalParametersDlCtrlFrame>();
412 ip2->txPhy =
nullptr;
414 ip2->ctrlMsgList = ctrlMsgList[2];
415 ip2->cellId = pbCellId[2];
417 Simulator::Schedule(ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
420 Create<LteSpectrumSignalParametersDlCtrlFrame>();
422 ip3->txPhy =
nullptr;
424 ip3->ctrlMsgList = ctrlMsgList[3];
425 ip3->cellId = pbCellId[3];
427 Simulator::Schedule(ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
430 Create<LteSpectrumSignalParametersDlCtrlFrame>();
432 ip4->txPhy =
nullptr;
434 ip4->ctrlMsgList = ctrlMsgList[4];
435 ip4->cellId = pbCellId[4];
437 Simulator::Schedule(ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
448 "Data Frame - Wrong SINR !");
450 Simulator::Destroy();
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.
AttributeValue implementation for Boolean.
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
Ptr< SpectrumValue > GetValue()
void AddTestCase(TestCase *testCase, TestDuration 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.
#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.
static LteDownlinkSinrTestSuite lteDownlinkSinrTestSuite
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.