23 #include "ns3/simulator.h"
27 #include "ns3/spectrum-test.h"
29 #include "ns3/lte-phy-tag.h"
32 #include "ns3/lte-spectrum-signal-parameters.h"
36 #include <ns3/lte-helper.h>
71 sm = Create<SpectrumModel> (bands);
77 (*rxPsd1)[0] = 1.255943215755e-15;
82 (*rxPsd2)[1] = 7.204059965732e-16;
85 (*theoreticalSinr1)[0] = 3.72589167251055;
86 (*theoreticalSinr1)[1] = 3.72255684126076;
96 (*rxPsd3)[0] = 2.505936168136e-17;
101 (*rxPsd4)[1] = 3.610582885110e-17;
104 (*theoreticalSinr2)[0] = 0.0743413124381667;
105 (*theoreticalSinr2)[1] = 0.1865697965291756;
121 :
TestCase (
"SINR calculation in uplink data frame: " + name),
124 m_sm (sv1->GetSpectrumModel ()),
127 NS_LOG_INFO (
"Creating LteUplinkDataSinrTestCase");
143 uint16_t cellId = 100;
144 dlPhy->SetCellId (cellId);
145 ulPhy->SetCellId (cellId);
148 ulPhy->AddDataSinrChunkProcessor (chunkProcessor);
159 const int numOfDataPbs = 2;
160 const int numOfIntfPbs = 4;
161 const int numOfPbs = numOfDataPbs + numOfIntfPbs;
164 const int numOfPkts = 10;
173 uint16_t pbCellId[numOfPbs];
181 for (
int dataPb = 0 ; dataPb < numOfDataPbs ; dataPb++, pb++ )
184 packetBursts[pb] = CreateObject<PacketBurst> ();
185 pbCellId[pb] = cellId;
187 for (
int i = 0 ; i < numOfPkts ; i++ )
189 pkt[pb][i] = Create<Packet> (1000);
191 packetBursts[pb]->AddPacket ( pkt[pb][i] );
194 for (
int intfPb = 0 ; intfPb < numOfIntfPbs ; intfPb++, pb++ )
197 packetBursts[pb] = CreateObject<PacketBurst> ();
198 pbCellId[pb] = cellId * (pb + 1);
201 for (
int i = 0 ; i < numOfPkts ; i++ )
203 pkt[pb][i] = Create<Packet> (1000);
205 packetBursts[pb]->AddPacket ( pkt[pb][i] );
216 (*noisePsd)[0] = 5.000000000000e-19;
217 (*noisePsd)[1] = 4.545454545455e-19;
219 (*i1)[0] = 5.000000000000e-18;
220 (*i2)[0] = 5.000000000000e-16;
221 (*i3)[0] = 1.581138830084e-16;
222 (*i4)[0] = 7.924465962306e-17;
223 (*i1)[1] = 1.437398936440e-18;
224 (*i2)[1] = 5.722388235428e-16;
225 (*i3)[1] = 7.204059965732e-17;
226 (*i4)[1] = 5.722388235428e-17;
228 Time ts = Seconds (1);
229 Time ds = Seconds (1);
230 Time ti1 = Seconds (0);
231 Time di1 = Seconds (3);
232 Time ti2 = Seconds (0.7);
233 Time di2 = Seconds (1);
234 Time ti3 = Seconds (1.2);
235 Time di3 = Seconds (1);
236 Time ti4 = Seconds (1.5);
237 Time di4 = Seconds (0.1);
239 ulPhy->SetNoisePowerSpectralDensity (noisePsd);
250 sp1->packetBurst = packetBursts[0];
251 sp1->cellId = pbCellId[0];
258 sp2->packetBurst = packetBursts[1];
259 sp2->cellId = pbCellId[1];
267 ip1->packetBurst = packetBursts[2];
268 ip1->cellId = pbCellId[2];
275 ip2->packetBurst = packetBursts[3];
276 ip2->cellId = pbCellId[3];
283 ip3->packetBurst = packetBursts[4];
284 ip3->cellId = pbCellId[4];
291 ip4->packetBurst = packetBursts[5];
292 ip4->cellId = pbCellId[5];
305 NS_LOG_INFO (
"Data Frame - Calculated SINR: " << *calculatedSinr);
319 :
TestCase (
"SINR calculation in uplink srs frame: " + name),
322 m_sm (sv1->GetSpectrumModel ()),
344 uint16_t cellId = 100;
345 dlPhy->SetCellId (cellId);
346 ulPhy->SetCellId (cellId);
349 ulPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
361 int numOfDataSignals = 2;
362 int numOfIntfSignals = 4;
363 int numOfSignals = numOfDataSignals + numOfIntfSignals;
365 uint16_t pbCellId[numOfSignals];
373 for (
int dataPb = 0 ; dataPb < numOfDataSignals ; dataPb++, pb++ )
375 pbCellId[pb] = cellId;
378 for (
int intfPb = 0 ; intfPb < numOfIntfSignals ; intfPb++, pb++ )
381 pbCellId[pb] = cellId * (pb + 1);
392 (*noisePsd)[0] = 5.000000000000e-19;
393 (*noisePsd)[1] = 4.545454545455e-19;
395 (*i1)[0] = 5.000000000000e-18;
396 (*i2)[0] = 5.000000000000e-16;
397 (*i3)[0] = 1.581138830084e-16;
398 (*i4)[0] = 7.924465962306e-17;
399 (*i1)[1] = 1.437398936440e-18;
400 (*i2)[1] = 5.722388235428e-16;
401 (*i3)[1] = 7.204059965732e-17;
402 (*i4)[1] = 5.722388235428e-17;
404 Time ts = Seconds (1);
405 Time ds = Seconds (1);
406 Time ti1 = Seconds (0);
407 Time di1 = Seconds (3);
408 Time ti2 = Seconds (0.7);
409 Time di2 = Seconds (1);
410 Time ti3 = Seconds (1.2);
411 Time di3 = Seconds (1);
412 Time ti4 = Seconds (1.5);
413 Time di4 = Seconds (0.1);
415 ulPhy->SetNoisePowerSpectralDensity (noisePsd);
426 sp1->cellId = pbCellId[0];
433 sp2->cellId = pbCellId[1];
441 ip1->cellId = pbCellId[2];
448 ip2->cellId = pbCellId[3];
455 ip3->cellId = pbCellId[4];
462 ip4->cellId = pbCellId[5];
475 NS_LOG_INFO (
"SRS Frame - Calculated SINR: " << *calculatedSinr);
virtual ~LteUplinkSrsSinrTestCase()
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
static LteUplinkSinrTestSuite lteUplinkSinrTestSuite
virtual void DoRun(void)
Implementation to actually run this TestCase.
static void Run(void)
Run the simulation until one of:
Ptr< SpectrumValue > m_sv2
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
LteUplinkSrsSinrTestCase(Ptr< SpectrumValue > sv1, Ptr< SpectrumValue > sv2, Ptr< SpectrumValue > sinr, std::string name)
TestCase Srs.
std::vector< BandInfo > Bands
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< SpectrumValue > m_sv2
Ptr< const SpectrumModel > m_sm
LteUplinkDataSinrTestCase(Ptr< SpectrumValue > sv1, Ptr< SpectrumValue > sv2, Ptr< SpectrumValue > sinr, std::string name)
TestCase Data.
double fc
center frequency
Test 1.2 SINR calculation in uplink.
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Ptr< SpectrumValue > m_sinr
Ptr< SpectrumValue > m_sinr
double fl
lower limit of subband
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Ptr< const SpectrumModel > m_sm
#define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumValue instances are equal within a given tolerance.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
LteUplinkSinrTestSuite()
Test 1.2 SINR calculation in uplink.
double fh
upper limit of subband
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
The building block of a SpectrumModel.
NS_LOG_COMPONENT_DEFINE("LteUplinkSinrTest")
The LtePhy models the physical layer of LTE.
Ptr< SpectrumValue > m_sv1
virtual ~LteUplinkDataSinrTestCase()
Ptr< SpectrumValue > m_sv1