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