A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-test-downlink-power-control.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"
24
25#include "ns3/lte-helper.h"
26#include "ns3/mobility-helper.h"
27#include <ns3/boolean.h>
28#include <ns3/callback.h>
29#include <ns3/config.h>
30#include <ns3/double.h>
31#include <ns3/enum.h>
32#include <ns3/ff-mac-scheduler.h>
33#include <ns3/log.h>
34#include <ns3/lte-chunk-processor.h>
35#include <ns3/lte-common.h>
36#include <ns3/lte-enb-net-device.h>
37#include <ns3/lte-enb-phy.h>
38#include <ns3/lte-enb-rrc.h>
39#include <ns3/lte-rrc-sap.h>
40#include <ns3/lte-ue-net-device.h>
41#include <ns3/lte-ue-phy.h>
42#include <ns3/lte-ue-rrc.h>
43#include <ns3/pointer.h>
44#include <ns3/simulator.h>
45#include <ns3/string.h>
46
47using namespace ns3;
48
49NS_LOG_COMPONENT_DEFINE("LteDownlinkPowerControlTest");
50
51/**
52 * TestSuite
53 */
54
56 : TestSuite("lte-downlink-power-control", Type::SYSTEM)
57{
58 // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_DEBUG);
59 // LogComponentEnable ("LteDownlinkPowerControlTest", logLevel);
60 NS_LOG_INFO("Creating LteDownlinkPowerControlTestSuite");
61
62 // Spectrum helper test
63 {
64 std::vector<int> activeRbs_txpowdB30nrb6run1earfcn500(4);
65 activeRbs_txpowdB30nrb6run1earfcn500[0] = 0;
66 activeRbs_txpowdB30nrb6run1earfcn500[1] = 2;
67 activeRbs_txpowdB30nrb6run1earfcn500[2] = 3;
68 activeRbs_txpowdB30nrb6run1earfcn500[3] = 5;
69
70 uint16_t earfcn = 500;
71 uint8_t bw = 6;
72 double powerTx = 30;
73
74 std::map<int, double> powerTxMap;
75 double rbTxPower = powerTx;
76
78 powerTxMap.insert(std::pair<int, double>(0, rbTxPower));
79
81 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
82
84 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
85
87 powerTxMap.insert(std::pair<int, double>(5, rbTxPower));
88
89 SpectrumValue spectrumValue_txpowdB30nrb6run1earfcn500(
91 spectrumValue_txpowdB30nrb6run1earfcn500[0] = 2.325820769916e-07;
92 spectrumValue_txpowdB30nrb6run1earfcn500[1] = 0.000000000000e+00;
93 spectrumValue_txpowdB30nrb6run1earfcn500[2] = 4.640622533585e-07;
94 spectrumValue_txpowdB30nrb6run1earfcn500[3] = 9.259259259259e-07;
95 spectrumValue_txpowdB30nrb6run1earfcn500[4] = 0.000000000000e+00;
96 spectrumValue_txpowdB30nrb6run1earfcn500[5] = 1.467493696723e-06;
97
99 "txpowdB30nrb6run1earfcn500_allRbPower",
100 earfcn,
101 bw,
102 powerTx,
103 powerTxMap,
104 activeRbs_txpowdB30nrb6run1earfcn500,
105 spectrumValue_txpowdB30nrb6run1earfcn500),
106 TestCase::Duration::QUICK);
107 }
108 {
109 // if power for RB not present, but RB is active, use powerTx
110 std::vector<int> activeRbs_txpowdB30nrb6run1earfcn500(4);
111 activeRbs_txpowdB30nrb6run1earfcn500[0] = 0;
112 activeRbs_txpowdB30nrb6run1earfcn500[1] = 2;
113 activeRbs_txpowdB30nrb6run1earfcn500[2] = 3;
114 activeRbs_txpowdB30nrb6run1earfcn500[3] = 5;
115
116 uint16_t earfcn = 500;
117 uint8_t bw = 6;
118 double powerTx = 30;
119
120 std::map<int, double> powerTxMap;
121 double rbTxPower = powerTx;
122
124 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
125
127 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
128
130 powerTxMap.insert(std::pair<int, double>(5, rbTxPower));
131
132 SpectrumValue spectrumValue_txpowdB30nrb6run1earfcn500(
134 spectrumValue_txpowdB30nrb6run1earfcn500[0] = 9.259259259259e-07;
135 spectrumValue_txpowdB30nrb6run1earfcn500[1] = 0.000000000000e+00;
136 spectrumValue_txpowdB30nrb6run1earfcn500[2] = 4.640622533585e-07;
137 spectrumValue_txpowdB30nrb6run1earfcn500[3] = 9.259259259259e-07;
138 spectrumValue_txpowdB30nrb6run1earfcn500[4] = 0.000000000000e+00;
139 spectrumValue_txpowdB30nrb6run1earfcn500[5] = 1.467493696723e-06;
140
142 "txpowdB30nrb6run1earfcn500",
143 earfcn,
144 bw,
145 powerTx,
146 powerTxMap,
147 activeRbs_txpowdB30nrb6run1earfcn500,
148 spectrumValue_txpowdB30nrb6run1earfcn500),
149 TestCase::Duration::QUICK);
150 }
151 {
152 std::vector<int> activeRbs_txpowdB30nrb25run1earfcn500(15);
153 activeRbs_txpowdB30nrb25run1earfcn500[0] = 0;
154 activeRbs_txpowdB30nrb25run1earfcn500[1] = 1;
155 activeRbs_txpowdB30nrb25run1earfcn500[2] = 2;
156 activeRbs_txpowdB30nrb25run1earfcn500[3] = 3;
157 activeRbs_txpowdB30nrb25run1earfcn500[4] = 7;
158 activeRbs_txpowdB30nrb25run1earfcn500[5] = 8;
159 activeRbs_txpowdB30nrb25run1earfcn500[6] = 9;
160 activeRbs_txpowdB30nrb25run1earfcn500[7] = 11;
161 activeRbs_txpowdB30nrb25run1earfcn500[8] = 13;
162 activeRbs_txpowdB30nrb25run1earfcn500[9] = 14;
163 activeRbs_txpowdB30nrb25run1earfcn500[10] = 18;
164 activeRbs_txpowdB30nrb25run1earfcn500[11] = 19;
165 activeRbs_txpowdB30nrb25run1earfcn500[12] = 20;
166 activeRbs_txpowdB30nrb25run1earfcn500[13] = 21;
167 activeRbs_txpowdB30nrb25run1earfcn500[14] = 24;
168
169 uint16_t earfcn = 500;
170 uint8_t bw = 25;
171 double powerTx = 30;
172
173 std::map<int, double> powerTxMap;
174 double rbTxPower = powerTx;
176 powerTxMap.insert(std::pair<int, double>(0, rbTxPower));
178 powerTxMap.insert(std::pair<int, double>(1, rbTxPower));
180 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
182 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
184 powerTxMap.insert(std::pair<int, double>(7, rbTxPower));
186 powerTxMap.insert(std::pair<int, double>(8, rbTxPower));
188 powerTxMap.insert(std::pair<int, double>(9, rbTxPower));
190 powerTxMap.insert(std::pair<int, double>(11, rbTxPower));
192 powerTxMap.insert(std::pair<int, double>(13, rbTxPower));
194 powerTxMap.insert(std::pair<int, double>(14, rbTxPower));
196 powerTxMap.insert(std::pair<int, double>(18, rbTxPower));
198 powerTxMap.insert(std::pair<int, double>(19, rbTxPower));
200 powerTxMap.insert(std::pair<int, double>(20, rbTxPower));
202 powerTxMap.insert(std::pair<int, double>(21, rbTxPower));
204 powerTxMap.insert(std::pair<int, double>(24, rbTxPower));
205
206 SpectrumValue spectrumValue_txpowdB30nrb25run1earfcn500(
208 spectrumValue_txpowdB30nrb25run1earfcn500[0] = 1.113749408060e-07;
209 spectrumValue_txpowdB30nrb25run1earfcn500[1] = 7.409475839182e-08;
210 spectrumValue_txpowdB30nrb25run1earfcn500[2] = 5.581969847799e-08;
211 spectrumValue_txpowdB30nrb25run1earfcn500[3] = 2.797612026209e-07;
212 spectrumValue_txpowdB30nrb25run1earfcn500[4] = 0.000000000000e+00;
213 spectrumValue_txpowdB30nrb25run1earfcn500[5] = 0.000000000000e+00;
214 spectrumValue_txpowdB30nrb25run1earfcn500[6] = 0.000000000000e+00;
215 spectrumValue_txpowdB30nrb25run1earfcn500[7] = 3.521984872135e-07;
216 spectrumValue_txpowdB30nrb25run1earfcn500[8] = 3.521984872135e-07;
217 spectrumValue_txpowdB30nrb25run1earfcn500[9] = 3.521984872135e-07;
218 spectrumValue_txpowdB30nrb25run1earfcn500[10] = 0.000000000000e+00;
219 spectrumValue_txpowdB30nrb25run1earfcn500[11] = 1.478384791559e-07;
220 spectrumValue_txpowdB30nrb25run1earfcn500[12] = 0.000000000000e+00;
221 spectrumValue_txpowdB30nrb25run1earfcn500[13] = 3.521984872135e-07;
222 spectrumValue_txpowdB30nrb25run1earfcn500[14] = 1.113749408060e-07;
223 spectrumValue_txpowdB30nrb25run1earfcn500[15] = 0.000000000000e+00;
224 spectrumValue_txpowdB30nrb25run1earfcn500[16] = 0.000000000000e+00;
225 spectrumValue_txpowdB30nrb25run1earfcn500[17] = 0.000000000000e+00;
226 spectrumValue_txpowdB30nrb25run1earfcn500[18] = 2.222222222222e-07;
227 spectrumValue_txpowdB30nrb25run1earfcn500[19] = 1.113749408060e-07;
228 spectrumValue_txpowdB30nrb25run1earfcn500[20] = 1.113749408060e-07;
229 spectrumValue_txpowdB30nrb25run1earfcn500[21] = 7.409475839182e-08;
230 spectrumValue_txpowdB30nrb25run1earfcn500[22] = 0.000000000000e+00;
231 spectrumValue_txpowdB30nrb25run1earfcn500[23] = 0.000000000000e+00;
232 spectrumValue_txpowdB30nrb25run1earfcn500[24] = 4.433916255486e-07;
233
235 "txpowdB30nrb25run1earfcn500_allRbPower",
236 earfcn,
237 bw,
238 powerTx,
239 powerTxMap,
240 activeRbs_txpowdB30nrb25run1earfcn500,
241 spectrumValue_txpowdB30nrb25run1earfcn500),
242 TestCase::Duration::QUICK);
243 }
244 {
245 // if power for RB not present, but RB is active, use powerTx
246 std::vector<int> activeRbs_txpowdB30nrb25run1earfcn500(15);
247 activeRbs_txpowdB30nrb25run1earfcn500[0] = 0;
248 activeRbs_txpowdB30nrb25run1earfcn500[1] = 1;
249 activeRbs_txpowdB30nrb25run1earfcn500[2] = 2;
250 activeRbs_txpowdB30nrb25run1earfcn500[3] = 3;
251 activeRbs_txpowdB30nrb25run1earfcn500[4] = 7;
252 activeRbs_txpowdB30nrb25run1earfcn500[5] = 8;
253 activeRbs_txpowdB30nrb25run1earfcn500[6] = 9;
254 activeRbs_txpowdB30nrb25run1earfcn500[7] = 11;
255 activeRbs_txpowdB30nrb25run1earfcn500[8] = 13;
256 activeRbs_txpowdB30nrb25run1earfcn500[9] = 14;
257 activeRbs_txpowdB30nrb25run1earfcn500[10] = 18;
258 activeRbs_txpowdB30nrb25run1earfcn500[11] = 19;
259 activeRbs_txpowdB30nrb25run1earfcn500[12] = 20;
260 activeRbs_txpowdB30nrb25run1earfcn500[13] = 21;
261 activeRbs_txpowdB30nrb25run1earfcn500[14] = 24;
262
263 uint16_t earfcn = 500;
264 uint8_t bw = 25;
265 double powerTx = 30;
266
267 std::map<int, double> powerTxMap;
268 double rbTxPower = powerTx;
270 powerTxMap.insert(std::pair<int, double>(0, rbTxPower));
272 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
274 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
276 powerTxMap.insert(std::pair<int, double>(7, rbTxPower));
278 powerTxMap.insert(std::pair<int, double>(8, rbTxPower));
280 powerTxMap.insert(std::pair<int, double>(13, rbTxPower));
282 powerTxMap.insert(std::pair<int, double>(14, rbTxPower));
284 powerTxMap.insert(std::pair<int, double>(18, rbTxPower));
286 powerTxMap.insert(std::pair<int, double>(19, rbTxPower));
288 powerTxMap.insert(std::pair<int, double>(24, rbTxPower));
289
290 SpectrumValue spectrumValue_txpowdB30nrb25run1earfcn500(
292 spectrumValue_txpowdB30nrb25run1earfcn500[0] = 1.113749408060e-07;
293 spectrumValue_txpowdB30nrb25run1earfcn500[1] = 2.222222222222e-07;
294 spectrumValue_txpowdB30nrb25run1earfcn500[2] = 5.581969847799e-08;
295 spectrumValue_txpowdB30nrb25run1earfcn500[3] = 2.797612026209e-07;
296 spectrumValue_txpowdB30nrb25run1earfcn500[4] = 0.000000000000e+00;
297 spectrumValue_txpowdB30nrb25run1earfcn500[5] = 0.000000000000e+00;
298 spectrumValue_txpowdB30nrb25run1earfcn500[6] = 0.000000000000e+00;
299 spectrumValue_txpowdB30nrb25run1earfcn500[7] = 3.521984872135e-07;
300 spectrumValue_txpowdB30nrb25run1earfcn500[8] = 3.521984872135e-07;
301 spectrumValue_txpowdB30nrb25run1earfcn500[9] = 2.222222222222e-07;
302 spectrumValue_txpowdB30nrb25run1earfcn500[10] = 0.000000000000e+00;
303 spectrumValue_txpowdB30nrb25run1earfcn500[11] = 2.222222222222e-07;
304 spectrumValue_txpowdB30nrb25run1earfcn500[12] = 0.000000000000e+00;
305 spectrumValue_txpowdB30nrb25run1earfcn500[13] = 3.521984872135e-07;
306 spectrumValue_txpowdB30nrb25run1earfcn500[14] = 1.113749408060e-07;
307 spectrumValue_txpowdB30nrb25run1earfcn500[15] = 0.000000000000e+00;
308 spectrumValue_txpowdB30nrb25run1earfcn500[16] = 0.000000000000e+00;
309 spectrumValue_txpowdB30nrb25run1earfcn500[17] = 0.000000000000e+00;
310 spectrumValue_txpowdB30nrb25run1earfcn500[18] = 2.222222222222e-07;
311 spectrumValue_txpowdB30nrb25run1earfcn500[19] = 1.113749408060e-07;
312 spectrumValue_txpowdB30nrb25run1earfcn500[20] = 2.222222222222e-07;
313 spectrumValue_txpowdB30nrb25run1earfcn500[21] = 2.222222222222e-07;
314 spectrumValue_txpowdB30nrb25run1earfcn500[22] = 0.000000000000e+00;
315 spectrumValue_txpowdB30nrb25run1earfcn500[23] = 0.000000000000e+00;
316 spectrumValue_txpowdB30nrb25run1earfcn500[24] = 4.433916255486e-07;
317
319 "txpowdB30nrb25run1earfcn500",
320 earfcn,
321 bw,
322 powerTx,
323 powerTxMap,
324 activeRbs_txpowdB30nrb25run1earfcn500,
325 spectrumValue_txpowdB30nrb25run1earfcn500),
326 TestCase::Duration::QUICK);
327 }
328
329 // Downlink DATA and CONTROL channels power comparison
332 "DataCtrlPowerDifference_noChange"),
333 TestCase::Duration::QUICK);
336 "DataCtrlPowerDifference_dB_6"),
337 TestCase::Duration::QUICK);
340 "DataCtrlPowerDifference_dB_4dot77"),
341 TestCase::Duration::QUICK);
344 "DataCtrlPowerDifference_dB_3"),
345 TestCase::Duration::QUICK);
348 "DataCtrlPowerDifference_dB_1dot77"),
349 TestCase::Duration::QUICK);
352 "DataCtrlPowerDifference_dB0"),
353 TestCase::Duration::QUICK);
356 "DataCtrlPowerDifference_dB1"),
357 TestCase::Duration::QUICK);
360 "DataCtrlPowerDifference_dB2"),
361 TestCase::Duration::QUICK);
364 "DataCtrlPowerDifference_dB3"),
365 TestCase::Duration::QUICK);
366
367 // RrcConnectionReconfiguration test
370 "RrcConnReconf-IdealRrc"),
371 TestCase::Duration::QUICK);
374 "RrcConnReconf-RealRrc"),
375 TestCase::Duration::QUICK);
376}
377
378double
380{
381 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
382 pdschConfigDedicated.pa = pa;
383 double rbTxpower =
384 txPower + LteRrcSap::ConvertPdschConfigDedicated2Double(pdschConfigDedicated);
385
386 return rbTxpower;
387}
388
389/**
390 * \ingroup lte-test
391 * Static variable for test initialization
392 */
394
395/**
396 * TestCase Data
397 */
398
400 std::string name,
401 uint16_t earfcn,
402 uint16_t bw,
403 double powerTx,
404 std::map<int, double> powerTxMap,
405 std::vector<int> activeRbs,
406 SpectrumValue& expected)
407 : TestCase("Downlink Power Control: " + name),
409 bw,
410 powerTx,
411 powerTxMap,
412 activeRbs)),
413 m_expected(Create<SpectrumValue>(expected))
414{
415 NS_LOG_INFO("Creating LteDownlinkPowerControlTestCase");
416}
417
419{
420}
421
422void
424{
425 NS_LOG_INFO("Creating LteDownlinkPowerControlSpectrumValueTestCase");
428 "SpectrumModel UID mismatch");
430 (*m_expected),
431 0.0000001,
432 "SpectrumValues not equal");
433}
434
436 uint8_t pa,
437 std::string name)
438 : TestCase("Downlink Power Control: " + name)
439{
440 m_changePdschConfigDedicated = changePower;
443 NS_LOG_INFO("Creating LteDownlinkPowerControlTestCase");
444}
445
447{
448}
449
450void
452{
454 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(false));
455
456 /**
457 * Simulation Topology
458 */
459
460 Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
461 lteHelper->SetFfrAlgorithmType("ns3::LteFfrSimple");
462
463 // Create Nodes: eNodeB and UE
464 NodeContainer enbNodes;
465 NodeContainer ueNodes;
466 enbNodes.Create(1);
467 ueNodes.Create(1);
468 NodeContainer allNodes = NodeContainer(enbNodes, ueNodes);
469
470 // Install Mobility Model
471 MobilityHelper mobility;
472 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
473 mobility.Install(allNodes);
474
475 // Create Devices and install them in the Nodes (eNB and UE)
476 NetDeviceContainer enbDevs;
477 NetDeviceContainer ueDevs;
478 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
479 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
480 ueDevs = lteHelper->InstallUeDevice(ueNodes);
481
482 // Attach a UE to a eNB
483 lteHelper->Attach(ueDevs, enbDevs.Get(0));
484
485 PointerValue tmp;
486 enbDevs.Get(0)->GetAttribute("LteFfrAlgorithm", tmp);
487 Ptr<LteFfrSimple> simpleFfrAlgorithm = DynamicCast<LteFfrSimple>(tmp.GetObject());
488 simpleFfrAlgorithm->ChangePdschConfigDedicated(m_changePdschConfigDedicated);
489 simpleFfrAlgorithm->SetPdschConfigDedicated(m_pdschConfigDedicated);
490
491 // Activate the default EPS bearer
493 EpsBearer bearer(q);
494 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
495
496 // Use testing chunk processor in the PHY layer
497 // It will be used to calculate data and ctrl power in downlink
498
499 Ptr<LtePhy> ue1Phy = ueDevs.Get(0)->GetObject<LteUeNetDevice>()->GetPhy()->GetObject<LtePhy>();
500
501 Ptr<LteChunkProcessor> testDlDataPowerReceived = Create<LteChunkProcessor>();
502 LteSpectrumValueCatcher dlDataPowerReceivedCatcher;
503 testDlDataPowerReceived->AddCallback(
504 MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlDataPowerReceivedCatcher));
505 ue1Phy->GetDownlinkSpectrumPhy()->AddDataPowerChunkProcessor(testDlDataPowerReceived);
506
507 Ptr<LteChunkProcessor> testDlCtrlPowerReceived = Create<LteChunkProcessor>();
508 LteSpectrumValueCatcher dlCtrlPowerReceivedCatcher;
509 testDlCtrlPowerReceived->AddCallback(
510 MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlCtrlPowerReceivedCatcher));
511 ue1Phy->GetDownlinkSpectrumPhy()->AddRsPowerChunkProcessor(testDlCtrlPowerReceived);
512
513 Simulator::Stop(Seconds(0.400));
515
516 double dataPower = 10.0 * std::log10(dlDataPowerReceivedCatcher.GetValue()->operator[](0));
517 double ctrlPower = 10.0 * std::log10(dlCtrlPowerReceivedCatcher.GetValue()->operator[](0));
518 double powerDiff = (-1.0) * ctrlPower + dataPower;
519
520 NS_LOG_DEBUG("DataPower: " << dataPower);
521 NS_LOG_DEBUG("CtrlPower: " << ctrlPower);
522 NS_LOG_DEBUG("PowerDifference: " << powerDiff);
523 NS_LOG_DEBUG("ExpectedPowerDifference: " << m_expectedPowerDiff);
524
526 powerDiff,
528 0.001,
529 "Downlink Data and Ctrl Power Difference are not equal within tolerance");
530
532}
533
534void
537 std::string context,
538 uint64_t imsi,
539 uint16_t cellId,
540 uint16_t rnti)
541{
542 testcase->ConnectionReconfigurationUe(context, imsi, cellId, rnti);
543}
544
545void
548 std::string context,
549 uint64_t imsi,
550 uint16_t cellId,
551 uint16_t rnti)
552{
553 testcase->ConnectionReconfigurationEnb(context, imsi, cellId, rnti);
554}
555
556void
559 std::string context,
560 uint16_t rnti,
561 uint8_t pa)
562{
563 testcase->ChangePdschConfigDedicated(rnti, pa);
564}
565
567 LteDownlinkPowerControlRrcConnectionReconfigurationTestCase(bool useIdealRrc, std::string name)
568 : TestCase("Downlink Power Control: " + name),
569 m_useIdealRrc(useIdealRrc),
570 m_changePdschConfigDedicatedTriggered(false),
571 m_connectionReconfigurationUeReceived(false),
572 m_connectionReconfigurationEnbCompleted(false)
573{
574}
575
578{
579}
580
581void
583 std::string context,
584 uint64_t imsi,
585 uint16_t cellid,
586 uint16_t rnti)
587{
588 if (Simulator::Now() > MilliSeconds(100))
589 {
590 NS_LOG_DEBUG("eNb ConnectionReconfigurationCompleted");
592 }
593}
594
595void
597 std::string context,
598 uint64_t imsi,
599 uint16_t cellid,
600 uint16_t rnti)
601{
602 if (Simulator::Now() > MilliSeconds(100))
603 {
604 NS_LOG_DEBUG("Ue ConnectionReconfiguration");
606 }
607}
608
609void
611 uint16_t rnti,
612 uint8_t pa)
613{
614 NS_LOG_DEBUG("FFR Algorithm ChangePdschConfigDedicated");
616}
617
618void
620{
622 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(m_useIdealRrc));
623
624 /**
625 * Simulation Topology
626 */
627
628 Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
629 lteHelper->SetFfrAlgorithmType("ns3::LteFfrSimple");
630
631 // Create Nodes: eNodeB and UE
632 NodeContainer enbNodes;
633 NodeContainer ueNodes;
634 enbNodes.Create(1);
635 ueNodes.Create(1);
636 NodeContainer allNodes = NodeContainer(enbNodes, ueNodes);
637
638 // Install Mobility Model
639 MobilityHelper mobility;
640 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
641 mobility.Install(allNodes);
642
643 // Create Devices and install them in the Nodes (eNB and UE)
644 NetDeviceContainer enbDevs;
645 NetDeviceContainer ueDevs;
646 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
647 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
648 ueDevs = lteHelper->InstallUeDevice(ueNodes);
649
650 // Attach a UE to a eNB
651 lteHelper->Attach(ueDevs, enbDevs.Get(0));
652
653 PointerValue tmp;
654 enbDevs.Get(0)->GetAttribute("LteFfrAlgorithm", tmp);
655 Ptr<LteFfrSimple> simpleFfrAlgorithm = DynamicCast<LteFfrSimple>(tmp.GetObject());
656 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
657 pdschConfigDedicated.pa = LteRrcSap::PdschConfigDedicated::dB_6;
658 simpleFfrAlgorithm->ChangePdschConfigDedicated(true);
659 simpleFfrAlgorithm->SetPdschConfigDedicated(pdschConfigDedicated);
660
661 // Activate the default EPS bearer
663 EpsBearer bearer(q);
664 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
665
666 Config::Connect("/NodeList/0/DeviceList/0/LteFfrAlgorithm/ChangePdschConfigDedicated",
668 Config::Connect("/NodeList/1/DeviceList/0/LteUeRrc/ConnectionReconfiguration",
670 Config::Connect("/NodeList/0/DeviceList/0/LteEnbRrc/ConnectionReconfiguration",
672
673 Simulator::Stop(Seconds(0.400));
675
677 true,
678 "Ffr have not changed PdschConfigDedicated for UE");
680 true,
681 "Ue have not received RrcConnectionReconfiguration");
683 true,
684 "Enb have not received RrcConnectionReconfigurationCompleted");
685
687}
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
Qci
QoS Class Indicator.
Definition: eps-bearer.h:106
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
Definition: eps-bearer.h:126
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:51
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
Convert PDSCH config dedicated function.
Definition: lte-rrc-sap.h:189
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
Ptr< SpectrumValue > GetValue()
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
This class defines all functions to create spectrum model for lte.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint16_t bandwidth)
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:522
AttributeValue implementation for Pointer.
Definition: pointer.h:48
Ptr< Object > GetObject() const
Get the Object referenced by the PointerValue.
Definition: pointer.cc:57
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static void Run()
Run the simulation.
Definition: simulator.cc:178
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
Set of values corresponding to a given SpectrumModel.
SpectrumModelUid_t GetSpectrumModelUid() const
encapsulates test code
Definition: test.h:1061
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1268
Type
Type of test.
Definition: test.h:1275
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:859
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:894
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:978
#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_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
static LteDownlinkPowerControlTestSuite lteDownlinkPowerControlTestSuite
Static variable for test initialization.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:765
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition: ptr.h:447
#define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumValue instances are equal within a given tolerance.
#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:145
#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:338
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:704
PdschConfigDedicated structure.
Definition: lte-rrc-sap.h:163
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double fc)