A Discrete-Event Network Simulator
API
lte-test-frequency-reuse.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Piotr Gawlowicz
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
19  *
20  */
21 
22 #include <ns3/simulator.h>
23 #include <ns3/log.h>
24 #include <ns3/callback.h>
25 #include <ns3/config.h>
26 #include <ns3/string.h>
27 #include <ns3/double.h>
28 #include <ns3/enum.h>
29 #include <ns3/boolean.h>
30 #include <ns3/pointer.h>
31 
32 #include "ns3/mobility-helper.h"
33 #include "ns3/lte-helper.h"
34 #include "ns3/point-to-point-epc-helper.h"
35 #include "ns3/internet-module.h"
36 #include "ns3/point-to-point-module.h"
37 #include "ns3/applications-module.h"
38 
39 #include <ns3/ff-mac-scheduler.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 
47 #include "lte-ffr-simple.h"
49 #include <ns3/lte-common.h>
50 
52 
53 
54 using namespace ns3;
55 
56 NS_LOG_COMPONENT_DEFINE ("LteFrequencyReuseTest");
57 
63  : TestSuite ("lte-frequency-reuse", SYSTEM)
64 {
65 // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_DEBUG);
66 // LogComponentEnable ("LteFrequencyReuseTest", logLevel);
67 
68  std::vector<bool> availableDlRb;
69  std::vector<bool> availableUlRb;
70  for (uint32_t i = 0; i < 12; i++)
71  {
72  availableDlRb.push_back (true);
73  availableUlRb.push_back (true);
74  }
75  for (uint32_t i = 12; i < 25; i++)
76  {
77  availableDlRb.push_back (false);
78  availableUlRb.push_back (false);
79  }
80 
81  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrPf1", 1, "ns3::PfFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
82  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrPf2", 5, "ns3::PfFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
83  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrPss1", 1, "ns3::PssFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
84  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrPss2", 5, "ns3::PssFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
85  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrCqa1", 1, "ns3::CqaFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
86  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrCqa2", 5, "ns3::CqaFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
87  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrFdTbfq1", 1, "ns3::FdTbfqFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
88  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrFdTbfq2", 5, "ns3::FdTbfqFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
89  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrTdTbfq1", 1, "ns3::TdTbfqFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
90  AddTestCase (new LteHardFrTestCase ("DownlinkHardFrTdTbfq2", 5, "ns3::TdTbfqFfMacScheduler", 25, 25, 0, 12, 0, 12, availableDlRb, availableUlRb), TestCase::QUICK);
91 
92  availableDlRb.clear ();
93  availableUlRb.clear ();
94  for (uint32_t i = 0; i < 6; i++)
95  {
96  availableDlRb.push_back (true);
97  availableUlRb.push_back (true);
98  }
99  for (uint32_t i = 6; i < 12; i++)
100  {
101  availableDlRb.push_back (false);
102  availableUlRb.push_back (false);
103  }
104  for (uint32_t i = 12; i < 18; i++)
105  {
106  availableDlRb.push_back (true);
107  availableUlRb.push_back (true);
108  }
109  for (uint32_t i = 18; i < 25; i++)
110  {
111  availableDlRb.push_back (false);
112  availableUlRb.push_back (false);
113  }
114 
115  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrPf1", 1, "ns3::PfFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
116  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrPf2", 5, "ns3::PfFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
117  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrPss1", 1, "ns3::PssFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
118  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrPss2", 5, "ns3::PssFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
119  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrCqa1", 1, "ns3::CqaFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
120  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrCqa2", 5, "ns3::CqaFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
121  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrCqaFdTbfq1", 1, "ns3::FdTbfqFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
122  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrCqaFdTbfq2", 5, "ns3::FdTbfqFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
123  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrCqaTdTbfq1", 1, "ns3::TdTbfqFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
124  AddTestCase (new LteStrictFrTestCase ("DownlinkStrictFrCqaTdTbfq2", 5, "ns3::TdTbfqFfMacScheduler", 25, 25, 6, 6, 6, 6, 6, 6, availableDlRb, availableUlRb), TestCase::QUICK);
125 
126  AddTestCase (new LteStrictFrAreaTestCase ("LteStrictFrAreaTestCasePf1", "ns3::PfFfMacScheduler"), TestCase::QUICK);
127  AddTestCase (new LteStrictFrAreaTestCase ("LteStrictFrAreaTestCasePss1", "ns3::PssFfMacScheduler"), TestCase::QUICK);
128  AddTestCase (new LteStrictFrAreaTestCase ("LteStrictFrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"), TestCase::QUICK);
129  AddTestCase (new LteStrictFrAreaTestCase ("LteStrictFrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"), TestCase::QUICK);
130  AddTestCase (new LteStrictFrAreaTestCase ("LteStrictFrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"), TestCase::QUICK);
131 
132  AddTestCase (new LteSoftFrAreaTestCase ("LteSoftFrAreaTestCasePf1", "ns3::PfFfMacScheduler"), TestCase::QUICK);
133  AddTestCase (new LteSoftFrAreaTestCase ("LteSoftFrAreaTestCasePss1", "ns3::PssFfMacScheduler"), TestCase::QUICK);
134  AddTestCase (new LteSoftFrAreaTestCase ("LteSoftFrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"), TestCase::QUICK);
135  AddTestCase (new LteSoftFrAreaTestCase ("LteSoftFrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"), TestCase::QUICK);
136  AddTestCase (new LteSoftFrAreaTestCase ("LteSoftFrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"), TestCase::QUICK);
137 
138  AddTestCase (new LteSoftFfrAreaTestCase ("LteSoftFfrAreaTestCasePf1", "ns3::PfFfMacScheduler"), TestCase::QUICK);
139  AddTestCase (new LteSoftFfrAreaTestCase ("LteSoftFfrAreaTestCasePss1", "ns3::PssFfMacScheduler"), TestCase::QUICK);
140  AddTestCase (new LteSoftFfrAreaTestCase ("LteSoftFfrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"), TestCase::QUICK);
141  AddTestCase (new LteSoftFfrAreaTestCase ("LteSoftFfrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"), TestCase::QUICK);
142  AddTestCase (new LteSoftFfrAreaTestCase ("LteSoftFfrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"), TestCase::QUICK);
143 
144  AddTestCase (new LteEnhancedFfrAreaTestCase ("LteEnhancedFfrAreaTestCasePf1", "ns3::PfFfMacScheduler"), TestCase::QUICK);
145  AddTestCase (new LteEnhancedFfrAreaTestCase ("LteEnhancedFfrAreaTestCasePss1", "ns3::PssFfMacScheduler"), TestCase::QUICK);
146  AddTestCase (new LteEnhancedFfrAreaTestCase ("LteEnhancedFfrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"), TestCase::QUICK);
147  AddTestCase (new LteEnhancedFfrAreaTestCase ("LteEnhancedFfrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"), TestCase::QUICK);
148  AddTestCase (new LteEnhancedFfrAreaTestCase ("LteEnhancedFfrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"), TestCase::QUICK);
149 
150  AddTestCase (new LteDistributedFfrAreaTestCase ("LteDistributedFfrAreaTestCasePf1", "ns3::PfFfMacScheduler"), TestCase::QUICK);
151  AddTestCase (new LteDistributedFfrAreaTestCase ("LteDistributedFfrAreaTestCasePss1", "ns3::PssFfMacScheduler"), TestCase::QUICK);
152  AddTestCase (new LteDistributedFfrAreaTestCase ("LteDistributedFfrAreaTestCaseCqa1", "ns3::CqaFfMacScheduler"), TestCase::QUICK);
153  AddTestCase (new LteDistributedFfrAreaTestCase ("LteDistributedFfrAreaTestCaseFdTbfq1", "ns3::FdTbfqFfMacScheduler"), TestCase::QUICK);
154  AddTestCase (new LteDistributedFfrAreaTestCase ("LteDistributedFfrAreaTestCaseTdTbfq1", "ns3::TdTbfqFfMacScheduler"), TestCase::QUICK);
155 }
156 
158 
159 
163 void
165  Ptr<const SpectrumValue> spectrumValue)
166 {
167  testcase->DlDataRxStart (spectrumValue);
168 }
169 
170 void
172  Ptr<const SpectrumValue> spectrumValue)
173 {
174  testcase->UlDataRxStart (spectrumValue);
175 }
176 
178  uint32_t userNum,uint8_t dlBandwidth,uint8_t ulBandwidth,
179  std::vector<bool> availableDlRb, std::vector<bool> availableUlRb)
180  : TestCase ("Test: " + name),
181  m_userNum (userNum),
182  m_dlBandwidth (dlBandwidth),
183  m_ulBandwidth (ulBandwidth),
184  m_availableDlRb (availableDlRb),
185  m_usedMutedDlRbg (false),
186  m_availableUlRb (availableUlRb),
187  m_usedMutedUlRbg (false)
188 {
189 }
190 
192 {
193 }
194 
195 
196 
197 void
199 {
200  NS_LOG_DEBUG ("DL DATA Power allocation :");
201  Values::const_iterator it;
202  uint32_t i = 0;
203  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
204  {
205  double power = (*it) * (m_dlBandwidth * 180000);
206  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power << " isAvailable: " << m_availableDlRb[i]);
207 
208  if (m_availableDlRb[i] == false && power > 0)
209  {
210  m_usedMutedDlRbg = true;
211  }
212  i++;
213  }
214 }
215 
216 void
218 {
219  NS_LOG_DEBUG ("UL DATA Power allocation :");
220  Values::const_iterator it;
221  uint32_t i = 0;
222  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
223  {
224  double power = (*it) * (m_ulBandwidth * 180000);
225  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power << " isAvailable: " << m_availableUlRb[i]);
226 
227  if (m_availableUlRb[i] == false && power > 0)
228  {
229  m_usedMutedUlRbg = true;
230  }
231  i++;
232  }
233 }
234 
235 
236 void
238 {
239 
240 }
241 
242 
243 LteHardFrTestCase::LteHardFrTestCase (std::string name, uint32_t userNum,
244  std::string schedulerType,
245  uint8_t dlBandwidth, uint8_t ulBandwidth,
246  uint8_t dlSubBandOffset, uint8_t dlSubBandwidth,
247  uint8_t ulSubBandOffset, uint8_t ulSubBandwidth,
248  std::vector<bool> availableDlRb, std::vector<bool> availableUlRb)
249  : LteFrTestCase (name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
250  m_schedulerType (schedulerType),
251  m_dlSubBandOffset (dlSubBandOffset),
252  m_dlSubBandwidth (dlSubBandwidth),
253  m_ulSubBandOffset (ulSubBandOffset),
254  m_ulSubBandwidth (ulSubBandwidth)
255 {
256  NS_LOG_INFO ("Creating LteDownlinkFrTestCase");
257 }
258 
260 {
261 }
262 
263 void
265 {
266  NS_LOG_DEBUG ("LteFrTestCase");
267 
268  Config::Reset ();
269  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
270 
275  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
276  lteHelper->SetFfrAlgorithmType ("ns3::LteFrHardAlgorithm");
277 
278  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandOffset", UintegerValue (m_dlSubBandOffset));
279  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandwidth", UintegerValue (m_dlSubBandwidth));
280 
281  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandOffset", UintegerValue (m_ulSubBandOffset));
282  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandwidth", UintegerValue (m_ulSubBandwidth));
283 
284 
285  // Create Nodes: eNodeB and UE
286  NodeContainer enbNodes;
287  NodeContainer ueNodes;
288  enbNodes.Create (1);
289  ueNodes.Create (m_userNum);
290  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
291 
292  // Install Mobility Model
294  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
295  mobility.Install (allNodes);
296 
297  // Create Devices and install them in the Nodes (eNB and UE)
298  NetDeviceContainer enbDevs;
299  NetDeviceContainer ueDevs;
300  lteHelper->SetSchedulerType (m_schedulerType);
301  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
302  ueDevs = lteHelper->InstallUeDevice (ueNodes);
303 
304  // Attach a UE to a eNB
305  lteHelper->Attach (ueDevs, enbDevs.Get (0));
306 
307  // Activate the default EPS bearer
308  //Since this test includes the Token Bank Fair Queue Scheduler
309  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
310  //bearer as the dedicated bearer with QoS.
311  GbrQosInformation qos;
312  qos.mbrUl = 1e6;
313  qos.mbrDl = 1e6;
314  qos.gbrUl = 1e4;
315  qos.gbrDl = 1e4;
316 
317  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
318  EpsBearer bearer (q, qos);
319  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
320 
321  //Test SpectrumPhy to get signals form DL channel
322  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
323  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
324 
325  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
326  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
327  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
328  dlChannel->AddRx (testDlSpectrumPhy);
329 
330  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
332 
333  //Test SpectrumPhy to get signals form UL channel
334  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
335  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
336 
337  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
338  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
339  ulChannel->AddRx (testUlSpectrumPhy);
340 
341  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
343 
344  Simulator::Stop (Seconds (0.500));
345  Simulator::Run ();
346 
348  "Scheduler used DL RBG muted by FFR Algorithm");
349 
351  "Scheduler used UL RBG muted by FFR Algorithm");
352 
353  Simulator::Destroy ();
354 }
355 
356 
357 
358 LteStrictFrTestCase::LteStrictFrTestCase (std::string name, uint32_t userNum,
359  std::string schedulerType,
360  uint8_t dlBandwidth, uint8_t ulBandwidth,
361  uint8_t dlCommonSubBandwidth, uint8_t dlEdgeSubBandOffset, uint8_t dlEdgeSubBandwidth,
362  uint8_t ulCommonSubBandwidth, uint8_t ulEdgeSubBandOffset, uint8_t ulEdgeSubBandwidth,
363  std::vector<bool> availableDlRb, std::vector<bool> availableUlRb)
364  : LteFrTestCase (name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
365  m_schedulerType (schedulerType),
366  m_dlCommonSubBandwidth (dlCommonSubBandwidth),
367  m_dlEdgeSubBandOffset (dlEdgeSubBandOffset),
368  m_dlEdgeSubBandwidth (dlEdgeSubBandwidth),
369  m_ulCommonSubBandwidth (ulCommonSubBandwidth),
370  m_ulEdgeSubBandOffset (ulEdgeSubBandOffset),
371  m_ulEdgeSubBandwidth (ulEdgeSubBandwidth)
372 {
373  NS_LOG_INFO ("Creating LteFrTestCase");
374 }
375 
377 {
378 }
379 
380 void
382 {
383  NS_LOG_DEBUG ("LteFrTestCase");
384 
385  Config::Reset ();
386  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
387 
392  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
393  lteHelper->SetFfrAlgorithmType ("ns3::LteFrStrictAlgorithm");
394 
395  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (m_dlCommonSubBandwidth));
396  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (m_dlEdgeSubBandOffset));
397  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (m_dlEdgeSubBandwidth));
398 
399  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (m_ulCommonSubBandwidth));
400  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (m_ulEdgeSubBandOffset));
401  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (m_ulEdgeSubBandwidth));
402 
403  // Create Nodes: eNodeB and UE
404  NodeContainer enbNodes;
405  NodeContainer ueNodes;
406  enbNodes.Create (1);
407  ueNodes.Create (m_userNum);
408  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
409 
410  // Install Mobility Model
412  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
413  mobility.Install (allNodes);
414 
415  // Create Devices and install them in the Nodes (eNB and UE)
416  NetDeviceContainer enbDevs;
417  NetDeviceContainer ueDevs;
418  lteHelper->SetSchedulerType (m_schedulerType);
419  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
420  ueDevs = lteHelper->InstallUeDevice (ueNodes);
421 
422  // Attach a UE to a eNB
423  lteHelper->Attach (ueDevs, enbDevs.Get (0));
424 
425  // Activate the default EPS bearer
426  //Since this test includes the Token Bank Fair Queue Scheduler
427  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
428  //bearer as the dedicated bearer with QoS.
429 
430  GbrQosInformation qos;
431  qos.mbrUl = 1e6;
432  qos.mbrDl = 1e6;
433  qos.gbrUl = 1e4;
434  qos.gbrDl = 1e4;
435 
436  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
437  EpsBearer bearer (q, qos);
438  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
439 
440  //Test SpectrumPhy to get signals form DL channel
441  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
442  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
443 
444  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
445  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
446  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
447  dlChannel->AddRx (testDlSpectrumPhy);
448 
449  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
451 
452  //Test SpectrumPhy to get signals form UL channel
453  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
454  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
455 
456  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
457  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
458  ulChannel->AddRx (testUlSpectrumPhy);
459 
460  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
462 
463  Simulator::Stop (Seconds (0.500));
464  Simulator::Run ();
465 
467  "Scheduler used DL RBG muted by FFR Algorithm");
468 
470  "Scheduler used UL RBG muted by FFR Algorithm");
471 
472  Simulator::Destroy ();
473 }
474 
475 void
477  Ptr<const SpectrumValue> spectrumValue)
478 {
479  testcase->DlDataRxStart (spectrumValue);
480 }
481 
482 void
484  Ptr<const SpectrumValue> spectrumValue)
485 {
486  testcase->UlDataRxStart (spectrumValue);
487 }
488 
489 LteFrAreaTestCase::LteFrAreaTestCase (std::string name, std::string schedulerType)
490  : TestCase ("Test: " + name),
491  m_schedulerType (schedulerType)
492 {
493  m_dlBandwidth = 25;
494  m_ulBandwidth = 25;
495  m_usedWrongDlRbg = false;
496  m_usedWrongUlRbg = false;
497 }
499 {
500 }
501 
502 void
504 {
505  //need time to report new UE measurements, and wait because of filtering
506  if ( (Simulator::Now () - m_teleportTime ) < MilliSeconds (400))
507  {
508  return;
509  }
510 
511  NS_LOG_DEBUG ("DL DATA Power allocation :");
512  Values::const_iterator it;
513  uint32_t i = 0;
514  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
515  {
516  double power = (*it) * (m_dlBandwidth * 180000);
517  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power);
518  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power
519  << " Available: " << m_expectedDlRb[i] << " Expected Power: " << m_expectedDlPower );
520 
521  if (m_expectedDlRb[i] == false && power > 0)
522  {
523  m_usedWrongDlRbg = true;
524  }
525  else if (m_expectedDlRb[i] == true && power > 0)
526  {
528  "Wrong Data Channel DL Power level");
529  }
530  i++;
531  }
532 }
533 
534 void
536 {
537  //need time to report new UE measurements, and wait because of filtering
538  if ( (Simulator::Now () - m_teleportTime ) < MilliSeconds (400))
539  {
540  return;
541  }
542 
543  NS_LOG_DEBUG ("UL DATA Power allocation :");
544  Values::const_iterator it;
545  uint32_t i = 0;
546  uint32_t numActiveRbs = 0;
547 
548  // At the moment I could not find a better way to find total number
549  // of active RBs. This method is independent of the bandwidth
550  // configuration done in a test scenario, thus, it requires
551  // minimum change to the script.
552  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
553  {
554  // Count the RB as active if it is part of
555  // the expected UL RBs and has Power Spectral Density (PSD) > 0
556  if (m_expectedUlRb[numActiveRbs] == true && (*it) > 0)
557  {
558  numActiveRbs++;
559  }
560  }
561  NS_LOG_DEBUG ("Total number of active RBs = " << numActiveRbs);
562 
563  // The uplink power control and the uplink PSD
564  // calculation only consider active resource blocks.
565  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
566  {
567  double power = (*it) * (numActiveRbs * 180000);
568  NS_LOG_DEBUG ("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower);
569  if (m_expectedUlRb[i] == false && power > 0)
570  {
571  m_usedWrongUlRbg = true;
572  }
573  else if (m_expectedUlRb[i] == true && power > 0)
574  {
576  "Wrong Data Channel UL Power level" << Simulator::Now ().GetSeconds ());
577  }
578  i++;
579  }
580 }
581 
582 void
584 {
585  NS_LOG_FUNCTION (this);
586  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
588  m_ueMobility->SetPosition (Vector (x, y, 0.0));
589 }
590 
591 void
592 LteFrAreaTestCase::TeleportUe (uint32_t x, uint32_t y, double expectedPower,
593  std::vector<bool> expectedDlRb)
594 {
595  NS_LOG_FUNCTION (this);
596  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
598  m_ueMobility->SetPosition (Vector (x, y, 0.0));
599  m_expectedDlPower = expectedPower;
600  m_expectedDlRb = expectedDlRb;
601 }
602 
603 void
604 LteFrAreaTestCase::TeleportUe2 (Ptr<Node> ueNode, uint32_t x, uint32_t y, double expectedPower,
605  std::vector<bool> expectedDlRb)
606 {
607  NS_LOG_FUNCTION (this);
608  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
609 
610  Ptr<MobilityModel> ueMobility = ueNode->GetObject<MobilityModel> ();
611  ueMobility->SetPosition (Vector (x, y, 0.0));
613  m_expectedDlPower = expectedPower;
614  m_expectedDlRb = expectedDlRb;
615 }
616 
617 void
618 LteFrAreaTestCase::SetDlExpectedValues (double expectedDlPower, std::vector<bool> expectedDlRb)
619 {
620  NS_LOG_FUNCTION (this);
621  m_expectedDlPower = expectedDlPower;
622  m_expectedDlRb = expectedDlRb;
623 }
624 
625 void
626 LteFrAreaTestCase::SetUlExpectedValues (double expectedUlPower, std::vector<bool> expectedUlRb)
627 {
628  NS_LOG_FUNCTION (this);
629  m_expectedUlPower = expectedUlPower;
630  m_expectedUlRb = expectedUlRb;
631 }
632 
633 void
635 {
636 }
637 
638 LteStrictFrAreaTestCase::LteStrictFrAreaTestCase (std::string name, std::string schedulerType)
639  : LteFrAreaTestCase (name, schedulerType)
640 {
641  NS_LOG_INFO ("Creating LteFrTestCase");
642 }
643 
645 {
646 }
647 
648 void
650 {
651  NS_LOG_DEBUG ("LteStrictFrAreaTestCase");
652 
653  Config::Reset ();
654  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
655  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
656  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
657 
658  double eNbTxPower = 30;
659  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
660  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
661  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
662 
663  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
664  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
665 
666  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
667 
668  // Create Nodes: eNodeB and UE
669  NodeContainer enbNodes;
670  NodeContainer ueNodes1;
671  NodeContainer ueNodes2;
672  enbNodes.Create (2);
673  ueNodes1.Create (1);
674  ueNodes2.Create (1);
675  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
676 
677  /*
678  * The topology is the following:
679  *
680  * eNB1 UE1 eNB2
681  * | | |
682  * x ------------ x ------------------------ x ------------ x----UE2
683  * 200 m 600 m 200 m 20 m
684  *
685  */
686 
687  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
688  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
689  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
690  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
691  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
693  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
694  mobility.SetPositionAllocator (positionAlloc);
695  mobility.Install (allNodes);
696  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
697 
698  // Disable layer-3 filtering
699  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
700  UintegerValue (0));
701  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
702  UintegerValue (0));
703 
704  // Create Devices and install them in the Nodes (eNB and UE)
705  NetDeviceContainer enbDevs;
706  NetDeviceContainer ueDevs1;
707  NetDeviceContainer ueDevs2;
708  lteHelper->SetSchedulerType (m_schedulerType);
709 
710  lteHelper->SetFfrAlgorithmType ("ns3::LteFrStrictAlgorithm");
711  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
712  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
713  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
714  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
715  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
716 
717  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (6));
718  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (6));
719  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (6));
720 
721  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (6));
722  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (6));
723  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (6));
724  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
725 
726  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
727  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
728 
729  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
730  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
731 
732  // Attach a UE to a eNB
733  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
734  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
735 
736  // Activate the default EPS bearer
737  //Since this test includes the Token Bank Fair Queue Scheduler
738  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
739  //bearer as the dedicated bearer with QoS.
740  GbrQosInformation qos;
741  qos.mbrUl = 1e6;
742  qos.mbrDl = 1e6;
743  qos.gbrUl = 1e4;
744  qos.gbrDl = 1e4;
745 
746  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
747  EpsBearer bearer (q, qos);
748 
749  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
750  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
751 
752  //Test SpectrumPhy to get signals form DL channel
753  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
754  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
755 
756  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
757  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
758  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
759  dlChannel->AddRx (testDlSpectrumPhy);
760 
761  testDlSpectrumPhy->SetCellId (1);
762 
763  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
765 
766  //Test SpectrumPhy to get signals form UL channel
767  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
768  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
769 
770  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
771  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
772  ulChannel->AddRx (testUlSpectrumPhy);
773 
774  testUlSpectrumPhy->SetCellId (1);
775 
776  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
778 
779  std::vector<bool> expectedDlRbCenterArea;
780  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
781  std::vector<bool> expectedUlRbCenterArea;
782  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
783  for (uint32_t i = 0; i < 6; i++)
784  {
785  expectedDlRbCenterArea[i] = true;
786  expectedUlRbCenterArea[i] = true;
787  }
788 
789  std::vector<bool> expectedDlRbEdgeArea;
790  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
791  std::vector<bool> expectedUlRbEdgeArea;
792  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
793  for (uint32_t i = 12; i < 18; i++)
794  {
795  expectedDlRbEdgeArea[i] = true;
796  expectedUlRbEdgeArea[i] = true;
797  }
798 
799  Simulator::Schedule (MilliSeconds (1),
800  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
801  Simulator::Schedule (MilliSeconds (1),
802  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
803 
804  Simulator::Schedule (MilliSeconds (501),
805  &LteFrAreaTestCase::TeleportUe, this, 800, 0, 2, expectedDlRbEdgeArea );
806  Simulator::Schedule (MilliSeconds (501),
807  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
808 
809  Simulator::Schedule (MilliSeconds (1001),
810  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
811  Simulator::Schedule (MilliSeconds (1001),
812  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
813 
814  Simulator::Stop (Seconds (1.500));
815  Simulator::Run ();
816 
818  "Scheduler used DL RB muted by FFR Algorithm");
820  "Scheduler used UL RB muted by FFR Algorithm");
821 
822  Simulator::Destroy ();
823 }
824 
825 LteSoftFrAreaTestCase::LteSoftFrAreaTestCase (std::string name, std::string schedulerType)
826  : LteFrAreaTestCase (name, schedulerType)
827 {
828  NS_LOG_INFO ("Creating LteSoftFrAreaTestCase");
829 }
830 
832 {
833 }
834 
835 void
837 {
838  NS_LOG_DEBUG ("LteSoftFrAreaTestCase");
839 
840  Config::Reset ();
841  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
842  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
843  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
844 
845  double eNbTxPower = 30;
846  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
847  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
848  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
849 
850  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
851  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
852 
853  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
854 
855  // Create Nodes: eNodeB and UE
856  NodeContainer enbNodes;
857  NodeContainer ueNodes1;
858  NodeContainer ueNodes2;
859  enbNodes.Create (2);
860  ueNodes1.Create (1);
861  ueNodes2.Create (1);
862  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
863 
864  /*
865  * The topology is the following:
866  *
867  * eNB1 UE1 eNB2
868  * | | |
869  * x ------------ x ------------------------ x ------------ x----UE2
870  * 200 m 600 m 200 m 20 m
871  *
872  */
873 
874  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
875  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
876  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
877  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
878  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
880  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
881  mobility.SetPositionAllocator (positionAlloc);
882  mobility.Install (allNodes);
883  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
884 
885  // Disable layer-3 filtering
886  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
887  UintegerValue (0));
888  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
889  UintegerValue (0));
890 
891  // Create Devices and install them in the Nodes (eNB and UE)
892  NetDeviceContainer enbDevs;
893  NetDeviceContainer ueDevs1;
894  NetDeviceContainer ueDevs2;
895  lteHelper->SetSchedulerType (m_schedulerType);
896 
897  lteHelper->SetFfrAlgorithmType ("ns3::LteFrSoftAlgorithm");
898  lteHelper->SetFfrAlgorithmAttribute ("AllowCenterUeUseEdgeSubBand", BooleanValue (false));
899  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
900  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
901  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
902  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
903  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
904 
905  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (8));
906  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (8));
907  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (8));
908  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (8));
909  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
910 
911  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
912  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
913 
914  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
915  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
916 
917  // Attach a UE to a eNB
918  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
919  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
920 
921  // Activate the default EPS bearer
922  //Since this test includes the Token Bank Fair Queue Scheduler
923  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
924  //bearer as the dedicated bearer with QoS.
925  GbrQosInformation qos;
926  qos.mbrUl = 1e6;
927  qos.mbrDl = 1e6;
928  qos.gbrUl = 1e4;
929  qos.gbrDl = 1e4;
930 
931  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
932  EpsBearer bearer (q, qos);
933  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
934  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
935 
936  //Test SpectrumPhy to get signals form DL channel
937  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
938  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
939 
940  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
941  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
942  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
943  dlChannel->AddRx (testDlSpectrumPhy);
944 
945  testDlSpectrumPhy->SetCellId (1);
946 
947  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
949 
950  //Test SpectrumPhy to get signals form UL channel
951  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
952  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
953 
954  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
955  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
956  ulChannel->AddRx (testUlSpectrumPhy);
957 
958  testUlSpectrumPhy->SetCellId (1);
959 
960  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
962 
963 
964  std::vector<bool> expectedDlRbCenterArea;
965  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
966  std::vector<bool> expectedUlRbCenterArea;
967  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
968  for (uint32_t i = 0; i < 8; i++)
969  {
970  expectedDlRbCenterArea[i] = true;
971  expectedUlRbCenterArea[i] = true;
972  }
973  for (uint32_t i = 16; i < 25; i++)
974  {
975  expectedDlRbCenterArea[i] = true;
976  }
977 
978  std::vector<bool> expectedDlRbEdgeArea;
979  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
980  std::vector<bool> expectedUlRbEdgeArea;
981  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
982  for (uint32_t i = 8; i < 16; i++)
983  {
984  expectedDlRbEdgeArea[i] = true;
985  expectedUlRbEdgeArea[i] = true;
986  }
987 
988  Simulator::Schedule (MilliSeconds (1),
989  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
990  Simulator::Schedule (MilliSeconds (1),
991  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
992 
993  Simulator::Schedule (MilliSeconds (501),
994  &LteFrAreaTestCase::TeleportUe, this, 800, 0, 2, expectedDlRbEdgeArea );
995  Simulator::Schedule (MilliSeconds (501),
996  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
997 
998  Simulator::Schedule (MilliSeconds (1001),
999  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
1000  Simulator::Schedule (MilliSeconds (1001),
1001  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1002 
1003  Simulator::Stop (Seconds (1.500));
1004  Simulator::Run ();
1005 
1006 #if 0
1008  "Scheduler used DL RBG muted by FFR Algorithm");
1009 
1010 #endif
1012  "Scheduler used UL RB muted by FFR Algorithm");
1013 
1014  Simulator::Destroy ();
1015 }
1016 
1017 LteSoftFfrAreaTestCase::LteSoftFfrAreaTestCase (std::string name, std::string schedulerType)
1018  : LteFrAreaTestCase (name, schedulerType)
1019 {
1020  NS_LOG_INFO ("Creating LteSoftFfrAreaTestCase");
1021 }
1022 
1024 {
1025 }
1026 
1027 void
1029 {
1030  NS_LOG_DEBUG ("LteSoftFfrAreaTestCase");
1031 
1032  Config::Reset ();
1033  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1034  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1035  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1036 
1037  double eNbTxPower = 30;
1038  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1039  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1040  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1041 
1042  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1043  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1044 
1045  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1046 
1047  // Create Nodes: eNodeB and UE
1048  NodeContainer enbNodes;
1049  NodeContainer ueNodes1;
1050  NodeContainer ueNodes2;
1051  enbNodes.Create (2);
1052  ueNodes1.Create (1);
1053  ueNodes2.Create (1);
1054  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1055 
1056  /*
1057  * The topology is the following:
1058  *
1059  * eNB1 UE1 eNB2
1060  * | | |
1061  * x ------------ x ------------------------ x ------------ x----UE2
1062  * 200 m 600 m 200 m 20 m
1063  *
1064  */
1065 
1066  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1067  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1068  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1069  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
1070  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
1072  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1073  mobility.SetPositionAllocator (positionAlloc);
1074  mobility.Install (allNodes);
1075  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
1076 
1077  // Disable layer-3 filtering
1078  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1079  UintegerValue (0));
1080  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1081  UintegerValue (0));
1082 
1083  // Create Devices and install them in the Nodes (eNB and UE)
1084  NetDeviceContainer enbDevs;
1085  NetDeviceContainer ueDevs1;
1086  NetDeviceContainer ueDevs2;
1087  lteHelper->SetSchedulerType (m_schedulerType);
1088 
1089  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrSoftAlgorithm");
1090  lteHelper->SetFfrAlgorithmAttribute ("CenterRsrqThreshold", UintegerValue (28));
1091  lteHelper->SetFfrAlgorithmAttribute ("EdgeRsrqThreshold", UintegerValue (18));
1092  lteHelper->SetFfrAlgorithmAttribute ("CenterAreaPowerOffset",
1093  UintegerValue (LteRrcSap::PdschConfigDedicated::dB_3));
1094  lteHelper->SetFfrAlgorithmAttribute ("MediumAreaPowerOffset",
1095  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1096  lteHelper->SetFfrAlgorithmAttribute ("EdgeAreaPowerOffset",
1097  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
1098 
1099  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (6));
1100  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (6));
1101 
1102  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (6));
1103  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (6));
1104  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (6));
1105  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (6));
1106  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
1107 
1108  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
1109  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
1110 
1111  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1112  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1113 
1114  // Attach a UE to a eNB
1115  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1116  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1117 
1118  // Activate the default EPS bearer
1119  //Since this test includes the Token Bank Fair Queue Scheduler
1120  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1121  //bearer as the dedicated bearer with QoS.
1122  GbrQosInformation qos;
1123  qos.mbrUl = 1e6;
1124  qos.mbrDl = 1e6;
1125  qos.gbrUl = 1e4;
1126  qos.gbrDl = 1e4;
1127 
1128  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1129  EpsBearer bearer (q, qos);
1130  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
1131  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
1132 
1133  //Test SpectrumPhy to get signals form DL channel
1134  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1135  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1136 
1137  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1138  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1139  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1140  dlChannel->AddRx (testDlSpectrumPhy);
1141 
1142  testDlSpectrumPhy->SetCellId (1);
1143 
1144  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1146 
1147  //Test SpectrumPhy to get signals form UL channel
1148  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1149  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1150 
1151  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1152  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1153  ulChannel->AddRx (testUlSpectrumPhy);
1154 
1155  testUlSpectrumPhy->SetCellId (1);
1156 
1157  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1159 
1160  double expectedDlPowerCenterArea = 0.5;
1161  std::vector<bool> expectedDlRbCenterArea;
1162  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1163  std::vector<bool> expectedUlRbCenterArea;
1164  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1165  for (uint32_t i = 6; i < 12; i++)
1166  {
1167  expectedDlRbCenterArea[i] = true;
1168  expectedUlRbCenterArea[i] = true;
1169  }
1170  for (uint32_t i = 18; i < 25; i++)
1171  {
1172  expectedDlRbCenterArea[i] = true;
1173  expectedUlRbCenterArea[i] = true;
1174  }
1175 
1176  double expectedDlPowerMiddleArea = 1.0;
1177  std::vector<bool> expectedDlRbMiddleArea;
1178  expectedDlRbMiddleArea.resize (m_dlBandwidth, false);
1179  std::vector<bool> expectedUlRbMiddleArea;
1180  expectedUlRbMiddleArea.resize (m_ulBandwidth, false);
1181  for (uint32_t i = 0; i < 6; i++)
1182  {
1183  expectedDlRbMiddleArea[i] = true;
1184  expectedUlRbMiddleArea[i] = true;
1185  }
1186 
1187  double expectedDlPowerEdgeArea = 2.0;
1188  std::vector<bool> expectedDlRbEdgeArea;
1189  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1190  std::vector<bool> expectedUlRbEdgeArea;
1191  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1192  for (uint32_t i = 12; i < 18; i++)
1193  {
1194  expectedDlRbEdgeArea[i] = true;
1195  expectedUlRbEdgeArea[i] = true;
1196  }
1197 
1198  Simulator::Schedule (MilliSeconds (1),
1199  &LteFrAreaTestCase::TeleportUe, this, 200, 0,
1200  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1201  Simulator::Schedule (MilliSeconds (1),
1202  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1203 
1204  Simulator::Schedule (MilliSeconds (501),
1205  &LteFrAreaTestCase::TeleportUe, this, 600, 0,
1206  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1207  Simulator::Schedule (MilliSeconds (501),
1208  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbMiddleArea );
1209 
1210  Simulator::Schedule (MilliSeconds (1001),
1211  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1212  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1213  Simulator::Schedule (MilliSeconds (1001),
1214  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
1215 
1216  Simulator::Schedule (MilliSeconds (1501),
1217  &LteFrAreaTestCase::TeleportUe, this, 600, 0,
1218  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1219  Simulator::Schedule (MilliSeconds (1501),
1220  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbMiddleArea );
1221 
1222  Simulator::Schedule (MilliSeconds (2001),
1223  &LteFrAreaTestCase::TeleportUe, this, 200, 0,
1224  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1225  Simulator::Schedule (MilliSeconds (2001),
1226  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1227 
1228  Simulator::Stop (Seconds (2.500));
1229  Simulator::Run ();
1230 
1232  "Scheduler used DL RBG muted by FFR Algorithm");
1233 
1235  "Scheduler used UL RB muted by FFR Algorithm");
1236 
1237  Simulator::Destroy ();
1238 }
1239 
1240 
1241 LteEnhancedFfrAreaTestCase::LteEnhancedFfrAreaTestCase (std::string name, std::string schedulerType)
1242  : LteFrAreaTestCase (name, schedulerType)
1243 {
1244  NS_LOG_INFO ("Creating LteEnhancedFfrAreaTestCase");
1245 }
1246 
1248 {
1249 }
1250 
1251 void
1253 {
1254  NS_LOG_DEBUG ("LteEnhancedFfrAreaTestCase");
1255 
1256  Config::Reset ();
1257  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1258  Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true));
1259  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1260  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1261 
1262  double eNbTxPower = 30;
1263  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1264  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1265  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1266 
1267  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1268  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1269 
1270 
1271  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1272 
1273  // Create Nodes: eNodeB and UE
1274  NodeContainer enbNodes;
1275  NodeContainer ueNodes1;
1276  NodeContainer ueNodes2;
1277  enbNodes.Create (2);
1278  ueNodes1.Create (1);
1279  ueNodes2.Create (1);
1280  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1281 
1282  /*
1283  * The topology is the following:
1284  *
1285  * eNB1 UE1 eNB2
1286  * | | |
1287  * x ------------ x ------------------------ x ------------ x----UE2
1288  * 200 m 600 m 200 m 20 m
1289  *
1290  */
1291 
1292  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1293  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1294  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1295  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
1296  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
1298  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1299  mobility.SetPositionAllocator (positionAlloc);
1300  mobility.Install (allNodes);
1301  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
1302 
1303  // Disable layer-3 filtering
1304  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1305  UintegerValue (0));
1306  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1307  UintegerValue (0));
1308 
1309  // Create Devices and install them in the Nodes (eNB and UE)
1310  NetDeviceContainer enbDevs;
1311  NetDeviceContainer ueDevs1;
1312  NetDeviceContainer ueDevs2;
1313  lteHelper->SetSchedulerType (m_schedulerType);
1314  lteHelper->SetSchedulerAttribute ("HarqEnabled", BooleanValue (true));
1315 
1316  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (m_dlBandwidth));
1317  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (m_ulBandwidth));
1318 
1319  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrEnhancedAlgorithm");
1320  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
1321  lteHelper->SetFfrAlgorithmAttribute ("DlCqiThreshold", UintegerValue (10));
1322  lteHelper->SetFfrAlgorithmAttribute ("UlCqiThreshold", UintegerValue (15));
1323  lteHelper->SetFfrAlgorithmAttribute ("CenterAreaPowerOffset",
1324  UintegerValue (LteRrcSap::PdschConfigDedicated::dB_6));
1325  lteHelper->SetFfrAlgorithmAttribute ("EdgeAreaPowerOffset",
1326  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1327 
1328  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandOffset", UintegerValue (0));
1329  lteHelper->SetFfrAlgorithmAttribute ("UlReuse3SubBandwidth", UintegerValue (4));
1330  lteHelper->SetFfrAlgorithmAttribute ("UlReuse1SubBandwidth", UintegerValue (4));
1331 
1332  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandOffset", UintegerValue (0));
1333  lteHelper->SetFfrAlgorithmAttribute ("DlReuse3SubBandwidth", UintegerValue (4));
1334  lteHelper->SetFfrAlgorithmAttribute ("DlReuse1SubBandwidth", UintegerValue (4));
1335 
1336  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
1337 
1338  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
1339  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
1340 
1341  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1342  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1343 
1344  // Attach a UE to a eNB
1345  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1346  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1347 
1348  // Activate the default EPS bearer
1349  //Since this test includes the Token Bank Fair Queue Scheduler
1350  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1351  //bearer as the dedicated bearer with QoS.
1352  GbrQosInformation qos;
1353  qos.mbrUl = 1e6;
1354  qos.mbrDl = 1e6;
1355  qos.gbrUl = 1e4;
1356  qos.gbrDl = 1e4;
1357 
1358  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1359  EpsBearer bearer (q, qos);
1360  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
1361  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
1362 
1363  //Test SpectrumPhy to get signals form DL channel
1364  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1365  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1366 
1367  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1368  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1369  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1370  dlChannel->AddRx (testDlSpectrumPhy);
1371 
1372  testDlSpectrumPhy->SetCellId (1);
1373 
1374  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1376 
1377  //Test SpectrumPhy to get signals form UL channel
1378  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1379  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1380 
1381  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1382  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1383  ulChannel->AddRx (testUlSpectrumPhy);
1384 
1385  testUlSpectrumPhy->SetCellId (1);
1386 
1387  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1389 
1390  double expectedDlPowerCenterArea = 0.251189;
1391  std::vector<bool> expectedDlRbCenterArea;
1392  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1393  std::vector<bool> expectedUlRbCenterArea;
1394  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1395  for (uint32_t i = 0; i < 8; i++)
1396  {
1397  expectedDlRbCenterArea[i] = true;
1398  expectedUlRbCenterArea[i] = true;
1399  }
1400  for (uint32_t i = 12; i < 16; i++)
1401  {
1402  expectedDlRbCenterArea[i] = true;
1403  expectedUlRbCenterArea[i] = true;
1404  }
1405  for (uint32_t i = 20; i < 24; i++)
1406  {
1407  expectedDlRbCenterArea[i] = true;
1408  expectedUlRbCenterArea[i] = true;
1409  }
1410 
1411  double expectedDlPowerMiddleArea = 0.251189;
1412  std::vector<bool> expectedDlRbMiddleArea;
1413  expectedDlRbMiddleArea.resize (m_dlBandwidth, false);
1414  std::vector<bool> expectedUlRbMiddleArea;
1415  expectedUlRbMiddleArea.resize (m_ulBandwidth, false);
1416  for (uint32_t i = 4; i < 8; i++)
1417  {
1418  expectedDlRbMiddleArea[i] = true;
1419  expectedUlRbMiddleArea[i] = true;
1420  }
1421 
1422  double expectedDlPowerEdgeArea = 1.0;
1423  std::vector<bool> expectedDlRbEdgeArea;
1424  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1425  std::vector<bool> expectedUlRbEdgeArea;
1426  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1427  for (uint32_t i = 0; i < 4; i++)
1428  {
1429  expectedDlRbEdgeArea[i] = true;
1430  expectedUlRbEdgeArea[i] = true;
1431  }
1432 
1433  Simulator::Schedule (MilliSeconds (1),
1435  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1436  Simulator::Schedule (MilliSeconds (1),
1437  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.00250905, expectedUlRbCenterArea );
1438 
1439  Simulator::Schedule (MilliSeconds (501),
1441  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1442  Simulator::Schedule (MilliSeconds (501),
1443  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbMiddleArea );
1444 
1445  Simulator::Schedule (MilliSeconds (1001),
1447  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1448  Simulator::Schedule (MilliSeconds (1001),
1449  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0903259, expectedUlRbEdgeArea );
1450 
1451  Simulator::Schedule (MilliSeconds (1501),
1453  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1454  Simulator::Schedule (MilliSeconds (1501),
1455  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.00250905, expectedUlRbCenterArea );
1456 
1457  Simulator::Schedule (MilliSeconds (2001),
1459  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1460  Simulator::Schedule (MilliSeconds (2001),
1461  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1462 
1463  Simulator::Stop (Seconds (2.500));
1464  Simulator::Run ();
1465 
1467  "Scheduler used DL RBG muted by FFR Algorithm");
1468 
1470  "Scheduler used UL RB muted by FFR Algorithm");
1471 
1472  Simulator::Destroy ();
1473 }
1474 
1475 
1476 LteDistributedFfrAreaTestCase::LteDistributedFfrAreaTestCase (std::string name, std::string schedulerType)
1477  : LteFrAreaTestCase (name, schedulerType)
1478 {
1479  NS_LOG_INFO ("Creating LteDistributedFfrAreaTestCase");
1480 }
1481 
1483 {
1484 }
1485 
1486 void
1488 {
1489  NS_LOG_DEBUG ("LteDistributedFfrAreaTestCase");
1490 
1491  Config::Reset ();
1492  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1493  Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true));
1494  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1495  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1496 
1497  double eNbTxPower = 30;
1498  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1499  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1500  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1501 
1502  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1503  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1504 
1505  // Disable layer-3 filtering
1506  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1507  UintegerValue (0));
1508  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1509  UintegerValue (0));
1510 
1511  uint8_t bandwidth = 25;
1512 
1513  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1514  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
1515  lteHelper->SetEpcHelper (epcHelper);
1516  lteHelper->SetHandoverAlgorithmType ("ns3::NoOpHandoverAlgorithm"); // disable automatic handover
1517 
1518  Ptr<Node> pgw = epcHelper->GetPgwNode ();
1519 
1520  // Create a single RemoteHost
1521  NodeContainer remoteHostContainer;
1522  remoteHostContainer.Create (1);
1523  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
1524  InternetStackHelper internet;
1525  internet.Install (remoteHostContainer);
1526 
1527  // Create the Internet
1528  PointToPointHelper p2ph;
1529  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
1530  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
1531  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
1532  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
1533  Ipv4AddressHelper ipv4h;
1534  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
1535  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
1536  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
1537 
1538  // Routing of the Internet Host (towards the LTE network)
1539  Ipv4StaticRoutingHelper ipv4RoutingHelper;
1540  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
1541  // interface 0 is localhost, 1 is the p2p device
1542  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
1543 
1544  // Create Nodes: eNodeB and UE
1545  NodeContainer enbNodes;
1546  NodeContainer ueNodes1;
1547  NodeContainer ueNodes2;
1548  enbNodes.Create (2);
1549  ueNodes1.Create (2);
1550  ueNodes2.Create (1);
1551  NodeContainer ueNodes = NodeContainer ( ueNodes1, ueNodes2);
1552  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1553 
1554  /*
1555  * The topology is the following:
1556  *
1557  * eNB1 UE1 UE2 eNB2
1558  * | | | |
1559  * x ------------ x ------------------------ x ------------ x
1560  * 200 m 600 m 200 m
1561  *
1562  */
1563 
1564  // Install Mobility Model
1565  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1566  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1567  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1568 
1569  positionAlloc->Add (Vector (200, 0.0, 0.0)); // UE1
1570  positionAlloc->Add (Vector (200, 0.0, 0.0)); // UE1
1571  positionAlloc->Add (Vector (800, 0.0, 0.0)); // UE2
1572 
1574  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1575  mobility.SetPositionAllocator (positionAlloc);
1576  mobility.Install (allNodes);
1577  m_ueMobility = ueNodes2.Get (0)->GetObject<MobilityModel> ();
1578 
1579  // Create Devices and install them in the Nodes (eNB and UE)
1580  NetDeviceContainer enbDevs;
1581  NetDeviceContainer ueDevs1;
1582  NetDeviceContainer ueDevs2;
1583  lteHelper->SetSchedulerType (m_schedulerType);
1584 
1585  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (bandwidth));
1586  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (bandwidth));
1587 
1588  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrDistributedAlgorithm");
1589  lteHelper->SetFfrAlgorithmAttribute ("CalculationInterval", TimeValue (MilliSeconds (10)));
1590  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
1591  lteHelper->SetFfrAlgorithmAttribute ("RsrpDifferenceThreshold", UintegerValue (5));
1592  lteHelper->SetFfrAlgorithmAttribute ("EdgeRbNum", UintegerValue (6));
1593  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
1594  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1595  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
1596  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
1597 
1598  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
1599  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1600  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1601 
1602  NetDeviceContainer ueLteDevs;
1603  ueLteDevs.Add (ueDevs1);
1604  ueLteDevs.Add (ueDevs2);
1605 
1606  // Add X2 interface
1607  lteHelper->AddX2Interface (enbNodes);
1608 
1609  // Install the IP stack on the UEs
1610  internet.Install (ueNodes);
1611  Ipv4InterfaceContainer ueIpIfaces;
1612  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
1613  // Assign IP address to UEs, and install applications
1614  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
1615  {
1616  Ptr<Node> ueNode = ueNodes.Get (u);
1617  // Set the default gateway for the UE
1618  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
1619  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
1620  }
1621 
1622  // Attach a UE to a eNB
1623  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1624  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1625 
1626 
1627  // Install and start applications on UEs and remote host
1628  uint16_t dlPort = 10000;
1629  uint16_t ulPort = 20000;
1630 
1631  // randomize a bit start times to avoid simulation artifacts
1632  // (e.g., buffer overflows due to packet transmissions happening
1633  // exactly at the same time)
1634  Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable> ();
1635  startTimeSeconds->SetAttribute ("Min", DoubleValue (0));
1636  startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010));
1637 
1638  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
1639  {
1640  Ptr<Node> ue = ueNodes.Get (u);
1641  // Set the default gateway for the UE
1642  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
1643  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
1644 
1645  for (uint32_t b = 0; b < 1; ++b)
1646  {
1647  ++dlPort;
1648  ++ulPort;
1649 
1652 
1653  NS_LOG_LOGIC ("installing UDP DL app for UE " << u);
1654  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
1655  dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
1656  dlClientHelper.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
1657  clientApps.Add (dlClientHelper.Install (remoteHost));
1658  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory",
1659  InetSocketAddress (Ipv4Address::GetAny (), dlPort));
1660  serverApps.Add (dlPacketSinkHelper.Install (ue));
1661 
1662  NS_LOG_LOGIC ("installing UDP UL app for UE " << u);
1663  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
1664  ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
1665  ulClientHelper.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
1666  clientApps.Add (ulClientHelper.Install (ue));
1667  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory",
1668  InetSocketAddress (Ipv4Address::GetAny (), ulPort));
1669  serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
1670 
1671  Ptr<EpcTft> tft = Create<EpcTft> ();
1672  EpcTft::PacketFilter dlpf;
1673  dlpf.localPortStart = dlPort;
1674  dlpf.localPortEnd = dlPort;
1675  tft->Add (dlpf);
1676  EpcTft::PacketFilter ulpf;
1677  ulpf.remotePortStart = ulPort;
1678  ulpf.remotePortEnd = ulPort;
1679  tft->Add (ulpf);
1680  //Since this test includes the Token Bank Fair Queue Scheduler
1681  //(ns3::FdTbfqFfMacScheduler) we have to use GBR bearer with
1682  //certain QoS.
1683  GbrQosInformation qos;
1684  qos.mbrUl = 1e6;
1685  qos.mbrDl = 1e6;
1686  qos.gbrUl = 1e4;
1687  qos.gbrDl = 1e4;
1688 
1689  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1690  EpsBearer bearer (q, qos);
1691  lteHelper->ActivateDedicatedEpsBearer (ueLteDevs.Get (u), bearer, tft);
1692 
1693  Time startTime = Seconds (startTimeSeconds->GetValue ());
1694  serverApps.Start (startTime);
1695  clientApps.Start (startTime);
1696  }
1697  }
1698 
1699  //Test SpectrumPhy to get signals form DL channel
1700  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1701  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1702 
1703  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1704  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1705  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1706  dlChannel->AddRx (testDlSpectrumPhy);
1707 
1708  testDlSpectrumPhy->SetCellId (2);
1709 
1710  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1712 
1713  //Test SpectrumPhy to get signals form UL channel
1714  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1715  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1716 
1717  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1718  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1719  ulChannel->AddRx (testUlSpectrumPhy);
1720 
1721  testUlSpectrumPhy->SetCellId (2);
1722 
1723  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1725 
1726  double expectedDlPowerCenterArea = 1.0;
1727  std::vector<bool> expectedDlRbCenterArea;
1728  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1729  std::vector<bool> expectedUlRbCenterArea;
1730  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1731  for (uint32_t i = 0; i < m_dlBandwidth; i++)
1732  {
1733  expectedDlRbCenterArea[i] = true;
1734  expectedUlRbCenterArea[i] = true;
1735  }
1736 
1737  double expectedDlPowerEdgeArea = 2.0;
1738  std::vector<bool> expectedDlRbEdgeArea;
1739  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1740  std::vector<bool> expectedUlRbEdgeArea;
1741  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1742  for (uint32_t i = 0; i < 6; i++)
1743  {
1744  expectedDlRbEdgeArea[i] = true;
1745  expectedUlRbEdgeArea[i] = true;
1746  }
1747 
1748  std::vector<bool> expectedDlRbEdgeArea2;
1749  expectedDlRbEdgeArea2.resize (m_dlBandwidth, false);
1750  std::vector<bool> expectedUlRbEdgeArea2;
1751  expectedUlRbEdgeArea2.resize (m_dlBandwidth, false);
1752  for (uint32_t i = 6; i < 12; i++)
1753  {
1754  expectedDlRbEdgeArea2[i] = true;
1755  expectedUlRbEdgeArea2[i] = true;
1756  }
1757 
1758 
1759  Simulator::Schedule (MilliSeconds (1),
1760  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1761  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1762  Simulator::Schedule (MilliSeconds (1),
1763  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1764 
1765  Simulator::Schedule (MilliSeconds (501),
1766  &LteFrAreaTestCase::TeleportUe, this, 400, 0,
1767  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1768  Simulator::Schedule (MilliSeconds (501),
1769  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea );
1770 
1771  Simulator::Schedule (MilliSeconds (1001),
1772  &LteFrAreaTestCase::TeleportUe2, this, ueNodes1.Get (0), 600, 0,
1773  expectedDlPowerEdgeArea, expectedDlRbEdgeArea2 );
1774  Simulator::Schedule (MilliSeconds (1001),
1775  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea2 );
1776 
1777  Simulator::Schedule (MilliSeconds (1501),
1778  &LteFrAreaTestCase::TeleportUe2, this, ueNodes1.Get (0), 200, 0,
1779  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1780  Simulator::Schedule (MilliSeconds (1501),
1781  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea );
1782 
1783  Simulator::Schedule (MilliSeconds (2001),
1784  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1785  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1786  Simulator::Schedule (MilliSeconds (2001),
1787  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1788 
1789  Simulator::Stop (Seconds (2.500));
1790  Simulator::Run ();
1791 
1792 #if 0
1794  "Scheduler used DL RBG muted by FFR Algorithm");
1795 #endif
1796 
1798  "Scheduler used UL RB muted by FFR Algorithm");
1799 
1800  Simulator::Destroy ();
1801 
1802 }
holds a vector of ns3::Application pointers.
Test hard frequency reuse algorithm.
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:240
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void SetCellId(uint16_t cellId)
Set cell ID.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
std::string m_schedulerType
scheduler type
Test the fractional frequency reuse algorithms.
an Inet address class
bool m_usedWrongUlRbg
used wrong UL RBG?
virtual void DoRun(void)
Implementation to actually run this TestCase.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::vector< bool > m_expectedDlRb
the expected DL per RB
AttributeValue implementation for Boolean.
Definition: boolean.h:36
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
std::string m_schedulerType
the scheduler type
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
void UlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:258
void SetRxSpectrumModel(Ptr< const SpectrumModel > model)
Set receive spectrum model.
Lte Enhanced Ffr Area Test Case.
A suite of tests to run.
Definition: test.h:1342
uint8_t m_dlEdgeSubBandwidth
DL edge subbandwidth.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
void UlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
UL data receive start function.
bool m_usedMutedUlRbg
used muted UL RBG?
serverApps
Definition: first.py:45
uint8_t m_ulEdgeSubBandwidth
UL edge subbandwidth.
LteStrictFrTestCase(std::string name, uint32_t userNum, std::string schedulerType, uint8_t dlBandwidth, uint8_t ulBandwidth, uint8_t dlCommonSubBandwidth, uint8_t dlEdgeSubBandOffset, uint8_t dlEdgeSubBandwidth, uint8_t ulCommonSubBandwidth, uint8_t ulEdgeSubBandOffset, uint8_t ulEdgeSubBandwidth, std::vector< bool > availableDlRb, std::vector< bool > availableUlRb)
Constructor.
uint8_t m_dlSubBandOffset
the DL subband offset
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:961
std::vector< bool > m_expectedUlRb
expected UL per RB
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:204
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1070
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:280
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void DlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
DL data receive start function.
encapsulates test code
Definition: test.h:1155
Lte Distributed Ffr Area Test Case.
Ptr< SpectrumChannel > GetChannel()
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1314
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
std::string m_schedulerType
the scheduler type
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:1069
Values::const_iterator ConstValuesBegin() const
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:327
uint8_t m_ulBandwidth
the UL bandwidth
ApplicationContainer Install(NodeContainer c)
void SetFfrAlgorithmType(std::string type)
Set the type of FFR algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:306
uint8_t m_dlBandwidth
the DL bandwidth
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:279
mobility
Definition: third.py:101
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:43
void TeleportUe(uint32_t x, uint32_t y, double expectedPower, std::vector< bool > expectedDlRb)
Teleport UE function.
Class for representing data rates.
Definition: data-rate.h:88
Keep track of the current position and velocity of an object.
LteFrTestCase(std::string name, uint32_t userNum, uint8_t dlBandwidth, uint8_t ulBandwidth, std::vector< bool > availableDlRb, std::vector< bool > availableUlRb)
Constructor.
void DlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
TestCase Data.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
LteStrictFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
AttributeValue implementation for Time.
Definition: nstime.h:1124
uint8_t m_dlEdgeSubBandOffset
DL edge subband offset.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Hold an unsigned integer type.
Definition: uinteger.h:44
uint8_t m_ulSubBandOffset
UL subband offset.
double startTime
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Definition: lte-helper.cc:293
#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:168
holds a vector of ns3::NetDevice pointers
LteDistributedFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Lte Soft Fr Area Test Case.
bool m_usedWrongDlRbg
used wrong DL RBG?
uint64_t gbrDl
Guaranteed Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:42
LteSoftFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
LteFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Test stric frequency reuse algorithm.
virtual void DoRun(void)
Implementation to actually run this TestCase.
#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:380
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double m_expectedDlPower
the expected DL power
uint8_t m_dlSubBandwidth
the DL subband width
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
std::vector< bool > m_availableDlRb
the available DL for each RB
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
Ptr< MobilityModel > m_ueMobility
the UE mobility model
bool m_usedMutedDlRbg
used muted DL RBG?
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
uint64_t mbrUl
Maximum Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:45
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1221
Values::const_iterator ConstValuesEnd() const
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
uint8_t m_ulBandwidth
the UL bandwidth
void SetDlExpectedValues(double expectedPower, std::vector< bool > expectedDlRb)
Set DL expected values function.
uint8_t m_ulCommonSubBandwidth
UL common subbandwidth.
void SetPosition(const Vector &position)
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
void UlDataRxStartNofiticationArea(LteFrAreaTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:785
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
Helper class used to assign positions and mobility models to nodes.
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Time m_teleportTime
the telport time
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
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:272
uint8_t m_ulSubBandwidth
UL subband offset.
double m_expectedUlPower
expected UL power
Helper class that adds ns3::Ipv4StaticRouting objects.
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
LteSoftFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
uint8_t m_dlBandwidth
the DL bandwidth
uint8_t m_ulEdgeSubBandOffset
UL edge subband offset.
Lte Soft Ffr Area Test Case.
LteEnhancedFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
uint32_t m_userNum
the number of UE nodes
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:272
static LteFrequencyReuseTestSuite lteFrequencyReuseTestSuite
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1062
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:810
void TeleportUe2(Ptr< Node > ueNode, uint32_t x, uint32_t y, double expectedPower, std::vector< bool > expectedDlRb)
Teleport UE 2 function.
void Add(Vector v)
Add a position to the list of positions.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
clientApps
Definition: first.py:54
void DlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
DL data receive start function.
Qci
QoS Class Indicator.
Definition: eps-bearer.h:106
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:309
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
LteHardFrTestCase(std::string name, uint32_t userNum, std::string schedulerType, uint8_t dlBandwidth, uint8_t ulBandwidth, uint8_t dlSubBandOffset, uint8_t dlSubBandwidth, uint8_t ulSubBandOffset, uint8_t ulSubBandwidth, std::vector< bool > availableDlRb, std::vector< bool > availableUlRb)
Constructor.
uint64_t mbrDl
Maximum Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:44
3GPP TS 36.413 9.2.1.18 GBR QoS Information
Definition: eps-bearer.h:35
std::vector< bool > m_availableUlRb
the available UL for each RB
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
void DlDataRxStartNofiticationArea(LteFrAreaTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
The eNodeB device implementation.
void UlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
UL data receive start function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the FFR algorithm to be created.
Definition: lte-helper.cc:314
void SetUlExpectedValues(double expectedPower, std::vector< bool > expectedDlRb)
Set UL expected values function.
Test frequency reuse algorithm by teleporing UEs to different parts of area and checking if the frequ...
Test frequency reuse algorithm.
uint8_t m_dlCommonSubBandwidth
DL common subbandwidth.
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
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...
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
void SimpleTeleportUe(uint32_t x, uint32_t y)
Simple teleport UE function.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:74
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:400
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139
The LteUeNetDevice class implements the UE net device.
virtual void DoRun(void)
Implementation to actually run this TestCase.