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  enum EpsBearer::Qci q = EpsBearer::NGBR_VIDEO_TCP_DEFAULT;
309  EpsBearer bearer (q);
310  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
311 
312  //Test SpectrumPhy to get signals form DL channel
313  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
314  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
315 
316  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
317  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
318  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
319  dlChannel->AddRx (testDlSpectrumPhy);
320 
321  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
323 
324  //Test SpectrumPhy to get signals form UL channel
325  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
326  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
327 
328  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
329  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
330  ulChannel->AddRx (testUlSpectrumPhy);
331 
332  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
334 
335  Simulator::Stop (Seconds (0.500));
336  Simulator::Run ();
337 
339  "Scheduler used DL RBG muted by FFR Algorithm");
340 
342  "Scheduler used UL RBG muted by FFR Algorithm");
343 
344  Simulator::Destroy ();
345 }
346 
347 
348 
349 LteStrictFrTestCase::LteStrictFrTestCase (std::string name, uint32_t userNum,
350  std::string schedulerType,
351  uint8_t dlBandwidth, uint8_t ulBandwidth,
352  uint8_t dlCommonSubBandwidth, uint8_t dlEdgeSubBandOffset, uint8_t dlEdgeSubBandwidth,
353  uint8_t ulCommonSubBandwidth, uint8_t ulEdgeSubBandOffset, uint8_t ulEdgeSubBandwidth,
354  std::vector<bool> availableDlRb, std::vector<bool> availableUlRb)
355  : LteFrTestCase (name, userNum, dlBandwidth, ulBandwidth, availableDlRb, availableUlRb),
356  m_schedulerType (schedulerType),
357  m_dlCommonSubBandwidth (dlCommonSubBandwidth),
358  m_dlEdgeSubBandOffset (dlEdgeSubBandOffset),
359  m_dlEdgeSubBandwidth (dlEdgeSubBandwidth),
360  m_ulCommonSubBandwidth (ulCommonSubBandwidth),
361  m_ulEdgeSubBandOffset (ulEdgeSubBandOffset),
362  m_ulEdgeSubBandwidth (ulEdgeSubBandwidth)
363 {
364  NS_LOG_INFO ("Creating LteFrTestCase");
365 }
366 
368 {
369 }
370 
371 void
373 {
374  NS_LOG_DEBUG ("LteFrTestCase");
375 
376  Config::Reset ();
377  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
378 
383  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
384  lteHelper->SetFfrAlgorithmType ("ns3::LteFrStrictAlgorithm");
385 
386  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (m_dlCommonSubBandwidth));
387  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (m_dlEdgeSubBandOffset));
388  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (m_dlEdgeSubBandwidth));
389 
390  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (m_ulCommonSubBandwidth));
391  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (m_ulEdgeSubBandOffset));
392  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (m_ulEdgeSubBandwidth));
393 
394  // Create Nodes: eNodeB and UE
395  NodeContainer enbNodes;
396  NodeContainer ueNodes;
397  enbNodes.Create (1);
398  ueNodes.Create (m_userNum);
399  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
400 
401  // Install Mobility Model
403  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
404  mobility.Install (allNodes);
405 
406  // Create Devices and install them in the Nodes (eNB and UE)
407  NetDeviceContainer enbDevs;
408  NetDeviceContainer ueDevs;
409  lteHelper->SetSchedulerType (m_schedulerType);
410  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
411  ueDevs = lteHelper->InstallUeDevice (ueNodes);
412 
413  // Attach a UE to a eNB
414  lteHelper->Attach (ueDevs, enbDevs.Get (0));
415 
416  // Activate the default EPS bearer
417  enum EpsBearer::Qci q = EpsBearer::NGBR_VIDEO_TCP_DEFAULT;
418  EpsBearer bearer (q);
419  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
420 
421  //Test SpectrumPhy to get signals form DL channel
422  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
423  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
424 
425  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
426  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
427  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
428  dlChannel->AddRx (testDlSpectrumPhy);
429 
430  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
432 
433  //Test SpectrumPhy to get signals form UL channel
434  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
435  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
436 
437  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
438  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
439  ulChannel->AddRx (testUlSpectrumPhy);
440 
441  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
443 
444  Simulator::Stop (Seconds (0.500));
445  Simulator::Run ();
446 
448  "Scheduler used DL RBG muted by FFR Algorithm");
449 
451  "Scheduler used UL RBG muted by FFR Algorithm");
452 
453  Simulator::Destroy ();
454 }
455 
456 void
458  Ptr<const SpectrumValue> spectrumValue)
459 {
460  testcase->DlDataRxStart (spectrumValue);
461 }
462 
463 void
465  Ptr<const SpectrumValue> spectrumValue)
466 {
467  testcase->UlDataRxStart (spectrumValue);
468 }
469 
470 LteFrAreaTestCase::LteFrAreaTestCase (std::string name, std::string schedulerType)
471  : TestCase ("Test: " + name),
472  m_schedulerType (schedulerType)
473 {
474  m_dlBandwidth = 25;
475  m_ulBandwidth = 25;
476  m_usedWrongDlRbg = false;
477  m_usedWrongUlRbg = false;
478 }
480 {
481 }
482 
483 void
485 {
486  //need time to report new UE measurements, and wait because of filtering
487  if ( (Simulator::Now () - m_teleportTime ) < MilliSeconds (400))
488  {
489  return;
490  }
491 
492  NS_LOG_DEBUG ("DL DATA Power allocation :");
493  Values::const_iterator it;
494  uint32_t i = 0;
495  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
496  {
497  double power = (*it) * (m_dlBandwidth * 180000);
498  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power);
499  NS_LOG_DEBUG ("RB " << i << " POWER: " << " " << power
500  << " Available: " << m_expectedDlRb[i] << " Expected Power: " << m_expectedDlPower );
501 
502  if (m_expectedDlRb[i] == false && power > 0)
503  {
504  m_usedWrongDlRbg = true;
505  }
506  else if (m_expectedDlRb[i] == true && power > 0)
507  {
509  "Wrong Data Channel DL Power level");
510  }
511  i++;
512  }
513 }
514 
515 void
517 {
518  //need time to report new UE measurements, and wait because of filtering
519  if ( (Simulator::Now () - m_teleportTime ) < MilliSeconds (400))
520  {
521  return;
522  }
523 
524  NS_LOG_DEBUG ("UL DATA Power allocation :");
525  Values::const_iterator it;
526  uint32_t i = 0;
527  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
528  {
529  double power = (*it) * (m_ulBandwidth * 180000);
530  NS_LOG_DEBUG ("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower);
531  if (m_expectedUlRb[i] == false && power > 0)
532  {
533  m_usedWrongUlRbg = true;
534  }
535  else if (m_expectedUlRb[i] == true && power > 0)
536  {
538  "Wrong Data Channel UL Power level" << Simulator::Now ().GetSeconds ());
539  }
540  i++;
541  }
542 }
543 
544 void
546 {
547  NS_LOG_FUNCTION (this);
548  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
550  m_ueMobility->SetPosition (Vector (x, y, 0.0));
551 }
552 
553 void
554 LteFrAreaTestCase::TeleportUe (uint32_t x, uint32_t y, double expectedPower,
555  std::vector<bool> expectedDlRb)
556 {
557  NS_LOG_FUNCTION (this);
558  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
560  m_ueMobility->SetPosition (Vector (x, y, 0.0));
561  m_expectedDlPower = expectedPower;
562  m_expectedDlRb = expectedDlRb;
563 }
564 
565 void
566 LteFrAreaTestCase::TeleportUe2 (Ptr<Node> ueNode, uint32_t x, uint32_t y, double expectedPower,
567  std::vector<bool> expectedDlRb)
568 {
569  NS_LOG_FUNCTION (this);
570  NS_LOG_DEBUG ("Teleport UE to : (" << x << ", " << y << ", 0)");
571 
572  Ptr<MobilityModel> ueMobility = ueNode->GetObject<MobilityModel> ();
573  ueMobility->SetPosition (Vector (x, y, 0.0));
575  m_expectedDlPower = expectedPower;
576  m_expectedDlRb = expectedDlRb;
577 }
578 
579 void
580 LteFrAreaTestCase::SetDlExpectedValues (double expectedDlPower, std::vector<bool> expectedDlRb)
581 {
582  NS_LOG_FUNCTION (this);
583  m_expectedDlPower = expectedDlPower;
584  m_expectedDlRb = expectedDlRb;
585 }
586 
587 void
588 LteFrAreaTestCase::SetUlExpectedValues (double expectedUlPower, std::vector<bool> expectedUlRb)
589 {
590  NS_LOG_FUNCTION (this);
591  m_expectedUlPower = expectedUlPower;
592  m_expectedUlRb = expectedUlRb;
593 }
594 
595 void
597 {
598 }
599 
600 LteStrictFrAreaTestCase::LteStrictFrAreaTestCase (std::string name, std::string schedulerType)
601  : LteFrAreaTestCase (name, schedulerType)
602 {
603  NS_LOG_INFO ("Creating LteFrTestCase");
604 }
605 
607 {
608 }
609 
610 void
612 {
613  NS_LOG_DEBUG ("LteStrictFrAreaTestCase");
614 
615  Config::Reset ();
616  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
617  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
618  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
619 
620  double eNbTxPower = 30;
621  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
622  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
623  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
624 
625  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
626  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
627 
628  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
629 
630  // Create Nodes: eNodeB and UE
631  NodeContainer enbNodes;
632  NodeContainer ueNodes1;
633  NodeContainer ueNodes2;
634  enbNodes.Create (2);
635  ueNodes1.Create (1);
636  ueNodes2.Create (1);
637  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
638 
639  /*
640  * The topology is the following:
641  *
642  * eNB1 UE1 eNB2
643  * | | |
644  * x ------------ x ------------------------ x ------------ x----UE2
645  * 200 m 600 m 200 m 20 m
646  *
647  */
648 
649  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
650  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
651  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
652  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
653  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
655  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
656  mobility.SetPositionAllocator (positionAlloc);
657  mobility.Install (allNodes);
658  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
659 
660  // Disable layer-3 filtering
661  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
662  UintegerValue (0));
663  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
664  UintegerValue (0));
665 
666  // Create Devices and install them in the Nodes (eNB and UE)
667  NetDeviceContainer enbDevs;
668  NetDeviceContainer ueDevs1;
669  NetDeviceContainer ueDevs2;
670  lteHelper->SetSchedulerType (m_schedulerType);
671 
672  lteHelper->SetFfrAlgorithmType ("ns3::LteFrStrictAlgorithm");
673  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
674  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
675  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
676  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
677  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
678 
679  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (6));
680  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (6));
681  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (6));
682 
683  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (6));
684  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (6));
685  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (6));
686  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
687 
688  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
689  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
690 
691  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
692  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
693 
694  // Attach a UE to a eNB
695  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
696  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
697 
698  // Activate an EPS bearer
699  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
700  EpsBearer bearer (q);
701  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
702  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
703 
704  //Test SpectrumPhy to get signals form DL channel
705  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
706  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
707 
708  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
709  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
710  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
711  dlChannel->AddRx (testDlSpectrumPhy);
712 
713  testDlSpectrumPhy->SetCellId (1);
714 
715  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
717 
718  //Test SpectrumPhy to get signals form UL channel
719  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
720  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
721 
722  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
723  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
724  ulChannel->AddRx (testUlSpectrumPhy);
725 
726  testUlSpectrumPhy->SetCellId (1);
727 
728  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
730 
731  std::vector<bool> expectedDlRbCenterArea;
732  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
733  std::vector<bool> expectedUlRbCenterArea;
734  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
735  for (uint32_t i = 0; i < 6; i++)
736  {
737  expectedDlRbCenterArea[i] = true;
738  expectedUlRbCenterArea[i] = true;
739  }
740 
741  std::vector<bool> expectedDlRbEdgeArea;
742  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
743  std::vector<bool> expectedUlRbEdgeArea;
744  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
745  for (uint32_t i = 12; i < 18; i++)
746  {
747  expectedDlRbEdgeArea[i] = true;
748  expectedUlRbEdgeArea[i] = true;
749  }
750 
751  Simulator::Schedule (MilliSeconds (1),
752  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
753  Simulator::Schedule (MilliSeconds (1),
754  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
755 
756  Simulator::Schedule (MilliSeconds (501),
757  &LteFrAreaTestCase::TeleportUe, this, 800, 0, 2, expectedDlRbEdgeArea );
758  Simulator::Schedule (MilliSeconds (501),
759  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
760 
761  Simulator::Schedule (MilliSeconds (1001),
762  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
763  Simulator::Schedule (MilliSeconds (1001),
764  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
765 
766  Simulator::Stop (Seconds (1.500));
767  Simulator::Run ();
768 
770  "Scheduler used DL RB muted by FFR Algorithm");
772  "Scheduler used UL RB muted by FFR Algorithm");
773 
774  Simulator::Destroy ();
775 }
776 
777 LteSoftFrAreaTestCase::LteSoftFrAreaTestCase (std::string name, std::string schedulerType)
778  : LteFrAreaTestCase (name, schedulerType)
779 {
780  NS_LOG_INFO ("Creating LteSoftFrAreaTestCase");
781 }
782 
784 {
785 }
786 
787 void
789 {
790  NS_LOG_DEBUG ("LteSoftFrAreaTestCase");
791 
792  Config::Reset ();
793  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
794  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
795  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
796 
797  double eNbTxPower = 30;
798  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
799  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
800  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
801 
802  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
803  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
804 
805  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
806 
807  // Create Nodes: eNodeB and UE
808  NodeContainer enbNodes;
809  NodeContainer ueNodes1;
810  NodeContainer ueNodes2;
811  enbNodes.Create (2);
812  ueNodes1.Create (1);
813  ueNodes2.Create (1);
814  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
815 
816  /*
817  * The topology is the following:
818  *
819  * eNB1 UE1 eNB2
820  * | | |
821  * x ------------ x ------------------------ x ------------ x----UE2
822  * 200 m 600 m 200 m 20 m
823  *
824  */
825 
826  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
827  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
828  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
829  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
830  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
832  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
833  mobility.SetPositionAllocator (positionAlloc);
834  mobility.Install (allNodes);
835  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
836 
837  // Disable layer-3 filtering
838  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
839  UintegerValue (0));
840  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
841  UintegerValue (0));
842 
843  // Create Devices and install them in the Nodes (eNB and UE)
844  NetDeviceContainer enbDevs;
845  NetDeviceContainer ueDevs1;
846  NetDeviceContainer ueDevs2;
847  lteHelper->SetSchedulerType (m_schedulerType);
848 
849  lteHelper->SetFfrAlgorithmType ("ns3::LteFrSoftAlgorithm");
850  lteHelper->SetFfrAlgorithmAttribute ("AllowCenterUeUseEdgeSubBand", BooleanValue (false));
851  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
852  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
853  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
854  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
855  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
856 
857  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (8));
858  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (8));
859  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (8));
860  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (8));
861  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
862 
863  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
864  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
865 
866  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
867  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
868 
869  // Attach a UE to a eNB
870  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
871  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
872 
873  // Activate an EPS bearer
874  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
875  EpsBearer bearer (q);
876  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
877  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
878 
879  //Test SpectrumPhy to get signals form DL channel
880  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
881  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
882 
883  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
884  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
885  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
886  dlChannel->AddRx (testDlSpectrumPhy);
887 
888  testDlSpectrumPhy->SetCellId (1);
889 
890  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
892 
893  //Test SpectrumPhy to get signals form UL channel
894  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
895  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
896 
897  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
898  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
899  ulChannel->AddRx (testUlSpectrumPhy);
900 
901  testUlSpectrumPhy->SetCellId (1);
902 
903  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
905 
906 
907  std::vector<bool> expectedDlRbCenterArea;
908  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
909  std::vector<bool> expectedUlRbCenterArea;
910  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
911  for (uint32_t i = 0; i < 8; i++)
912  {
913  expectedDlRbCenterArea[i] = true;
914  expectedUlRbCenterArea[i] = true;
915  }
916  for (uint32_t i = 16; i < 25; i++)
917  {
918  expectedDlRbCenterArea[i] = true;
919  }
920 
921  std::vector<bool> expectedDlRbEdgeArea;
922  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
923  std::vector<bool> expectedUlRbEdgeArea;
924  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
925  for (uint32_t i = 8; i < 16; i++)
926  {
927  expectedDlRbEdgeArea[i] = true;
928  expectedUlRbEdgeArea[i] = true;
929  }
930 
931  Simulator::Schedule (MilliSeconds (1),
932  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
933  Simulator::Schedule (MilliSeconds (1),
934  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
935 
936  Simulator::Schedule (MilliSeconds (501),
937  &LteFrAreaTestCase::TeleportUe, this, 800, 0, 2, expectedDlRbEdgeArea );
938  Simulator::Schedule (MilliSeconds (501),
939  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
940 
941  Simulator::Schedule (MilliSeconds (1001),
942  &LteFrAreaTestCase::TeleportUe, this, 200, 0, 1, expectedDlRbCenterArea );
943  Simulator::Schedule (MilliSeconds (1001),
944  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
945 
946  Simulator::Stop (Seconds (1.500));
947  Simulator::Run ();
948 
949 #if 0
951  "Scheduler used DL RBG muted by FFR Algorithm");
952 
953 #endif
955  "Scheduler used UL RB muted by FFR Algorithm");
956 
957  Simulator::Destroy ();
958 }
959 
960 LteSoftFfrAreaTestCase::LteSoftFfrAreaTestCase (std::string name, std::string schedulerType)
961  : LteFrAreaTestCase (name, schedulerType)
962 {
963  NS_LOG_INFO ("Creating LteSoftFfrAreaTestCase");
964 }
965 
967 {
968 }
969 
970 void
972 {
973  NS_LOG_DEBUG ("LteSoftFfrAreaTestCase");
974 
975  Config::Reset ();
976  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
977  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
978  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
979 
980  double eNbTxPower = 30;
981  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
982  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
983  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
984 
985  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
986  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
987 
988  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
989 
990  // Create Nodes: eNodeB and UE
991  NodeContainer enbNodes;
992  NodeContainer ueNodes1;
993  NodeContainer ueNodes2;
994  enbNodes.Create (2);
995  ueNodes1.Create (1);
996  ueNodes2.Create (1);
997  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
998 
999  /*
1000  * The topology is the following:
1001  *
1002  * eNB1 UE1 eNB2
1003  * | | |
1004  * x ------------ x ------------------------ x ------------ x----UE2
1005  * 200 m 600 m 200 m 20 m
1006  *
1007  */
1008 
1009  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1010  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1011  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1012  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
1013  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
1015  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1016  mobility.SetPositionAllocator (positionAlloc);
1017  mobility.Install (allNodes);
1018  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
1019 
1020  // Disable layer-3 filtering
1021  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1022  UintegerValue (0));
1023  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1024  UintegerValue (0));
1025 
1026  // Create Devices and install them in the Nodes (eNB and UE)
1027  NetDeviceContainer enbDevs;
1028  NetDeviceContainer ueDevs1;
1029  NetDeviceContainer ueDevs2;
1030  lteHelper->SetSchedulerType (m_schedulerType);
1031 
1032  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrSoftAlgorithm");
1033  lteHelper->SetFfrAlgorithmAttribute ("CenterRsrqThreshold", UintegerValue (28));
1034  lteHelper->SetFfrAlgorithmAttribute ("EdgeRsrqThreshold", UintegerValue (18));
1035  lteHelper->SetFfrAlgorithmAttribute ("CenterAreaPowerOffset",
1036  UintegerValue (LteRrcSap::PdschConfigDedicated::dB_3));
1037  lteHelper->SetFfrAlgorithmAttribute ("MediumAreaPowerOffset",
1038  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1039  lteHelper->SetFfrAlgorithmAttribute ("EdgeAreaPowerOffset",
1040  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
1041 
1042  lteHelper->SetFfrAlgorithmAttribute ("UlCommonSubBandwidth", UintegerValue (6));
1043  lteHelper->SetFfrAlgorithmAttribute ("DlCommonSubBandwidth", UintegerValue (6));
1044 
1045  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandOffset", UintegerValue (6));
1046  lteHelper->SetFfrAlgorithmAttribute ("DlEdgeSubBandwidth", UintegerValue (6));
1047  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandOffset", UintegerValue (6));
1048  lteHelper->SetFfrAlgorithmAttribute ("UlEdgeSubBandwidth", UintegerValue (6));
1049  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
1050 
1051  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
1052  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
1053 
1054  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1055  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1056 
1057  // Attach a UE to a eNB
1058  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1059  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1060 
1061  // Activate an EPS bearer
1062  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1063  EpsBearer bearer (q);
1064  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
1065  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
1066 
1067  //Test SpectrumPhy to get signals form DL channel
1068  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1069  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1070 
1071  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1072  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1073  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1074  dlChannel->AddRx (testDlSpectrumPhy);
1075 
1076  testDlSpectrumPhy->SetCellId (1);
1077 
1078  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1080 
1081  //Test SpectrumPhy to get signals form UL channel
1082  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1083  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1084 
1085  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1086  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1087  ulChannel->AddRx (testUlSpectrumPhy);
1088 
1089  testUlSpectrumPhy->SetCellId (1);
1090 
1091  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1093 
1094  double expectedDlPowerCenterArea = 0.5;
1095  std::vector<bool> expectedDlRbCenterArea;
1096  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1097  std::vector<bool> expectedUlRbCenterArea;
1098  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1099  for (uint32_t i = 6; i < 12; i++)
1100  {
1101  expectedDlRbCenterArea[i] = true;
1102  expectedUlRbCenterArea[i] = true;
1103  }
1104  for (uint32_t i = 18; i < 25; i++)
1105  {
1106  expectedDlRbCenterArea[i] = true;
1107  expectedUlRbCenterArea[i] = true;
1108  }
1109 
1110  double expectedDlPowerMiddleArea = 1.0;
1111  std::vector<bool> expectedDlRbMiddleArea;
1112  expectedDlRbMiddleArea.resize (m_dlBandwidth, false);
1113  std::vector<bool> expectedUlRbMiddleArea;
1114  expectedUlRbMiddleArea.resize (m_ulBandwidth, false);
1115  for (uint32_t i = 0; i < 6; i++)
1116  {
1117  expectedDlRbMiddleArea[i] = true;
1118  expectedUlRbMiddleArea[i] = true;
1119  }
1120 
1121  double expectedDlPowerEdgeArea = 2.0;
1122  std::vector<bool> expectedDlRbEdgeArea;
1123  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1124  std::vector<bool> expectedUlRbEdgeArea;
1125  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1126  for (uint32_t i = 12; i < 18; i++)
1127  {
1128  expectedDlRbEdgeArea[i] = true;
1129  expectedUlRbEdgeArea[i] = true;
1130  }
1131 
1132  Simulator::Schedule (MilliSeconds (1),
1133  &LteFrAreaTestCase::TeleportUe, this, 200, 0,
1134  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1135  Simulator::Schedule (MilliSeconds (1),
1136  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1137 
1138  Simulator::Schedule (MilliSeconds (501),
1139  &LteFrAreaTestCase::TeleportUe, this, 600, 0,
1140  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1141  Simulator::Schedule (MilliSeconds (501),
1142  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbMiddleArea );
1143 
1144  Simulator::Schedule (MilliSeconds (1001),
1145  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1146  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1147  Simulator::Schedule (MilliSeconds (1001),
1148  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.199526, expectedUlRbEdgeArea );
1149 
1150  Simulator::Schedule (MilliSeconds (1501),
1151  &LteFrAreaTestCase::TeleportUe, this, 600, 0,
1152  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1153  Simulator::Schedule (MilliSeconds (1501),
1154  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbMiddleArea );
1155 
1156  Simulator::Schedule (MilliSeconds (2001),
1157  &LteFrAreaTestCase::TeleportUe, this, 200, 0,
1158  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1159  Simulator::Schedule (MilliSeconds (2001),
1160  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0150543, expectedUlRbCenterArea );
1161 
1162  Simulator::Stop (Seconds (2.500));
1163  Simulator::Run ();
1164 
1166  "Scheduler used DL RBG muted by FFR Algorithm");
1167 
1169  "Scheduler used UL RB muted by FFR Algorithm");
1170 
1171  Simulator::Destroy ();
1172 }
1173 
1174 
1175 LteEnhancedFfrAreaTestCase::LteEnhancedFfrAreaTestCase (std::string name, std::string schedulerType)
1176  : LteFrAreaTestCase (name, schedulerType)
1177 {
1178  NS_LOG_INFO ("Creating LteEnhancedFfrAreaTestCase");
1179 }
1180 
1182 {
1183 }
1184 
1185 void
1187 {
1188  NS_LOG_DEBUG ("LteEnhancedFfrAreaTestCase");
1189 
1190  Config::Reset ();
1191  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1192  Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true));
1193  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1194  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1195 
1196  double eNbTxPower = 30;
1197  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1198  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1199  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1200 
1201  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1202  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1203 
1204 
1205  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1206 
1207  // Create Nodes: eNodeB and UE
1208  NodeContainer enbNodes;
1209  NodeContainer ueNodes1;
1210  NodeContainer ueNodes2;
1211  enbNodes.Create (2);
1212  ueNodes1.Create (1);
1213  ueNodes2.Create (1);
1214  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1215 
1216  /*
1217  * The topology is the following:
1218  *
1219  * eNB1 UE1 eNB2
1220  * | | |
1221  * x ------------ x ------------------------ x ------------ x----UE2
1222  * 200 m 600 m 200 m 20 m
1223  *
1224  */
1225 
1226  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1227  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1228  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1229  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // UE1
1230  positionAlloc->Add (Vector (1020, 0.0, 0.0)); // UE2
1232  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1233  mobility.SetPositionAllocator (positionAlloc);
1234  mobility.Install (allNodes);
1235  m_ueMobility = ueNodes1.Get (0)->GetObject<MobilityModel> ();
1236 
1237  // Disable layer-3 filtering
1238  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1239  UintegerValue (0));
1240  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1241  UintegerValue (0));
1242 
1243  // Create Devices and install them in the Nodes (eNB and UE)
1244  NetDeviceContainer enbDevs;
1245  NetDeviceContainer ueDevs1;
1246  NetDeviceContainer ueDevs2;
1247  lteHelper->SetSchedulerType (m_schedulerType);
1248  lteHelper->SetSchedulerAttribute ("HarqEnabled", BooleanValue (true));
1249 
1250  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (m_dlBandwidth));
1251  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (m_ulBandwidth));
1252 
1253  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrEnhancedAlgorithm");
1254  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
1255  lteHelper->SetFfrAlgorithmAttribute ("DlCqiThreshold", UintegerValue (10));
1256  lteHelper->SetFfrAlgorithmAttribute ("UlCqiThreshold", UintegerValue (15));
1257  lteHelper->SetFfrAlgorithmAttribute ("CenterAreaPowerOffset",
1258  UintegerValue (LteRrcSap::PdschConfigDedicated::dB_6));
1259  lteHelper->SetFfrAlgorithmAttribute ("EdgeAreaPowerOffset",
1260  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1261 
1262  lteHelper->SetFfrAlgorithmAttribute ("UlSubBandOffset", UintegerValue (0));
1263  lteHelper->SetFfrAlgorithmAttribute ("UlReuse3SubBandwidth", UintegerValue (4));
1264  lteHelper->SetFfrAlgorithmAttribute ("UlReuse1SubBandwidth", UintegerValue (4));
1265 
1266  lteHelper->SetFfrAlgorithmAttribute ("DlSubBandOffset", UintegerValue (0));
1267  lteHelper->SetFfrAlgorithmAttribute ("DlReuse3SubBandwidth", UintegerValue (4));
1268  lteHelper->SetFfrAlgorithmAttribute ("DlReuse1SubBandwidth", UintegerValue (4));
1269 
1270  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0)));
1271 
1272  lteHelper->SetFfrAlgorithmType ("ns3::LteFrNoOpAlgorithm");
1273  enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1)));
1274 
1275  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1276  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1277 
1278  // Attach a UE to a eNB
1279  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1280  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1281 
1282  // Activate an EPS bearer
1283  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1284  EpsBearer bearer (q);
1285  lteHelper->ActivateDataRadioBearer (ueDevs1, bearer);
1286  lteHelper->ActivateDataRadioBearer (ueDevs2, bearer);
1287 
1288  //Test SpectrumPhy to get signals form DL channel
1289  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1290  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1291 
1292  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1293  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1294  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1295  dlChannel->AddRx (testDlSpectrumPhy);
1296 
1297  testDlSpectrumPhy->SetCellId (1);
1298 
1299  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1301 
1302  //Test SpectrumPhy to get signals form UL channel
1303  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1304  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1305 
1306  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1307  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1308  ulChannel->AddRx (testUlSpectrumPhy);
1309 
1310  testUlSpectrumPhy->SetCellId (1);
1311 
1312  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1314 
1315  double expectedDlPowerCenterArea = 0.251189;
1316  std::vector<bool> expectedDlRbCenterArea;
1317  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1318  std::vector<bool> expectedUlRbCenterArea;
1319  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1320  for (uint32_t i = 0; i < 8; i++)
1321  {
1322  expectedDlRbCenterArea[i] = true;
1323  expectedUlRbCenterArea[i] = true;
1324  }
1325  for (uint32_t i = 12; i < 16; i++)
1326  {
1327  expectedDlRbCenterArea[i] = true;
1328  expectedUlRbCenterArea[i] = true;
1329  }
1330  for (uint32_t i = 20; i < 24; i++)
1331  {
1332  expectedDlRbCenterArea[i] = true;
1333  expectedUlRbCenterArea[i] = true;
1334  }
1335 
1336  double expectedDlPowerMiddleArea = 0.251189;
1337  std::vector<bool> expectedDlRbMiddleArea;
1338  expectedDlRbMiddleArea.resize (m_dlBandwidth, false);
1339  std::vector<bool> expectedUlRbMiddleArea;
1340  expectedUlRbMiddleArea.resize (m_ulBandwidth, false);
1341  for (uint32_t i = 4; i < 8; i++)
1342  {
1343  expectedDlRbMiddleArea[i] = true;
1344  expectedUlRbMiddleArea[i] = true;
1345  }
1346 
1347  double expectedDlPowerEdgeArea = 1.0;
1348  std::vector<bool> expectedDlRbEdgeArea;
1349  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1350  std::vector<bool> expectedUlRbEdgeArea;
1351  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1352  for (uint32_t i = 0; i < 4; i++)
1353  {
1354  expectedDlRbEdgeArea[i] = true;
1355  expectedUlRbEdgeArea[i] = true;
1356  }
1357 
1358  Simulator::Schedule (MilliSeconds (1),
1360  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1361  Simulator::Schedule (MilliSeconds (1),
1362  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.00250905, expectedUlRbCenterArea );
1363 
1364  Simulator::Schedule (MilliSeconds (501),
1366  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1367  Simulator::Schedule (MilliSeconds (501),
1368  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbMiddleArea );
1369 
1370  Simulator::Schedule (MilliSeconds (1001),
1372  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1373  Simulator::Schedule (MilliSeconds (1001),
1374  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0903259, expectedUlRbEdgeArea );
1375 
1376  Simulator::Schedule (MilliSeconds (1501),
1378  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1379  Simulator::Schedule (MilliSeconds (1501),
1380  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.00250905, expectedUlRbCenterArea );
1381 
1382  Simulator::Schedule (MilliSeconds (2001),
1384  expectedDlPowerMiddleArea, expectedDlRbMiddleArea );
1385  Simulator::Schedule (MilliSeconds (2001),
1386  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1387 
1388  Simulator::Stop (Seconds (2.500));
1389  Simulator::Run ();
1390 
1392  "Scheduler used DL RBG muted by FFR Algorithm");
1393 
1395  "Scheduler used UL RB muted by FFR Algorithm");
1396 
1397  Simulator::Destroy ();
1398 }
1399 
1400 
1401 LteDistributedFfrAreaTestCase::LteDistributedFfrAreaTestCase (std::string name, std::string schedulerType)
1402  : LteFrAreaTestCase (name, schedulerType)
1403 {
1404  NS_LOG_INFO ("Creating LteDistributedFfrAreaTestCase");
1405 }
1406 
1408 {
1409 }
1410 
1411 void
1413 {
1414  NS_LOG_DEBUG ("LteDistributedFfrAreaTestCase");
1415 
1416  Config::Reset ();
1417  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
1418  Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true));
1419  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
1420  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
1421 
1422  double eNbTxPower = 30;
1423  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNbTxPower));
1424  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (10.0));
1425  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
1426 
1427  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
1428  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (false));
1429 
1430  // Disable layer-3 filtering
1431  Config::SetDefault ("ns3::LteEnbRrc::RsrpFilterCoefficient",
1432  UintegerValue (0));
1433  Config::SetDefault ("ns3::LteEnbRrc::RsrqFilterCoefficient",
1434  UintegerValue (0));
1435 
1436  uint8_t bandwidth = 25;
1437 
1438  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
1439  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
1440  lteHelper->SetEpcHelper (epcHelper);
1441  lteHelper->SetHandoverAlgorithmType ("ns3::NoOpHandoverAlgorithm"); // disable automatic handover
1442 
1443  Ptr<Node> pgw = epcHelper->GetPgwNode ();
1444 
1445  // Create a single RemoteHost
1446  NodeContainer remoteHostContainer;
1447  remoteHostContainer.Create (1);
1448  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
1449  InternetStackHelper internet;
1450  internet.Install (remoteHostContainer);
1451 
1452  // Create the Internet
1453  PointToPointHelper p2ph;
1454  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
1455  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
1456  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
1457  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
1458  Ipv4AddressHelper ipv4h;
1459  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
1460  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
1461  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
1462 
1463  // Routing of the Internet Host (towards the LTE network)
1464  Ipv4StaticRoutingHelper ipv4RoutingHelper;
1465  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
1466  // interface 0 is localhost, 1 is the p2p device
1467  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
1468 
1469  // Create Nodes: eNodeB and UE
1470  NodeContainer enbNodes;
1471  NodeContainer ueNodes1;
1472  NodeContainer ueNodes2;
1473  enbNodes.Create (2);
1474  ueNodes1.Create (2);
1475  ueNodes2.Create (1);
1476  NodeContainer ueNodes = NodeContainer ( ueNodes1, ueNodes2);
1477  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
1478 
1479  /*
1480  * The topology is the following:
1481  *
1482  * eNB1 UE1 UE2 eNB2
1483  * | | | |
1484  * x ------------ x ------------------------ x ------------ x
1485  * 200 m 600 m 200 m
1486  *
1487  */
1488 
1489  // Install Mobility Model
1490  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
1491  positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1
1492  positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2
1493 
1494  positionAlloc->Add (Vector (200, 0.0, 0.0)); // UE1
1495  positionAlloc->Add (Vector (200, 0.0, 0.0)); // UE1
1496  positionAlloc->Add (Vector (800, 0.0, 0.0)); // UE2
1497 
1499  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
1500  mobility.SetPositionAllocator (positionAlloc);
1501  mobility.Install (allNodes);
1502  m_ueMobility = ueNodes2.Get (0)->GetObject<MobilityModel> ();
1503 
1504  // Create Devices and install them in the Nodes (eNB and UE)
1505  NetDeviceContainer enbDevs;
1506  NetDeviceContainer ueDevs1;
1507  NetDeviceContainer ueDevs2;
1508  lteHelper->SetSchedulerType (m_schedulerType);
1509 
1510  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (bandwidth));
1511  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (bandwidth));
1512 
1513  lteHelper->SetFfrAlgorithmType ("ns3::LteFfrDistributedAlgorithm");
1514  lteHelper->SetFfrAlgorithmAttribute ("CalculationInterval", TimeValue (MilliSeconds (10)));
1515  lteHelper->SetFfrAlgorithmAttribute ("RsrqThreshold", UintegerValue (25));
1516  lteHelper->SetFfrAlgorithmAttribute ("RsrpDifferenceThreshold", UintegerValue (5));
1517  lteHelper->SetFfrAlgorithmAttribute ("EdgeRbNum", UintegerValue (6));
1518  lteHelper->SetFfrAlgorithmAttribute ("CenterPowerOffset",
1519  UintegerValue (LteRrcSap::PdschConfigDedicated::dB0));
1520  lteHelper->SetFfrAlgorithmAttribute ("EdgePowerOffset",
1521  UintegerValue (LteRrcSap::PdschConfigDedicated::dB3));
1522 
1523  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
1524  ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
1525  ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
1526 
1527  NetDeviceContainer ueLteDevs;
1528  ueLteDevs.Add (ueDevs1);
1529  ueLteDevs.Add (ueDevs2);
1530 
1531  // Add X2 inteface
1532  lteHelper->AddX2Interface (enbNodes);
1533 
1534  // Install the IP stack on the UEs
1535  internet.Install (ueNodes);
1536  Ipv4InterfaceContainer ueIpIfaces;
1537  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
1538  // Assign IP address to UEs, and install applications
1539  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
1540  {
1541  Ptr<Node> ueNode = ueNodes.Get (u);
1542  // Set the default gateway for the UE
1543  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
1544  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
1545  }
1546 
1547  // Attach a UE to a eNB
1548  lteHelper->Attach (ueDevs1, enbDevs.Get (0));
1549  lteHelper->Attach (ueDevs2, enbDevs.Get (1));
1550 
1551 
1552  // Install and start applications on UEs and remote host
1553  uint16_t dlPort = 10000;
1554  uint16_t ulPort = 20000;
1555 
1556  // randomize a bit start times to avoid simulation artifacts
1557  // (e.g., buffer overflows due to packet transmissions happening
1558  // exactly at the same time)
1559  Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable> ();
1560  startTimeSeconds->SetAttribute ("Min", DoubleValue (0));
1561  startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010));
1562 
1563  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
1564  {
1565  Ptr<Node> ue = ueNodes.Get (u);
1566  // Set the default gateway for the UE
1567  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
1568  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
1569 
1570  for (uint32_t b = 0; b < 1; ++b)
1571  {
1572  ++dlPort;
1573  ++ulPort;
1574 
1577 
1578  NS_LOG_LOGIC ("installing UDP DL app for UE " << u);
1579  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
1580  dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
1581  dlClientHelper.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
1582  clientApps.Add (dlClientHelper.Install (remoteHost));
1583  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory",
1584  InetSocketAddress (Ipv4Address::GetAny (), dlPort));
1585  serverApps.Add (dlPacketSinkHelper.Install (ue));
1586 
1587  NS_LOG_LOGIC ("installing UDP UL app for UE " << u);
1588  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
1589  ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
1590  ulClientHelper.SetAttribute ("Interval", TimeValue (MilliSeconds (1.0)));
1591  clientApps.Add (ulClientHelper.Install (ue));
1592  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory",
1593  InetSocketAddress (Ipv4Address::GetAny (), ulPort));
1594  serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
1595 
1596  Ptr<EpcTft> tft = Create<EpcTft> ();
1597  EpcTft::PacketFilter dlpf;
1598  dlpf.localPortStart = dlPort;
1599  dlpf.localPortEnd = dlPort;
1600  tft->Add (dlpf);
1601  EpcTft::PacketFilter ulpf;
1602  ulpf.remotePortStart = ulPort;
1603  ulpf.remotePortEnd = ulPort;
1604  tft->Add (ulpf);
1605  EpsBearer bearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT);
1606  lteHelper->ActivateDedicatedEpsBearer (ueLteDevs.Get (u), bearer, tft);
1607 
1608  Time startTime = Seconds (startTimeSeconds->GetValue ());
1609  serverApps.Start (startTime);
1610  clientApps.Start (startTime);
1611  }
1612  }
1613 
1614  //Test SpectrumPhy to get signals form DL channel
1615  Ptr<LteSpectrumPhy> enbDlSpectrumPhy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetDownlinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1616  Ptr<SpectrumChannel> dlChannel = enbDlSpectrumPhy->GetChannel ();
1617 
1618  Ptr<LteSimpleSpectrumPhy> testDlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1619  Ptr<LteEnbNetDevice> eNbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1620  testDlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetDlEarfcn (), m_dlBandwidth));
1621  dlChannel->AddRx (testDlSpectrumPhy);
1622 
1623  testDlSpectrumPhy->SetCellId (2);
1624 
1625  testDlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1627 
1628  //Test SpectrumPhy to get signals form UL channel
1629  Ptr<LteSpectrumPhy> ueUlSpectrumPhy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetUplinkSpectrumPhy ()->GetObject<LteSpectrumPhy> ();
1630  Ptr<SpectrumChannel> ulChannel = ueUlSpectrumPhy->GetChannel ();
1631 
1632  Ptr<LteSimpleSpectrumPhy> testUlSpectrumPhy = CreateObject<LteSimpleSpectrumPhy> ();
1633  testUlSpectrumPhy->SetRxSpectrumModel (LteSpectrumValueHelper::GetSpectrumModel (eNbDev->GetUlEarfcn (), m_ulBandwidth));
1634  ulChannel->AddRx (testUlSpectrumPhy);
1635 
1636  testUlSpectrumPhy->SetCellId (2);
1637 
1638  testUlSpectrumPhy->TraceConnectWithoutContext ("RxStart",
1640 
1641  double expectedDlPowerCenterArea = 1.0;
1642  std::vector<bool> expectedDlRbCenterArea;
1643  expectedDlRbCenterArea.resize (m_dlBandwidth, false);
1644  std::vector<bool> expectedUlRbCenterArea;
1645  expectedUlRbCenterArea.resize (m_ulBandwidth, false);
1646  for (uint32_t i = 0; i < m_dlBandwidth; i++)
1647  {
1648  expectedDlRbCenterArea[i] = true;
1649  expectedUlRbCenterArea[i] = true;
1650  }
1651 
1652  double expectedDlPowerEdgeArea = 2.0;
1653  std::vector<bool> expectedDlRbEdgeArea;
1654  expectedDlRbEdgeArea.resize (m_dlBandwidth, false);
1655  std::vector<bool> expectedUlRbEdgeArea;
1656  expectedUlRbEdgeArea.resize (m_ulBandwidth, false);
1657  for (uint32_t i = 0; i < 6; i++)
1658  {
1659  expectedDlRbEdgeArea[i] = true;
1660  expectedUlRbEdgeArea[i] = true;
1661  }
1662 
1663  std::vector<bool> expectedDlRbEdgeArea2;
1664  expectedDlRbEdgeArea2.resize (m_dlBandwidth, false);
1665  std::vector<bool> expectedUlRbEdgeArea2;
1666  expectedUlRbEdgeArea2.resize (m_dlBandwidth, false);
1667  for (uint32_t i = 6; i < 12; i++)
1668  {
1669  expectedDlRbEdgeArea2[i] = true;
1670  expectedUlRbEdgeArea2[i] = true;
1671  }
1672 
1673 
1674  Simulator::Schedule (MilliSeconds (1),
1675  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1676  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1677  Simulator::Schedule (MilliSeconds (1),
1678  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1679 
1680  Simulator::Schedule (MilliSeconds (501),
1681  &LteFrAreaTestCase::TeleportUe, this, 400, 0,
1682  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1683  Simulator::Schedule (MilliSeconds (501),
1684  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea );
1685 
1686  Simulator::Schedule (MilliSeconds (1001),
1687  &LteFrAreaTestCase::TeleportUe2, this, ueNodes1.Get (0), 600, 0,
1688  expectedDlPowerEdgeArea, expectedDlRbEdgeArea2 );
1689  Simulator::Schedule (MilliSeconds (1001),
1690  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea2 );
1691 
1692  Simulator::Schedule (MilliSeconds (1501),
1693  &LteFrAreaTestCase::TeleportUe2, this, ueNodes1.Get (0), 200, 0,
1694  expectedDlPowerEdgeArea, expectedDlRbEdgeArea );
1695  Simulator::Schedule (MilliSeconds (1501),
1696  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.135489, expectedUlRbEdgeArea );
1697 
1698  Simulator::Schedule (MilliSeconds (2001),
1699  &LteFrAreaTestCase::TeleportUe, this, 800, 0,
1700  expectedDlPowerCenterArea, expectedDlRbCenterArea );
1701  Simulator::Schedule (MilliSeconds (2001),
1702  &LteFrAreaTestCase::SetUlExpectedValues, this, 0.0225815, expectedUlRbCenterArea );
1703 
1704  Simulator::Stop (Seconds (2.500));
1705  Simulator::Run ();
1706 
1707 #if 0
1709  "Scheduler used DL RBG muted by FFR Algorithm");
1710 #endif
1711 
1713  "Scheduler used UL RB muted by FFR Algorithm");
1714 
1715  Simulator::Destroy ();
1716 
1717 }
Values::const_iterator ConstValuesEnd() const
holds a vector of ns3::Application pointers.
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:157
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Test Downlink FFR algorithms.
an Inet address class
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
AttributeValue implementation for Boolean.
Definition: boolean.h:34
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:382
holds a vector of std::pair of Ptr and interface index.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:462
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
void UlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
void SetRxSpectrumModel(Ptr< const SpectrumModel > model)
A suite of tests to run.
Definition: test.h:1333
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
void UlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
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)
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:716
std::vector< bool > m_expectedUlRb
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:903
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:244
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)
encapsulates test code
Definition: test.h:1147
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:1046
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
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:824
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:273
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:252
tuple clientApps
Definition: first.py:54
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:225
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
void TeleportUe(uint32_t x, uint32_t y, double expectedPower, std::vector< bool > expectedDlRb)
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)
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
void DlDataRxStartNofitication(LteFrTestCase *testcase, Ptr< const SpectrumValue > spectrumValue)
TestCase Data.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
virtual void DoRun(void)
Implementation to actually run this TestCase.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Definition: test.cc:298
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)
AttributeValue implementation for Time.
Definition: nstime.h:957
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
double startTime
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Definition: lte-helper.cc:239
#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:161
holds a vector of ns3::NetDevice pointers
LteDistributedFfrAreaTestCase(std::string name, std::string schedulerType)
LteSoftFfrAreaTestCase(std::string name, std::string schedulerType)
LteFrAreaTestCase(std::string name, std::string schedulerType)
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
virtual void DoRun(void)
Implementation to actually run this TestCase.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
#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:373
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
std::vector< bool > m_availableDlRb
tuple serverApps
Definition: first.py:45
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
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
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:299
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:113
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:976
void SetDlExpectedValues(double expectedPower, std::vector< bool > expectedDlRb)
void SetPosition(const Vector &position)
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:749
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:397
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.
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...
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 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:218
Helper class that adds ns3::Ipv4StaticRouting objects.
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
LteSoftFrAreaTestCase(std::string name, std::string schedulerType)
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
LteEnhancedFfrAreaTestCase(std::string name, std::string schedulerType)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
static LteFrequencyReuseTestSuite lteFrequencyReuseTestSuite
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
void TeleportUe2(Ptr< Node > ueNode, uint32_t x, uint32_t y, double expectedPower, std::vector< bool > expectedDlRb)
void Add(Vector v)
Add a position to the list of positions.
void DlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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:340
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Values::const_iterator ConstValuesBegin() const
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)
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
std::vector< bool > m_availableUlRb
This class can be used to hold variables of floating point type such as 'double' or 'float'...
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:191
The eNodeB device implementation.
void UlDataRxStart(Ptr< const SpectrumValue > spectrumValue)
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:260
void SetUlExpectedValues(double expectedPower, std::vector< bool > expectedDlRb)
Qci
QoS Class Indicator.
Definition: eps-bearer.h:77
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:112
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)
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:73
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:307
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:114
The LteSpectrumPhy models the physical layer of LTE.
The LteUeNetDevice class implements the UE net device.
virtual void DoRun(void)
Implementation to actually run this TestCase.