23 #include "ns3/simulator.h" 27 #include "ns3/spectrum-test.h" 28 #include "ns3/boolean.h" 29 #include "ns3/lte-phy-tag.h" 31 #include "ns3/lte-spectrum-signal-parameters.h" 34 #include <ns3/lte-control-messages.h> 35 #include "ns3/lte-helper.h" 36 #include <ns3/lte-chunk-processor.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 ()),
115 m_expectedSinr (sinr)
135 uint16_t cellId = 100;
136 dlPhy->SetCellId (cellId);
137 ulPhy->SetCellId (cellId);
142 dlPhy->AddDataSinrChunkProcessor (chunkProcessor);
153 const int numOfPbs = 5;
156 const int numOfPkts = 10;
165 uint16_t pbCellId[numOfPbs];
170 for (
int pb = 0 ; pb < numOfPbs ; pb++ )
173 packetBursts[pb] = CreateObject<PacketBurst> ();
174 pbCellId[pb] = cellId * (pb + 1);
177 for (
int i = 0 ; i < numOfPkts ; i++ )
179 pkt[pb][i] = Create<Packet> (1000);
181 packetBursts[pb]->
AddPacket ( pkt[pb][i] );
192 (*noisePsd)[0] = 5.000000000000e-19;
193 (*noisePsd)[1] = 4.545454545455e-19;
195 (*i1)[0] = 5.000000000000e-18;
196 (*i2)[0] = 5.000000000000e-16;
197 (*i3)[0] = 1.581138830084e-16;
198 (*i4)[0] = 7.924465962306e-17;
199 (*i1)[1] = 1.437398936440e-18;
200 (*i2)[1] = 5.722388235428e-16;
201 (*i3)[1] = 7.204059965732e-17;
202 (*i4)[1] = 5.722388235428e-17;
215 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
227 sp1->
cellId = pbCellId[0];
228 Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
236 ip1->
cellId = pbCellId[1];
237 Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
244 ip2->
cellId = pbCellId[2];
245 Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
252 ip3->
cellId = pbCellId[3];
253 Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
260 ip4->
cellId = pbCellId[4];
261 Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
263 Simulator::Stop (
Seconds (5.0));
267 NS_LOG_INFO (
"Data Frame - Calculated SINR: " << *(actualSinrCatcher.GetValue ()));
271 Simulator::Destroy ();
281 :
TestCase (
"SINR calculation in downlink Ctrl Frame: " + name),
283 m_sm (sv->GetSpectrumModel ()),
284 m_expectedSinr (sinr)
286 NS_LOG_INFO (
"Creating LenaDownlinkCtrlSinrTestCase");
303 uint16_t cellId = 100;
304 dlPhy->SetCellId (cellId);
305 ulPhy->SetCellId (cellId);
310 dlPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
320 const int numOfUes = 5;
323 const int numOfCtrlMsgs = 10;
326 std::list<Ptr<LteControlMessage> > ctrlMsgList[numOfUes];
329 uint16_t pbCellId[numOfUes];
334 for (
int pb = 0 ; pb < numOfUes ; pb++ )
336 pbCellId[pb] = cellId * (pb + 1);
339 for (
int i = 0 ; i < numOfCtrlMsgs ; i++ )
344 ctrlMsgList[pb].push_back (msg);
355 (*noisePsd)[0] = 5.000000000000e-19;
356 (*noisePsd)[1] = 4.545454545455e-19;
358 (*i1)[0] = 5.000000000000e-18;
359 (*i2)[0] = 5.000000000000e-16;
360 (*i3)[0] = 1.581138830084e-16;
361 (*i4)[0] = 7.924465962306e-17;
362 (*i1)[1] = 1.437398936440e-18;
363 (*i2)[1] = 5.722388235428e-16;
364 (*i3)[1] = 7.204059965732e-17;
365 (*i4)[1] = 5.722388235428e-17;
378 dlPhy->SetNoisePowerSpectralDensity (noisePsd);
390 sp1->
cellId = pbCellId[0];
392 Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
400 ip1->
cellId = pbCellId[1];
402 Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
409 ip2->
cellId = pbCellId[2];
411 Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
418 ip3->
cellId = pbCellId[3];
420 Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
427 ip4->
cellId = pbCellId[4];
429 Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
431 Simulator::Stop (
Seconds (5.0));
435 NS_LOG_INFO (
"Ctrl Frame - Calculated SINR: " << *(actualSinrCatcher.GetValue ()));
439 Simulator::Destroy ();
See section 4.3.1 dlDciListElement.
Simulation virtual time values and global simulation resolution.
std::list< Ptr< LteControlMessage > > ctrlMsgList
control message list
Ptr< SpectrumValue > m_expectedSinr
the expected SINR
AttributeValue implementation for Boolean.
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.
std::vector< BandInfo > Bands
Container of BandInfo.
Test compares if the generated SINR is equal to estimated SINR value.
Test compares if the generated SINR is equal to estimated SINR value.
Ptr< SpectrumValue > m_sv
the spectrum value
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ptr< const SpectrumModel > m_sm
the spectrum model
double fc
center frequency
LteDownlinkCtrlSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
Constructor.
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool pss
primary synchronization signal
void AddPacket(Ptr< Packet > packet)
add a packet to the list of packet
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double fl
lower limit of subband
Ptr< PacketBurst > packetBurst
The packet burst being transmitted with this signal.
Ptr< SpectrumValue > m_sv
the spectrum value
Test 1.1 SINR calculation in downlink.
void SetDci(DlDciListElement_s dci)
add a DCI into the message
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.
void SetDefault(std::string name, const AttributeValue &value)
Time duration
The duration of the packet transmission.
LteDownlinkDataSinrTestCase(Ptr< SpectrumValue > sv, Ptr< SpectrumValue > sinr, std::string name)
Constructor.
double fh
upper limit of subband
The building block of a SpectrumModel.
Ptr< SpectrumValue > m_expectedSinr
the expected SINR
Ptr< const SpectrumModel > m_sm
the spectrum model