A Discrete-Event Network Simulator
API
lte-test-frequency-reuse.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Piotr Gawlowicz
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
18  *
19  */
20 
22 
23 #include "lte-ffr-simple.h"
25 
26 #include "ns3/applications-module.h"
27 #include "ns3/internet-module.h"
28 #include "ns3/lte-helper.h"
29 #include "ns3/mobility-helper.h"
30 #include "ns3/point-to-point-epc-helper.h"
31 #include "ns3/point-to-point-module.h"
32 #include <ns3/boolean.h>
33 #include <ns3/callback.h>
34 #include <ns3/config.h>
35 #include <ns3/double.h>
36 #include <ns3/enum.h>
37 #include <ns3/ff-mac-scheduler.h>
38 #include <ns3/log.h>
39 #include <ns3/lte-common.h>
40 #include <ns3/lte-enb-net-device.h>
41 #include <ns3/lte-enb-phy.h>
42 #include <ns3/lte-enb-rrc.h>
43 #include <ns3/lte-ue-net-device.h>
44 #include <ns3/lte-ue-phy.h>
45 #include <ns3/lte-ue-rrc.h>
46 #include <ns3/pointer.h>
47 #include <ns3/simulator.h>
48 #include <ns3/string.h>
49 
50 using namespace ns3;
51 
52 NS_LOG_COMPONENT_DEFINE("LteFrequencyReuseTest");
53 
59  : TestSuite("lte-frequency-reuse", SYSTEM)
60 {
61  // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_DEBUG);
62  // LogComponentEnable ("LteFrequencyReuseTest", logLevel);
63 
64  std::vector<bool> availableDlRb;
65  std::vector<bool> availableUlRb;
66  for (uint32_t i = 0; i < 12; i++)
67  {
68  availableDlRb.push_back(true);
69  availableUlRb.push_back(true);
70  }
71  for (uint32_t i = 12; i < 25; i++)
72  {
73  availableDlRb.push_back(false);
74  availableUlRb.push_back(false);
75  }
76 
77  AddTestCase(new LteHardFrTestCase("DownlinkHardFrPf1",
78  1,
79  "ns3::PfFfMacScheduler",
80  25,
81  25,
82  0,
83  12,
84  0,
85  12,
86  availableDlRb,
87  availableUlRb),
88  TestCase::QUICK);
89  AddTestCase(new LteHardFrTestCase("DownlinkHardFrPf2",
90  5,
91  "ns3::PfFfMacScheduler",
92  25,
93  25,
94  0,
95  12,
96  0,
97  12,
98  availableDlRb,
99  availableUlRb),
100  TestCase::QUICK);
101  AddTestCase(new LteHardFrTestCase("DownlinkHardFrPss1",
102  1,
103  "ns3::PssFfMacScheduler",
104  25,
105  25,
106  0,
107  12,
108  0,
109  12,
110  availableDlRb,
111  availableUlRb),
112  TestCase::QUICK);
113  AddTestCase(new LteHardFrTestCase("DownlinkHardFrPss2",
114  5,
115  "ns3::PssFfMacScheduler",
116  25,
117  25,
118  0,
119  12,
120  0,
121  12,
122  availableDlRb,
123  availableUlRb),
124  TestCase::QUICK);
125  AddTestCase(new LteHardFrTestCase("DownlinkHardFrCqa1",
126  1,
127  "ns3::CqaFfMacScheduler",
128  25,
129  25,
130  0,
131  12,
132  0,
133  12,
134  availableDlRb,
135  availableUlRb),
136  TestCase::QUICK);
137  AddTestCase(new LteHardFrTestCase("DownlinkHardFrCqa2",
138  5,
139  "ns3::CqaFfMacScheduler",
140  25,
141  25,
142  0,
143  12,
144  0,
145  12,
146  availableDlRb,
147  availableUlRb),
148  TestCase::QUICK);
149  AddTestCase(new LteHardFrTestCase("DownlinkHardFrFdTbfq1",
150  1,
151  "ns3::FdTbfqFfMacScheduler",
152  25,
153  25,
154  0,
155  12,
156  0,
157  12,
158  availableDlRb,
159  availableUlRb),
160  TestCase::QUICK);
161  AddTestCase(new LteHardFrTestCase("DownlinkHardFrFdTbfq2",
162  5,
163  "ns3::FdTbfqFfMacScheduler",
164  25,
165  25,
166  0,
167  12,
168  0,
169  12,
170  availableDlRb,
171  availableUlRb),
172  TestCase::QUICK);
173  AddTestCase(new LteHardFrTestCase("DownlinkHardFrTdTbfq1",
174  1,
175  "ns3::TdTbfqFfMacScheduler",
176  25,
177  25,
178  0,
179  12,
180  0,
181  12,
182  availableDlRb,
183  availableUlRb),
184  TestCase::QUICK);
185  AddTestCase(new LteHardFrTestCase("DownlinkHardFrTdTbfq2",
186  5,
187  "ns3::TdTbfqFfMacScheduler",
188  25,
189  25,
190  0,
191  12,
192  0,
193  12,
194  availableDlRb,
195  availableUlRb),
196  TestCase::QUICK);
197 
198  availableDlRb.clear();
199  availableUlRb.clear();
200  for (uint32_t i = 0; i < 6; i++)
201  {
202  availableDlRb.push_back(true);
203  availableUlRb.push_back(true);
204  }
205  for (uint32_t i = 6; i < 12; i++)
206  {
207  availableDlRb.push_back(false);
208  availableUlRb.push_back(false);
209  }
210  for (uint32_t i = 12; i < 18; i++)
211  {
212  availableDlRb.push_back(true);
213  availableUlRb.push_back(true);
214  }
215  for (uint32_t i = 18; i < 25; i++)
216  {
217  availableDlRb.push_back(false);
218  availableUlRb.push_back(false);
219  }
220 
221  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrPf1",
222  1,
223  "ns3::PfFfMacScheduler",
224  25,
225  25,
226  6,
227  6,
228  6,
229  6,
230  6,
231  6,
232  availableDlRb,
233  availableUlRb),
234  TestCase::QUICK);
235  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrPf2",
236  5,
237  "ns3::PfFfMacScheduler",
238  25,
239  25,
240  6,
241  6,
242  6,
243  6,
244  6,
245  6,
246  availableDlRb,
247  availableUlRb),
248  TestCase::QUICK);
249  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrPss1",
250  1,
251  "ns3::PssFfMacScheduler",
252  25,
253  25,
254  6,
255  6,
256  6,
257  6,
258  6,
259  6,
260  availableDlRb,
261  availableUlRb),
262  TestCase::QUICK);
263  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrPss2",
264  5,
265  "ns3::PssFfMacScheduler",
266  25,
267  25,
268  6,
269  6,
270  6,
271  6,
272  6,
273  6,
274  availableDlRb,
275  availableUlRb),
276  TestCase::QUICK);
277  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrCqa1",
278  1,
279  "ns3::CqaFfMacScheduler",
280  25,
281  25,
282  6,
283  6,
284  6,
285  6,
286  6,
287  6,
288  availableDlRb,
289  availableUlRb),
290  TestCase::QUICK);
291  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrCqa2",
292  5,
293  "ns3::CqaFfMacScheduler",
294  25,
295  25,
296  6,
297  6,
298  6,
299  6,
300  6,
301  6,
302  availableDlRb,
303  availableUlRb),
304  TestCase::QUICK);
305  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrCqaFdTbfq1",
306  1,
307  "ns3::FdTbfqFfMacScheduler",
308  25,
309  25,
310  6,
311  6,
312  6,
313  6,
314  6,
315  6,
316  availableDlRb,
317  availableUlRb),
318  TestCase::QUICK);
319  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrCqaFdTbfq2",
320  5,
321  "ns3::FdTbfqFfMacScheduler",
322  25,
323  25,
324  6,
325  6,
326  6,
327  6,
328  6,
329  6,
330  availableDlRb,
331  availableUlRb),
332  TestCase::QUICK);
333  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrCqaTdTbfq1",
334  1,
335  "ns3::TdTbfqFfMacScheduler",
336  25,
337  25,
338  6,
339  6,
340  6,
341  6,
342  6,
343  6,
344  availableDlRb,
345  availableUlRb),
346  TestCase::QUICK);
347  AddTestCase(new LteStrictFrTestCase("DownlinkStrictFrCqaTdTbfq2",
348  5,
349  "ns3::TdTbfqFfMacScheduler",
350  25,
351  25,
352  6,
353  6,
354  6,
355  6,
356  6,
357  6,
358  availableDlRb,
359  availableUlRb),
360  TestCase::QUICK);
361 
362  AddTestCase(new LteStrictFrAreaTestCase("LteStrictFrAreaTestCasePf1", "ns3::PfFfMacScheduler"),
363  TestCase::QUICK);
364  AddTestCase(
365  new LteStrictFrAreaTestCase("LteStrictFrAreaTestCasePss1", "ns3::PssFfMacScheduler"),
366  TestCase::QUICK);
367  AddTestCase(
368  new LteStrictFrAreaTestCase("LteStrictFrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"),
369  TestCase::QUICK);
370  AddTestCase(
371  new LteStrictFrAreaTestCase("LteStrictFrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"),
372  TestCase::QUICK);
373  AddTestCase(
374  new LteStrictFrAreaTestCase("LteStrictFrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"),
375  TestCase::QUICK);
376 
377  AddTestCase(new LteSoftFrAreaTestCase("LteSoftFrAreaTestCasePf1", "ns3::PfFfMacScheduler"),
378  TestCase::QUICK);
379  AddTestCase(new LteSoftFrAreaTestCase("LteSoftFrAreaTestCasePss1", "ns3::PssFfMacScheduler"),
380  TestCase::QUICK);
381  AddTestCase(new LteSoftFrAreaTestCase("LteSoftFrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"),
382  TestCase::QUICK);
383  AddTestCase(
384  new LteSoftFrAreaTestCase("LteSoftFrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"),
385  TestCase::QUICK);
386  AddTestCase(
387  new LteSoftFrAreaTestCase("LteSoftFrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"),
388  TestCase::QUICK);
389 
390  AddTestCase(new LteSoftFfrAreaTestCase("LteSoftFfrAreaTestCasePf1", "ns3::PfFfMacScheduler"),
391  TestCase::QUICK);
392  AddTestCase(new LteSoftFfrAreaTestCase("LteSoftFfrAreaTestCasePss1", "ns3::PssFfMacScheduler"),
393  TestCase::QUICK);
394  AddTestCase(new LteSoftFfrAreaTestCase("LteSoftFfrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"),
395  TestCase::QUICK);
396  AddTestCase(
397  new LteSoftFfrAreaTestCase("LteSoftFfrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"),
398  TestCase::QUICK);
399  AddTestCase(
400  new LteSoftFfrAreaTestCase("LteSoftFfrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"),
401  TestCase::QUICK);
402 
403  AddTestCase(
404  new LteEnhancedFfrAreaTestCase("LteEnhancedFfrAreaTestCasePf1", "ns3::PfFfMacScheduler"),
405  TestCase::QUICK);
406  AddTestCase(
407  new LteEnhancedFfrAreaTestCase("LteEnhancedFfrAreaTestCasePss1", "ns3::PssFfMacScheduler"),
408  TestCase::QUICK);
409  AddTestCase(
410  new LteEnhancedFfrAreaTestCase("LteEnhancedFfrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"),
411  TestCase::QUICK);
412  AddTestCase(new LteEnhancedFfrAreaTestCase("LteEnhancedFfrAreaTestCaseFdTbfq1",
413  "ns3::FdTbfqFfMacScheduler"),
414  TestCase::QUICK);
415  AddTestCase(new LteEnhancedFfrAreaTestCase("LteEnhancedFfrAreaTestCaseTdTbfq1",
416  "ns3::TdTbfqFfMacScheduler"),
417  TestCase::QUICK);
418 
419  AddTestCase(new LteDistributedFfrAreaTestCase("LteDistributedFfrAreaTestCasePf1",
420  "ns3::PfFfMacScheduler"),
421  TestCase::QUICK);
422  AddTestCase(new LteDistributedFfrAreaTestCase("LteDistributedFfrAreaTestCasePss1",
423  "ns3::PssFfMacScheduler"),
424  TestCase::QUICK);
425  AddTestCase(new LteDistributedFfrAreaTestCase("LteDistributedFfrAreaTestCaseCqa1",
426  "ns3::CqaFfMacScheduler"),
427  TestCase::QUICK);
428  AddTestCase(new LteDistributedFfrAreaTestCase("LteDistributedFfrAreaTestCaseFdTbfq1",
429  "ns3::FdTbfqFfMacScheduler"),
430  TestCase::QUICK);
431  AddTestCase(new LteDistributedFfrAreaTestCase("LteDistributedFfrAreaTestCaseTdTbfq1",
432  "ns3::TdTbfqFfMacScheduler"),
433  TestCase::QUICK);
434 }
435 
441 
445 void
447 {
448  testcase->DlDataRxStart(spectrumValue);
449 }
450 
451 void
453 {
454  testcase->UlDataRxStart(spectrumValue);
455 }
456 
458  uint32_t userNum,
459  uint16_t dlBandwidth,
460  uint16_t ulBandwidth,
461  std::vector<bool> availableDlRb,
462  std::vector<bool> availableUlRb)
463  : TestCase("Test: " + name),
464  m_userNum(userNum),
465  m_dlBandwidth(dlBandwidth),
466  m_ulBandwidth(ulBandwidth),
467  m_availableDlRb(availableDlRb),
468  m_usedMutedDlRbg(false),
469  m_availableUlRb(availableUlRb),
470  m_usedMutedUlRbg(false)
471 {
472 }
473 
475 {
476 }
477 
478 void
480 {
481  NS_LOG_DEBUG("DL DATA Power allocation :");
482  Values::const_iterator it;
483  uint32_t i = 0;
484  for (it = spectrumValue->ConstValuesBegin(); it != spectrumValue->ConstValuesEnd(); it++)
485  {
486  double power = (*it) * (m_dlBandwidth * 180000);
487  NS_LOG_DEBUG("RB " << i << " POWER: "
488  << " " << power << " isAvailable: " << m_availableDlRb[i]);
489 
490  if (m_availableDlRb[i] == false && power > 0)
491  {
492  m_usedMutedDlRbg = true;
493  }
494  i++;
495  }
496 }
497 
498 void
500 {
501  NS_LOG_DEBUG("UL DATA Power allocation :");
502  Values::const_iterator it;
503  uint32_t i = 0;
504  for (it = spectrumValue->ConstValuesBegin(); it != spectrumValue->ConstValuesEnd(); it++)
505  {
506  double power = (*it) * (m_ulBandwidth * 180000);
507  NS_LOG_DEBUG("RB " << i << " POWER: "
508  << " " << power << " isAvailable: " << m_availableUlRb[i]);
509 
510  if (m_availableUlRb[i] == false && power > 0)
511  {
512  m_usedMutedUlRbg = true;
513  }
514  i++;
515  }
516 }
517 
518 void
520 {
521 }
522 
524  uint32_t userNum,
525  std::string schedulerType,
526  uint16_t dlBandwidth,
527  uint16_t ulBandwidth,
528  uint8_t dlSubBandOffset,
529  uint16_t dlSubBandwidth,
530  uint8_t ulSubBandOffset,
531  uint16_t ulSubBandwidth,
532  std::vector<bool> availableDlRb,
533  std::vector<bool> availableUlRb)
534  : LteFrTestCase(name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
535  m_schedulerType(schedulerType),
536  m_dlSubBandOffset(dlSubBandOffset),
537  m_dlSubBandwidth(dlSubBandwidth),
538  m_ulSubBandOffset(ulSubBandOffset),
539  m_ulSubBandwidth(ulSubBandwidth)
540 {
541  NS_LOG_INFO("Creating LteDownlinkFrTestCase");
542 }
543 
545 {
546 }
547 
548 void
550 {
551  NS_LOG_DEBUG("LteFrTestCase");
552 
553  Config::Reset();
554  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(false));
555 
560  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
561  lteHelper->SetFfrAlgorithmType("ns3::LteFrHardAlgorithm");
562 
563  lteHelper->SetFfrAlgorithmAttribute("DlSubBandOffset", UintegerValue(m_dlSubBandOffset));
564  lteHelper->SetFfrAlgorithmAttribute("DlSubBandwidth", UintegerValue(m_dlSubBandwidth));
565 
566  lteHelper->SetFfrAlgorithmAttribute("UlSubBandOffset", UintegerValue(m_ulSubBandOffset));
567  lteHelper->SetFfrAlgorithmAttribute("UlSubBandwidth", UintegerValue(m_ulSubBandwidth));
568 
569  // Create Nodes: eNodeB and UE
570  NodeContainer enbNodes;
571  NodeContainer ueNodes;
572  enbNodes.Create(1);
573  ueNodes.Create(m_userNum);
574  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes);
575 
576  // Install Mobility Model
578  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
579  mobility.Install(allNodes);
580 
581  // Create Devices and install them in the Nodes (eNB and UE)
582  NetDeviceContainer enbDevs;
583  NetDeviceContainer ueDevs;
584  lteHelper->SetSchedulerType(m_schedulerType);
585  enbDevs = lteHelper->InstallEnbDevice(enbNodes);
586  ueDevs = lteHelper->InstallUeDevice(ueNodes);
587 
588  // Attach a UE to a eNB
589  lteHelper->Attach(ueDevs, enbDevs.Get(0));
590 
591  // Activate the default EPS bearer
592  // Since this test includes the Token Bank Fair Queue Scheduler
593  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
594  // bearer as the dedicated bearer with QoS.
595  GbrQosInformation qos;
596  qos.mbrUl = 1e6;
597  qos.mbrDl = 1e6;
598  qos.gbrUl = 1e4;
599  qos.gbrDl = 1e4;
600 
601  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
602  EpsBearer bearer(q, qos);
603  lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
604 
605  // Test SpectrumPhy to get signals form DL channel
606  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
607  ->GetObject<LteEnbNetDevice>()
608  ->GetPhy()
609  ->GetDownlinkSpectrumPhy()
611  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
612 
613  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
614  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
615  testDlSpectrumPhy->SetRxSpectrumModel(
616  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
617  dlChannel->AddRx(testDlSpectrumPhy);
618 
619  testDlSpectrumPhy->TraceConnectWithoutContext(
620  "RxStart",
622 
623  // Test SpectrumPhy to get signals form UL channel
624  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get(0)
625  ->GetObject<LteUeNetDevice>()
626  ->GetPhy()
627  ->GetUplinkSpectrumPhy()
629  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
630 
631  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
632  testUlSpectrumPhy->SetRxSpectrumModel(
633  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
634  ulChannel->AddRx(testUlSpectrumPhy);
635 
636  testUlSpectrumPhy->TraceConnectWithoutContext(
637  "RxStart",
639 
640  Simulator::Stop(Seconds(0.500));
641  Simulator::Run();
642 
643  NS_TEST_ASSERT_MSG_EQ(m_usedMutedDlRbg, false, "Scheduler used DL RBG muted by FFR Algorithm");
644 
645  NS_TEST_ASSERT_MSG_EQ(m_usedMutedUlRbg, false, "Scheduler used UL RBG muted by FFR Algorithm");
646 
647  Simulator::Destroy();
648 }
649 
651  uint32_t userNum,
652  std::string schedulerType,
653  uint16_t dlBandwidth,
654  uint16_t ulBandwidth,
655  uint16_t dlCommonSubBandwidth,
656  uint8_t dlEdgeSubBandOffset,
657  uint16_t dlEdgeSubBandwidth,
658  uint16_t ulCommonSubBandwidth,
659  uint8_t ulEdgeSubBandOffset,
660  uint16_t ulEdgeSubBandwidth,
661  std::vector<bool> availableDlRb,
662  std::vector<bool> availableUlRb)
663  : LteFrTestCase(name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
664  m_schedulerType(schedulerType),
665  m_dlCommonSubBandwidth(dlCommonSubBandwidth),
666  m_dlEdgeSubBandOffset(dlEdgeSubBandOffset),
667  m_dlEdgeSubBandwidth(dlEdgeSubBandwidth),
668  m_ulCommonSubBandwidth(ulCommonSubBandwidth),
669  m_ulEdgeSubBandOffset(ulEdgeSubBandOffset),
670  m_ulEdgeSubBandwidth(ulEdgeSubBandwidth)
671 {
672  NS_LOG_INFO("Creating LteFrTestCase");
673 }
674 
676 {
677 }
678 
679 void
681 {
682  NS_LOG_DEBUG("LteFrTestCase");
683 
684  Config::Reset();
685  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(false));
686 
691  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
692  lteHelper->SetFfrAlgorithmType("ns3::LteFrStrictAlgorithm");
693 
694  lteHelper->SetFfrAlgorithmAttribute("DlCommonSubBandwidth",
696  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandOffset",
698  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandwidth", UintegerValue(m_dlEdgeSubBandwidth));
699 
700  lteHelper->SetFfrAlgorithmAttribute("UlCommonSubBandwidth",
702  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandOffset",
704  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandwidth", UintegerValue(m_ulEdgeSubBandwidth));
705 
706  // Create Nodes: eNodeB and UE
707  NodeContainer enbNodes;
708  NodeContainer ueNodes;
709  enbNodes.Create(1);
710  ueNodes.Create(m_userNum);
711  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes);
712 
713  // Install Mobility Model
715  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
716  mobility.Install(allNodes);
717 
718  // Create Devices and install them in the Nodes (eNB and UE)
719  NetDeviceContainer enbDevs;
720  NetDeviceContainer ueDevs;
721  lteHelper->SetSchedulerType(m_schedulerType);
722  enbDevs = lteHelper->InstallEnbDevice(enbNodes);
723  ueDevs = lteHelper->InstallUeDevice(ueNodes);
724 
725  // Attach a UE to a eNB
726  lteHelper->Attach(ueDevs, enbDevs.Get(0));
727 
728  // Activate the default EPS bearer
729  // Since this test includes the Token Bank Fair Queue Scheduler
730  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
731  // bearer as the dedicated bearer with QoS.
732 
733  GbrQosInformation qos;
734  qos.mbrUl = 1e6;
735  qos.mbrDl = 1e6;
736  qos.gbrUl = 1e4;
737  qos.gbrDl = 1e4;
738 
739  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
740  EpsBearer bearer(q, qos);
741  lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
742 
743  // Test SpectrumPhy to get signals form DL channel
744  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
745  ->GetObject<LteEnbNetDevice>()
746  ->GetPhy()
747  ->GetDownlinkSpectrumPhy()
749  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
750 
751  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
752  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
753  testDlSpectrumPhy->SetRxSpectrumModel(
754  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
755  dlChannel->AddRx(testDlSpectrumPhy);
756 
757  testDlSpectrumPhy->TraceConnectWithoutContext(
758  "RxStart",
760 
761  // Test SpectrumPhy to get signals form UL channel
762  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get(0)
763  ->GetObject<LteUeNetDevice>()
764  ->GetPhy()
765  ->GetUplinkSpectrumPhy()
767  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
768 
769  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
770  testUlSpectrumPhy->SetRxSpectrumModel(
771  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
772  ulChannel->AddRx(testUlSpectrumPhy);
773 
774  testUlSpectrumPhy->TraceConnectWithoutContext(
775  "RxStart",
777 
778  Simulator::Stop(Seconds(0.500));
779  Simulator::Run();
780 
781  NS_TEST_ASSERT_MSG_EQ(m_usedMutedDlRbg, false, "Scheduler used DL RBG muted by FFR Algorithm");
782 
783  NS_TEST_ASSERT_MSG_EQ(m_usedMutedUlRbg, false, "Scheduler used UL RBG muted by FFR Algorithm");
784 
785  Simulator::Destroy();
786 }
787 
788 void
790 {
791  testcase->DlDataRxStart(spectrumValue);
792 }
793 
794 void
796 {
797  testcase->UlDataRxStart(spectrumValue);
798 }
799 
800 LteFrAreaTestCase::LteFrAreaTestCase(std::string name, std::string schedulerType)
801  : TestCase("Test: " + name),
802  m_schedulerType(schedulerType)
803 {
804  m_dlBandwidth = 25;
805  m_ulBandwidth = 25;
806  m_usedWrongDlRbg = false;
807  m_usedWrongUlRbg = false;
808 }
809 
811 {
812 }
813 
814 void
816 {
817  // need time to report new UE measurements, and wait because of filtering
818  if ((Simulator::Now() - m_teleportTime) < MilliSeconds(400))
819  {
820  return;
821  }
822 
823  NS_LOG_DEBUG("DL DATA Power allocation :");
824  Values::const_iterator it;
825  uint32_t i = 0;
826  for (it = spectrumValue->ConstValuesBegin(); it != spectrumValue->ConstValuesEnd(); it++)
827  {
828  double power = (*it) * (m_dlBandwidth * 180000);
829  NS_LOG_DEBUG("RB " << i << " POWER: "
830  << " " << power);
831  NS_LOG_DEBUG("RB " << i << " POWER: "
832  << " " << power << " Available: " << m_expectedDlRb[i]
833  << " Expected Power: " << m_expectedDlPower);
834 
835  if (m_expectedDlRb[i] == false && power > 0)
836  {
837  m_usedWrongDlRbg = true;
838  }
839  else if (m_expectedDlRb[i] == true && power > 0)
840  {
843  0.1,
844  "Wrong Data Channel DL Power level");
845  }
846  i++;
847  }
848 }
849 
850 void
852 {
853  // need time to report new UE measurements, and wait because of filtering
854  if ((Simulator::Now() - m_teleportTime) < MilliSeconds(400))
855  {
856  return;
857  }
858 
859  NS_LOG_DEBUG("UL DATA Power allocation :");
860  Values::const_iterator it;
861  uint32_t i = 0;
862  uint32_t numActiveRbs = 0;
863 
864  // At the moment I could not find a better way to find total number
865  // of active RBs. This method is independent of the bandwidth
866  // configuration done in a test scenario, thus, it requires
867  // minimum change to the script.
868  for (it = spectrumValue->ConstValuesBegin(); it != spectrumValue->ConstValuesEnd(); it++)
869  {
870  // Count the RB as active if it is part of
871  // the expected UL RBs and has Power Spectral Density (PSD) > 0
872  if (m_expectedUlRb[numActiveRbs] == true && (*it) > 0)
873  {
874  numActiveRbs++;
875  }
876  }
877  NS_LOG_DEBUG("Total number of active RBs = " << numActiveRbs);
878 
879  // The uplink power control and the uplink PSD
880  // calculation only consider active resource blocks.
881  for (it = spectrumValue->ConstValuesBegin(); it != spectrumValue->ConstValuesEnd(); it++)
882  {
883  double power = (*it) * (numActiveRbs * 180000);
884  NS_LOG_DEBUG("RB " << i << " POWER: " << power
885  << " expectedUlPower: " << m_expectedUlPower);
886  if (m_expectedUlRb[i] == false && power > 0)
887  {
888  m_usedWrongUlRbg = true;
889  }
890  else if (m_expectedUlRb[i] == true && power > 0)
891  {
894  0.01,
895  "Wrong Data Channel UL Power level"
896  << Simulator::Now().As(Time::S));
897  }
898  i++;
899  }
900 }
901 
902 void
904 {
905  NS_LOG_FUNCTION(this);
906  NS_LOG_DEBUG("Teleport UE to : (" << x << ", " << y << ", 0)");
908  m_ueMobility->SetPosition(Vector(x, y, 0.0));
909 }
910 
911 void
913  uint32_t y,
914  double expectedPower,
915  std::vector<bool> expectedDlRb)
916 {
917  NS_LOG_FUNCTION(this);
918  NS_LOG_DEBUG("Teleport UE to : (" << x << ", " << y << ", 0)");
920  m_ueMobility->SetPosition(Vector(x, y, 0.0));
921  m_expectedDlPower = expectedPower;
922  m_expectedDlRb = expectedDlRb;
923 }
924 
925 void
927  uint32_t x,
928  uint32_t y,
929  double expectedPower,
930  std::vector<bool> expectedDlRb)
931 {
932  NS_LOG_FUNCTION(this);
933  NS_LOG_DEBUG("Teleport UE to : (" << x << ", " << y << ", 0)");
934 
935  Ptr<MobilityModel> ueMobility = ueNode->GetObject<MobilityModel>();
936  ueMobility->SetPosition(Vector(x, y, 0.0));
938  m_expectedDlPower = expectedPower;
939  m_expectedDlRb = expectedDlRb;
940 }
941 
942 void
943 LteFrAreaTestCase::SetDlExpectedValues(double expectedDlPower, std::vector<bool> expectedDlRb)
944 {
945  NS_LOG_FUNCTION(this);
946  m_expectedDlPower = expectedDlPower;
947  m_expectedDlRb = expectedDlRb;
948 }
949 
950 void
951 LteFrAreaTestCase::SetUlExpectedValues(double expectedUlPower, std::vector<bool> expectedUlRb)
952 {
953  NS_LOG_FUNCTION(this);
954  m_expectedUlPower = expectedUlPower;
955  m_expectedUlRb = expectedUlRb;
956 }
957 
958 void
960 {
961 }
962 
963 LteStrictFrAreaTestCase::LteStrictFrAreaTestCase(std::string name, std::string schedulerType)
964  : LteFrAreaTestCase(name, schedulerType)
965 {
966  NS_LOG_INFO("Creating LteFrTestCase");
967 }
968 
970 {
971 }
972 
973 void
975 {
976  NS_LOG_DEBUG("LteStrictFrAreaTestCase");
977 
978  Config::Reset();
979  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(true));
980  Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue(false));
981  Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue(false));
982 
983  double eNbTxPower = 30;
984  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNbTxPower));
985  Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(10.0));
986  Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
987 
988  Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
989  Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(false));
990 
991  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
992 
993  // Create Nodes: eNodeB and UE
994  NodeContainer enbNodes;
995  NodeContainer ueNodes1;
996  NodeContainer ueNodes2;
997  enbNodes.Create(2);
998  ueNodes1.Create(1);
999  ueNodes2.Create(1);
1000  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes1, ueNodes2);
1001 
1002  /*
1003  * The topology is the following:
1004  *
1005  * eNB1 UE1 eNB2
1006  * | | |
1007  * x ------------ x ------------------------ x ------------ x----UE2
1008  * 200 m 600 m 200 m 20 m
1009  *
1010  */
1011 
1012  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1013  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // eNB1
1014  positionAlloc->Add(Vector(1000, 0.0, 0.0)); // eNB2
1015  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // UE1
1016  positionAlloc->Add(Vector(1020, 0.0, 0.0)); // UE2
1018  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1019  mobility.SetPositionAllocator(positionAlloc);
1020  mobility.Install(allNodes);
1021  m_ueMobility = ueNodes1.Get(0)->GetObject<MobilityModel>();
1022 
1023  // Disable layer-3 filtering
1024  Config::SetDefault("ns3::LteEnbRrc::RsrpFilterCoefficient", UintegerValue(0));
1025  Config::SetDefault("ns3::LteEnbRrc::RsrqFilterCoefficient", UintegerValue(0));
1026 
1027  // Create Devices and install them in the Nodes (eNB and UE)
1028  NetDeviceContainer enbDevs;
1029  NetDeviceContainer ueDevs1;
1030  NetDeviceContainer ueDevs2;
1031  lteHelper->SetSchedulerType(m_schedulerType);
1032 
1033  lteHelper->SetFfrAlgorithmType("ns3::LteFrStrictAlgorithm");
1034  lteHelper->SetFfrAlgorithmAttribute("RsrqThreshold", UintegerValue(25));
1035  lteHelper->SetFfrAlgorithmAttribute("CenterPowerOffset",
1036  UintegerValue(LteRrcSap::PdschConfigDedicated::dB0));
1037  lteHelper->SetFfrAlgorithmAttribute("EdgePowerOffset",
1038  UintegerValue(LteRrcSap::PdschConfigDedicated::dB3));
1039 
1040  lteHelper->SetFfrAlgorithmAttribute("DlCommonSubBandwidth", UintegerValue(6));
1041  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandOffset", UintegerValue(6));
1042  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandwidth", UintegerValue(6));
1043 
1044  lteHelper->SetFfrAlgorithmAttribute("UlCommonSubBandwidth", UintegerValue(6));
1045  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandOffset", UintegerValue(6));
1046  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandwidth", UintegerValue(6));
1047  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(0)));
1048 
1049  lteHelper->SetFfrAlgorithmType("ns3::LteFrNoOpAlgorithm");
1050  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(1)));
1051 
1052  ueDevs1 = lteHelper->InstallUeDevice(ueNodes1);
1053  ueDevs2 = lteHelper->InstallUeDevice(ueNodes2);
1054 
1055  // Attach a UE to a eNB
1056  lteHelper->Attach(ueDevs1, enbDevs.Get(0));
1057  lteHelper->Attach(ueDevs2, enbDevs.Get(1));
1058 
1059  // Activate the default EPS bearer
1060  // Since this test includes the Token Bank Fair Queue Scheduler
1061  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1062  // bearer as the dedicated bearer with QoS.
1063  GbrQosInformation qos;
1064  qos.mbrUl = 1e6;
1065  qos.mbrDl = 1e6;
1066  qos.gbrUl = 1e4;
1067  qos.gbrDl = 1e4;
1068 
1069  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1070  EpsBearer bearer(q, qos);
1071 
1072  lteHelper->ActivateDataRadioBearer(ueDevs1, bearer);
1073  lteHelper->ActivateDataRadioBearer(ueDevs2, bearer);
1074 
1075  // Test SpectrumPhy to get signals form DL channel
1076  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
1077  ->GetObject<LteEnbNetDevice>()
1078  ->GetPhy()
1079  ->GetDownlinkSpectrumPhy()
1081  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
1082 
1083  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1084  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
1085  testDlSpectrumPhy->SetRxSpectrumModel(
1086  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
1087  dlChannel->AddRx(testDlSpectrumPhy);
1088 
1089  testDlSpectrumPhy->SetCellId(1);
1090 
1091  testDlSpectrumPhy->TraceConnectWithoutContext(
1092  "RxStart",
1094 
1095  // Test SpectrumPhy to get signals form UL channel
1096  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get(0)
1097  ->GetObject<LteUeNetDevice>()
1098  ->GetPhy()
1099  ->GetUplinkSpectrumPhy()
1101  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
1102 
1103  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1104  testUlSpectrumPhy->SetRxSpectrumModel(
1105  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
1106  ulChannel->AddRx(testUlSpectrumPhy);
1107 
1108  testUlSpectrumPhy->SetCellId(1);
1109 
1110  testUlSpectrumPhy->TraceConnectWithoutContext(
1111  "RxStart",
1113 
1114  std::vector<bool> expectedDlRbCenterArea;
1115  expectedDlRbCenterArea.resize(m_dlBandwidth, false);
1116  std::vector<bool> expectedUlRbCenterArea;
1117  expectedUlRbCenterArea.resize(m_ulBandwidth, false);
1118  for (uint32_t i = 0; i < 6; i++)
1119  {
1120  expectedDlRbCenterArea[i] = true;
1121  expectedUlRbCenterArea[i] = true;
1122  }
1123 
1124  std::vector<bool> expectedDlRbEdgeArea;
1125  expectedDlRbEdgeArea.resize(m_dlBandwidth, false);
1126  std::vector<bool> expectedUlRbEdgeArea;
1127  expectedUlRbEdgeArea.resize(m_ulBandwidth, false);
1128  for (uint32_t i = 12; i < 18; i++)
1129  {
1130  expectedDlRbEdgeArea[i] = true;
1131  expectedUlRbEdgeArea[i] = true;
1132  }
1133 
1134  Simulator::Schedule(MilliSeconds(1),
1136  this,
1137  200,
1138  0,
1139  1,
1140  expectedDlRbCenterArea);
1141  Simulator::Schedule(MilliSeconds(1),
1143  this,
1144  0.0150543,
1145  expectedUlRbCenterArea);
1146 
1147  Simulator::Schedule(MilliSeconds(501),
1149  this,
1150  800,
1151  0,
1152  2,
1153  expectedDlRbEdgeArea);
1154  Simulator::Schedule(MilliSeconds(501),
1156  this,
1157  0.199526,
1158  expectedUlRbEdgeArea);
1159 
1160  Simulator::Schedule(MilliSeconds(1001),
1162  this,
1163  200,
1164  0,
1165  1,
1166  expectedDlRbCenterArea);
1167  Simulator::Schedule(MilliSeconds(1001),
1169  this,
1170  0.0150543,
1171  expectedUlRbCenterArea);
1172 
1173  Simulator::Stop(Seconds(1.500));
1174  Simulator::Run();
1175 
1176  NS_TEST_ASSERT_MSG_EQ(m_usedWrongDlRbg, false, "Scheduler used DL RB muted by FFR Algorithm");
1177  NS_TEST_ASSERT_MSG_EQ(m_usedWrongUlRbg, false, "Scheduler used UL RB muted by FFR Algorithm");
1178 
1179  Simulator::Destroy();
1180 }
1181 
1182 LteSoftFrAreaTestCase::LteSoftFrAreaTestCase(std::string name, std::string schedulerType)
1183  : LteFrAreaTestCase(name, schedulerType)
1184 {
1185  NS_LOG_INFO("Creating LteSoftFrAreaTestCase");
1186 }
1187 
1189 {
1190 }
1191 
1192 void
1194 {
1195  NS_LOG_DEBUG("LteSoftFrAreaTestCase");
1196 
1197  Config::Reset();
1198  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(true));
1199  Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue(false));
1200  Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue(false));
1201 
1202  double eNbTxPower = 30;
1203  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNbTxPower));
1204  Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(10.0));
1205  Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
1206 
1207  Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
1208  Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(false));
1209 
1210  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
1211 
1212  // Create Nodes: eNodeB and UE
1213  NodeContainer enbNodes;
1214  NodeContainer ueNodes1;
1215  NodeContainer ueNodes2;
1216  enbNodes.Create(2);
1217  ueNodes1.Create(1);
1218  ueNodes2.Create(1);
1219  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes1, ueNodes2);
1220 
1221  /*
1222  * The topology is the following:
1223  *
1224  * eNB1 UE1 eNB2
1225  * | | |
1226  * x ------------ x ------------------------ x ------------ x----UE2
1227  * 200 m 600 m 200 m 20 m
1228  *
1229  */
1230 
1231  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1232  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // eNB1
1233  positionAlloc->Add(Vector(1000, 0.0, 0.0)); // eNB2
1234  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // UE1
1235  positionAlloc->Add(Vector(1020, 0.0, 0.0)); // UE2
1237  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1238  mobility.SetPositionAllocator(positionAlloc);
1239  mobility.Install(allNodes);
1240  m_ueMobility = ueNodes1.Get(0)->GetObject<MobilityModel>();
1241 
1242  // Disable layer-3 filtering
1243  Config::SetDefault("ns3::LteEnbRrc::RsrpFilterCoefficient", UintegerValue(0));
1244  Config::SetDefault("ns3::LteEnbRrc::RsrqFilterCoefficient", UintegerValue(0));
1245 
1246  // Create Devices and install them in the Nodes (eNB and UE)
1247  NetDeviceContainer enbDevs;
1248  NetDeviceContainer ueDevs1;
1249  NetDeviceContainer ueDevs2;
1250  lteHelper->SetSchedulerType(m_schedulerType);
1251 
1252  lteHelper->SetFfrAlgorithmType("ns3::LteFrSoftAlgorithm");
1253  lteHelper->SetFfrAlgorithmAttribute("AllowCenterUeUseEdgeSubBand", BooleanValue(false));
1254  lteHelper->SetFfrAlgorithmAttribute("RsrqThreshold", UintegerValue(25));
1255  lteHelper->SetFfrAlgorithmAttribute("CenterPowerOffset",
1256  UintegerValue(LteRrcSap::PdschConfigDedicated::dB0));
1257  lteHelper->SetFfrAlgorithmAttribute("EdgePowerOffset",
1258  UintegerValue(LteRrcSap::PdschConfigDedicated::dB3));
1259 
1260  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandOffset", UintegerValue(8));
1261  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandwidth", UintegerValue(8));
1262  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandOffset", UintegerValue(8));
1263  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandwidth", UintegerValue(8));
1264  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(0)));
1265 
1266  lteHelper->SetFfrAlgorithmType("ns3::LteFrNoOpAlgorithm");
1267  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(1)));
1268 
1269  ueDevs1 = lteHelper->InstallUeDevice(ueNodes1);
1270  ueDevs2 = lteHelper->InstallUeDevice(ueNodes2);
1271 
1272  // Attach a UE to a eNB
1273  lteHelper->Attach(ueDevs1, enbDevs.Get(0));
1274  lteHelper->Attach(ueDevs2, enbDevs.Get(1));
1275 
1276  // Activate the default EPS bearer
1277  // Since this test includes the Token Bank Fair Queue Scheduler
1278  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1279  // bearer as the dedicated bearer with QoS.
1280  GbrQosInformation qos;
1281  qos.mbrUl = 1e6;
1282  qos.mbrDl = 1e6;
1283  qos.gbrUl = 1e4;
1284  qos.gbrDl = 1e4;
1285 
1286  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1287  EpsBearer bearer(q, qos);
1288  lteHelper->ActivateDataRadioBearer(ueDevs1, bearer);
1289  lteHelper->ActivateDataRadioBearer(ueDevs2, bearer);
1290 
1291  // Test SpectrumPhy to get signals form DL channel
1292  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
1293  ->GetObject<LteEnbNetDevice>()
1294  ->GetPhy()
1295  ->GetDownlinkSpectrumPhy()
1297  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
1298 
1299  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1300  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
1301  testDlSpectrumPhy->SetRxSpectrumModel(
1302  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
1303  dlChannel->AddRx(testDlSpectrumPhy);
1304 
1305  testDlSpectrumPhy->SetCellId(1);
1306 
1307  testDlSpectrumPhy->TraceConnectWithoutContext(
1308  "RxStart",
1310 
1311  // Test SpectrumPhy to get signals form UL channel
1312  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get(0)
1313  ->GetObject<LteUeNetDevice>()
1314  ->GetPhy()
1315  ->GetUplinkSpectrumPhy()
1317  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
1318 
1319  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1320  testUlSpectrumPhy->SetRxSpectrumModel(
1321  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
1322  ulChannel->AddRx(testUlSpectrumPhy);
1323 
1324  testUlSpectrumPhy->SetCellId(1);
1325 
1326  testUlSpectrumPhy->TraceConnectWithoutContext(
1327  "RxStart",
1329 
1330  std::vector<bool> expectedDlRbCenterArea;
1331  expectedDlRbCenterArea.resize(m_dlBandwidth, false);
1332  std::vector<bool> expectedUlRbCenterArea;
1333  expectedUlRbCenterArea.resize(m_ulBandwidth, false);
1334  for (uint32_t i = 0; i < 8; i++)
1335  {
1336  expectedDlRbCenterArea[i] = true;
1337  expectedUlRbCenterArea[i] = true;
1338  }
1339  for (uint32_t i = 16; i < 25; i++)
1340  {
1341  expectedDlRbCenterArea[i] = true;
1342  }
1343 
1344  std::vector<bool> expectedDlRbEdgeArea;
1345  expectedDlRbEdgeArea.resize(m_dlBandwidth, false);
1346  std::vector<bool> expectedUlRbEdgeArea;
1347  expectedUlRbEdgeArea.resize(m_ulBandwidth, false);
1348  for (uint32_t i = 8; i < 16; i++)
1349  {
1350  expectedDlRbEdgeArea[i] = true;
1351  expectedUlRbEdgeArea[i] = true;
1352  }
1353 
1354  Simulator::Schedule(MilliSeconds(1),
1356  this,
1357  200,
1358  0,
1359  1,
1360  expectedDlRbCenterArea);
1361  Simulator::Schedule(MilliSeconds(1),
1363  this,
1364  0.0150543,
1365  expectedUlRbCenterArea);
1366 
1367  Simulator::Schedule(MilliSeconds(501),
1369  this,
1370  800,
1371  0,
1372  2,
1373  expectedDlRbEdgeArea);
1374  Simulator::Schedule(MilliSeconds(501),
1376  this,
1377  0.199526,
1378  expectedUlRbEdgeArea);
1379 
1380  Simulator::Schedule(MilliSeconds(1001),
1382  this,
1383  200,
1384  0,
1385  1,
1386  expectedDlRbCenterArea);
1387  Simulator::Schedule(MilliSeconds(1001),
1389  this,
1390  0.0150543,
1391  expectedUlRbCenterArea);
1392 
1393  Simulator::Stop(Seconds(1.500));
1394  Simulator::Run();
1395 
1396 #if 0
1398  "Scheduler used DL RBG muted by FFR Algorithm");
1399 
1400 #endif
1401  NS_TEST_ASSERT_MSG_EQ(m_usedWrongUlRbg, false, "Scheduler used UL RB muted by FFR Algorithm");
1402 
1403  Simulator::Destroy();
1404 }
1405 
1406 LteSoftFfrAreaTestCase::LteSoftFfrAreaTestCase(std::string name, std::string schedulerType)
1407  : LteFrAreaTestCase(name, schedulerType)
1408 {
1409  NS_LOG_INFO("Creating LteSoftFfrAreaTestCase");
1410 }
1411 
1413 {
1414 }
1415 
1416 void
1418 {
1419  NS_LOG_DEBUG("LteSoftFfrAreaTestCase");
1420 
1421  Config::Reset();
1422  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(true));
1423  Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue(false));
1424  Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue(false));
1425 
1426  double eNbTxPower = 30;
1427  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNbTxPower));
1428  Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(10.0));
1429  Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
1430 
1431  Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
1432  Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(false));
1433 
1434  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
1435 
1436  // Create Nodes: eNodeB and UE
1437  NodeContainer enbNodes;
1438  NodeContainer ueNodes1;
1439  NodeContainer ueNodes2;
1440  enbNodes.Create(2);
1441  ueNodes1.Create(1);
1442  ueNodes2.Create(1);
1443  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes1, ueNodes2);
1444 
1445  /*
1446  * The topology is the following:
1447  *
1448  * eNB1 UE1 eNB2
1449  * | | |
1450  * x ------------ x ------------------------ x ------------ x----UE2
1451  * 200 m 600 m 200 m 20 m
1452  *
1453  */
1454 
1455  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1456  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // eNB1
1457  positionAlloc->Add(Vector(1000, 0.0, 0.0)); // eNB2
1458  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // UE1
1459  positionAlloc->Add(Vector(1020, 0.0, 0.0)); // UE2
1461  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1462  mobility.SetPositionAllocator(positionAlloc);
1463  mobility.Install(allNodes);
1464  m_ueMobility = ueNodes1.Get(0)->GetObject<MobilityModel>();
1465 
1466  // Disable layer-3 filtering
1467  Config::SetDefault("ns3::LteEnbRrc::RsrpFilterCoefficient", UintegerValue(0));
1468  Config::SetDefault("ns3::LteEnbRrc::RsrqFilterCoefficient", UintegerValue(0));
1469 
1470  // Create Devices and install them in the Nodes (eNB and UE)
1471  NetDeviceContainer enbDevs;
1472  NetDeviceContainer ueDevs1;
1473  NetDeviceContainer ueDevs2;
1474  lteHelper->SetSchedulerType(m_schedulerType);
1475 
1476  lteHelper->SetFfrAlgorithmType("ns3::LteFfrSoftAlgorithm");
1477  lteHelper->SetFfrAlgorithmAttribute("CenterRsrqThreshold", UintegerValue(28));
1478  lteHelper->SetFfrAlgorithmAttribute("EdgeRsrqThreshold", UintegerValue(18));
1479  lteHelper->SetFfrAlgorithmAttribute("CenterAreaPowerOffset",
1480  UintegerValue(LteRrcSap::PdschConfigDedicated::dB_3));
1481  lteHelper->SetFfrAlgorithmAttribute("MediumAreaPowerOffset",
1482  UintegerValue(LteRrcSap::PdschConfigDedicated::dB0));
1483  lteHelper->SetFfrAlgorithmAttribute("EdgeAreaPowerOffset",
1484  UintegerValue(LteRrcSap::PdschConfigDedicated::dB3));
1485 
1486  lteHelper->SetFfrAlgorithmAttribute("UlCommonSubBandwidth", UintegerValue(6));
1487  lteHelper->SetFfrAlgorithmAttribute("DlCommonSubBandwidth", UintegerValue(6));
1488 
1489  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandOffset", UintegerValue(6));
1490  lteHelper->SetFfrAlgorithmAttribute("DlEdgeSubBandwidth", UintegerValue(6));
1491  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandOffset", UintegerValue(6));
1492  lteHelper->SetFfrAlgorithmAttribute("UlEdgeSubBandwidth", UintegerValue(6));
1493  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(0)));
1494 
1495  lteHelper->SetFfrAlgorithmType("ns3::LteFrNoOpAlgorithm");
1496  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(1)));
1497 
1498  ueDevs1 = lteHelper->InstallUeDevice(ueNodes1);
1499  ueDevs2 = lteHelper->InstallUeDevice(ueNodes2);
1500 
1501  // Attach a UE to a eNB
1502  lteHelper->Attach(ueDevs1, enbDevs.Get(0));
1503  lteHelper->Attach(ueDevs2, enbDevs.Get(1));
1504 
1505  // Activate the default EPS bearer
1506  // Since this test includes the Token Bank Fair Queue Scheduler
1507  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1508  // bearer as the dedicated bearer with QoS.
1509  GbrQosInformation qos;
1510  qos.mbrUl = 1e6;
1511  qos.mbrDl = 1e6;
1512  qos.gbrUl = 1e4;
1513  qos.gbrDl = 1e4;
1514 
1515  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1516  EpsBearer bearer(q, qos);
1517  lteHelper->ActivateDataRadioBearer(ueDevs1, bearer);
1518  lteHelper->ActivateDataRadioBearer(ueDevs2, bearer);
1519 
1520  // Test SpectrumPhy to get signals form DL channel
1521  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
1522  ->GetObject<LteEnbNetDevice>()
1523  ->GetPhy()
1524  ->GetDownlinkSpectrumPhy()
1526  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
1527 
1528  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1529  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
1530  testDlSpectrumPhy->SetRxSpectrumModel(
1531  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
1532  dlChannel->AddRx(testDlSpectrumPhy);
1533 
1534  testDlSpectrumPhy->SetCellId(1);
1535 
1536  testDlSpectrumPhy->TraceConnectWithoutContext(
1537  "RxStart",
1539 
1540  // Test SpectrumPhy to get signals form UL channel
1541  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get(0)
1542  ->GetObject<LteUeNetDevice>()
1543  ->GetPhy()
1544  ->GetUplinkSpectrumPhy()
1546  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
1547 
1548  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1549  testUlSpectrumPhy->SetRxSpectrumModel(
1550  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
1551  ulChannel->AddRx(testUlSpectrumPhy);
1552 
1553  testUlSpectrumPhy->SetCellId(1);
1554 
1555  testUlSpectrumPhy->TraceConnectWithoutContext(
1556  "RxStart",
1558 
1559  double expectedDlPowerCenterArea = 0.5;
1560  std::vector<bool> expectedDlRbCenterArea;
1561  expectedDlRbCenterArea.resize(m_dlBandwidth, false);
1562  std::vector<bool> expectedUlRbCenterArea;
1563  expectedUlRbCenterArea.resize(m_ulBandwidth, false);
1564  for (uint32_t i = 6; i < 12; i++)
1565  {
1566  expectedDlRbCenterArea[i] = true;
1567  expectedUlRbCenterArea[i] = true;
1568  }
1569  for (uint32_t i = 18; i < 25; i++)
1570  {
1571  expectedDlRbCenterArea[i] = true;
1572  expectedUlRbCenterArea[i] = true;
1573  }
1574 
1575  double expectedDlPowerMiddleArea = 1.0;
1576  std::vector<bool> expectedDlRbMiddleArea;
1577  expectedDlRbMiddleArea.resize(m_dlBandwidth, false);
1578  std::vector<bool> expectedUlRbMiddleArea;
1579  expectedUlRbMiddleArea.resize(m_ulBandwidth, false);
1580  for (uint32_t i = 0; i < 6; i++)
1581  {
1582  expectedDlRbMiddleArea[i] = true;
1583  expectedUlRbMiddleArea[i] = true;
1584  }
1585 
1586  double expectedDlPowerEdgeArea = 2.0;
1587  std::vector<bool> expectedDlRbEdgeArea;
1588  expectedDlRbEdgeArea.resize(m_dlBandwidth, false);
1589  std::vector<bool> expectedUlRbEdgeArea;
1590  expectedUlRbEdgeArea.resize(m_ulBandwidth, false);
1591  for (uint32_t i = 12; i < 18; i++)
1592  {
1593  expectedDlRbEdgeArea[i] = true;
1594  expectedUlRbEdgeArea[i] = true;
1595  }
1596 
1597  Simulator::Schedule(MilliSeconds(1),
1599  this,
1600  200,
1601  0,
1602  expectedDlPowerCenterArea,
1603  expectedDlRbCenterArea);
1604  Simulator::Schedule(MilliSeconds(1),
1606  this,
1607  0.0150543,
1608  expectedUlRbCenterArea);
1609 
1610  Simulator::Schedule(MilliSeconds(501),
1612  this,
1613  600,
1614  0,
1615  expectedDlPowerMiddleArea,
1616  expectedDlRbMiddleArea);
1617  Simulator::Schedule(MilliSeconds(501),
1619  this,
1620  0.135489,
1621  expectedUlRbMiddleArea);
1622 
1623  Simulator::Schedule(MilliSeconds(1001),
1625  this,
1626  800,
1627  0,
1628  expectedDlPowerEdgeArea,
1629  expectedDlRbEdgeArea);
1630  Simulator::Schedule(MilliSeconds(1001),
1632  this,
1633  0.199526,
1634  expectedUlRbEdgeArea);
1635 
1636  Simulator::Schedule(MilliSeconds(1501),
1638  this,
1639  600,
1640  0,
1641  expectedDlPowerMiddleArea,
1642  expectedDlRbMiddleArea);
1643  Simulator::Schedule(MilliSeconds(1501),
1645  this,
1646  0.135489,
1647  expectedUlRbMiddleArea);
1648 
1649  Simulator::Schedule(MilliSeconds(2001),
1651  this,
1652  200,
1653  0,
1654  expectedDlPowerCenterArea,
1655  expectedDlRbCenterArea);
1656  Simulator::Schedule(MilliSeconds(2001),
1658  this,
1659  0.0150543,
1660  expectedUlRbCenterArea);
1661 
1662  Simulator::Stop(Seconds(2.500));
1663  Simulator::Run();
1664 
1665  NS_TEST_ASSERT_MSG_EQ(m_usedWrongDlRbg, false, "Scheduler used DL RBG muted by FFR Algorithm");
1666 
1667  NS_TEST_ASSERT_MSG_EQ(m_usedWrongUlRbg, false, "Scheduler used UL RB muted by FFR Algorithm");
1668 
1669  Simulator::Destroy();
1670 }
1671 
1672 LteEnhancedFfrAreaTestCase::LteEnhancedFfrAreaTestCase(std::string name, std::string schedulerType)
1673  : LteFrAreaTestCase(name, schedulerType)
1674 {
1675  NS_LOG_INFO("Creating LteEnhancedFfrAreaTestCase");
1676 }
1677 
1679 {
1680 }
1681 
1682 void
1684 {
1685  NS_LOG_DEBUG("LteEnhancedFfrAreaTestCase");
1686 
1687  Config::Reset();
1688  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(true));
1689  Config::SetDefault("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue(true));
1690  Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue(false));
1691  Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue(false));
1692 
1693  double eNbTxPower = 30;
1694  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNbTxPower));
1695  Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(10.0));
1696  Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
1697 
1698  Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
1699  Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(false));
1700 
1701  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
1702 
1703  // Create Nodes: eNodeB and UE
1704  NodeContainer enbNodes;
1705  NodeContainer ueNodes1;
1706  NodeContainer ueNodes2;
1707  enbNodes.Create(2);
1708  ueNodes1.Create(1);
1709  ueNodes2.Create(1);
1710  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes1, ueNodes2);
1711 
1712  /*
1713  * The topology is the following:
1714  *
1715  * eNB1 UE1 eNB2
1716  * | | |
1717  * x ------------ x ------------------------ x ------------ x----UE2
1718  * 200 m 600 m 200 m 20 m
1719  *
1720  */
1721 
1722  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1723  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // eNB1
1724  positionAlloc->Add(Vector(1000, 0.0, 0.0)); // eNB2
1725  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // UE1
1726  positionAlloc->Add(Vector(1020, 0.0, 0.0)); // UE2
1728  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1729  mobility.SetPositionAllocator(positionAlloc);
1730  mobility.Install(allNodes);
1731  m_ueMobility = ueNodes1.Get(0)->GetObject<MobilityModel>();
1732 
1733  // Disable layer-3 filtering
1734  Config::SetDefault("ns3::LteEnbRrc::RsrpFilterCoefficient", UintegerValue(0));
1735  Config::SetDefault("ns3::LteEnbRrc::RsrqFilterCoefficient", UintegerValue(0));
1736 
1737  // Create Devices and install them in the Nodes (eNB and UE)
1738  NetDeviceContainer enbDevs;
1739  NetDeviceContainer ueDevs1;
1740  NetDeviceContainer ueDevs2;
1741  lteHelper->SetSchedulerType(m_schedulerType);
1742  lteHelper->SetSchedulerAttribute("HarqEnabled", BooleanValue(true));
1743 
1744  lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(m_dlBandwidth));
1745  lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(m_ulBandwidth));
1746 
1747  lteHelper->SetFfrAlgorithmType("ns3::LteFfrEnhancedAlgorithm");
1748  lteHelper->SetFfrAlgorithmAttribute("RsrqThreshold", UintegerValue(25));
1749  lteHelper->SetFfrAlgorithmAttribute("DlCqiThreshold", UintegerValue(10));
1750  lteHelper->SetFfrAlgorithmAttribute("UlCqiThreshold", UintegerValue(15));
1751  lteHelper->SetFfrAlgorithmAttribute("CenterAreaPowerOffset",
1752  UintegerValue(LteRrcSap::PdschConfigDedicated::dB_6));
1753  lteHelper->SetFfrAlgorithmAttribute("EdgeAreaPowerOffset",
1754  UintegerValue(LteRrcSap::PdschConfigDedicated::dB0));
1755 
1756  lteHelper->SetFfrAlgorithmAttribute("UlSubBandOffset", UintegerValue(0));
1757  lteHelper->SetFfrAlgorithmAttribute("UlReuse3SubBandwidth", UintegerValue(4));
1758  lteHelper->SetFfrAlgorithmAttribute("UlReuse1SubBandwidth", UintegerValue(4));
1759 
1760  lteHelper->SetFfrAlgorithmAttribute("DlSubBandOffset", UintegerValue(0));
1761  lteHelper->SetFfrAlgorithmAttribute("DlReuse3SubBandwidth", UintegerValue(4));
1762  lteHelper->SetFfrAlgorithmAttribute("DlReuse1SubBandwidth", UintegerValue(4));
1763 
1764  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(0)));
1765 
1766  lteHelper->SetFfrAlgorithmType("ns3::LteFrNoOpAlgorithm");
1767  enbDevs.Add(lteHelper->InstallEnbDevice(enbNodes.Get(1)));
1768 
1769  ueDevs1 = lteHelper->InstallUeDevice(ueNodes1);
1770  ueDevs2 = lteHelper->InstallUeDevice(ueNodes2);
1771 
1772  // Attach a UE to a eNB
1773  lteHelper->Attach(ueDevs1, enbDevs.Get(0));
1774  lteHelper->Attach(ueDevs2, enbDevs.Get(1));
1775 
1776  // Activate the default EPS bearer
1777  // Since this test includes the Token Bank Fair Queue Scheduler
1778  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1779  // bearer as the dedicated bearer with QoS.
1780  GbrQosInformation qos;
1781  qos.mbrUl = 1e6;
1782  qos.mbrDl = 1e6;
1783  qos.gbrUl = 1e4;
1784  qos.gbrDl = 1e4;
1785 
1786  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1787  EpsBearer bearer(q, qos);
1788  lteHelper->ActivateDataRadioBearer(ueDevs1, bearer);
1789  lteHelper->ActivateDataRadioBearer(ueDevs2, bearer);
1790 
1791  // Test SpectrumPhy to get signals form DL channel
1792  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
1793  ->GetObject<LteEnbNetDevice>()
1794  ->GetPhy()
1795  ->GetDownlinkSpectrumPhy()
1797  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
1798 
1799  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1800  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
1801  testDlSpectrumPhy->SetRxSpectrumModel(
1802  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
1803  dlChannel->AddRx(testDlSpectrumPhy);
1804 
1805  testDlSpectrumPhy->SetCellId(1);
1806 
1807  testDlSpectrumPhy->TraceConnectWithoutContext(
1808  "RxStart",
1810 
1811  // Test SpectrumPhy to get signals form UL channel
1812  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get(0)
1813  ->GetObject<LteUeNetDevice>()
1814  ->GetPhy()
1815  ->GetUplinkSpectrumPhy()
1817  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
1818 
1819  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
1820  testUlSpectrumPhy->SetRxSpectrumModel(
1821  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
1822  ulChannel->AddRx(testUlSpectrumPhy);
1823 
1824  testUlSpectrumPhy->SetCellId(1);
1825 
1826  testUlSpectrumPhy->TraceConnectWithoutContext(
1827  "RxStart",
1829 
1830  double expectedDlPowerCenterArea = 0.251189;
1831  std::vector<bool> expectedDlRbCenterArea;
1832  expectedDlRbCenterArea.resize(m_dlBandwidth, false);
1833  std::vector<bool> expectedUlRbCenterArea;
1834  expectedUlRbCenterArea.resize(m_ulBandwidth, false);
1835  for (uint32_t i = 0; i < 8; i++)
1836  {
1837  expectedDlRbCenterArea[i] = true;
1838  expectedUlRbCenterArea[i] = true;
1839  }
1840  for (uint32_t i = 12; i < 16; i++)
1841  {
1842  expectedDlRbCenterArea[i] = true;
1843  expectedUlRbCenterArea[i] = true;
1844  }
1845  for (uint32_t i = 20; i < 24; i++)
1846  {
1847  expectedDlRbCenterArea[i] = true;
1848  expectedUlRbCenterArea[i] = true;
1849  }
1850 
1851  double expectedDlPowerMiddleArea = 0.251189;
1852  std::vector<bool> expectedDlRbMiddleArea;
1853  expectedDlRbMiddleArea.resize(m_dlBandwidth, false);
1854  std::vector<bool> expectedUlRbMiddleArea;
1855  expectedUlRbMiddleArea.resize(m_ulBandwidth, false);
1856  for (uint32_t i = 4; i < 8; i++)
1857  {
1858  expectedDlRbMiddleArea[i] = true;
1859  expectedUlRbMiddleArea[i] = true;
1860  }
1861 
1862  double expectedDlPowerEdgeArea = 1.0;
1863  std::vector<bool> expectedDlRbEdgeArea;
1864  expectedDlRbEdgeArea.resize(m_dlBandwidth, false);
1865  std::vector<bool> expectedUlRbEdgeArea;
1866  expectedUlRbEdgeArea.resize(m_ulBandwidth, false);
1867  for (uint32_t i = 0; i < 4; i++)
1868  {
1869  expectedDlRbEdgeArea[i] = true;
1870  expectedUlRbEdgeArea[i] = true;
1871  }
1872 
1873  Simulator::Schedule(MilliSeconds(1),
1875  this,
1876  100,
1877  0,
1878  expectedDlPowerCenterArea,
1879  expectedDlRbCenterArea);
1880  Simulator::Schedule(MilliSeconds(1),
1882  this,
1883  0.00250905,
1884  expectedUlRbCenterArea);
1885 
1886  Simulator::Schedule(MilliSeconds(501),
1888  this,
1889  300,
1890  0,
1891  expectedDlPowerMiddleArea,
1892  expectedDlRbMiddleArea);
1893  Simulator::Schedule(MilliSeconds(501),
1895  this,
1896  0.0225815,
1897  expectedUlRbMiddleArea);
1898 
1899  Simulator::Schedule(MilliSeconds(1001),
1901  this,
1902  600,
1903  0,
1904  expectedDlPowerEdgeArea,
1905  expectedDlRbEdgeArea);
1906  Simulator::Schedule(MilliSeconds(1001),
1908  this,
1909  0.0903259,
1910  expectedUlRbEdgeArea);
1911 
1912  Simulator::Schedule(MilliSeconds(1501),
1914  this,
1915  100,
1916  0,
1917  expectedDlPowerCenterArea,
1918  expectedDlRbCenterArea);
1919  Simulator::Schedule(MilliSeconds(1501),
1921  this,
1922  0.00250905,
1923  expectedUlRbCenterArea);
1924 
1925  Simulator::Schedule(MilliSeconds(2001),
1927  this,
1928  300,
1929  0,
1930  expectedDlPowerMiddleArea,
1931  expectedDlRbMiddleArea);
1932  Simulator::Schedule(MilliSeconds(2001),
1934  this,
1935  0.0225815,
1936  expectedUlRbCenterArea);
1937 
1938  Simulator::Stop(Seconds(2.500));
1939  Simulator::Run();
1940 
1941  NS_TEST_ASSERT_MSG_EQ(m_usedWrongDlRbg, false, "Scheduler used DL RBG muted by FFR Algorithm");
1942 
1943  NS_TEST_ASSERT_MSG_EQ(m_usedWrongUlRbg, false, "Scheduler used UL RB muted by FFR Algorithm");
1944 
1945  Simulator::Destroy();
1946 }
1947 
1949  std::string schedulerType)
1950  : LteFrAreaTestCase(name, schedulerType)
1951 {
1952  NS_LOG_INFO("Creating LteDistributedFfrAreaTestCase");
1953 }
1954 
1956 {
1957 }
1958 
1959 void
1961 {
1962  NS_LOG_DEBUG("LteDistributedFfrAreaTestCase");
1963 
1964  Config::Reset();
1965  Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(true));
1966  Config::SetDefault("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue(true));
1967  Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue(false));
1968  Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue(false));
1969 
1970  double eNbTxPower = 30;
1971  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNbTxPower));
1972  Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(10.0));
1973  Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
1974 
1975  Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
1976  Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(false));
1977 
1978  // Disable layer-3 filtering
1979  Config::SetDefault("ns3::LteEnbRrc::RsrpFilterCoefficient", UintegerValue(0));
1980  Config::SetDefault("ns3::LteEnbRrc::RsrqFilterCoefficient", UintegerValue(0));
1981 
1982  uint16_t bandwidth = 25;
1983 
1984  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
1985  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper>();
1986  lteHelper->SetEpcHelper(epcHelper);
1987  lteHelper->SetHandoverAlgorithmType("ns3::NoOpHandoverAlgorithm"); // disable automatic handover
1988 
1989  Ptr<Node> pgw = epcHelper->GetPgwNode();
1990 
1991  // Create a single RemoteHost
1992  NodeContainer remoteHostContainer;
1993  remoteHostContainer.Create(1);
1994  Ptr<Node> remoteHost = remoteHostContainer.Get(0);
1995  InternetStackHelper internet;
1996  internet.Install(remoteHostContainer);
1997 
1998  // Create the Internet
1999  PointToPointHelper p2ph;
2000  p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
2001  p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
2002  p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
2003  NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
2004  Ipv4AddressHelper ipv4h;
2005  ipv4h.SetBase("1.0.0.0", "255.0.0.0");
2006  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
2007  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
2008 
2009  // Routing of the Internet Host (towards the LTE network)
2010  Ipv4StaticRoutingHelper ipv4RoutingHelper;
2011  Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
2012  ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
2013  // interface 0 is localhost, 1 is the p2p device
2014  remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
2015 
2016  // Create Nodes: eNodeB and UE
2017  NodeContainer enbNodes;
2018  NodeContainer ueNodes1;
2019  NodeContainer ueNodes2;
2020  enbNodes.Create(2);
2021  ueNodes1.Create(2);
2022  ueNodes2.Create(1);
2023  NodeContainer ueNodes = NodeContainer(ueNodes1, ueNodes2);
2024  NodeContainer allNodes = NodeContainer(enbNodes, ueNodes1, ueNodes2);
2025 
2026  /*
2027  * The topology is the following:
2028  *
2029  * eNB1 UE1 UE2 eNB2
2030  * | | | |
2031  * x ------------ x ------------------------ x ------------ x
2032  * 200 m 600 m 200 m
2033  *
2034  */
2035 
2036  // Install Mobility Model
2037  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2038  positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // eNB1
2039  positionAlloc->Add(Vector(1000, 0.0, 0.0)); // eNB2
2040 
2041  positionAlloc->Add(Vector(200, 0.0, 0.0)); // UE1
2042  positionAlloc->Add(Vector(200, 0.0, 0.0)); // UE1
2043  positionAlloc->Add(Vector(800, 0.0, 0.0)); // UE2
2044 
2046  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2047  mobility.SetPositionAllocator(positionAlloc);
2048  mobility.Install(allNodes);
2049  m_ueMobility = ueNodes2.Get(0)->GetObject<MobilityModel>();
2050 
2051  // Create Devices and install them in the Nodes (eNB and UE)
2052  NetDeviceContainer enbDevs;
2053  NetDeviceContainer ueDevs1;
2054  NetDeviceContainer ueDevs2;
2055  lteHelper->SetSchedulerType(m_schedulerType);
2056 
2057  lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(bandwidth));
2058  lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(bandwidth));
2059 
2060  lteHelper->SetFfrAlgorithmType("ns3::LteFfrDistributedAlgorithm");
2061  lteHelper->SetFfrAlgorithmAttribute("CalculationInterval", TimeValue(MilliSeconds(10)));
2062  lteHelper->SetFfrAlgorithmAttribute("RsrqThreshold", UintegerValue(25));
2063  lteHelper->SetFfrAlgorithmAttribute("RsrpDifferenceThreshold", UintegerValue(5));
2064  lteHelper->SetFfrAlgorithmAttribute("EdgeRbNum", UintegerValue(6));
2065  lteHelper->SetFfrAlgorithmAttribute("CenterPowerOffset",
2066  UintegerValue(LteRrcSap::PdschConfigDedicated::dB0));
2067  lteHelper->SetFfrAlgorithmAttribute("EdgePowerOffset",
2068  UintegerValue(LteRrcSap::PdschConfigDedicated::dB3));
2069 
2070  enbDevs = lteHelper->InstallEnbDevice(enbNodes);
2071  ueDevs1 = lteHelper->InstallUeDevice(ueNodes1);
2072  ueDevs2 = lteHelper->InstallUeDevice(ueNodes2);
2073 
2074  NetDeviceContainer ueLteDevs;
2075  ueLteDevs.Add(ueDevs1);
2076  ueLteDevs.Add(ueDevs2);
2077 
2078  // Add X2 interface
2079  lteHelper->AddX2Interface(enbNodes);
2080 
2081  // Install the IP stack on the UEs
2082  internet.Install(ueNodes);
2083  Ipv4InterfaceContainer ueIpIfaces;
2084  ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueLteDevs));
2085  // Assign IP address to UEs, and install applications
2086  for (uint32_t u = 0; u < ueNodes.GetN(); ++u)
2087  {
2088  Ptr<Node> ueNode = ueNodes.Get(u);
2089  // Set the default gateway for the UE
2090  Ptr<Ipv4StaticRouting> ueStaticRouting =
2091  ipv4RoutingHelper.GetStaticRouting(ueNode->GetObject<Ipv4>());
2092  ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
2093  }
2094 
2095  // Attach a UE to a eNB
2096  lteHelper->Attach(ueDevs1, enbDevs.Get(0));
2097  lteHelper->Attach(ueDevs2, enbDevs.Get(1));
2098 
2099  // Install and start applications on UEs and remote host
2100  uint16_t dlPort = 10000;
2101  uint16_t ulPort = 20000;
2102 
2103  // randomize a bit start times to avoid simulation artifacts
2104  // (e.g., buffer overflows due to packet transmissions happening
2105  // exactly at the same time)
2106  Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable>();
2107  startTimeSeconds->SetAttribute("Min", DoubleValue(0));
2108  startTimeSeconds->SetAttribute("Max", DoubleValue(0.010));
2109 
2110  for (uint32_t u = 0; u < ueNodes.GetN(); ++u)
2111  {
2112  Ptr<Node> ue = ueNodes.Get(u);
2113  // Set the default gateway for the UE
2114  Ptr<Ipv4StaticRouting> ueStaticRouting =
2115  ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
2116  ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
2117 
2118  for (uint32_t b = 0; b < 1; ++b)
2119  {
2120  ++dlPort;
2121  ++ulPort;
2122 
2125 
2126  NS_LOG_LOGIC("installing UDP DL app for UE " << u);
2127  UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
2128  dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
2129  dlClientHelper.SetAttribute("Interval", TimeValue(MilliSeconds(1.0)));
2130  clientApps.Add(dlClientHelper.Install(remoteHost));
2131  PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
2132  InetSocketAddress(Ipv4Address::GetAny(), dlPort));
2133  serverApps.Add(dlPacketSinkHelper.Install(ue));
2134 
2135  NS_LOG_LOGIC("installing UDP UL app for UE " << u);
2136  UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
2137  ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
2138  ulClientHelper.SetAttribute("Interval", TimeValue(MilliSeconds(1.0)));
2139  clientApps.Add(ulClientHelper.Install(ue));
2140  PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
2141  InetSocketAddress(Ipv4Address::GetAny(), ulPort));
2142  serverApps.Add(ulPacketSinkHelper.Install(remoteHost));
2143 
2144  Ptr<EpcTft> tft = Create<EpcTft>();
2145  EpcTft::PacketFilter dlpf;
2146  dlpf.localPortStart = dlPort;
2147  dlpf.localPortEnd = dlPort;
2148  tft->Add(dlpf);
2149  EpcTft::PacketFilter ulpf;
2150  ulpf.remotePortStart = ulPort;
2151  ulpf.remotePortEnd = ulPort;
2152  tft->Add(ulpf);
2153  // Since this test includes the Token Bank Fair Queue Scheduler
2154  //(ns3::FdTbfqFfMacScheduler) we have to use GBR bearer with
2155  // certain QoS.
2156  GbrQosInformation qos;
2157  qos.mbrUl = 1e6;
2158  qos.mbrDl = 1e6;
2159  qos.gbrUl = 1e4;
2160  qos.gbrDl = 1e4;
2161 
2162  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
2163  EpsBearer bearer(q, qos);
2164  lteHelper->ActivateDedicatedEpsBearer(ueLteDevs.Get(u), bearer, tft);
2165 
2166  Time startTime = Seconds(startTimeSeconds->GetValue());
2167  serverApps.Start(startTime);
2168  clientApps.Start(startTime);
2169  }
2170  }
2171 
2172  // Test SpectrumPhy to get signals form DL channel
2173  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get(0)
2174  ->GetObject<LteEnbNetDevice>()
2175  ->GetPhy()
2176  ->GetDownlinkSpectrumPhy()
2178  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel();
2179 
2180  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
2181  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get(0)->GetObject<LteEnbNetDevice>();
2182  testDlSpectrumPhy->SetRxSpectrumModel(
2183  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetDlEarfcn(), m_dlBandwidth));
2184  dlChannel->AddRx(testDlSpectrumPhy);
2185 
2186  testDlSpectrumPhy->SetCellId(2);
2187 
2188  testDlSpectrumPhy->TraceConnectWithoutContext(
2189  "RxStart",
2191 
2192  // Test SpectrumPhy to get signals form UL channel
2193  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get(0)
2194  ->GetObject<LteUeNetDevice>()
2195  ->GetPhy()
2196  ->GetUplinkSpectrumPhy()
2198  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel();
2199 
2200  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy>();
2201  testUlSpectrumPhy->SetRxSpectrumModel(
2202  LteSpectrumValueHelper::GetSpectrumModel(eNbDev->GetUlEarfcn(), m_ulBandwidth));
2203  ulChannel->AddRx(testUlSpectrumPhy);
2204 
2205  testUlSpectrumPhy->SetCellId(2);
2206 
2207  testUlSpectrumPhy->TraceConnectWithoutContext(
2208  "RxStart",
2210 
2211  double expectedDlPowerCenterArea = 1.0;
2212  std::vector<bool> expectedDlRbCenterArea;
2213  expectedDlRbCenterArea.resize(m_dlBandwidth, false);
2214  std::vector<bool> expectedUlRbCenterArea;
2215  expectedUlRbCenterArea.resize(m_ulBandwidth, false);
2216  for (uint32_t i = 0; i < m_dlBandwidth; i++)
2217  {
2218  expectedDlRbCenterArea[i] = true;
2219  expectedUlRbCenterArea[i] = true;
2220  }
2221 
2222  double expectedDlPowerEdgeArea = 2.0;
2223  std::vector<bool> expectedDlRbEdgeArea;
2224  expectedDlRbEdgeArea.resize(m_dlBandwidth, false);
2225  std::vector<bool> expectedUlRbEdgeArea;
2226  expectedUlRbEdgeArea.resize(m_ulBandwidth, false);
2227  for (uint32_t i = 0; i < 6; i++)
2228  {
2229  expectedDlRbEdgeArea[i] = true;
2230  expectedUlRbEdgeArea[i] = true;
2231  }
2232 
2233  std::vector<bool> expectedDlRbEdgeArea2;
2234  expectedDlRbEdgeArea2.resize(m_dlBandwidth, false);
2235  std::vector<bool> expectedUlRbEdgeArea2;
2236  expectedUlRbEdgeArea2.resize(m_dlBandwidth, false);
2237  for (uint32_t i = 6; i < 12; i++)
2238  {
2239  expectedDlRbEdgeArea2[i] = true;
2240  expectedUlRbEdgeArea2[i] = true;
2241  }
2242 
2243  Simulator::Schedule(MilliSeconds(1),
2245  this,
2246  800,
2247  0,
2248  expectedDlPowerCenterArea,
2249  expectedDlRbCenterArea);
2250  Simulator::Schedule(MilliSeconds(1),
2252  this,
2253  0.0225815,
2254  expectedUlRbCenterArea);
2255 
2256  Simulator::Schedule(MilliSeconds(501),
2258  this,
2259  400,
2260  0,
2261  expectedDlPowerEdgeArea,
2262  expectedDlRbEdgeArea);
2263  Simulator::Schedule(MilliSeconds(501),
2265  this,
2266  0.135489,
2267  expectedUlRbEdgeArea);
2268 
2269  Simulator::Schedule(MilliSeconds(1001),
2271  this,
2272  ueNodes1.Get(0),
2273  600,
2274  0,
2275  expectedDlPowerEdgeArea,
2276  expectedDlRbEdgeArea2);
2277  Simulator::Schedule(MilliSeconds(1001),
2279  this,
2280  0.135489,
2281  expectedUlRbEdgeArea2);
2282 
2283  Simulator::Schedule(MilliSeconds(1501),
2285  this,
2286  ueNodes1.Get(0),
2287  200,
2288  0,
2289  expectedDlPowerEdgeArea,
2290  expectedDlRbEdgeArea);
2291  Simulator::Schedule(MilliSeconds(1501),
2293  this,
2294  0.135489,
2295  expectedUlRbEdgeArea);
2296 
2297  Simulator::Schedule(MilliSeconds(2001),
2299  this,
2300  800,
2301  0,
2302  expectedDlPowerCenterArea,
2303  expectedDlRbCenterArea);
2304  Simulator::Schedule(MilliSeconds(2001),
2306  this,
2307  0.0225815,
2308  expectedUlRbCenterArea);
2309 
2310  Simulator::Stop(Seconds(2.500));
2311  Simulator::Run();
2312 
2313 #if 0
2315  "Scheduler used DL RBG muted by FFR Algorithm");
2316 #endif
2317 
2318  NS_TEST_ASSERT_MSG_EQ(m_usedWrongUlRbg, false, "Scheduler used UL RB muted by FFR Algorithm");
2319 
2320  Simulator::Destroy();
2321 }
Lte Distributed Ffr Area Test Case.
LteDistributedFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
Lte Enhanced Ffr Area Test Case.
void DoRun() override
Implementation to actually run this TestCase.
LteEnhancedFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Test frequency reuse algorithm by teleporting UEs to different parts of area and checking if the freq...
Time m_teleportTime
the teleport time
LteFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
bool m_usedWrongUlRbg
used wrong UL RBG?
std::vector< bool > m_expectedDlRb
the expected DL per RB
void SimpleTeleportUe(uint32_t x, uint32_t y)
Simple teleport UE function.
uint16_t m_ulBandwidth
the UL bandwidth
uint16_t m_dlBandwidth
the DL bandwidth
std::vector< bool > m_expectedUlRb
expected UL per RB
void UlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
UL data receive start function.
void TeleportUe2(Ptr< Node > ueNode, uint32_t x, uint32_t y, double expectedPower, std::vector< bool > expectedDlRb)
Teleport UE 2 function.
void DlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
DL data receive start function.
double m_expectedUlPower
expected UL power
std::string m_schedulerType
the scheduler type
void SetUlExpectedValues(double expectedPower, std::vector< bool > expectedDlRb)
Set UL expected values function.
double m_expectedDlPower
the expected DL power
void SetDlExpectedValues(double expectedPower, std::vector< bool > expectedDlRb)
Set DL expected values function.
bool m_usedWrongDlRbg
used wrong DL RBG?
void TeleportUe(uint32_t x, uint32_t y, double expectedPower, std::vector< bool > expectedDlRb)
Teleport UE function.
Ptr< MobilityModel > m_ueMobility
the UE mobility model
void DoRun() override
Implementation to actually run this TestCase.
Test frequency reuse algorithm.
void DlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
DL data receive start function.
uint32_t m_userNum
the number of UE nodes
void UlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
UL data receive start function.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_dlBandwidth
the DL bandwidth
LteFrTestCase(std::string name, uint32_t userNum, uint16_t dlBandwidth, uint16_t ulBandwidth, std::vector< bool > availableDlRb, std::vector< bool > availableUlRb)
Constructor.
uint16_t m_ulBandwidth
the UL bandwidth
bool m_usedMutedDlRbg
used muted DL RBG?
std::vector< bool > m_availableDlRb
the available DL for each RB
std::vector< bool > m_availableUlRb
the available UL for each RB
bool m_usedMutedUlRbg
used muted UL RBG?
Test the fractional frequency reuse algorithms.
Test hard frequency reuse algorithm.
LteHardFrTestCase(std::string name, uint32_t userNum, std::string schedulerType, uint16_t dlBandwidth, uint16_t ulBandwidth, uint8_t dlSubBandOffset, uint16_t dlSubBandwidth, uint8_t ulSubBandOffset, uint16_t ulSubBandwidth, std::vector< bool > availableDlRb, std::vector< bool > availableUlRb)
Constructor.
uint8_t m_dlSubBandOffset
the DL subband offset
uint8_t m_ulSubBandwidth
UL subband offset.
uint8_t m_ulSubBandOffset
UL subband offset.
void DoRun() override
Implementation to actually run this TestCase.
uint8_t m_dlSubBandwidth
the DL subband width
std::string m_schedulerType
the scheduler type
Lte Soft Ffr Area Test Case.
void DoRun() override
Implementation to actually run this TestCase.
LteSoftFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Lte Soft Fr Area Test Case.
void DoRun() override
Implementation to actually run this TestCase.
LteSoftFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
LteStrictFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Test strict frequency reuse algorithm.
uint16_t m_ulCommonSubBandwidth
UL common subbandwidth.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_dlCommonSubBandwidth
DL common subbandwidth.
uint8_t m_dlEdgeSubBandOffset
DL edge subband offset.
uint8_t m_ulEdgeSubBandOffset
UL edge subband offset.
std::string m_schedulerType
scheduler type
LteStrictFrTestCase(std::string name, uint32_t userNum, std::string schedulerType, uint16_t dlBandwidth, uint16_t ulBandwidth, uint16_t dlCommonSubBandwidth, uint8_t dlEdgeSubBandOffset, uint16_t dlEdgeSubBandwidth, uint16_t ulCommonSubBandwidth, uint8_t ulEdgeSubBandOffset, uint16_t ulEdgeSubBandwidth, std::vector< bool > availableDlRb, std::vector< bool > availableUlRb)
Constructor.
uint16_t m_dlEdgeSubBandwidth
DL edge subbandwidth.
uint16_t m_ulEdgeSubBandwidth
UL edge subbandwidth.
holds a vector of ns3::Application pointers.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
Qci
QoS Class Indicator.
Definition: eps-bearer.h:106
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:79
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:258
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
The eNodeB device implementation.
uint32_t GetUlEarfcn() const
uint32_t GetDlEarfcn() const
void SetFfrAlgorithmType(std::string type)
Set the type of FFR algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:316
void SetEpcHelper(Ptr< EpcHelper > h)
Set the EpcHelper to be used to setup the EPC network in conjunction with the setup of the LTE radio ...
Definition: lte-helper.cc:282
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Definition: lte-helper.cc:303
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:482
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:337
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the FFR algorithm to be created.
Definition: lte-helper.cc:324
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:289
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
Definition: lte-helper.cc:1044
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:409
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1441
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:497
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1318
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices.
Definition: lte-helper.cc:1159
The LteSpectrumPhy models the physical layer of LTE.
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
void SetPosition(const Vector &position)
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Ptr< Node > GetPgwNode() const override
Get the PGW node.
Ipv4Address GetUeDefaultGatewayAddress() override
Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices) override
Assign IPv4 addresses to UE devices.
keep track of a set of node pointers.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:200
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
encapsulates test code
Definition: test.h:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
AttributeValue implementation for Time.
Definition: nstime.h:1423
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
ApplicationContainer Install(NodeContainer c)
Hold an unsigned integer type.
Definition: uinteger.h:45
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:856
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
static LteFrequencyReuseTestSuite lteFrequencyReuseTestSuite
Static variable for test initialization.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:768
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:328
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:296
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:144
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition: test.h:337
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
void UlDataRxStartNofiticationArea(LteFrAreaTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
void DlDataRxStartNofiticationArea(LteFrAreaTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
void DlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
TestCase Data.
void UlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
serverApps
Definition: first.py:48
clientApps
Definition: first.py:58
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mobility
Definition: third.py:96
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:71
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:132
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:130
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:129
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:131
3GPP TS 36.413 9.2.1.18 GBR QoS Information
Definition: eps-bearer.h:36
uint64_t gbrDl
Guaranteed Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:42
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:43
uint64_t mbrDl
Maximum Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:44
uint64_t mbrUl
Maximum Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:45