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,uint16_t dlBandwidth,uint16_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 
191 {}
192 
193 
194 
195 void
197 {
198  NS_LOG_DEBUG ("DL DATA Power allocation :");
199  Values::const_iterator it;
200  uint32_t i = 0;
201  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
202  {
203  double power = (*it) * (m_dlBandwidth * 180000);
204  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power << " isAvailable: " << m_availableDlRb[i]);
205 
206  if (m_availableDlRb[i] == false && power > 0)
207  {
208  m_usedMutedDlRbg = true;
209  }
210  i++;
211  }
212 }
213 
214 void
216 {
217  NS_LOG_DEBUG ("UL DATA Power allocation :");
218  Values::const_iterator it;
219  uint32_t i = 0;
220  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
221  {
222  double power = (*it) * (m_ulBandwidth * 180000);
223  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power << " isAvailable: " << m_availableUlRb[i]);
224 
225  if (m_availableUlRb[i] == false && power > 0)
226  {
227  m_usedMutedUlRbg = true;
228  }
229  i++;
230  }
231 }
232 
233 
234 void
236 {}
237 
238 
239 LteHardFrTestCase::LteHardFrTestCase (std::string name, uint32_t userNum,
240  std::string schedulerType,
241  uint16_t dlBandwidth, uint16_t ulBandwidth,
242  uint8_t dlSubBandOffset, uint16_t dlSubBandwidth,
243  uint8_t ulSubBandOffset, uint16_t ulSubBandwidth,
244  std::vector<bool> availableDlRb, std::vector<bool> availableUlRb)
245  : LteFrTestCase (name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
246  m_schedulerType (schedulerType),
247  m_dlSubBandOffset (dlSubBandOffset),
248  m_dlSubBandwidth (dlSubBandwidth),
249  m_ulSubBandOffset (ulSubBandOffset),
250  m_ulSubBandwidth (ulSubBandwidth)
251 {
252  NS_LOG_INFO ("Creating LteDownlinkFrTestCase");
253 }
254 
256 {}
257 
258 void
260 {
261  NS_LOG_DEBUG ("LteFrTestCase");
262 
263  Config::Reset ();
264  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
265 
270  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
271  lteHelper->SetFfrAlgorithmType ("ns3::LteFrHardAlgorithm");
272 
273  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandOffset", UintegerValue (m_dlSubBandOffset));
274  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandwidth", UintegerValue (m_dlSubBandwidth));
275 
276  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandOffset", UintegerValue (m_ulSubBandOffset));
277  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandwidth", UintegerValue (m_ulSubBandwidth));
278 
279 
280  // Create Nodes: eNodeB and UE
281  NodeContainer enbNodes;
282  NodeContainer ueNodes;
283  enbNodes.Create (1);
284  ueNodes.Create (m_userNum);
285  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
286 
287  // Install Mobility Model
289  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
290  mobility.Install (allNodes);
291 
292  // Create Devices and install them in the Nodes (eNB and UE)
293  NetDeviceContainer enbDevs;
294  NetDeviceContainer ueDevs;
295  lteHelper->SetSchedulerType (m_schedulerType);
296  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
297  ueDevs = lteHelper->InstallUeDevice (ueNodes);
298 
299  // Attach a UE to a eNB
300  lteHelper->Attach (ueDevs, enbDevs.Get (0));
301 
302  // Activate the default EPS bearer
303  //Since this test includes the Token Bank Fair Queue Scheduler
304  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
305  //bearer as the dedicated bearer with QoS.
306  GbrQosInformation qos;
307  qos.mbrUl = 1e6;
308  qos.mbrDl = 1e6;
309  qos.gbrUl = 1e4;
310  qos.gbrDl = 1e4;
311 
312  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
313  EpsBearer bearer (q, qos);
314  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
315 
316  //Test SpectrumPhy to get signals form DL channel
317  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
318  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
319 
320  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
321  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
322  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
323  dlChannel->AddRx (testDlSpectrumPhy);
324 
325  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
327 
328  //Test SpectrumPhy to get signals form UL channel
329  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
330  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
331 
332  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
333  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
334  ulChannel->AddRx (testUlSpectrumPhy);
335 
336  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
338 
339  Simulator::Stop (Seconds (0.500));
340  Simulator::Run ();
341 
343  "Scheduler used DL RBG muted by FFR Algorithm");
344 
346  "Scheduler used UL RBG muted by FFR Algorithm");
347 
348  Simulator::Destroy ();
349 }
350 
351 
352 
353 LteStrictFrTestCase::LteStrictFrTestCase (std::string name, uint32_t userNum,
354  std::string schedulerType,
355  uint16_t dlBandwidth, uint16_t ulBandwidth,
356  uint16_t dlCommonSubBandwidth, uint8_t dlEdgeSubBandOffset, uint16_t dlEdgeSubBandwidth,
357  uint16_t ulCommonSubBandwidth, uint8_t ulEdgeSubBandOffset, uint16_t ulEdgeSubBandwidth,
358  std::vector<bool> availableDlRb, std::vector<bool> availableUlRb)
359  : LteFrTestCase (name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
360  m_schedulerType (schedulerType),
361  m_dlCommonSubBandwidth (dlCommonSubBandwidth),
362  m_dlEdgeSubBandOffset (dlEdgeSubBandOffset),
363  m_dlEdgeSubBandwidth (dlEdgeSubBandwidth),
364  m_ulCommonSubBandwidth (ulCommonSubBandwidth),
365  m_ulEdgeSubBandOffset (ulEdgeSubBandOffset),
366  m_ulEdgeSubBandwidth (ulEdgeSubBandwidth)
367 {
368  NS_LOG_INFO ("Creating LteFrTestCase");
369 }
370 
372 {}
373 
374 void
376 {
377  NS_LOG_DEBUG ("LteFrTestCase");
378 
379  Config::Reset ();
380  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
381 
386  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
387  lteHelper->SetFfrAlgorithmType ("ns3::LteFrStrictAlgorithm");
388 
389  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (m_dlCommonSubBandwidth));
390  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (m_dlEdgeSubBandOffset));
391  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (m_dlEdgeSubBandwidth));
392 
393  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (m_ulCommonSubBandwidth));
394  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (m_ulEdgeSubBandOffset));
395  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (m_ulEdgeSubBandwidth));
396 
397  // Create Nodes: eNodeB and UE
398  NodeContainer enbNodes;
399  NodeContainer ueNodes;
400  enbNodes.Create (1);
401  ueNodes.Create (m_userNum);
402  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
403 
404  // Install Mobility Model
406  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
407  mobility.Install (allNodes);
408 
409  // Create Devices and install them in the Nodes (eNB and UE)
410  NetDeviceContainer enbDevs;
411  NetDeviceContainer ueDevs;
412  lteHelper->SetSchedulerType (m_schedulerType);
413  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
414  ueDevs = lteHelper->InstallUeDevice (ueNodes);
415 
416  // Attach a UE to a eNB
417  lteHelper->Attach (ueDevs, enbDevs.Get (0));
418 
419  // Activate the default EPS bearer
420  //Since this test includes the Token Bank Fair Queue Scheduler
421  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
422  //bearer as the dedicated bearer with QoS.
423 
424  GbrQosInformation qos;
425  qos.mbrUl = 1e6;
426  qos.mbrDl = 1e6;
427  qos.gbrUl = 1e4;
428  qos.gbrDl = 1e4;
429 
430  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
431  EpsBearer bearer (q, qos);
432  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
433 
434  //Test SpectrumPhy to get signals form DL channel
435  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
436  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
437 
438  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
439  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
440  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
441  dlChannel->AddRx (testDlSpectrumPhy);
442 
443  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
445 
446  //Test SpectrumPhy to get signals form UL channel
447  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
448  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
449 
450  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
451  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
452  ulChannel->AddRx (testUlSpectrumPhy);
453 
454  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
456 
457  Simulator::Stop (Seconds (0.500));
458  Simulator::Run ();
459 
461  "Scheduler used DL RBG muted by FFR Algorithm");
462 
464  "Scheduler used UL RBG muted by FFR Algorithm");
465 
466  Simulator::Destroy ();
467 }
468 
469 void
471  Ptr<const SpectrumValue> spectrumValue)
472 {
473  testcase->DlDataRxStart (spectrumValue);
474 }
475 
476 void
478  Ptr<const SpectrumValue> spectrumValue)
479 {
480  testcase->UlDataRxStart (spectrumValue);
481 }
482 
483 LteFrAreaTestCase::LteFrAreaTestCase (std::string name, std::string schedulerType)
484  : TestCase ("Test: " + name),
485  m_schedulerType (schedulerType)
486 {
487  m_dlBandwidth = 25;
488  m_ulBandwidth = 25;
489  m_usedWrongDlRbg = false;
490  m_usedWrongUlRbg = false;
491 }
493 {}
494 
495 void
497 {
498  //need time to report new UE measurements, and wait because of filtering
499  if ( (Simulator::Now () - m_teleportTime ) < MilliSeconds (400))
500  {
501  return;
502  }
503 
504  NS_LOG_DEBUG ("DL DATA Power allocation :");
505  Values::const_iterator it;
506  uint32_t i = 0;
507  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
508  {
509  double power = (*it) * (m_dlBandwidth * 180000);
510  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power);
511  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power
512  << " Available: " << m_expectedDlRb[i] << " Expected Power: " << m_expectedDlPower );
513 
514  if (m_expectedDlRb[i] == false && power > 0)
515  {
516  m_usedWrongDlRbg = true;
517  }
518  else if (m_expectedDlRb[i] == true && power > 0)
519  {
521  "Wrong Data Channel DL Power level");
522  }
523  i++;
524  }
525 }
526 
527 void
529 {
530  //need time to report new UE measurements, and wait because of filtering
531  if ( (Simulator::Now () - m_teleportTime ) < MilliSeconds (400))
532  {
533  return;
534  }
535 
536  NS_LOG_DEBUG ("UL DATA Power allocation :");
537  Values::const_iterator it;
538  uint32_t i = 0;
539  uint32_t numActiveRbs = 0;
540 
541  // At the moment I could not find a better way to find total number
542  // of active RBs. This method is independent of the bandwidth
543  // configuration done in a test scenario, thus, it requires
544  // minimum change to the script.
545  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
546  {
547  // Count the RB as active if it is part of
548  // the expected UL RBs and has Power Spectral Density (PSD) > 0
549  if (m_expectedUlRb[numActiveRbs] == true && (*it) > 0)
550  {
551  numActiveRbs++;
552  }
553  }
554  NS_LOG_DEBUG ("Total number of active RBs = " << numActiveRbs);
555 
556  // The uplink power control and the uplink PSD
557  // calculation only consider active resource blocks.
558  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
559  {
560  double power = (*it) * (numActiveRbs * 180000);
561  NS_LOG_DEBUG ("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower);
562  if (m_expectedUlRb[i] == false && power > 0)
563  {
564  m_usedWrongUlRbg = true;
565  }
566  else if (m_expectedUlRb[i] == true && power > 0)
567  {
569  "Wrong Data Channel UL Power level" << Simulator::Now ().As (Time::S));
570  }
571  i++;
572  }
573 }
574 
575 void
577 {
578  NS_LOG_FUNCTION (this);
579  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
581  m_ueMobility->SetPosition (Vector (x, y, 0.0));
582 }
583 
584 void
585 LteFrAreaTestCase::TeleportUe (uint32_t x, uint32_t y, double expectedPower,
586  std::vector<bool> expectedDlRb)
587 {
588  NS_LOG_FUNCTION (this);
589  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
591  m_ueMobility->SetPosition (Vector (x, y, 0.0));
592  m_expectedDlPower = expectedPower;
593  m_expectedDlRb = expectedDlRb;
594 }
595 
596 void
597 LteFrAreaTestCase::TeleportUe2 (Ptr<Node> ueNode, uint32_t x, uint32_t y, double expectedPower,
598  std::vector<bool> expectedDlRb)
599 {
600  NS_LOG_FUNCTION (this);
601  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
602 
603  Ptr<MobilityModel> ueMobility = ueNode->GetObject<MobilityModel> ();
604  ueMobility->SetPosition (Vector (x, y, 0.0));
606  m_expectedDlPower = expectedPower;
607  m_expectedDlRb = expectedDlRb;
608 }
609 
610 void
611 LteFrAreaTestCase::SetDlExpectedValues (double expectedDlPower, std::vector<bool> expectedDlRb)
612 {
613  NS_LOG_FUNCTION (this);
614  m_expectedDlPower = expectedDlPower;
615  m_expectedDlRb = expectedDlRb;
616 }
617 
618 void
619 LteFrAreaTestCase::SetUlExpectedValues (double expectedUlPower, std::vector<bool> expectedUlRb)
620 {
621  NS_LOG_FUNCTION (this);
622  m_expectedUlPower = expectedUlPower;
623  m_expectedUlRb = expectedUlRb;
624 }
625 
626 void
628 {}
629 
630 LteStrictFrAreaTestCase::LteStrictFrAreaTestCase (std::string name, std::string schedulerType)
631  : LteFrAreaTestCase (name, schedulerType)
632 {
633  NS_LOG_INFO ("Creating LteFrTestCase");
634 }
635 
637 {}
638 
639 void
641 {
642  NS_LOG_DEBUG ("LteStrictFrAreaTestCase");
643 
644  Config::Reset ();
645  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
646  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
647  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
648 
649  double eNbTxPower = 30;
650  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
651  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
652  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
653 
654  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
655  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
656 
657  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
658 
659  // Create Nodes: eNodeB and UE
660  NodeContainer enbNodes;
661  NodeContainer ueNodes1;
662  NodeContainer ueNodes2;
663  enbNodes.Create (2);
664  ueNodes1.Create (1);
665  ueNodes2.Create (1);
666  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
667 
668  /*
669  * The topology is the following:
670  *
671  * eNB1 UE1 eNB2
672  * | | |
673  * x ------------ x ------------------------ x ------------ x----UE2
674  * 200 m 600 m 200 m 20 m
675  *
676  */
677 
678  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
679  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
680  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
681  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
682  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
684  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
685  mobility.SetPositionAllocator (positionAlloc);
686  mobility.Install (allNodes);
687  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
688 
689  // Disable layer-3 filtering
690  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
691  UintegerValue (0));
692  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
693  UintegerValue (0));
694 
695  // Create Devices and install them in the Nodes (eNB and UE)
696  NetDeviceContainer enbDevs;
697  NetDeviceContainer ueDevs1;
698  NetDeviceContainer ueDevs2;
699  lteHelper->SetSchedulerType (m_schedulerType);
700 
701  lteHelper->SetFfrAlgorithmType ("ns3::LteFrStrictAlgorithm");
702  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
703  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
704  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
705  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
706  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
707 
708  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (6));
709  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (6));
710  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (6));
711 
712  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (6));
713  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (6));
714  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (6));
715  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
716 
717  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
718  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
719 
720  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
721  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
722 
723  // Attach a UE to a eNB
724  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
725  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
726 
727  // Activate the default EPS bearer
728  //Since this test includes the Token Bank Fair Queue Scheduler
729  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
730  //bearer as the dedicated bearer with QoS.
731  GbrQosInformation qos;
732  qos.mbrUl = 1e6;
733  qos.mbrDl = 1e6;
734  qos.gbrUl = 1e4;
735  qos.gbrDl = 1e4;
736 
737  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
738  EpsBearer bearer (q, qos);
739 
740  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
741  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
742 
743  //Test SpectrumPhy to get signals form DL channel
744  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
745  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
746 
747  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
748  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
749  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
750  dlChannel->AddRx (testDlSpectrumPhy);
751 
752  testDlSpectrumPhy->SetCellId (1);
753 
754  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
756 
757  //Test SpectrumPhy to get signals form UL channel
758  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
759  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
760 
761  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
762  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
763  ulChannel->AddRx (testUlSpectrumPhy);
764 
765  testUlSpectrumPhy->SetCellId (1);
766 
767  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
769 
770  std::vector<bool> expectedDlRbCenterArea;
771  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
772  std::vector<bool> expectedUlRbCenterArea;
773  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
774  for (uint32_t i = 0; i < 6; i++)
775  {
776  expectedDlRbCenterArea[i] = true;
777  expectedUlRbCenterArea[i] = true;
778  }
779 
780  std::vector<bool> expectedDlRbEdgeArea;
781  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
782  std::vector<bool> expectedUlRbEdgeArea;
783  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
784  for (uint32_t i = 12; i < 18; i++)
785  {
786  expectedDlRbEdgeArea[i] = true;
787  expectedUlRbEdgeArea[i] = true;
788  }
789 
790  Simulator::Schedule (MilliSeconds (1),
791  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
792  Simulator::Schedule (MilliSeconds (1),
793  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
794 
795  Simulator::Schedule (MilliSeconds (501),
796  &LteFrAreaTestCase::TeleportUe, this, 800, 0, 2, expectedDlRbEdgeArea );
797  Simulator::Schedule (MilliSeconds (501),
798  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
799 
800  Simulator::Schedule (MilliSeconds (1001),
801  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
802  Simulator::Schedule (MilliSeconds (1001),
803  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
804 
805  Simulator::Stop (Seconds (1.500));
806  Simulator::Run ();
807 
809  "Scheduler used DL RB muted by FFR Algorithm");
811  "Scheduler used UL RB muted by FFR Algorithm");
812 
813  Simulator::Destroy ();
814 }
815 
816 LteSoftFrAreaTestCase::LteSoftFrAreaTestCase (std::string name, std::string schedulerType)
817  : LteFrAreaTestCase (name, schedulerType)
818 {
819  NS_LOG_INFO ("Creating LteSoftFrAreaTestCase");
820 }
821 
823 {}
824 
825 void
827 {
828  NS_LOG_DEBUG ("LteSoftFrAreaTestCase");
829 
830  Config::Reset ();
831  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
832  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
833  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
834 
835  double eNbTxPower = 30;
836  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
837  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
838  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
839 
840  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
841  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
842 
843  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
844 
845  // Create Nodes: eNodeB and UE
846  NodeContainer enbNodes;
847  NodeContainer ueNodes1;
848  NodeContainer ueNodes2;
849  enbNodes.Create (2);
850  ueNodes1.Create (1);
851  ueNodes2.Create (1);
852  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
853 
854  /*
855  * The topology is the following:
856  *
857  * eNB1 UE1 eNB2
858  * | | |
859  * x ------------ x ------------------------ x ------------ x----UE2
860  * 200 m 600 m 200 m 20 m
861  *
862  */
863 
864  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
865  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
866  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
867  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
868  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
870  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
871  mobility.SetPositionAllocator (positionAlloc);
872  mobility.Install (allNodes);
873  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
874 
875  // Disable layer-3 filtering
876  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
877  UintegerValue (0));
878  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
879  UintegerValue (0));
880 
881  // Create Devices and install them in the Nodes (eNB and UE)
882  NetDeviceContainer enbDevs;
883  NetDeviceContainer ueDevs1;
884  NetDeviceContainer ueDevs2;
885  lteHelper->SetSchedulerType (m_schedulerType);
886 
887  lteHelper->SetFfrAlgorithmType ("ns3::LteFrSoftAlgorithm");
888  lteHelper->SetFfrAlgorithmAttribute ("AllowCenterUeUseEdgeSubBand", BooleanValue (false));
889  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
890  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
891  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
892  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
893  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
894 
895  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (8));
896  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (8));
897  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (8));
898  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (8));
899  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
900 
901  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
902  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
903 
904  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
905  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
906 
907  // Attach a UE to a eNB
908  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
909  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
910 
911  // Activate the default EPS bearer
912  //Since this test includes the Token Bank Fair Queue Scheduler
913  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
914  //bearer as the dedicated bearer with QoS.
915  GbrQosInformation qos;
916  qos.mbrUl = 1e6;
917  qos.mbrDl = 1e6;
918  qos.gbrUl = 1e4;
919  qos.gbrDl = 1e4;
920 
921  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
922  EpsBearer bearer (q, qos);
923  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
924  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
925 
926  //Test SpectrumPhy to get signals form DL channel
927  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
928  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
929 
930  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
931  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
932  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
933  dlChannel->AddRx (testDlSpectrumPhy);
934 
935  testDlSpectrumPhy->SetCellId (1);
936 
937  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
939 
940  //Test SpectrumPhy to get signals form UL channel
941  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
942  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
943 
944  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
945  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
946  ulChannel->AddRx (testUlSpectrumPhy);
947 
948  testUlSpectrumPhy->SetCellId (1);
949 
950  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
952 
953 
954  std::vector<bool> expectedDlRbCenterArea;
955  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
956  std::vector<bool> expectedUlRbCenterArea;
957  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
958  for (uint32_t i = 0; i < 8; i++)
959  {
960  expectedDlRbCenterArea[i] = true;
961  expectedUlRbCenterArea[i] = true;
962  }
963  for (uint32_t i = 16; i < 25; i++)
964  {
965  expectedDlRbCenterArea[i] = true;
966  }
967 
968  std::vector<bool> expectedDlRbEdgeArea;
969  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
970  std::vector<bool> expectedUlRbEdgeArea;
971  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
972  for (uint32_t i = 8; i < 16; i++)
973  {
974  expectedDlRbEdgeArea[i] = true;
975  expectedUlRbEdgeArea[i] = true;
976  }
977 
978  Simulator::Schedule (MilliSeconds (1),
979  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
980  Simulator::Schedule (MilliSeconds (1),
981  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
982 
983  Simulator::Schedule (MilliSeconds (501),
984  &LteFrAreaTestCase::TeleportUe, this, 800, 0, 2, expectedDlRbEdgeArea );
985  Simulator::Schedule (MilliSeconds (501),
986  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
987 
988  Simulator::Schedule (MilliSeconds (1001),
989  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
990  Simulator::Schedule (MilliSeconds (1001),
991  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
992 
993  Simulator::Stop (Seconds (1.500));
994  Simulator::Run ();
995 
996 #if 0
998  "Scheduler used DL RBG muted by FFR Algorithm");
999 
1000 #endif
1002  "Scheduler used UL RB muted by FFR Algorithm");
1003 
1004  Simulator::Destroy ();
1005 }
1006 
1007 LteSoftFfrAreaTestCase::LteSoftFfrAreaTestCase (std::string name, std::string schedulerType)
1008  : LteFrAreaTestCase (name, schedulerType)
1009 {
1010  NS_LOG_INFO ("Creating LteSoftFfrAreaTestCase");
1011 }
1012 
1014 {}
1015 
1016 void
1018 {
1019  NS_LOG_DEBUG ("LteSoftFfrAreaTestCase");
1020 
1021  Config::Reset ();
1022  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1023  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1024  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1025 
1026  double eNbTxPower = 30;
1027  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1028  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1029  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1030 
1031  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1032  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1033 
1034  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1035 
1036  // Create Nodes: eNodeB and UE
1037  NodeContainer enbNodes;
1038  NodeContainer ueNodes1;
1039  NodeContainer ueNodes2;
1040  enbNodes.Create (2);
1041  ueNodes1.Create (1);
1042  ueNodes2.Create (1);
1043  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1044 
1045  /*
1046  * The topology is the following:
1047  *
1048  * eNB1 UE1 eNB2
1049  * | | |
1050  * x ------------ x ------------------------ x ------------ x----UE2
1051  * 200 m 600 m 200 m 20 m
1052  *
1053  */
1054 
1055  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1056  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1057  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1058  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
1059  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
1061  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1062  mobility.SetPositionAllocator (positionAlloc);
1063  mobility.Install (allNodes);
1064  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
1065 
1066  // Disable layer-3 filtering
1067  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1068  UintegerValue (0));
1069  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1070  UintegerValue (0));
1071 
1072  // Create Devices and install them in the Nodes (eNB and UE)
1073  NetDeviceContainer enbDevs;
1074  NetDeviceContainer ueDevs1;
1075  NetDeviceContainer ueDevs2;
1076  lteHelper->SetSchedulerType (m_schedulerType);
1077 
1078  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrSoftAlgorithm");
1079  lteHelper->SetFfrAlgorithmAttribute ("CenterRsrqThreshold", UintegerValue (28));
1080  lteHelper->SetFfrAlgorithmAttribute ("EdgeRsrqThreshold", UintegerValue (18));
1081  lteHelper->SetFfrAlgorithmAttribute ("CenterAreaPowerOffset",
1082  UintegerValue (LteRrcSap::PdschConfigDedicated::dB_3));
1083  lteHelper->SetFfrAlgorithmAttribute ("MediumAreaPowerOffset",
1084  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1085  lteHelper->SetFfrAlgorithmAttribute ("EdgeAreaPowerOffset",
1086  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
1087 
1088  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (6));
1089  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (6));
1090 
1091  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (6));
1092  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (6));
1093  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (6));
1094  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (6));
1095  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
1096 
1097  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
1098  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
1099 
1100  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1101  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1102 
1103  // Attach a UE to a eNB
1104  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1105  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1106 
1107  // Activate the default EPS bearer
1108  //Since this test includes the Token Bank Fair Queue Scheduler
1109  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1110  //bearer as the dedicated bearer with QoS.
1111  GbrQosInformation qos;
1112  qos.mbrUl = 1e6;
1113  qos.mbrDl = 1e6;
1114  qos.gbrUl = 1e4;
1115  qos.gbrDl = 1e4;
1116 
1117  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1118  EpsBearer bearer (q, qos);
1119  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
1120  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
1121 
1122  //Test SpectrumPhy to get signals form DL channel
1123  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1124  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1125 
1126  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1127  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1128  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1129  dlChannel->AddRx (testDlSpectrumPhy);
1130 
1131  testDlSpectrumPhy->SetCellId (1);
1132 
1133  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1135 
1136  //Test SpectrumPhy to get signals form UL channel
1137  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1138  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1139 
1140  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1141  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1142  ulChannel->AddRx (testUlSpectrumPhy);
1143 
1144  testUlSpectrumPhy->SetCellId (1);
1145 
1146  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1148 
1149  double expectedDlPowerCenterArea = 0.5;
1150  std::vector<bool> expectedDlRbCenterArea;
1151  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1152  std::vector<bool> expectedUlRbCenterArea;
1153  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1154  for (uint32_t i = 6; i < 12; i++)
1155  {
1156  expectedDlRbCenterArea[i] = true;
1157  expectedUlRbCenterArea[i] = true;
1158  }
1159  for (uint32_t i = 18; i < 25; i++)
1160  {
1161  expectedDlRbCenterArea[i] = true;
1162  expectedUlRbCenterArea[i] = true;
1163  }
1164 
1165  double expectedDlPowerMiddleArea = 1.0;
1166  std::vector<bool> expectedDlRbMiddleArea;
1167  expectedDlRbMiddleArea.resize (m_dlBandwidth, false);
1168  std::vector<bool> expectedUlRbMiddleArea;
1169  expectedUlRbMiddleArea.resize (m_ulBandwidth, false);
1170  for (uint32_t i = 0; i < 6; i++)
1171  {
1172  expectedDlRbMiddleArea[i] = true;
1173  expectedUlRbMiddleArea[i] = true;
1174  }
1175 
1176  double expectedDlPowerEdgeArea = 2.0;
1177  std::vector<bool> expectedDlRbEdgeArea;
1178  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1179  std::vector<bool> expectedUlRbEdgeArea;
1180  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1181  for (uint32_t i = 12; i < 18; i++)
1182  {
1183  expectedDlRbEdgeArea[i] = true;
1184  expectedUlRbEdgeArea[i] = true;
1185  }
1186 
1187  Simulator::Schedule (MilliSeconds (1),
1188  &LteFrAreaTestCase::TeleportUe, this, 200, 0,
1189  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1190  Simulator::Schedule (MilliSeconds (1),
1191  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1192 
1193  Simulator::Schedule (MilliSeconds (501),
1194  &LteFrAreaTestCase::TeleportUe, this, 600, 0,
1195  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1196  Simulator::Schedule (MilliSeconds (501),
1197  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbMiddleArea );
1198 
1199  Simulator::Schedule (MilliSeconds (1001),
1200  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1201  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1202  Simulator::Schedule (MilliSeconds (1001),
1203  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
1204 
1205  Simulator::Schedule (MilliSeconds (1501),
1206  &LteFrAreaTestCase::TeleportUe, this, 600, 0,
1207  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1208  Simulator::Schedule (MilliSeconds (1501),
1209  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbMiddleArea );
1210 
1211  Simulator::Schedule (MilliSeconds (2001),
1212  &LteFrAreaTestCase::TeleportUe, this, 200, 0,
1213  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1214  Simulator::Schedule (MilliSeconds (2001),
1215  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1216 
1217  Simulator::Stop (Seconds (2.500));
1218  Simulator::Run ();
1219 
1221  "Scheduler used DL RBG muted by FFR Algorithm");
1222 
1224  "Scheduler used UL RB muted by FFR Algorithm");
1225 
1226  Simulator::Destroy ();
1227 }
1228 
1229 
1230 LteEnhancedFfrAreaTestCase::LteEnhancedFfrAreaTestCase (std::string name, std::string schedulerType)
1231  : LteFrAreaTestCase (name, schedulerType)
1232 {
1233  NS_LOG_INFO ("Creating LteEnhancedFfrAreaTestCase");
1234 }
1235 
1237 {}
1238 
1239 void
1241 {
1242  NS_LOG_DEBUG ("LteEnhancedFfrAreaTestCase");
1243 
1244  Config::Reset ();
1245  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1246  Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true));
1247  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1248  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1249 
1250  double eNbTxPower = 30;
1251  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1252  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1253  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1254 
1255  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1256  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1257 
1258 
1259  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1260 
1261  // Create Nodes: eNodeB and UE
1262  NodeContainer enbNodes;
1263  NodeContainer ueNodes1;
1264  NodeContainer ueNodes2;
1265  enbNodes.Create (2);
1266  ueNodes1.Create (1);
1267  ueNodes2.Create (1);
1268  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1269 
1270  /*
1271  * The topology is the following:
1272  *
1273  * eNB1 UE1 eNB2
1274  * | | |
1275  * x ------------ x ------------------------ x ------------ x----UE2
1276  * 200 m 600 m 200 m 20 m
1277  *
1278  */
1279 
1280  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1281  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1282  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1283  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
1284  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
1286  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1287  mobility.SetPositionAllocator (positionAlloc);
1288  mobility.Install (allNodes);
1289  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
1290 
1291  // Disable layer-3 filtering
1292  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1293  UintegerValue (0));
1294  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1295  UintegerValue (0));
1296 
1297  // Create Devices and install them in the Nodes (eNB and UE)
1298  NetDeviceContainer enbDevs;
1299  NetDeviceContainer ueDevs1;
1300  NetDeviceContainer ueDevs2;
1301  lteHelper->SetSchedulerType (m_schedulerType);
1302  lteHelper->SetSchedulerAttribute ("HarqEnabled", BooleanValue (true));
1303 
1304  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (m_dlBandwidth));
1305  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (m_ulBandwidth));
1306 
1307  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrEnhancedAlgorithm");
1308  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
1309  lteHelper->SetFfrAlgorithmAttribute ("DlCqiThreshold", UintegerValue (10));
1310  lteHelper->SetFfrAlgorithmAttribute ("UlCqiThreshold", UintegerValue (15));
1311  lteHelper->SetFfrAlgorithmAttribute ("CenterAreaPowerOffset",
1312  UintegerValue (LteRrcSap::PdschConfigDedicated::dB_6));
1313  lteHelper->SetFfrAlgorithmAttribute ("EdgeAreaPowerOffset",
1314  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1315 
1316  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandOffset", UintegerValue (0));
1317  lteHelper->SetFfrAlgorithmAttribute ("UlReuse3SubBandwidth", UintegerValue (4));
1318  lteHelper->SetFfrAlgorithmAttribute ("UlReuse1SubBandwidth", UintegerValue (4));
1319 
1320  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandOffset", UintegerValue (0));
1321  lteHelper->SetFfrAlgorithmAttribute ("DlReuse3SubBandwidth", UintegerValue (4));
1322  lteHelper->SetFfrAlgorithmAttribute ("DlReuse1SubBandwidth", UintegerValue (4));
1323 
1324  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
1325 
1326  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
1327  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
1328 
1329  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1330  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1331 
1332  // Attach a UE to a eNB
1333  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1334  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1335 
1336  // Activate the default EPS bearer
1337  //Since this test includes the Token Bank Fair Queue Scheduler
1338  //(ns3::FdTbfqFfMacScheduler) we have to treat the default
1339  //bearer as the dedicated bearer with QoS.
1340  GbrQosInformation qos;
1341  qos.mbrUl = 1e6;
1342  qos.mbrDl = 1e6;
1343  qos.gbrUl = 1e4;
1344  qos.gbrDl = 1e4;
1345 
1346  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1347  EpsBearer bearer (q, qos);
1348  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
1349  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
1350 
1351  //Test SpectrumPhy to get signals form DL channel
1352  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1353  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1354 
1355  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1356  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1357  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1358  dlChannel->AddRx (testDlSpectrumPhy);
1359 
1360  testDlSpectrumPhy->SetCellId (1);
1361 
1362  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1364 
1365  //Test SpectrumPhy to get signals form UL channel
1366  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1367  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1368 
1369  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1370  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1371  ulChannel->AddRx (testUlSpectrumPhy);
1372 
1373  testUlSpectrumPhy->SetCellId (1);
1374 
1375  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1377 
1378  double expectedDlPowerCenterArea = 0.251189;
1379  std::vector<bool> expectedDlRbCenterArea;
1380  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1381  std::vector<bool> expectedUlRbCenterArea;
1382  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1383  for (uint32_t i = 0; i < 8; i++)
1384  {
1385  expectedDlRbCenterArea[i] = true;
1386  expectedUlRbCenterArea[i] = true;
1387  }
1388  for (uint32_t i = 12; i < 16; i++)
1389  {
1390  expectedDlRbCenterArea[i] = true;
1391  expectedUlRbCenterArea[i] = true;
1392  }
1393  for (uint32_t i = 20; i < 24; i++)
1394  {
1395  expectedDlRbCenterArea[i] = true;
1396  expectedUlRbCenterArea[i] = true;
1397  }
1398 
1399  double expectedDlPowerMiddleArea = 0.251189;
1400  std::vector<bool> expectedDlRbMiddleArea;
1401  expectedDlRbMiddleArea.resize (m_dlBandwidth, false);
1402  std::vector<bool> expectedUlRbMiddleArea;
1403  expectedUlRbMiddleArea.resize (m_ulBandwidth, false);
1404  for (uint32_t i = 4; i < 8; i++)
1405  {
1406  expectedDlRbMiddleArea[i] = true;
1407  expectedUlRbMiddleArea[i] = true;
1408  }
1409 
1410  double expectedDlPowerEdgeArea = 1.0;
1411  std::vector<bool> expectedDlRbEdgeArea;
1412  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1413  std::vector<bool> expectedUlRbEdgeArea;
1414  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1415  for (uint32_t i = 0; i < 4; i++)
1416  {
1417  expectedDlRbEdgeArea[i] = true;
1418  expectedUlRbEdgeArea[i] = true;
1419  }
1420 
1421  Simulator::Schedule (MilliSeconds (1),
1423  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1424  Simulator::Schedule (MilliSeconds (1),
1425  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.00250905, expectedUlRbCenterArea );
1426 
1427  Simulator::Schedule (MilliSeconds (501),
1429  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1430  Simulator::Schedule (MilliSeconds (501),
1431  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbMiddleArea );
1432 
1433  Simulator::Schedule (MilliSeconds (1001),
1435  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1436  Simulator::Schedule (MilliSeconds (1001),
1437  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0903259, expectedUlRbEdgeArea );
1438 
1439  Simulator::Schedule (MilliSeconds (1501),
1441  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1442  Simulator::Schedule (MilliSeconds (1501),
1443  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.00250905, expectedUlRbCenterArea );
1444 
1445  Simulator::Schedule (MilliSeconds (2001),
1447  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1448  Simulator::Schedule (MilliSeconds (2001),
1449  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1450 
1451  Simulator::Stop (Seconds (2.500));
1452  Simulator::Run ();
1453 
1455  "Scheduler used DL RBG muted by FFR Algorithm");
1456 
1458  "Scheduler used UL RB muted by FFR Algorithm");
1459 
1460  Simulator::Destroy ();
1461 }
1462 
1463 
1464 LteDistributedFfrAreaTestCase::LteDistributedFfrAreaTestCase (std::string name, std::string schedulerType)
1465  : LteFrAreaTestCase (name, schedulerType)
1466 {
1467  NS_LOG_INFO ("Creating LteDistributedFfrAreaTestCase");
1468 }
1469 
1471 {}
1472 
1473 void
1475 {
1476  NS_LOG_DEBUG ("LteDistributedFfrAreaTestCase");
1477 
1478  Config::Reset ();
1479  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1480  Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true));
1481  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1482  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1483 
1484  double eNbTxPower = 30;
1485  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1486  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1487  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1488 
1489  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1490  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1491 
1492  // Disable layer-3 filtering
1493  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1494  UintegerValue (0));
1495  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1496  UintegerValue (0));
1497 
1498  uint16_t bandwidth = 25;
1499 
1500  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1501  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
1502  lteHelper->SetEpcHelper (epcHelper);
1503  lteHelper->SetHandoverAlgorithmType ("ns3::NoOpHandoverAlgorithm"); // disable automatic handover
1504 
1505  Ptr<Node> pgw = epcHelper->GetPgwNode ();
1506 
1507  // Create a single RemoteHost
1508  NodeContainer remoteHostContainer;
1509  remoteHostContainer.Create (1);
1510  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
1511  InternetStackHelper internet;
1512  internet.Install (remoteHostContainer);
1513 
1514  // Create the Internet
1515  PointToPointHelper p2ph;
1516  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
1517  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
1518  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
1519  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
1520  Ipv4AddressHelper ipv4h;
1521  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
1522  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
1523  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
1524 
1525  // Routing of the Internet Host (towards the LTE network)
1526  Ipv4StaticRoutingHelper ipv4RoutingHelper;
1527  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
1528  // interface 0 is localhost, 1 is the p2p device
1529  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
1530 
1531  // Create Nodes: eNodeB and UE
1532  NodeContainer enbNodes;
1533  NodeContainer ueNodes1;
1534  NodeContainer ueNodes2;
1535  enbNodes.Create (2);
1536  ueNodes1.Create (2);
1537  ueNodes2.Create (1);
1538  NodeContainer ueNodes = NodeContainer ( ueNodes1, ueNodes2);
1539  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1540 
1541  /*
1542  * The topology is the following:
1543  *
1544  * eNB1 UE1 UE2 eNB2
1545  * | | | |
1546  * x ------------ x ------------------------ x ------------ x
1547  * 200 m 600 m 200 m
1548  *
1549  */
1550 
1551  // Install Mobility Model
1552  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1553  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1554  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1555 
1556  positionAlloc->Add (Vector (200, 0.0, 0.0)); // UE1
1557  positionAlloc->Add (Vector (200, 0.0, 0.0)); // UE1
1558  positionAlloc->Add (Vector (800, 0.0, 0.0)); // UE2
1559 
1561  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1562  mobility.SetPositionAllocator (positionAlloc);
1563  mobility.Install (allNodes);
1564  m_ueMobility = ueNodes2.Get (0)->GetObject<MobilityModel> ();
1565 
1566  // Create Devices and install them in the Nodes (eNB and UE)
1567  NetDeviceContainer enbDevs;
1568  NetDeviceContainer ueDevs1;
1569  NetDeviceContainer ueDevs2;
1570  lteHelper->SetSchedulerType (m_schedulerType);
1571 
1572  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (bandwidth));
1573  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (bandwidth));
1574 
1575  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrDistributedAlgorithm");
1576  lteHelper->SetFfrAlgorithmAttribute ("CalculationInterval", TimeValue (MilliSeconds (10)));
1577  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
1578  lteHelper->SetFfrAlgorithmAttribute ("RsrpDifferenceThreshold", UintegerValue (5));
1579  lteHelper->SetFfrAlgorithmAttribute ("EdgeRbNum", UintegerValue (6));
1580  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
1581  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1582  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
1583  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
1584 
1585  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
1586  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1587  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1588 
1589  NetDeviceContainer ueLteDevs;
1590  ueLteDevs.Add (ueDevs1);
1591  ueLteDevs.Add (ueDevs2);
1592 
1593  // Add X2 interface
1594  lteHelper->AddX2Interface (enbNodes);
1595 
1596  // Install the IP stack on the UEs
1597  internet.Install (ueNodes);
1598  Ipv4InterfaceContainer ueIpIfaces;
1599  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
1600  // Assign IP address to UEs, and install applications
1601  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
1602  {
1603  Ptr<Node> ueNode = ueNodes.Get (u);
1604  // Set the default gateway for the UE
1605  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
1606  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
1607  }
1608 
1609  // Attach a UE to a eNB
1610  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1611  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1612 
1613 
1614  // Install and start applications on UEs and remote host
1615  uint16_t dlPort = 10000;
1616  uint16_t ulPort = 20000;
1617 
1618  // randomize a bit start times to avoid simulation artifacts
1619  // (e.g., buffer overflows due to packet transmissions happening
1620  // exactly at the same time)
1621  Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable> ();
1622  startTimeSeconds->SetAttribute ("Min", DoubleValue (0));
1623  startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010));
1624 
1625  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
1626  {
1627  Ptr<Node> ue = ueNodes.Get (u);
1628  // Set the default gateway for the UE
1629  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
1630  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
1631 
1632  for (uint32_t b = 0; b < 1; ++b)
1633  {
1634  ++dlPort;
1635  ++ulPort;
1636 
1639 
1640  NS_LOG_LOGIC ("installing UDP DL app for UE " << u);
1641  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
1642  dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
1643  dlClientHelper.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
1644  clientApps.Add (dlClientHelper.Install (remoteHost));
1645  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory",
1646  InetSocketAddress (Ipv4Address::GetAny (), dlPort));
1647  serverApps.Add (dlPacketSinkHelper.Install (ue));
1648 
1649  NS_LOG_LOGIC ("installing UDP UL app for UE " << u);
1650  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
1651  ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
1652  ulClientHelper.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
1653  clientApps.Add (ulClientHelper.Install (ue));
1654  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory",
1655  InetSocketAddress (Ipv4Address::GetAny (), ulPort));
1656  serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
1657 
1658  Ptr<EpcTft> tft = Create<EpcTft> ();
1659  EpcTft::PacketFilter dlpf;
1660  dlpf.localPortStart = dlPort;
1661  dlpf.localPortEnd = dlPort;
1662  tft->Add (dlpf);
1663  EpcTft::PacketFilter ulpf;
1664  ulpf.remotePortStart = ulPort;
1665  ulpf.remotePortEnd = ulPort;
1666  tft->Add (ulpf);
1667  //Since this test includes the Token Bank Fair Queue Scheduler
1668  //(ns3::FdTbfqFfMacScheduler) we have to use GBR bearer with
1669  //certain QoS.
1670  GbrQosInformation qos;
1671  qos.mbrUl = 1e6;
1672  qos.mbrDl = 1e6;
1673  qos.gbrUl = 1e4;
1674  qos.gbrDl = 1e4;
1675 
1676  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1677  EpsBearer bearer (q, qos);
1678  lteHelper->ActivateDedicatedEpsBearer (ueLteDevs.Get (u), bearer, tft);
1679 
1680  Time startTime = Seconds (startTimeSeconds->GetValue ());
1681  serverApps.Start (startTime);
1682  clientApps.Start (startTime);
1683  }
1684  }
1685 
1686  //Test SpectrumPhy to get signals form DL channel
1687  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1688  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1689 
1690  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1691  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1692  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1693  dlChannel->AddRx (testDlSpectrumPhy);
1694 
1695  testDlSpectrumPhy->SetCellId (2);
1696 
1697  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1699 
1700  //Test SpectrumPhy to get signals form UL channel
1701  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1702  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1703 
1704  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1705  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1706  ulChannel->AddRx (testUlSpectrumPhy);
1707 
1708  testUlSpectrumPhy->SetCellId (2);
1709 
1710  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1712 
1713  double expectedDlPowerCenterArea = 1.0;
1714  std::vector<bool> expectedDlRbCenterArea;
1715  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1716  std::vector<bool> expectedUlRbCenterArea;
1717  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1718  for (uint32_t i = 0; i < m_dlBandwidth; i++)
1719  {
1720  expectedDlRbCenterArea[i] = true;
1721  expectedUlRbCenterArea[i] = true;
1722  }
1723 
1724  double expectedDlPowerEdgeArea = 2.0;
1725  std::vector<bool> expectedDlRbEdgeArea;
1726  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1727  std::vector<bool> expectedUlRbEdgeArea;
1728  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1729  for (uint32_t i = 0; i < 6; i++)
1730  {
1731  expectedDlRbEdgeArea[i] = true;
1732  expectedUlRbEdgeArea[i] = true;
1733  }
1734 
1735  std::vector<bool> expectedDlRbEdgeArea2;
1736  expectedDlRbEdgeArea2.resize (m_dlBandwidth, false);
1737  std::vector<bool> expectedUlRbEdgeArea2;
1738  expectedUlRbEdgeArea2.resize (m_dlBandwidth, false);
1739  for (uint32_t i = 6; i < 12; i++)
1740  {
1741  expectedDlRbEdgeArea2[i] = true;
1742  expectedUlRbEdgeArea2[i] = true;
1743  }
1744 
1745 
1746  Simulator::Schedule (MilliSeconds (1),
1747  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1748  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1749  Simulator::Schedule (MilliSeconds (1),
1750  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1751 
1752  Simulator::Schedule (MilliSeconds (501),
1753  &LteFrAreaTestCase::TeleportUe, this, 400, 0,
1754  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1755  Simulator::Schedule (MilliSeconds (501),
1756  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea );
1757 
1758  Simulator::Schedule (MilliSeconds (1001),
1759  &LteFrAreaTestCase::TeleportUe2, this, ueNodes1.Get (0), 600, 0,
1760  expectedDlPowerEdgeArea, expectedDlRbEdgeArea2 );
1761  Simulator::Schedule (MilliSeconds (1001),
1762  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea2 );
1763 
1764  Simulator::Schedule (MilliSeconds (1501),
1765  &LteFrAreaTestCase::TeleportUe2, this, ueNodes1.Get (0), 200, 0,
1766  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1767  Simulator::Schedule (MilliSeconds (1501),
1768  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea );
1769 
1770  Simulator::Schedule (MilliSeconds (2001),
1771  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1772  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1773  Simulator::Schedule (MilliSeconds (2001),
1774  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1775 
1776  Simulator::Stop (Seconds (2.500));
1777  Simulator::Run ();
1778 
1779 #if 0
1781  "Scheduler used DL RBG muted by FFR Algorithm");
1782 #endif
1783 
1785  "Scheduler used UL RB muted by FFR Algorithm");
1786 
1787  Simulator::Destroy ();
1788 
1789 }
Lte Distributed Ffr Area Test Case.
virtual void DoRun(void)
Implementation to actually run this TestCase.
LteDistributedFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Lte Enhanced Ffr Area Test Case.
virtual void DoRun(void)
Implementation to actually run this TestCase.
LteEnhancedFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Test frequency reuse algorithm by teleporing UEs to different parts of area and checking if the frequ...
Time m_teleportTime
the telport 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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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
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.
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
virtual void DoRun(void)
Implementation to actually run this TestCase.
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.
uint8_t m_dlSubBandwidth
the DL subband width
virtual void DoRun(void)
Implementation to actually run this TestCase.
std::string m_schedulerType
the scheduler type
Lte Soft Ffr Area Test Case.
virtual void DoRun(void)
Implementation to actually run this TestCase.
LteSoftFfrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Lte Soft Fr Area Test Case.
LteSoftFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
LteStrictFrAreaTestCase(std::string name, std::string schedulerType)
Constructor.
Test stric frequency reuse algorithm.
uint16_t m_ulCommonSubBandwidth
UL common subbandwidth.
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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
holds a vector of ns3::Application pointers.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Class for representing data rates.
Definition: data-rate.h:89
AttributeValue implementation for DataRate.
Definition: data-rate.h:298
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
Qci
QoS Class Indicator.
Definition: eps-bearer.h:107
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:41
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
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:256
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:306
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
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Definition: lte-helper.cc:293
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:327
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the FFR algorithm to be created.
Definition: lte-helper.cc:314
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:279
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:959
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:400
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1313
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1220
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:1068
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.
virtual Ipv4Address GetUeDefaultGatewayAddress()
virtual Ptr< Node > GetPgwNode() const
Get the PGW node.
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
keep track of a set of node pointers.
uint32_t GetN(void) 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:256
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
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:74
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
AttributeValue implementation for Time.
Definition: nstime.h:1308
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:44
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
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:820
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#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:281
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1709
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
#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:141
#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:323
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
void UlDataRxStartNofiticationArea(LteFrAreaTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
void DlDataRxStartNofiticationArea(LteFrAreaTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
static LteFrequencyReuseTestSuite lteFrequencyReuseTestSuite
void DlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
TestCase Data.
void UlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
serverApps
Definition: first.py:52
clientApps
Definition: first.py:61
Every class exported by the ns3 library is enclosed in the ns3 namespace.
list x
Random number samples.
mobility
Definition: third.py:108
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:75
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:140
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139
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
double startTime