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"
71 sm = Create<SpectrumModel> (bands);
77 (*rxPsd1)[0] = 1.255943215755e-15;
78 (*rxPsd1)[1] = 7.204059965732e-16;
81 (*theoreticalSinr1)[0] = 3.72589167251055;
82 (*theoreticalSinr1)[1] = 3.72255684126076;
91 (*rxPsd2)[0] = 2.505936168136e-17;
92 (*rxPsd2)[1] = 3.610582885110e-17;
95 (*theoreticalSinr2)[0] = 0.0743413124381667;
96 (*theoreticalSinr2)[1] = 0.1865697965291756;
112 :
TestCase (
"SINR calculation in downlink Data frame: " + name),
114 m_sm (sv->GetSpectrumModel ()),
134 uint16_t cellId = 100;
135 dlPhy->SetCellId (cellId);
136 ulPhy->SetCellId (cellId);
139 dlPhy->AddDataSinrChunkProcessor (chunkProcessor);
150 const int numOfPbs = 5;
153 const int numOfPkts = 10;
162 uint16_t pbCellId[numOfPbs];
167 for (
int pb = 0 ; pb < numOfPbs ; pb++ )
170 packetBursts[pb] = CreateObject<PacketBurst> ();
171 pbCellId[pb] = cellId * (pb + 1);
174 for (
int i = 0 ; i < numOfPkts ; i++ )
176 pkt[pb][i] = Create<Packet> (1000);
178 packetBursts[pb]->
AddPacket ( pkt[pb][i] );
189 (*noisePsd)[0] = 5.000000000000e-19;
190 (*noisePsd)[1] = 4.545454545455e-19;
192 (*i1)[0] = 5.000000000000e-18;
193 (*i2)[0] = 5.000000000000e-16;
194 (*i3)[0] = 1.581138830084e-16;
195 (*i4)[0] = 7.924465962306e-17;
196 (*i1)[1] = 1.437398936440e-18;
197 (*i2)[1] = 5.722388235428e-16;
198 (*i3)[1] = 7.204059965732e-17;
199 (*i4)[1] = 5.722388235428e-17;
212 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
224 sp1->
cellId = pbCellId[0];
225 Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
233 ip1->
cellId = pbCellId[1];
234 Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
241 ip2->
cellId = pbCellId[2];
242 Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
249 ip3->
cellId = pbCellId[3];
250 Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
257 ip4->
cellId = pbCellId[4];
258 Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
260 Simulator::Stop (
Seconds (5.0));
270 NS_LOG_INFO (
"Data Frame - Calculated SINR: " << *calculatedSinr);
274 Simulator::Destroy ();
284 :
TestCase (
"SINR calculation in downlink Ctrl Frame: " + name),
286 m_sm (sv->GetSpectrumModel ()),
289 NS_LOG_INFO (
"Creating LenaDownlinkCtrlSinrTestCase");
306 uint16_t cellId = 100;
307 dlPhy->SetCellId (cellId);
308 ulPhy->SetCellId (cellId);
311 dlPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
321 const int numOfUes = 5;
324 const int numOfCtrlMsgs = 10;
327 std::list<Ptr<LteControlMessage> > ctrlMsgList[numOfUes];
330 uint16_t pbCellId[numOfUes];
335 for (
int pb = 0 ; pb < numOfUes ; pb++ )
337 pbCellId[pb] = cellId * (pb + 1);
340 for (
int i = 0 ; i < numOfCtrlMsgs ; i++ )
345 ctrlMsgList[pb].push_back (msg);
356 (*noisePsd)[0] = 5.000000000000e-19;
357 (*noisePsd)[1] = 4.545454545455e-19;
359 (*i1)[0] = 5.000000000000e-18;
360 (*i2)[0] = 5.000000000000e-16;
361 (*i3)[0] = 1.581138830084e-16;
362 (*i4)[0] = 7.924465962306e-17;
363 (*i1)[1] = 1.437398936440e-18;
364 (*i2)[1] = 5.722388235428e-16;
365 (*i3)[1] = 7.204059965732e-17;
366 (*i4)[1] = 5.722388235428e-17;
379 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
391 sp1->
cellId = pbCellId[0];
393 Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
401 ip1->
cellId = pbCellId[1];
403 Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
410 ip2->
cellId = pbCellId[2];
412 Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
419 ip3->
cellId = pbCellId[3];
421 Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
428 ip4->
cellId = pbCellId[4];
430 Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
432 Simulator::Stop (
Seconds (5.0));
442 NS_LOG_INFO (
"Ctrl Frame - Calculated SINR: " << *calculatedSinr);
446 Simulator::Destroy ();
See section 4.3.1 dlDciListElement.
Simulation virtual time values and global simulation resolution.
std::list< Ptr< LteControlMessage > > ctrlMsgList
virtual void DoRun(void)
Implementation to actually run this TestCase.
#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.
Ptr< SpectrumValue > m_sinr
std::vector< BandInfo > Bands
Ptr< SpectrumValue > m_sv
Ptr< const SpectrumModel > m_sm
Ptr< SpectrumValue > m_sinr
double fc
center frequency
LteDownlinkCtrlSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
TestCase CTRL.
Ptr< SpectrumValue > GetSinr()
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetDefault(std::string name, const AttributeValue &value)
void AddPacket(Ptr< Packet > packet)
add a packet to the list of packet
double fl
lower limit of subband
Ptr< PacketBurst > packetBurst
The packet burst being transmitted with this signal.
Ptr< SpectrumValue > m_sv
Test 1.1 SINR calculation in downlink.
void SetDci(DlDciListElement_s dci)
add a DCI into the message
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
virtual ~LteDownlinkCtrlSinrTestCase()
#define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumValue instances are equal within a given tolerance.
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
LteDownlinkSinrTestSuite()
Test 1.1 SINR calculation in downlink.
virtual ~LteDownlinkDataSinrTestCase()
static LteDownlinkSinrTestSuite lteDownlinkSinrTestSuite
Time Seconds(double value)
Construct a Time in the indicated unit.
Time duration
The duration of the packet transmission.
LteDownlinkDataSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
TestCase Data.
double fh
upper limit of subband
The building block of a SpectrumModel.
Ptr< const SpectrumModel > m_sm