16#include "ns3/lte-phy-tag.h"
17#include "ns3/lte-spectrum-signal-parameters.h"
18#include "ns3/simulator.h"
19#include "ns3/spectrum-test.h"
20#include <ns3/lte-chunk-processor.h>
21#include <ns3/lte-helper.h>
62 (*rxPsd1)[0] = 1.255943215755e-15;
67 (*rxPsd2)[1] = 7.204059965732e-16;
70 (*theoreticalSinr1)[0] = 3.72589167251055;
71 (*theoreticalSinr1)[1] = 3.72255684126076;
76 "sdBm = [-46 -inf] and [-inf -48]"),
77 TestCase::Duration::QUICK);
82 "sdBm = [-46 -inf] and [-inf -48]"),
83 TestCase::Duration::QUICK);
90 (*rxPsd3)[0] = 2.505936168136e-17;
95 (*rxPsd4)[1] = 3.610582885110e-17;
98 (*theoreticalSinr2)[0] = 0.0743413124381667;
99 (*theoreticalSinr2)[1] = 0.1865697965291756;
104 "sdBm = [-63 -inf] and [-inf -61]"),
105 TestCase::Duration::QUICK);
110 "sdBm = [-63 -inf] and [-inf -61]"),
111 TestCase::Duration::QUICK);
128 :
TestCase(
"SINR calculation in uplink data frame: " + name),
131 m_sm(sv1->GetSpectrumModel()),
150 uint16_t cellId = 100;
151 dlPhy->SetCellId(cellId);
152 ulPhy->SetCellId(cellId);
156 chunkProcessor->AddCallback(
158 ulPhy->AddDataSinrChunkProcessor(chunkProcessor);
169 constexpr int numOfDataPbs = 2;
170 constexpr int numOfIntfPbs = 4;
171 constexpr int numOfPbs = numOfDataPbs + numOfIntfPbs;
174 constexpr int numOfPkts = 10;
183 uint16_t pbCellId[numOfPbs];
189 for (
int dataPb = 0; dataPb < numOfDataPbs; dataPb++, pb++)
193 pbCellId[pb] = cellId;
195 for (
int i = 0; i < numOfPkts; i++)
199 packetBursts[pb]->AddPacket(pkt[pb][i]);
202 for (
int intfPb = 0; intfPb < numOfIntfPbs; intfPb++, pb++)
206 pbCellId[pb] = cellId * (pb + 1);
209 for (
int i = 0; i < numOfPkts; i++)
213 packetBursts[pb]->AddPacket(pkt[pb][i]);
223 (*noisePsd)[0] = 5.000000000000e-19;
224 (*noisePsd)[1] = 4.545454545455e-19;
226 (*i1)[0] = 5.000000000000e-18;
227 (*i2)[0] = 5.000000000000e-16;
228 (*i3)[0] = 1.581138830084e-16;
229 (*i4)[0] = 7.924465962306e-17;
230 (*i1)[1] = 1.437398936440e-18;
231 (*i2)[1] = 5.722388235428e-16;
232 (*i3)[1] = 7.204059965732e-17;
233 (*i4)[1] = 5.722388235428e-17;
246 ulPhy->SetNoisePowerSpectralDensity(noisePsd);
255 sp1->txPhy =
nullptr;
257 sp1->packetBurst = packetBursts[0];
258 sp1->cellId = pbCellId[0];
263 sp2->txPhy =
nullptr;
265 sp2->packetBurst = packetBursts[1];
266 sp2->cellId = pbCellId[1];
271 ip1->txPhy =
nullptr;
273 ip1->packetBurst = packetBursts[2];
274 ip1->cellId = pbCellId[2];
279 ip2->txPhy =
nullptr;
281 ip2->packetBurst = packetBursts[3];
282 ip2->cellId = pbCellId[3];
287 ip3->txPhy =
nullptr;
289 ip3->packetBurst = packetBursts[4];
290 ip3->cellId = pbCellId[4];
295 ip4->txPhy =
nullptr;
297 ip4->packetBurst = packetBursts[5];
298 ip4->cellId = pbCellId[5];
312 "Data Frame - Wrong SINR !");
325 :
TestCase(
"SINR calculation in uplink srs frame: " + name),
328 m_sm(sv1->GetSpectrumModel()),
356 uint16_t cellId = 100;
357 dlPhy->SetCellId(cellId);
358 ulPhy->SetCellId(cellId);
362 ulPhy->AddCtrlSinrChunkProcessor(chunkProcessor);
374 constexpr int numOfDataSignals = 2;
375 constexpr int numOfIntfSignals = 4;
376 constexpr int numOfSignals = numOfDataSignals + numOfIntfSignals;
378 uint16_t pbCellId[numOfSignals];
384 for (
int dataPb = 0; dataPb < numOfDataSignals; dataPb++, pb++)
386 pbCellId[pb] = cellId;
388 for (
int intfPb = 0; intfPb < numOfIntfSignals; intfPb++, pb++)
390 pbCellId[pb] = cellId * (pb + 1);
399 (*noisePsd)[0] = 5.000000000000e-19;
400 (*noisePsd)[1] = 4.545454545455e-19;
402 (*i1)[0] = 5.000000000000e-18;
403 (*i2)[0] = 5.000000000000e-16;
404 (*i3)[0] = 1.581138830084e-16;
405 (*i4)[0] = 7.924465962306e-17;
406 (*i1)[1] = 1.437398936440e-18;
407 (*i2)[1] = 5.722388235428e-16;
408 (*i3)[1] = 7.204059965732e-17;
409 (*i4)[1] = 5.722388235428e-17;
422 ulPhy->SetNoisePowerSpectralDensity(noisePsd);
432 sp1->txPhy =
nullptr;
434 sp1->cellId = pbCellId[0];
440 sp2->txPhy =
nullptr;
442 sp2->cellId = pbCellId[1];
448 ip1->txPhy =
nullptr;
450 ip1->cellId = pbCellId[2];
456 ip2->txPhy =
nullptr;
458 ip2->cellId = pbCellId[3];
464 ip3->txPhy =
nullptr;
466 ip3->cellId = pbCellId[4];
472 ip4->txPhy =
nullptr;
474 ip4->cellId = pbCellId[5];
488 "Data Frame - Wrong SINR !");
Test generation of SINR in the uplink.
Ptr< SpectrumValue > m_sv1
the spectrum value #1
Ptr< SpectrumValue > m_sv2
the spectrum value #2
void DoRun() override
Implementation to actually run this TestCase.
Ptr< const SpectrumModel > m_sm
the spectrum model
Ptr< SpectrumValue > m_expectedSinr
the expected SINR
~LteUplinkDataSinrTestCase() override
LteUplinkDataSinrTestCase(Ptr< SpectrumValue > sv1, Ptr< SpectrumValue > sv2, Ptr< SpectrumValue > sinr, std::string name)
Constructor.
Test 1.2 SINR calculation in uplink.
LteUplinkSinrTestSuite()
Test 1.2 SINR calculation in uplink.
In this test one signal will be of interest, i.e., the SRS of the first signal will have the same Cel...
void ReportSinr(const SpectrumValue &sinr)
Callback to be connected to an LteChunkProcessor to collect the reported SINR.
~LteUplinkSrsSinrTestCase() override
Ptr< SpectrumValue > m_actualSinr
the actual SINR
Ptr< const SpectrumModel > m_sm
the spectrum model
Ptr< SpectrumValue > m_expectedSinr
the expected SINR
void DoRun() override
Implementation to actually run this TestCase.
LteUplinkSrsSinrTestCase(Ptr< SpectrumValue > sv1, Ptr< SpectrumValue > sv2, Ptr< SpectrumValue > sinr, std::string name)
Constructor.
Ptr< SpectrumValue > m_sv2
the spectrum value #2
Ptr< SpectrumValue > m_sv1
the spectrum value #1
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.
Set of values corresponding to a given SpectrumModel.
Ptr< SpectrumValue > Copy() const
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.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#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 LteUplinkSinrTestSuite lteUplinkSinrTestSuite
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.
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
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