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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
7 *
8 */
9
11
12#include "lte-ffr-simple.h"
13
14#include "ns3/lte-helper.h"
15#include "ns3/mobility-helper.h"
16#include <ns3/boolean.h>
17#include <ns3/callback.h>
18#include <ns3/config.h>
19#include <ns3/double.h>
20#include <ns3/enum.h>
21#include <ns3/ff-mac-scheduler.h>
22#include <ns3/log.h>
23#include <ns3/lte-chunk-processor.h>
24#include <ns3/lte-common.h>
25#include <ns3/lte-enb-net-device.h>
26#include <ns3/lte-enb-phy.h>
27#include <ns3/lte-enb-rrc.h>
28#include <ns3/lte-rrc-sap.h>
29#include <ns3/lte-ue-net-device.h>
30#include <ns3/lte-ue-phy.h>
31#include <ns3/lte-ue-rrc.h>
32#include <ns3/pointer.h>
33#include <ns3/simulator.h>
34#include <ns3/string.h>
35
36using namespace ns3;
37
38NS_LOG_COMPONENT_DEFINE("LteDownlinkPowerControlTest");
39
40/**
41 * TestSuite
42 */
43
45 : TestSuite("lte-downlink-power-control", Type::SYSTEM)
46{
47 // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_DEBUG);
48 // LogComponentEnable ("LteDownlinkPowerControlTest", logLevel);
49 NS_LOG_INFO("Creating LteDownlinkPowerControlTestSuite");
50
51 // Spectrum helper test
52 {
53 std::vector<int> activeRbs_txpowdB30nrb6run1earfcn500(4);
54 activeRbs_txpowdB30nrb6run1earfcn500[0] = 0;
55 activeRbs_txpowdB30nrb6run1earfcn500[1] = 2;
56 activeRbs_txpowdB30nrb6run1earfcn500[2] = 3;
57 activeRbs_txpowdB30nrb6run1earfcn500[3] = 5;
58
59 uint16_t earfcn = 500;
60 uint8_t bw = 6;
61 double powerTx = 30;
62
63 std::map<int, double> powerTxMap;
64 double rbTxPower = powerTx;
65
67 powerTxMap.insert(std::pair<int, double>(0, rbTxPower));
68
70 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
71
73 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
74
76 powerTxMap.insert(std::pair<int, double>(5, rbTxPower));
77
78 SpectrumValue spectrumValue_txpowdB30nrb6run1earfcn500(
80 spectrumValue_txpowdB30nrb6run1earfcn500[0] = 2.325820769916e-07;
81 spectrumValue_txpowdB30nrb6run1earfcn500[1] = 0.000000000000e+00;
82 spectrumValue_txpowdB30nrb6run1earfcn500[2] = 4.640622533585e-07;
83 spectrumValue_txpowdB30nrb6run1earfcn500[3] = 9.259259259259e-07;
84 spectrumValue_txpowdB30nrb6run1earfcn500[4] = 0.000000000000e+00;
85 spectrumValue_txpowdB30nrb6run1earfcn500[5] = 1.467493696723e-06;
86
88 "txpowdB30nrb6run1earfcn500_allRbPower",
89 earfcn,
90 bw,
91 powerTx,
92 powerTxMap,
93 activeRbs_txpowdB30nrb6run1earfcn500,
94 spectrumValue_txpowdB30nrb6run1earfcn500),
95 TestCase::Duration::QUICK);
96 }
97 {
98 // if power for RB not present, but RB is active, use powerTx
99 std::vector<int> activeRbs_txpowdB30nrb6run1earfcn500(4);
100 activeRbs_txpowdB30nrb6run1earfcn500[0] = 0;
101 activeRbs_txpowdB30nrb6run1earfcn500[1] = 2;
102 activeRbs_txpowdB30nrb6run1earfcn500[2] = 3;
103 activeRbs_txpowdB30nrb6run1earfcn500[3] = 5;
104
105 uint16_t earfcn = 500;
106 uint8_t bw = 6;
107 double powerTx = 30;
108
109 std::map<int, double> powerTxMap;
110 double rbTxPower = powerTx;
111
113 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
114
116 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
117
119 powerTxMap.insert(std::pair<int, double>(5, rbTxPower));
120
121 SpectrumValue spectrumValue_txpowdB30nrb6run1earfcn500(
123 spectrumValue_txpowdB30nrb6run1earfcn500[0] = 9.259259259259e-07;
124 spectrumValue_txpowdB30nrb6run1earfcn500[1] = 0.000000000000e+00;
125 spectrumValue_txpowdB30nrb6run1earfcn500[2] = 4.640622533585e-07;
126 spectrumValue_txpowdB30nrb6run1earfcn500[3] = 9.259259259259e-07;
127 spectrumValue_txpowdB30nrb6run1earfcn500[4] = 0.000000000000e+00;
128 spectrumValue_txpowdB30nrb6run1earfcn500[5] = 1.467493696723e-06;
129
131 "txpowdB30nrb6run1earfcn500",
132 earfcn,
133 bw,
134 powerTx,
135 powerTxMap,
136 activeRbs_txpowdB30nrb6run1earfcn500,
137 spectrumValue_txpowdB30nrb6run1earfcn500),
138 TestCase::Duration::QUICK);
139 }
140 {
141 std::vector<int> activeRbs_txpowdB30nrb25run1earfcn500(15);
142 activeRbs_txpowdB30nrb25run1earfcn500[0] = 0;
143 activeRbs_txpowdB30nrb25run1earfcn500[1] = 1;
144 activeRbs_txpowdB30nrb25run1earfcn500[2] = 2;
145 activeRbs_txpowdB30nrb25run1earfcn500[3] = 3;
146 activeRbs_txpowdB30nrb25run1earfcn500[4] = 7;
147 activeRbs_txpowdB30nrb25run1earfcn500[5] = 8;
148 activeRbs_txpowdB30nrb25run1earfcn500[6] = 9;
149 activeRbs_txpowdB30nrb25run1earfcn500[7] = 11;
150 activeRbs_txpowdB30nrb25run1earfcn500[8] = 13;
151 activeRbs_txpowdB30nrb25run1earfcn500[9] = 14;
152 activeRbs_txpowdB30nrb25run1earfcn500[10] = 18;
153 activeRbs_txpowdB30nrb25run1earfcn500[11] = 19;
154 activeRbs_txpowdB30nrb25run1earfcn500[12] = 20;
155 activeRbs_txpowdB30nrb25run1earfcn500[13] = 21;
156 activeRbs_txpowdB30nrb25run1earfcn500[14] = 24;
157
158 uint16_t earfcn = 500;
159 uint8_t bw = 25;
160 double powerTx = 30;
161
162 std::map<int, double> powerTxMap;
163 double rbTxPower = powerTx;
165 powerTxMap.insert(std::pair<int, double>(0, rbTxPower));
167 powerTxMap.insert(std::pair<int, double>(1, rbTxPower));
169 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
171 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
173 powerTxMap.insert(std::pair<int, double>(7, rbTxPower));
175 powerTxMap.insert(std::pair<int, double>(8, rbTxPower));
177 powerTxMap.insert(std::pair<int, double>(9, rbTxPower));
179 powerTxMap.insert(std::pair<int, double>(11, rbTxPower));
181 powerTxMap.insert(std::pair<int, double>(13, rbTxPower));
183 powerTxMap.insert(std::pair<int, double>(14, rbTxPower));
185 powerTxMap.insert(std::pair<int, double>(18, rbTxPower));
187 powerTxMap.insert(std::pair<int, double>(19, rbTxPower));
189 powerTxMap.insert(std::pair<int, double>(20, rbTxPower));
191 powerTxMap.insert(std::pair<int, double>(21, rbTxPower));
193 powerTxMap.insert(std::pair<int, double>(24, rbTxPower));
194
195 SpectrumValue spectrumValue_txpowdB30nrb25run1earfcn500(
197 spectrumValue_txpowdB30nrb25run1earfcn500[0] = 1.113749408060e-07;
198 spectrumValue_txpowdB30nrb25run1earfcn500[1] = 7.409475839182e-08;
199 spectrumValue_txpowdB30nrb25run1earfcn500[2] = 5.581969847799e-08;
200 spectrumValue_txpowdB30nrb25run1earfcn500[3] = 2.797612026209e-07;
201 spectrumValue_txpowdB30nrb25run1earfcn500[4] = 0.000000000000e+00;
202 spectrumValue_txpowdB30nrb25run1earfcn500[5] = 0.000000000000e+00;
203 spectrumValue_txpowdB30nrb25run1earfcn500[6] = 0.000000000000e+00;
204 spectrumValue_txpowdB30nrb25run1earfcn500[7] = 3.521984872135e-07;
205 spectrumValue_txpowdB30nrb25run1earfcn500[8] = 3.521984872135e-07;
206 spectrumValue_txpowdB30nrb25run1earfcn500[9] = 3.521984872135e-07;
207 spectrumValue_txpowdB30nrb25run1earfcn500[10] = 0.000000000000e+00;
208 spectrumValue_txpowdB30nrb25run1earfcn500[11] = 1.478384791559e-07;
209 spectrumValue_txpowdB30nrb25run1earfcn500[12] = 0.000000000000e+00;
210 spectrumValue_txpowdB30nrb25run1earfcn500[13] = 3.521984872135e-07;
211 spectrumValue_txpowdB30nrb25run1earfcn500[14] = 1.113749408060e-07;
212 spectrumValue_txpowdB30nrb25run1earfcn500[15] = 0.000000000000e+00;
213 spectrumValue_txpowdB30nrb25run1earfcn500[16] = 0.000000000000e+00;
214 spectrumValue_txpowdB30nrb25run1earfcn500[17] = 0.000000000000e+00;
215 spectrumValue_txpowdB30nrb25run1earfcn500[18] = 2.222222222222e-07;
216 spectrumValue_txpowdB30nrb25run1earfcn500[19] = 1.113749408060e-07;
217 spectrumValue_txpowdB30nrb25run1earfcn500[20] = 1.113749408060e-07;
218 spectrumValue_txpowdB30nrb25run1earfcn500[21] = 7.409475839182e-08;
219 spectrumValue_txpowdB30nrb25run1earfcn500[22] = 0.000000000000e+00;
220 spectrumValue_txpowdB30nrb25run1earfcn500[23] = 0.000000000000e+00;
221 spectrumValue_txpowdB30nrb25run1earfcn500[24] = 4.433916255486e-07;
222
224 "txpowdB30nrb25run1earfcn500_allRbPower",
225 earfcn,
226 bw,
227 powerTx,
228 powerTxMap,
229 activeRbs_txpowdB30nrb25run1earfcn500,
230 spectrumValue_txpowdB30nrb25run1earfcn500),
231 TestCase::Duration::QUICK);
232 }
233 {
234 // if power for RB not present, but RB is active, use powerTx
235 std::vector<int> activeRbs_txpowdB30nrb25run1earfcn500(15);
236 activeRbs_txpowdB30nrb25run1earfcn500[0] = 0;
237 activeRbs_txpowdB30nrb25run1earfcn500[1] = 1;
238 activeRbs_txpowdB30nrb25run1earfcn500[2] = 2;
239 activeRbs_txpowdB30nrb25run1earfcn500[3] = 3;
240 activeRbs_txpowdB30nrb25run1earfcn500[4] = 7;
241 activeRbs_txpowdB30nrb25run1earfcn500[5] = 8;
242 activeRbs_txpowdB30nrb25run1earfcn500[6] = 9;
243 activeRbs_txpowdB30nrb25run1earfcn500[7] = 11;
244 activeRbs_txpowdB30nrb25run1earfcn500[8] = 13;
245 activeRbs_txpowdB30nrb25run1earfcn500[9] = 14;
246 activeRbs_txpowdB30nrb25run1earfcn500[10] = 18;
247 activeRbs_txpowdB30nrb25run1earfcn500[11] = 19;
248 activeRbs_txpowdB30nrb25run1earfcn500[12] = 20;
249 activeRbs_txpowdB30nrb25run1earfcn500[13] = 21;
250 activeRbs_txpowdB30nrb25run1earfcn500[14] = 24;
251
252 uint16_t earfcn = 500;
253 uint8_t bw = 25;
254 double powerTx = 30;
255
256 std::map<int, double> powerTxMap;
257 double rbTxPower = powerTx;
259 powerTxMap.insert(std::pair<int, double>(0, rbTxPower));
261 powerTxMap.insert(std::pair<int, double>(2, rbTxPower));
263 powerTxMap.insert(std::pair<int, double>(3, rbTxPower));
265 powerTxMap.insert(std::pair<int, double>(7, rbTxPower));
267 powerTxMap.insert(std::pair<int, double>(8, rbTxPower));
269 powerTxMap.insert(std::pair<int, double>(13, rbTxPower));
271 powerTxMap.insert(std::pair<int, double>(14, rbTxPower));
273 powerTxMap.insert(std::pair<int, double>(18, rbTxPower));
275 powerTxMap.insert(std::pair<int, double>(19, rbTxPower));
277 powerTxMap.insert(std::pair<int, double>(24, rbTxPower));
278
279 SpectrumValue spectrumValue_txpowdB30nrb25run1earfcn500(
281 spectrumValue_txpowdB30nrb25run1earfcn500[0] = 1.113749408060e-07;
282 spectrumValue_txpowdB30nrb25run1earfcn500[1] = 2.222222222222e-07;
283 spectrumValue_txpowdB30nrb25run1earfcn500[2] = 5.581969847799e-08;
284 spectrumValue_txpowdB30nrb25run1earfcn500[3] = 2.797612026209e-07;
285 spectrumValue_txpowdB30nrb25run1earfcn500[4] = 0.000000000000e+00;
286 spectrumValue_txpowdB30nrb25run1earfcn500[5] = 0.000000000000e+00;
287 spectrumValue_txpowdB30nrb25run1earfcn500[6] = 0.000000000000e+00;
288 spectrumValue_txpowdB30nrb25run1earfcn500[7] = 3.521984872135e-07;
289 spectrumValue_txpowdB30nrb25run1earfcn500[8] = 3.521984872135e-07;
290 spectrumValue_txpowdB30nrb25run1earfcn500[9] = 2.222222222222e-07;
291 spectrumValue_txpowdB30nrb25run1earfcn500[10] = 0.000000000000e+00;
292 spectrumValue_txpowdB30nrb25run1earfcn500[11] = 2.222222222222e-07;
293 spectrumValue_txpowdB30nrb25run1earfcn500[12] = 0.000000000000e+00;
294 spectrumValue_txpowdB30nrb25run1earfcn500[13] = 3.521984872135e-07;
295 spectrumValue_txpowdB30nrb25run1earfcn500[14] = 1.113749408060e-07;
296 spectrumValue_txpowdB30nrb25run1earfcn500[15] = 0.000000000000e+00;
297 spectrumValue_txpowdB30nrb25run1earfcn500[16] = 0.000000000000e+00;
298 spectrumValue_txpowdB30nrb25run1earfcn500[17] = 0.000000000000e+00;
299 spectrumValue_txpowdB30nrb25run1earfcn500[18] = 2.222222222222e-07;
300 spectrumValue_txpowdB30nrb25run1earfcn500[19] = 1.113749408060e-07;
301 spectrumValue_txpowdB30nrb25run1earfcn500[20] = 2.222222222222e-07;
302 spectrumValue_txpowdB30nrb25run1earfcn500[21] = 2.222222222222e-07;
303 spectrumValue_txpowdB30nrb25run1earfcn500[22] = 0.000000000000e+00;
304 spectrumValue_txpowdB30nrb25run1earfcn500[23] = 0.000000000000e+00;
305 spectrumValue_txpowdB30nrb25run1earfcn500[24] = 4.433916255486e-07;
306
308 "txpowdB30nrb25run1earfcn500",
309 earfcn,
310 bw,
311 powerTx,
312 powerTxMap,
313 activeRbs_txpowdB30nrb25run1earfcn500,
314 spectrumValue_txpowdB30nrb25run1earfcn500),
315 TestCase::Duration::QUICK);
316 }
317
318 // Downlink DATA and CONTROL channels power comparison
321 "DataCtrlPowerDifference_noChange"),
322 TestCase::Duration::QUICK);
325 "DataCtrlPowerDifference_dB_6"),
326 TestCase::Duration::QUICK);
329 "DataCtrlPowerDifference_dB_4dot77"),
330 TestCase::Duration::QUICK);
333 "DataCtrlPowerDifference_dB_3"),
334 TestCase::Duration::QUICK);
337 "DataCtrlPowerDifference_dB_1dot77"),
338 TestCase::Duration::QUICK);
341 "DataCtrlPowerDifference_dB0"),
342 TestCase::Duration::QUICK);
345 "DataCtrlPowerDifference_dB1"),
346 TestCase::Duration::QUICK);
349 "DataCtrlPowerDifference_dB2"),
350 TestCase::Duration::QUICK);
353 "DataCtrlPowerDifference_dB3"),
354 TestCase::Duration::QUICK);
355
356 // RrcConnectionReconfiguration test
359 "RrcConnReconf-IdealRrc"),
360 TestCase::Duration::QUICK);
363 "RrcConnReconf-RealRrc"),
364 TestCase::Duration::QUICK);
365}
366
367double
369{
370 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
371 pdschConfigDedicated.pa = pa;
372 double rbTxpower =
373 txPower + LteRrcSap::ConvertPdschConfigDedicated2Double(pdschConfigDedicated);
374
375 return rbTxpower;
376}
377
378/**
379 * @ingroup lte-test
380 * Static variable for test initialization
381 */
383
384/**
385 * TestCase Data
386 */
387
389 std::string name,
390 uint16_t earfcn,
391 uint16_t bw,
392 double powerTx,
393 std::map<int, double> powerTxMap,
394 std::vector<int> activeRbs,
395 SpectrumValue& expected)
396 : TestCase("Downlink Power Control: " + name),
398 bw,
399 powerTx,
400 powerTxMap,
401 activeRbs)),
402 m_expected(Create<SpectrumValue>(expected))
403{
404 NS_LOG_INFO("Creating LteDownlinkPowerControlTestCase");
405}
406
410
411void
413{
414 NS_LOG_INFO("Creating LteDownlinkPowerControlSpectrumValueTestCase");
415 NS_TEST_ASSERT_MSG_EQ(m_actual->GetSpectrumModelUid(),
416 m_expected->GetSpectrumModelUid(),
417 "SpectrumModel UID mismatch");
419 (*m_expected),
420 0.0000001,
421 "SpectrumValues not equal");
422}
423
425 uint8_t pa,
426 std::string name)
427 : TestCase("Downlink Power Control: " + name)
428{
429 m_changePdschConfigDedicated = changePower;
432 NS_LOG_INFO("Creating LteDownlinkPowerControlTestCase");
433}
434
438
439void
441{
443 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(false));
444
445 /**
446 * Simulation Topology
447 */
448
450 lteHelper->SetFfrAlgorithmType("ns3::LteFfrSimple");
451
452 // Create Nodes: eNodeB and UE
453 NodeContainer enbNodes;
454 NodeContainer ueNodes;
455 enbNodes.Create(1);
456 ueNodes.Create(1);
457 NodeContainer allNodes = NodeContainer(enbNodes, ueNodes);
458
459 // Install Mobility Model
460 MobilityHelper mobility;
461 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
462 mobility.Install(allNodes);
463
464 // Create Devices and install them in the Nodes (eNB and UE)
465 NetDeviceContainer enbDevs;
466 NetDeviceContainer ueDevs;
467 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
468 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
469 ueDevs = lteHelper->InstallUeDevice(ueNodes);
470
471 // Attach a UE to a eNB
472 lteHelper->Attach(ueDevs, enbDevs.Get(0));
473
474 PointerValue tmp;
475 enbDevs.Get(0)->GetAttribute("LteFfrAlgorithm", tmp);
476 Ptr<LteFfrSimple> simpleFfrAlgorithm = DynamicCast<LteFfrSimple>(tmp.GetObject());
477 simpleFfrAlgorithm->ChangePdschConfigDedicated(m_changePdschConfigDedicated);
478 simpleFfrAlgorithm->SetPdschConfigDedicated(m_pdschConfigDedicated);
479
480 // Activate the default EPS bearer
482 EpsBearer bearer(q);
483 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
484
485 // Use testing chunk processor in the PHY layer
486 // It will be used to calculate data and ctrl power in downlink
487
488 Ptr<LtePhy> ue1Phy = ueDevs.Get(0)->GetObject<LteUeNetDevice>()->GetPhy()->GetObject<LtePhy>();
489
490 Ptr<LteChunkProcessor> testDlDataPowerReceived = Create<LteChunkProcessor>();
491 LteSpectrumValueCatcher dlDataPowerReceivedCatcher;
492 testDlDataPowerReceived->AddCallback(
493 MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlDataPowerReceivedCatcher));
494 ue1Phy->GetDownlinkSpectrumPhy()->AddDataPowerChunkProcessor(testDlDataPowerReceived);
495
496 Ptr<LteChunkProcessor> testDlCtrlPowerReceived = Create<LteChunkProcessor>();
497 LteSpectrumValueCatcher dlCtrlPowerReceivedCatcher;
498 testDlCtrlPowerReceived->AddCallback(
499 MakeCallback(&LteSpectrumValueCatcher::ReportValue, &dlCtrlPowerReceivedCatcher));
500 ue1Phy->GetDownlinkSpectrumPhy()->AddRsPowerChunkProcessor(testDlCtrlPowerReceived);
501
502 Simulator::Stop(Seconds(0.400));
504
505 double dataPower = 10.0 * std::log10(dlDataPowerReceivedCatcher.GetValue()->operator[](0));
506 double ctrlPower = 10.0 * std::log10(dlCtrlPowerReceivedCatcher.GetValue()->operator[](0));
507 double powerDiff = (-1.0) * ctrlPower + dataPower;
508
509 NS_LOG_DEBUG("DataPower: " << dataPower);
510 NS_LOG_DEBUG("CtrlPower: " << ctrlPower);
511 NS_LOG_DEBUG("PowerDifference: " << powerDiff);
512 NS_LOG_DEBUG("ExpectedPowerDifference: " << m_expectedPowerDiff);
513
515 powerDiff,
517 0.001,
518 "Downlink Data and Ctrl Power Difference are not equal within tolerance");
519
521}
522
523void
526 std::string context,
527 uint64_t imsi,
528 uint16_t cellId,
529 uint16_t rnti)
530{
531 testcase->ConnectionReconfigurationUe(context, imsi, cellId, rnti);
532}
533
534void
537 std::string context,
538 uint64_t imsi,
539 uint16_t cellId,
540 uint16_t rnti)
541{
542 testcase->ConnectionReconfigurationEnb(context, imsi, cellId, rnti);
543}
544
545void
548 std::string context,
549 uint16_t rnti,
550 uint8_t pa)
551{
552 testcase->ChangePdschConfigDedicated(rnti, pa);
553}
554
556 LteDownlinkPowerControlRrcConnectionReconfigurationTestCase(bool useIdealRrc, std::string name)
557 : TestCase("Downlink Power Control: " + name),
558 m_useIdealRrc(useIdealRrc),
559 m_changePdschConfigDedicatedTriggered(false),
560 m_connectionReconfigurationUeReceived(false),
561 m_connectionReconfigurationEnbCompleted(false)
562{
563}
564
569
570void
572 std::string context,
573 uint64_t imsi,
574 uint16_t cellid,
575 uint16_t rnti)
576{
577 if (Simulator::Now() > MilliSeconds(100))
578 {
579 NS_LOG_DEBUG("eNb ConnectionReconfigurationCompleted");
581 }
582}
583
584void
586 std::string context,
587 uint64_t imsi,
588 uint16_t cellid,
589 uint16_t rnti)
590{
591 if (Simulator::Now() > MilliSeconds(100))
592 {
593 NS_LOG_DEBUG("Ue ConnectionReconfiguration");
595 }
596}
597
598void
600 uint16_t rnti,
601 uint8_t pa)
602{
603 NS_LOG_DEBUG("FFR Algorithm ChangePdschConfigDedicated");
605}
606
607void
609{
611 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(m_useIdealRrc));
612
613 /**
614 * Simulation Topology
615 */
616
618 lteHelper->SetFfrAlgorithmType("ns3::LteFfrSimple");
619
620 // Create Nodes: eNodeB and UE
621 NodeContainer enbNodes;
622 NodeContainer ueNodes;
623 enbNodes.Create(1);
624 ueNodes.Create(1);
625 NodeContainer allNodes = NodeContainer(enbNodes, ueNodes);
626
627 // Install Mobility Model
628 MobilityHelper mobility;
629 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
630 mobility.Install(allNodes);
631
632 // Create Devices and install them in the Nodes (eNB and UE)
633 NetDeviceContainer enbDevs;
634 NetDeviceContainer ueDevs;
635 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
636 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
637 ueDevs = lteHelper->InstallUeDevice(ueNodes);
638
639 // Attach a UE to a eNB
640 lteHelper->Attach(ueDevs, enbDevs.Get(0));
641
642 PointerValue tmp;
643 enbDevs.Get(0)->GetAttribute("LteFfrAlgorithm", tmp);
644 Ptr<LteFfrSimple> simpleFfrAlgorithm = DynamicCast<LteFfrSimple>(tmp.GetObject());
645 LteRrcSap::PdschConfigDedicated pdschConfigDedicated;
646 pdschConfigDedicated.pa = LteRrcSap::PdschConfigDedicated::dB_6;
647 simpleFfrAlgorithm->ChangePdschConfigDedicated(true);
648 simpleFfrAlgorithm->SetPdschConfigDedicated(pdschConfigDedicated);
649
650 // Activate the default EPS bearer
652 EpsBearer bearer(q);
653 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
654
655 Config::Connect("/NodeList/0/DeviceList/0/LteFfrAlgorithm/ChangePdschConfigDedicated",
657 Config::Connect("/NodeList/1/DeviceList/0/LteUeRrc/ConnectionReconfiguration",
659 Config::Connect("/NodeList/0/DeviceList/0/LteEnbRrc/ConnectionReconfiguration",
661
662 Simulator::Stop(Seconds(0.400));
664
666 true,
667 "Ffr have not changed PdschConfigDedicated for UE");
669 true,
670 "Ue have not received RrcConnectionReconfiguration");
672 true,
673 "Enb have not received RrcConnectionReconfigurationCompleted");
674
676}
AttributeValue implementation for Boolean.
Definition boolean.h:26
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
Qci
QoS Class Indicator.
Definition eps-bearer.h:95
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
Definition eps-bearer.h:115
The LtePhy models the physical layer of LTE.
Definition lte-phy.h:40
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
Convert PDSCH config dedicated function.
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:511
AttributeValue implementation for Pointer.
Ptr< Object > GetObject() const
Get the Object referenced by the PointerValue.
Definition pointer.cc:46
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Set of values corresponding to a given SpectrumModel.
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
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:848
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:967
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
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:745
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#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:134
#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:327
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1356
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:684
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
PdschConfigDedicated structure.
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double fcHz, double pwrDbm, double bwHz, double rbWidthHz)
Create the PSD for the TX.