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