23 #include "ns3/simulator.h"
27 #include "ns3/spectrum-test.h"
28 #include "ns3/boolean.h"
29 #include "ns3/lte-phy-tag.h"
30 #include "lte-test-ue-phy.h"
31 #include "lte-test-sinr-chunk-processor.h"
32 #include "ns3/lte-spectrum-signal-parameters.h"
34 #include "lte-test-downlink-sinr.h"
35 #include <ns3/lte-control-messages.h>
36 #include "ns3/lte-helper.h"
72 sm = Create<SpectrumModel> (bands);
78 (*rxPsd1)[0] = 1.255943215755e-15;
79 (*rxPsd1)[1] = 7.204059965732e-16;
82 (*theoreticalSinr1)[0] = 3.72589167251055;
83 (*theoreticalSinr1)[1] = 3.72255684126076;
92 (*rxPsd2)[0] = 2.505936168136e-17;
93 (*rxPsd2)[1] = 3.610582885110e-17;
96 (*theoreticalSinr2)[0] = 0.0743413124381667;
97 (*theoreticalSinr2)[1] = 0.1865697965291756;
113 :
TestCase (
"SINR calculation in downlink Data frame: " + name),
115 m_sm (sv->GetSpectrumModel ()),
121 LteDownlinkDataSinrTestCase::~LteDownlinkDataSinrTestCase ()
135 uint16_t cellId = 100;
136 dlPhy->SetCellId (cellId);
137 ulPhy->SetCellId (cellId);
140 dlPhy->AddDataSinrChunkProcessor (chunkProcessor);
151 const int numOfPbs = 5;
154 const int numOfPkts = 10;
163 uint16_t pbCellId[numOfPbs];
168 for (
int pb = 0 ; pb < numOfPbs ; pb++ )
171 packetBursts[pb] = CreateObject<PacketBurst> ();
172 pbCellId[pb] = cellId * (pb + 1);
175 for (
int i = 0 ; i < numOfPkts ; i++ )
177 pkt[pb][i] = Create<Packet> (1000);
179 packetBursts[pb]->AddPacket ( pkt[pb][i] );
190 (*noisePsd)[0] = 5.000000000000e-19;
191 (*noisePsd)[1] = 4.545454545455e-19;
193 (*i1)[0] = 5.000000000000e-18;
194 (*i2)[0] = 5.000000000000e-16;
195 (*i3)[0] = 1.581138830084e-16;
196 (*i4)[0] = 7.924465962306e-17;
197 (*i1)[1] = 1.437398936440e-18;
198 (*i2)[1] = 5.722388235428e-16;
199 (*i3)[1] = 7.204059965732e-17;
200 (*i4)[1] = 5.722388235428e-17;
213 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
224 sp1->packetBurst = packetBursts[0];
225 sp1->cellId = pbCellId[0];
233 ip1->packetBurst = packetBursts[1];
234 ip1->cellId = pbCellId[1];
241 ip2->packetBurst = packetBursts[2];
242 ip2->cellId = pbCellId[2];
249 ip3->packetBurst = packetBursts[3];
250 ip3->cellId = pbCellId[3];
257 ip4->packetBurst = packetBursts[4];
258 ip4->cellId = pbCellId[4];
270 NS_LOG_INFO (
"Data Frame - Theoretical SINR: " << *m_sinr);
271 NS_LOG_INFO (
"Data Frame - Calculated SINR: " << *calculatedSinr);
273 NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(*calculatedSinr, *m_sinr, 0.0000001,
"Data Frame - Wrong SINR !");
285 :
TestCase (
"SINR calculation in downlink Ctrl Frame: " + name),
287 m_sm (sv->GetSpectrumModel ()),
290 NS_LOG_INFO (
"Creating LenaDownlinkCtrlSinrTestCase");
293 LteDownlinkCtrlSinrTestCase::~LteDownlinkCtrlSinrTestCase ()
307 uint16_t cellId = 100;
308 dlPhy->SetCellId (cellId);
309 ulPhy->SetCellId (cellId);
312 dlPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
322 const int numOfUes = 5;
325 const int numOfCtrlMsgs = 10;
328 std::list<Ptr<LteControlMessage> > ctrlMsgList[numOfUes];
331 uint16_t pbCellId[numOfUes];
336 for (
int pb = 0 ; pb < numOfUes ; pb++ )
338 pbCellId[pb] = cellId * (pb + 1);
341 for (
int i = 0 ; i < numOfCtrlMsgs ; i++ )
346 ctrlMsgList[pb].push_back (msg);
357 (*noisePsd)[0] = 5.000000000000e-19;
358 (*noisePsd)[1] = 4.545454545455e-19;
360 (*i1)[0] = 5.000000000000e-18;
361 (*i2)[0] = 5.000000000000e-16;
362 (*i3)[0] = 1.581138830084e-16;
363 (*i4)[0] = 7.924465962306e-17;
364 (*i1)[1] = 1.437398936440e-18;
365 (*i2)[1] = 5.722388235428e-16;
366 (*i3)[1] = 7.204059965732e-17;
367 (*i4)[1] = 5.722388235428e-17;
380 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
391 sp1->ctrlMsgList = ctrlMsgList[0];
392 sp1->cellId = pbCellId[0];
400 ip1->ctrlMsgList = ctrlMsgList[1];
401 ip1->cellId = pbCellId[1];
408 ip2->ctrlMsgList = ctrlMsgList[2];
409 ip2->cellId = pbCellId[2];
416 ip3->ctrlMsgList = ctrlMsgList[3];
417 ip3->cellId = pbCellId[3];
424 ip4->ctrlMsgList = ctrlMsgList[4];
425 ip4->cellId = pbCellId[4];
437 NS_LOG_INFO (
"Ctrl Frame - Theoretical SINR: " << *m_sinr);
438 NS_LOG_INFO (
"Ctrl Frame - Calculated SINR: " << *calculatedSinr);
440 NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(*calculatedSinr, *m_sinr, 0.0000001,
"Data Frame - Wrong SINR !");
See section 4.3.1 dlDciListElement.
smart pointer class similar to boost::intrusive_ptr
virtual void DoRun(void)
Implementation to actually run this test case.
#define NS_LOG_COMPONENT_DEFINE(name)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
virtual void DoRun(void)
Implementation to actually run this test case.
LteDownlinkSinrTestSuite()
double fc
center frequency
static void Destroy(void)
void SetDefault(std::string name, const AttributeValue &value)
double fl
lower limit of subband
LteDownlinkDataSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
LteDownlinkCtrlSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
double fh
upper limit of subband
void StartRx(Ptr< SpectrumSignalParameters > params)