5G-LENA nr-v3.0-32-g83aee33
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
system-scheduler-test-qos.cc
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
3// Copyright (c) 2022 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4//
5// SPDX-License-Identifier: GPL-2.0-only
6
8
9#include <ns3/antenna-module.h>
10#include <ns3/applications-module.h>
11#include <ns3/config.h>
12#include <ns3/internet-module.h>
13#include <ns3/nr-module.h>
14#include <ns3/packet.h>
15#include <ns3/point-to-point-helper.h>
16#include <ns3/pointer.h>
17#include <ns3/simulator.h>
18#include <ns3/uinteger.h>
19
20namespace ns3
21{
22
24 uint32_t numerology,
25 double bw1,
26 bool isDownlnk,
27 bool isUplink,
28 double p1,
29 double p2,
30 uint32_t priorityTrafficScenario,
31 const std::string& schedulerType)
32 : TestCase("QoS Scheduler Test Case")
33{
34 m_ueNumPergNb = ueNumPergNb;
35 m_numerology = numerology;
36 m_bw1 = bw1;
37 m_isDownlink = isDownlnk;
38 m_isUplink = isUplink;
39 m_p1 = p1;
40 m_p2 = p2;
41 m_priorityTrafficScenario = priorityTrafficScenario;
42 m_schedulerType = schedulerType;
43}
44
45// This destructor does nothing but we include it as a reminder that
46// the test case should clean up after itself
50
51void
52SystemSchedulerTestQos::DoRun()
53{
54 NS_ABORT_IF(!m_isUplink && !m_isDownlink);
55
56 // set simulation time and mobility
57 Time simTime = MilliSeconds(1500);
58 Time udpAppStartTimeDl = MilliSeconds(500);
59 Time udpAppStartTimeUl = MilliSeconds(500);
60 Time udpAppStopTimeDl = MilliSeconds(1500); // Let's give 1s to end the tx
61 Time udpAppStopTimeUl = MilliSeconds(1500); // Let's give 1 to end the tx
62 uint16_t gNbNum = 1;
63
64 Config::SetDefault("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue(999999999));
65 Config::SetDefault("ns3::LteRlcUm::ReorderingTimer", TimeValue(Seconds(1)));
66 Config::SetDefault("ns3::EpsBearer::Release", UintegerValue(15));
67
68 // create base stations and mobile terminals
69 int64_t randomStream = 1;
70
71 GridScenarioHelper gridScenario;
72 gridScenario.SetRows(1);
73 gridScenario.SetColumns(gNbNum);
74 gridScenario.SetHorizontalBsDistance(5.0);
75 gridScenario.SetVerticalBsDistance(5.0);
76 gridScenario.SetBsHeight(1.5);
77 gridScenario.SetUtHeight(1.5);
78 // must be set before BS number
80 gridScenario.SetBsNumber(gNbNum);
81 gridScenario.SetUtNumber(m_ueNumPergNb * gNbNum);
82 gridScenario.SetScenarioHeight(3); // Create a 3x3 scenario where the UE will
83 gridScenario.SetScenarioLength(3); // be distributed.
84 randomStream += gridScenario.AssignStreams(randomStream);
85 gridScenario.CreateScenario();
86
87 if (verbose)
88 {
89 std::cout << "Test case: Scheduler type: " << m_schedulerType
90 << " numerology: " << m_numerology << " BW: " << m_bw1 << " DL: " << m_isDownlink
91 << " UL: " << m_isUplink << " number of UEs: " << m_ueNumPergNb << std::endl;
92 }
93
94 uint32_t udpPacketSizeULL = 3000; // m_priorityTrafficScenario == 0 //saturation
95 uint32_t udpPacketSizeBe = 3000;
96 uint32_t lambdaULL = 1000;
97 uint32_t lambdaBe = 1000;
98
99 if (m_priorityTrafficScenario == 1) // medium-load
100 {
101 udpPacketSizeBe = 1252;
102 }
103
104 NodeContainer ueLowLatContainer;
105 NodeContainer ueVoiceContainer;
106
107 for (uint32_t j = 0; j < gridScenario.GetUserTerminals().GetN(); ++j)
108 {
109 Ptr<Node> ue = gridScenario.GetUserTerminals().Get(j);
110 j % 2 == 0 ? ueLowLatContainer.Add(ue) : ueVoiceContainer.Add(ue);
111 }
112
113 if (m_priorityTrafficScenario == 1)
114 {
115 lambdaULL = 1000 / ueLowLatContainer.GetN();
116 lambdaBe = 1000 / ueVoiceContainer.GetN();
117 }
118
119 // setup the nr simulation
120 Ptr<NrPointToPointEpcHelper> epcHelper = CreateObject<NrPointToPointEpcHelper>();
121 Ptr<IdealBeamformingHelper> idealBeamformingHelper = CreateObject<IdealBeamformingHelper>();
122 Ptr<NrHelper> nrHelper = CreateObject<NrHelper>();
123
124 // Put the pointers inside nrHelper
125 nrHelper->SetBeamformingHelper(idealBeamformingHelper);
126 nrHelper->SetEpcHelper(epcHelper);
127
128 nrHelper->SetPathlossAttribute("ShadowingEnabled", BooleanValue(false));
129 epcHelper->SetAttribute("S1uLinkDelay", TimeValue(MilliSeconds(0)));
130 Config::SetDefault("ns3::ThreeGppChannelModel::UpdatePeriod", TimeValue(MilliSeconds(0)));
131 nrHelper->SetChannelConditionModelAttribute("UpdatePeriod", TimeValue(MilliSeconds(0)));
132
133 // Set the scheduler type
134 nrHelper->SetSchedulerTypeId(TypeId::LookupByName(m_schedulerType));
135
136 uint16_t mcsTable = 2;
137 // Error Model: gNB and UE with same spectrum error model.
138 std::string errorModel = "ns3::NrEesmIrT" + std::to_string(mcsTable);
139 nrHelper->SetDlErrorModel(errorModel);
140 nrHelper->SetUlErrorModel(errorModel);
141
142 // Both DL and UL AMC will have the same model behind.
143 nrHelper->SetGnbDlAmcAttribute("AmcModel", EnumValue(NrAmc::ErrorModel));
144 nrHelper->SetGnbUlAmcAttribute("AmcModel", EnumValue(NrAmc::ErrorModel));
145
146 // Beamforming method
147 idealBeamformingHelper->SetAttribute("BeamformingMethod",
148 TypeIdValue(DirectPathBeamforming::GetTypeId()));
149
150 // set the number of antenna elements of UE
151 nrHelper->SetUeAntennaAttribute("NumRows", UintegerValue(1));
152 nrHelper->SetUeAntennaAttribute("NumColumns", UintegerValue(1));
153 nrHelper->SetUeAntennaAttribute("AntennaElement",
154 PointerValue(CreateObject<IsotropicAntennaModel>()));
155
156 // set the number of antenna elements of gNbs
157 nrHelper->SetGnbAntennaAttribute("NumRows", UintegerValue(1));
158 nrHelper->SetGnbAntennaAttribute("NumColumns", UintegerValue(1));
159 nrHelper->SetGnbAntennaAttribute("AntennaElement",
160 PointerValue(CreateObject<ThreeGppAntennaModel>()));
161
162 // gNB transmit power
163 nrHelper->SetGnbPhyAttribute("TxPower", DoubleValue(43.0));
164 nrHelper->SetUePhyAttribute("TxPower", DoubleValue(43.0));
165
166 // gNB numerology
167 nrHelper->SetGnbPhyAttribute("Numerology", UintegerValue(m_numerology));
168
169 /*
170 * The configured spectrum division for TDD is:
171 *
172 * |----Band1----|
173 * |-----CC1-----|
174 * |-----BWP1----|
175 */
177 CcBwpCreator ccBwpCreator;
178 OperationBandInfo band;
179 double centralFrequency = 4e9;
180 double bandwidth = m_bw1;
181 const uint8_t numCcPerBand = 1;
183 CcBwpCreator::SimpleOperationBandConf bandConf(centralFrequency,
184 bandwidth,
185 numCcPerBand,
186 scenario);
187
188 // By using the configuration created, it is time to make the operation bands
189 band = ccBwpCreator.CreateOperationBandContiguousCc(bandConf);
190
191 nrHelper->InitializeOperationBand(&band);
192 allBwps = CcBwpCreator::GetAllBwps({band});
193
194 uint32_t bwpIdForLowLat = 0;
195 uint32_t bwpIdForVoice = 0;
196
197 // gNb routing between Bearer and bandwidh part
198 nrHelper->SetGnbBwpManagerAlgorithmAttribute("NGBR_LOW_LAT_EMBB",
199 UintegerValue(bwpIdForLowLat));
200 nrHelper->SetGnbBwpManagerAlgorithmAttribute("GBR_CONV_VOICE", UintegerValue(bwpIdForVoice));
201
202 // Ue routing between Bearer and bandwidth part
203 nrHelper->SetUeBwpManagerAlgorithmAttribute("NGBR_LOW_LAT_EMBB", UintegerValue(bwpIdForLowLat));
204 nrHelper->SetUeBwpManagerAlgorithmAttribute("GBR_CONV_VOICE", UintegerValue(bwpIdForVoice));
205
206 // install mmWave net devices
207 NetDeviceContainer gNbNetDevs =
208 nrHelper->InstallGnbDevice(gridScenario.GetBaseStations(), allBwps);
209 NetDeviceContainer ueLowLatNetDev = nrHelper->InstallUeDevice(ueLowLatContainer, allBwps);
210 NetDeviceContainer ueVoiceNetDev = nrHelper->InstallUeDevice(ueVoiceContainer, allBwps);
211
212 randomStream = 1;
213 randomStream += nrHelper->AssignStreams(gNbNetDevs, randomStream);
214 randomStream += nrHelper->AssignStreams(ueLowLatNetDev, randomStream);
215 randomStream += nrHelper->AssignStreams(ueVoiceNetDev, randomStream);
216
217 for (auto it = gNbNetDevs.Begin(); it != gNbNetDevs.End(); ++it)
218 {
219 DynamicCast<NrGnbNetDevice>(*it)->UpdateConfig();
220 }
221
222 for (auto it = ueLowLatNetDev.Begin(); it != ueLowLatNetDev.End(); ++it)
223 {
224 DynamicCast<NrUeNetDevice>(*it)->UpdateConfig();
225 }
226 for (auto it = ueVoiceNetDev.Begin(); it != ueVoiceNetDev.End(); ++it)
227 {
228 DynamicCast<NrUeNetDevice>(*it)->UpdateConfig();
229 }
230
231 // create the internet and install the IP stack on the UEs
232 // get SGW/PGW and create a single RemoteHost
233 Ptr<Node> pgw = epcHelper->GetPgwNode();
234 NodeContainer remoteHostContainer;
235 Ptr<Node> remoteHostLowLat;
236 Ptr<Node> remoteHostVoice;
237 Ptr<Node> remoteHost;
238
239 if (m_isDownlink)
240 {
241 remoteHostContainer.Create(1);
242 remoteHost = remoteHostContainer.Get(0);
243 }
244 else
245 {
246 remoteHostContainer.Create(2);
247 remoteHostLowLat = remoteHostContainer.Get(0);
248 remoteHostVoice = remoteHostContainer.Get(1);
249 }
250
251 InternetStackHelper internet;
252 internet.Install(remoteHostContainer);
253
254 // connect a remoteHost to pgw. Setup routing too
255 PointToPointHelper p2ph;
256 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
257 p2ph.SetDeviceAttribute("Mtu", UintegerValue(2500));
258 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.000)));
259
260 NetDeviceContainer internetDevicesLowLat;
261 NetDeviceContainer internetDevicesVoice;
262 NetDeviceContainer internetDevices;
263
264 Ipv4AddressHelper ipv4h;
265 Ipv4InterfaceContainer internetIpIfacesLowLat;
266 Ipv4InterfaceContainer internetIpIfacesVoice;
267 Ipv4InterfaceContainer internetIpIfaces;
268 Ipv4StaticRoutingHelper ipv4RoutingHelper;
269
270 Ptr<Ipv4StaticRouting> remoteHostStaticRoutingLowLat;
271 Ptr<Ipv4StaticRouting> remoteHostStaticRoutingVoice;
272 Ptr<Ipv4StaticRouting> remoteHostStaticRouting;
273
274 if (m_isDownlink)
275 {
276 internetDevices = p2ph.Install(pgw, remoteHost);
277
278 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
279 internetIpIfaces = ipv4h.Assign(internetDevices);
280
281 remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
282 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"),
283 Ipv4Mask("255.0.0.0"),
284 1);
285 }
286 else
287 {
288 internetDevicesLowLat = p2ph.Install(pgw, remoteHostLowLat);
289 internetDevicesVoice = p2ph.Install(pgw, remoteHostVoice);
290
291 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
292 internetIpIfacesLowLat = ipv4h.Assign(internetDevicesLowLat);
293 ipv4h.SetBase("2.0.0.0", "255.0.0.0");
294 internetIpIfacesVoice = ipv4h.Assign(internetDevicesVoice);
295
296 remoteHostStaticRoutingLowLat =
297 ipv4RoutingHelper.GetStaticRouting(remoteHostLowLat->GetObject<Ipv4>());
298 remoteHostStaticRoutingLowLat->AddNetworkRouteTo(Ipv4Address("7.0.0.0"),
299 Ipv4Mask("255.0.0.0"),
300 1);
301 remoteHostStaticRoutingVoice =
302 ipv4RoutingHelper.GetStaticRouting(remoteHostVoice->GetObject<Ipv4>());
303 remoteHostStaticRoutingVoice->AddNetworkRouteTo(Ipv4Address("8.0.0.0"),
304 Ipv4Mask("255.0.0.0"),
305 1);
306 }
307
308 internet.Install(gridScenario.GetUserTerminals());
309
310 Ipv4InterfaceContainer ueLowLatIpIface;
311 Ipv4InterfaceContainer ueVoiceIpIface;
312 ueLowLatIpIface = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueLowLatNetDev));
313 ueVoiceIpIface = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueVoiceNetDev));
314
315 // Set the default gateway for the UEs
316 for (uint32_t j = 0; j < gridScenario.GetUserTerminals().GetN(); ++j)
317 {
318 Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting(
319 gridScenario.GetUserTerminals().Get(j)->GetObject<Ipv4>());
320 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
321 }
322
323 // attach UEs to the closest gNB
324 nrHelper->AttachToClosestEnb(ueLowLatNetDev, gNbNetDevs);
325 nrHelper->AttachToClosestEnb(ueVoiceNetDev, gNbNetDevs);
326
327 /*
328 * Traffic part. Install two kind of traffic: low-latency and voice, each
329 * identified by a particular source port.
330 */
331 uint16_t dlPortLowLat = 1234;
332 uint16_t dlPortVoice = 1235;
333
334 uint16_t ulPortLowLat = 2000;
335 uint16_t ulPortVoice = 2001;
336
337 ApplicationContainer clientAppsDl;
338 ApplicationContainer serverAppsDlLowLat;
339 ApplicationContainer serverAppsDlVoice;
340
341 ApplicationContainer clientAppsUl;
342 ApplicationContainer serverAppsUlLowLat;
343 ApplicationContainer serverAppsUlVoice;
344
345 if (m_isUplink)
346 {
347 UdpServerHelper ulPacketSinkLowLat(ulPortLowLat);
348 UdpServerHelper ulPacketSinkVoice(ulPortVoice);
349
350 serverAppsUlLowLat = (ulPacketSinkLowLat.Install(remoteHostLowLat));
351 serverAppsUlVoice = (ulPacketSinkVoice.Install(remoteHostVoice));
352
353 UdpClientHelper ulClientLowlat;
354 ulClientLowlat.SetAttribute("RemotePort", UintegerValue(ulPortLowLat));
355 ulClientLowlat.SetAttribute("MaxPackets", UintegerValue(0xFFFFFFFF));
356 ulClientLowlat.SetAttribute("PacketSize", UintegerValue(udpPacketSizeULL));
357 ulClientLowlat.SetAttribute("Interval", TimeValue(Seconds(1.0 / lambdaULL)));
358
359 Ptr<EpcTft> ulLowLatTft = Create<EpcTft>();
360 EpcTft::PacketFilter ulpfLowLat;
361 ulpfLowLat.remotePortStart = ulPortLowLat;
362 ulpfLowLat.remotePortEnd = ulPortLowLat;
363 ulpfLowLat.direction = EpcTft::UPLINK;
364 ulLowLatTft->Add(ulpfLowLat);
365
366 EpsBearer bearerLowLat(EpsBearer::NGBR_LOW_LAT_EMBB);
367
368 UdpClientHelper ulClientVoice;
369 ulClientVoice.SetAttribute("RemotePort", UintegerValue(ulPortVoice));
370 ulClientVoice.SetAttribute("MaxPackets", UintegerValue(0xFFFFFFFF));
371 ulClientVoice.SetAttribute("PacketSize", UintegerValue(udpPacketSizeBe));
372 ulClientVoice.SetAttribute("Interval", TimeValue(Seconds(1.0 / lambdaBe)));
373
374 Ptr<EpcTft> ulVoiceTft = Create<EpcTft>();
375 EpcTft::PacketFilter ulpfVoice;
376 ulpfVoice.remotePortStart = ulPortVoice;
377 ulpfVoice.remotePortEnd = ulPortVoice;
378 ulpfVoice.direction = EpcTft::UPLINK;
379 ulVoiceTft->Add(ulpfVoice);
380
381 EpsBearer bearerVoice(EpsBearer::GBR_CONV_VOICE);
382
383 // configure here UDP traffic flows
384 for (uint32_t j = 0; j < ueLowLatContainer.GetN(); ++j)
385 {
386 ulClientLowlat.SetAttribute("RemoteAddress",
387 AddressValue(internetIpIfacesLowLat.GetAddress(1)));
388 clientAppsUl.Add(ulClientLowlat.Install(ueLowLatContainer.Get(j)));
389 nrHelper->ActivateDedicatedEpsBearer(ueLowLatNetDev.Get(j), bearerLowLat, ulLowLatTft);
390 }
391
392 // configure here UDP traffic flows
393 for (uint32_t j = 0; j < ueVoiceContainer.GetN(); ++j)
394 {
395 ulClientVoice.SetAttribute("RemoteAddress",
396 AddressValue(internetIpIfacesVoice.GetAddress(1)));
397 clientAppsUl.Add(ulClientVoice.Install(ueVoiceContainer.Get(j)));
398 nrHelper->ActivateDedicatedEpsBearer(ueVoiceNetDev.Get(j), bearerVoice, ulVoiceTft);
399 }
400
401 serverAppsUlLowLat.Start(udpAppStartTimeUl);
402 serverAppsUlVoice.Start(udpAppStartTimeUl);
403 clientAppsUl.Start(udpAppStartTimeUl);
404
405 serverAppsUlLowLat.Stop(udpAppStopTimeUl);
406 serverAppsUlVoice.Stop(udpAppStopTimeUl);
407 clientAppsUl.Stop(udpAppStopTimeUl);
408 }
409
410 if (m_isDownlink)
411 {
412 UdpServerHelper dlPacketSinkLowLat(dlPortLowLat);
413 UdpServerHelper dlPacketSinkVoice(dlPortVoice);
414
415 serverAppsDlLowLat = (dlPacketSinkLowLat.Install(ueLowLatContainer));
416 serverAppsDlVoice = (dlPacketSinkVoice.Install(ueVoiceContainer));
417
418 Ptr<EpcTft> dlLowLatTft = Create<EpcTft>();
419 EpcTft::PacketFilter dlpfLowLat;
420 dlpfLowLat.localPortStart = dlPortLowLat;
421 dlpfLowLat.localPortEnd = dlPortLowLat;
422 dlpfLowLat.direction = EpcTft::DOWNLINK;
423 dlLowLatTft->Add(dlpfLowLat);
424
425 EpsBearer bearerLowlat(EpsBearer::NGBR_LOW_LAT_EMBB);
426
427 Ptr<EpcTft> dlVoiceTft = Create<EpcTft>();
428 EpcTft::PacketFilter dlpfVoice;
429 dlpfVoice.localPortStart = dlPortVoice;
430 dlpfVoice.localPortEnd = dlPortVoice;
431 dlpfVoice.direction = EpcTft::DOWNLINK;
432 dlVoiceTft->Add(dlpfVoice);
433
434 EpsBearer bearerVoice(EpsBearer::GBR_CONV_VOICE);
435
436 for (uint32_t j = 0; j < ueLowLatContainer.GetN(); ++j)
437 {
438 UdpClientHelper dlClient(ueLowLatIpIface.GetAddress(j), dlPortLowLat);
439 dlClient.SetAttribute("MaxPackets", UintegerValue(0xFFFFFFFF));
440 dlClient.SetAttribute("PacketSize", UintegerValue(udpPacketSizeULL));
441 dlClient.SetAttribute("Interval", TimeValue(Seconds(1.0 / lambdaULL)));
442 clientAppsDl.Add(dlClient.Install(remoteHost));
443
444 nrHelper->ActivateDedicatedEpsBearer(ueLowLatNetDev.Get(j), bearerLowlat, dlLowLatTft);
445 }
446
447 for (uint32_t j = 0; j < ueVoiceContainer.GetN(); ++j)
448 {
449 UdpClientHelper dlClient(ueVoiceIpIface.GetAddress(j), dlPortVoice);
450 dlClient.SetAttribute("MaxPackets", UintegerValue(0xFFFFFFFF));
451 dlClient.SetAttribute("PacketSize", UintegerValue(udpPacketSizeBe));
452 dlClient.SetAttribute("Interval", TimeValue(Seconds(1.0 / lambdaBe)));
453 clientAppsDl.Add(dlClient.Install(remoteHost));
454
455 nrHelper->ActivateDedicatedEpsBearer(ueVoiceNetDev.Get(j), bearerVoice, dlVoiceTft);
456 }
457
458 // start UDP server and client apps
459 serverAppsDlLowLat.Start(udpAppStartTimeDl);
460 serverAppsDlVoice.Start(udpAppStartTimeDl);
461 clientAppsDl.Start(udpAppStartTimeDl);
462
463 serverAppsDlLowLat.Stop(udpAppStopTimeDl);
464 serverAppsDlVoice.Stop(udpAppStopTimeDl);
465 clientAppsDl.Stop(udpAppStopTimeDl);
466 }
467
468 // nrHelper->EnableTraces();
469 Simulator::Stop(simTime);
470 Simulator::Run();
471
472 uint32_t appTime = (simTime.GetSeconds() - udpAppStartTimeDl.GetSeconds());
473
474 // Test Case 1: Half UEs QCI 1 saturated
475 // and Half UEs QCI 80
476 // check if ratio of throughputs is equal to ratio of priorities
477 double dlThroughputLowLat = 0;
478 double dlThroughputVoice = 0;
479 double ulThroughputLowLat = 0;
480 double ulThroughputVoice = 0;
481
482 if (m_isDownlink)
483 {
484 for (uint32_t i = 0; i < serverAppsDlLowLat.GetN(); i++)
485 {
486 Ptr<UdpServer> serverApp = serverAppsDlLowLat.Get(i)->GetObject<UdpServer>();
487 dlThroughputLowLat += (serverApp->GetReceived() * udpPacketSizeULL * 8) / appTime;
488 }
489 for (uint32_t i = 0; i < serverAppsDlVoice.GetN(); i++)
490 {
491 Ptr<UdpServer> serverApp = serverAppsDlVoice.Get(i)->GetObject<UdpServer>();
492 dlThroughputVoice += (serverApp->GetReceived() * udpPacketSizeBe * 8) / appTime;
493 }
494
495 // Flow 2 is saturated and it must be prioritized (QCI 1 vs 80)
496
497 double qciRatio = (100 - m_p1) / (100 - m_p2);
498 double throughputRatio = dlThroughputVoice / dlThroughputLowLat;
499
500 if (verbose)
501 {
502 std::cout << "dlThroughputLowLat: " << dlThroughputVoice
503 << " dlThroughputVoice: " << dlThroughputLowLat << std::endl;
504 std::cout << "ratio: " << qciRatio << " throughput ratio: " << throughputRatio
505 << std::endl;
506 }
507
508 NS_TEST_ASSERT_MSG_EQ_TOL(qciRatio,
509 throughputRatio,
510 (qciRatio * 0.1),
511 "DL qci Ratio and throughput Ratio are not "
512 "equal within tolerance");
513 }
514 if (m_isUplink)
515 {
516 for (uint32_t i = 0; i < serverAppsUlLowLat.GetN(); i++)
517 {
518 Ptr<UdpServer> serverApp = serverAppsUlLowLat.Get(i)->GetObject<UdpServer>();
519 ulThroughputLowLat += (serverApp->GetReceived() * udpPacketSizeULL * 8) / appTime;
520 }
521 for (uint32_t i = 0; i < serverAppsUlVoice.GetN(); i++)
522 {
523 Ptr<UdpServer> serverApp = serverAppsUlVoice.Get(i)->GetObject<UdpServer>();
524 ulThroughputVoice += (serverApp->GetReceived() * udpPacketSizeBe * 8) / appTime;
525 }
526
527 double qciRatio = (100 - m_p1) / (100 - 90); // Hardcoded P due to scheduler restrictions
528 double throughputRatio = ulThroughputVoice / ulThroughputLowLat;
529
530 if (verbose)
531 {
532 std::cout << "ulThroughputLowLat: " << ulThroughputVoice
533 << " ulThroughputVoice: " << ulThroughputLowLat << std::endl;
534 std::cout << "ratio: " << qciRatio << " throughput ratio: " << throughputRatio
535 << std::endl;
536 }
537
538 NS_TEST_ASSERT_MSG_EQ_TOL(qciRatio,
539 throughputRatio,
540 (qciRatio * 0.1),
541 "UL qci Ratio and throughput Ratio are not "
542 "equal within tolerance");
543 }
544
545 Simulator::Destroy();
546}
547
548} // namespace ns3
static BandwidthPartInfoPtrVector GetAllBwps(const std::vector< std::reference_wrapper< OperationBandInfo > > &operationBands)
Get all the BWP pointers from the specified vector of operation bands.
static TypeId GetTypeId()
Get the type id.
The GridScenarioHelper class.
void SetRows(uint32_t r)
SetRows.
void SetHorizontalBsDistance(double d)
SetHorizontalBsDistance.
void SetVerticalBsDistance(double d)
SetVerticalBsDistance.
void CreateScenario() override
Create the scenario, with the configured parameter.
int64_t AssignStreams(int64_t stream)
void SetColumns(uint32_t c)
SetColumns.
const NodeContainer & GetUserTerminals() const
Get the list of user nodes.
void SetBsNumber(std::size_t n)
Set the number of base stations.
void SetUtNumber(std::size_t n)
Set the number of UT/UE.
const NodeContainer & GetBaseStations() const
Get the list of gnb/base station nodes.
@ ErrorModel
Error Model version (can use different error models, see NrErrorModel)
Definition nr-amc.h:89
void SetBsHeight(double h)
SetGnbHeight.
void SetUtHeight(double h)
SetUeHeight.
void SetSectorization(SiteSectorizationType numSectors)
Sets the number of sectors of every site.
@ SINGLE
Site with a 360ยบ-width sector.
SystemSchedulerTestQos(uint32_t ueNumPergNb, uint32_t numerology, double bw1, bool isDownlink, bool isUplink, double p1, double p2, uint32_t priorityTrafficScenario, const std::string &schedulerType)
SystemSchedulerTest is a test constructor which is used to initialise the test parameters.
~SystemSchedulerTestQos() override
~SystemSchedulerTestQos
std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > BandwidthPartInfoPtrVector
vector of unique_ptr of BandwidthPartInfo
Scenario
Different types for the propagation loss model of this bandwidth part.
@ UMi_StreetCanyon_LoS
UMi_StreetCanyon where all the nodes will be in Line-of-Sight.
This test case checks if the throughput obtained is as expected for the QoS scheduling logic.