23 #include "ns3/simulator.h"
27 #include "ns3/spectrum-test.h"
28 #include "ns3/boolean.h"
29 #include "ns3/lte-phy-tag.h"
32 #include "ns3/lte-spectrum-signal-parameters.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 ()),
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;
202 Time ts = Seconds (1);
203 Time ds = Seconds (1);
204 Time ti1 = Seconds (0);
205 Time di1 = Seconds (3);
206 Time ti2 = Seconds (0.7);
207 Time di2 = Seconds (1);
208 Time ti3 = Seconds (1.2);
209 Time di3 = Seconds (1);
210 Time ti4 = Seconds (1.5);
211 Time di4 = Seconds (0.1);
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];
271 NS_LOG_INFO (
"Data Frame - Calculated SINR: " << *calculatedSinr);
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);
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;
369 Time ts = Seconds (1);
370 Time ds = Seconds (1);
371 Time ti1 = Seconds (0);
372 Time di1 = Seconds (3);
373 Time ti2 = Seconds (0.7);
374 Time di2 = Seconds (1);
375 Time ti3 = Seconds (1.2);
376 Time di3 = Seconds (1);
377 Time ti4 = Seconds (1.5);
378 Time di4 = Seconds (0.1);
380 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
391 sp1->ctrlMsgList = ctrlMsgList[0];
392 sp1->cellId = pbCellId[0];
401 ip1->ctrlMsgList = ctrlMsgList[1];
402 ip1->cellId = pbCellId[1];
410 ip2->ctrlMsgList = ctrlMsgList[2];
411 ip2->cellId = pbCellId[2];
419 ip3->ctrlMsgList = ctrlMsgList[3];
420 ip3->cellId = pbCellId[3];
428 ip4->ctrlMsgList = ctrlMsgList[4];
429 ip4->cellId = pbCellId[4];
443 NS_LOG_INFO (
"Ctrl Frame - Calculated SINR: " << *calculatedSinr);
See section 4.3.1 dlDciListElement.
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
virtual void DoRun(void)
Implementation to actually run this TestCase.
static void Run(void)
Run the simulation until one of:
virtual ~LteDownlinkDataSinrTestCase()
Ptr< SpectrumValue > m_sinr
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
std::vector< BandInfo > Bands
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< const SpectrumModel > m_sm
Ptr< SpectrumValue > m_sinr
LteDownlinkSinrTestSuite()
Test 1.1 SINR calculation in downlink.
double fc
center frequency
static LteDownlinkSinrTestSuite lteDownlinkSinrTestSuite
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
void SetDefault(std::string name, const AttributeValue &value)
double fl
lower limit of subband
Test 1.1 SINR calculation in downlink.
NS_LOG_COMPONENT_DEFINE("LteDownlinkSinrTest")
LteDownlinkDataSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
TestCase Data.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Ptr< SpectrumValue > m_sv
#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...
virtual ~LteDownlinkCtrlSinrTestCase()
LteDownlinkCtrlSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
TestCase CTRL.
double fh
upper limit of subband
Ptr< SpectrumValue > m_sv
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
The building block of a SpectrumModel.
Ptr< const SpectrumModel > m_sm
The LtePhy models the physical layer of LTE.