5G-LENA nr-v3.3-159-ga6832aa7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
cttc-3gpp-indoor-calibration.cc
Go to the documentation of this file.
1// Copyright (c) 2020 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "ns3/antenna-module.h"
6#include "ns3/applications-module.h"
7#include "ns3/config-store-module.h"
8#include "ns3/core-module.h"
9#include "ns3/internet-module.h"
10#include "ns3/mobility-module.h"
11#include "ns3/nr-eps-bearer-tag.h"
12#include "ns3/nr-module.h"
13#include "ns3/point-to-point-helper.h"
14
15using namespace ns3;
16
69NS_LOG_COMPONENT_DEFINE("Nr3gppIndoorCalibration");
70
71struct DroppingParameters
72{
73 bool ueAntennaPolarization;
74 bool gnbAntennaPolarization;
75 uint8_t numVPortsGnb = 1;
76 uint8_t numHPortsGnb = 1;
77 uint8_t numVPortsUe = 1;
78 uint8_t numHPortsUe = 1;
79 DroppingParameters()
80 : ueAntennaPolarization(false),
81 gnbAntennaPolarization(false){};
82 DroppingParameters(bool isUePolarized, bool isGnbPolarized)
83 : ueAntennaPolarization(isUePolarized),
84 gnbAntennaPolarization(isGnbPolarized){};
85 DroppingParameters(bool isUePolarized, bool isGnbPolarized, uint8_t nVGnb, uint8_t nHGnb)
86 : ueAntennaPolarization(isUePolarized),
87 gnbAntennaPolarization(isGnbPolarized),
88 numVPortsGnb(nVGnb),
89 numHPortsGnb(nHGnb){};
90 DroppingParameters(bool isUePolarized,
91 bool isGnbPolarized,
92 uint8_t nVGnb,
93 uint8_t nHGnb,
94 uint8_t nVUe,
95 uint8_t nHUe)
96 : ueAntennaPolarization(isUePolarized),
97 gnbAntennaPolarization(isGnbPolarized),
98 numVPortsGnb(nVGnb),
99 numHPortsGnb(nHGnb),
100 numVPortsUe(nVUe),
101 numHPortsUe(nHUe){};
102};
103
107class Nr3gppIndoorCalibration
108{
109 public:
118 void UeReception(RxPacketTraceParams params);
119
125 void UeSnrPerProcessedChunk(double snr);
126
131 void UeRssiPerProcessedChunk(double rssidBm);
132
156 void Run(double centralFrequencyBand,
157 double bandwidthBand,
158 uint16_t numerology,
159 double totalTxPower,
160 bool cellScan,
161 double beamSearchAngleStep,
162 bool gNbAntennaModel,
163 bool ueAntennaModel,
164 std::string indoorScenario,
165 double speed,
166 std::string resultsDirPath,
167 std::string tag,
168 uint32_t duration,
169 DroppingParameters dropParam = DroppingParameters());
174 ~Nr3gppIndoorCalibration();
175
185 NodeContainer SelectWellPlacedUes(const NodeContainer ueNodes,
186 const NodeContainer gnbNodes,
187 double min3DDistance,
188 uint32_t numberOfUesToBeSelected);
189
190 private:
191 std::ofstream m_outSinrFile;
192 std::ofstream m_outSnrFile;
193 std::ofstream m_outRssiFile;
194 std::ofstream m_outUePositionsFile;
195 std::ofstream m_outGnbPositionsFile;
196 std::ofstream m_outDistancesFile;
197};
198
208std::string
209BuildFileNameString(std::string directoryName, std::string filePrefix, std::string tag)
210{
211 std::ostringstream oss;
212 oss << directoryName << filePrefix << tag;
213 return oss.str();
214}
215
226std::string
227BuildTag(bool gNbAntennaModel, bool ueAntennaModel, std::string scenario, double speed)
228{
229 std::ostringstream oss;
230 std::string ao;
231
232 std::string gnbAm;
233 if (gNbAntennaModel)
234 {
235 gnbAm = "ISO";
236 }
237 else
238 {
239 gnbAm = "3GPP";
240 }
241
242 std::string ueAm;
243 if (ueAntennaModel)
244 {
245 ueAm = "ISO";
246 }
247 else
248 {
249 ueAm = "3GPP";
250 }
251
252 std::string gm = "";
253 oss << "-ao" << ao << "-amGnb" << gnbAm << "-amUE" << ueAm << "-sc" << scenario << "-sp"
254 << speed << "-gm" << gm;
255
256 return oss.str();
257}
258
264void
265UeReceptionTrace(Nr3gppIndoorCalibration* scenario, RxPacketTraceParams params)
266{
267 scenario->UeReception(params);
268}
269
275void
276UeSnrPerProcessedChunkTrace(Nr3gppIndoorCalibration* scenario, double snr)
277{
278 scenario->UeSnrPerProcessedChunk(snr);
279}
280
286void
287UeRssiPerProcessedChunkTrace(Nr3gppIndoorCalibration* scenario, double rssidBm)
288{
289 scenario->UeRssiPerProcessedChunk(rssidBm);
290}
291
292void
293Nr3gppIndoorCalibration::UeReception(RxPacketTraceParams params)
294{
295 m_outSinrFile << params.m_cellId << params.m_rnti << "\t" << 10 * log10(params.m_sinr)
296 << std::endl;
297}
298
299void
300Nr3gppIndoorCalibration::UeSnrPerProcessedChunk(double snr)
301{
302 m_outSnrFile << 10 * log10(snr) << std::endl;
303}
304
305void
306Nr3gppIndoorCalibration::UeRssiPerProcessedChunk(double rssidBm)
307{
308 m_outRssiFile << rssidBm << std::endl;
309}
310
311Nr3gppIndoorCalibration::~Nr3gppIndoorCalibration()
312{
313 m_outSinrFile.close();
314 m_outSnrFile.close();
315 m_outRssiFile.close();
316}
317
318NodeContainer
319Nr3gppIndoorCalibration::SelectWellPlacedUes(const NodeContainer ueNodes,
320 const NodeContainer gnbNodes,
321 double minDistance,
322 uint32_t numberOfUesToBeSelected)
323{
324 NodeContainer ueNodesFiltered;
325 bool correctDistance = true;
326
327 for (NodeContainer::Iterator itUe = ueNodes.Begin(); itUe != ueNodes.End(); itUe++)
328 {
329 correctDistance = true;
330 Ptr<MobilityModel> ueMm = (*itUe)->GetObject<MobilityModel>();
331 Vector uePos = ueMm->GetPosition();
332
333 for (NodeContainer::Iterator itGnb = gnbNodes.Begin(); itGnb != gnbNodes.End(); itGnb++)
334 {
335 Ptr<MobilityModel> gnbMm = (*itGnb)->GetObject<MobilityModel>();
336 Vector gnbPos = gnbMm->GetPosition();
337 double x = uePos.x - gnbPos.x;
338 double y = uePos.y - gnbPos.y;
339 double distance = sqrt(x * x + y * y);
340
341 if (distance < minDistance)
342 {
343 correctDistance = false;
344 // NS_LOG("The UE node "<<(*itUe)->GetId() << " has wrong position, discarded.");
345 break;
346 }
347 else
348 {
349 m_outDistancesFile << distance << std::endl;
350 }
351 }
352
353 if (correctDistance)
354 {
355 ueNodesFiltered.Add(*itUe);
356 }
357 if (ueNodesFiltered.GetN() >= numberOfUesToBeSelected)
358 {
359 // there are enough candidate UE nodes
360 break;
361 }
362 }
363 return ueNodesFiltered;
364}
365
366void
367Nr3gppIndoorCalibration::Run(double centralFrequencyBand,
368 double bandwidthBand,
369 uint16_t numerology,
370 double totalTxPower,
371 bool cellScan,
372 double beamSearchAngleStep,
373 bool gNbAntennaModel,
374 bool ueAntennaModel,
375 std::string indoorScenario,
376 double speed,
377 std::string resultsDirPath,
378 std::string tag,
379 uint32_t duration,
380 DroppingParameters dropParam)
381{
382 Time simTime = MilliSeconds(duration);
383 Time udpAppStartTimeDl = MilliSeconds(100);
384 Time udpAppStopTimeDl = MilliSeconds(duration);
385 uint32_t packetSize = 1000;
386 DataRate udpRate = DataRate("0.1kbps");
387 // initially created 240 UE nodes, out of which will be selected 120 UEs that
388 // are well placed respecting the minimum distance parameter that is configured
389 uint16_t ueCount = 240;
390 // the minimum distance parameter
391 double minDistance = 0;
392 // BS atnenna height is 3 meters
393 double gNbHeight = 3;
394 // UE antenna height is 1.5 meters
395 double ueHeight = 1.5;
396
397 NS_ABORT_MSG_UNLESS(indoorScenario == "InH-OfficeOpen" || indoorScenario == "InH-OfficeMixed",
398 "The scenario is not supported");
399
400 // if simulation tag is not provided create one
401 if (tag.empty())
402 {
403 tag = BuildTag(gNbAntennaModel, ueAntennaModel, indoorScenario, speed);
404 }
405 std::string filenameSinr = BuildFileNameString(resultsDirPath, "sinrs", tag);
406 std::string filenameSnr = BuildFileNameString(resultsDirPath, "snrs", tag);
407 std::string filenameRssi = BuildFileNameString(resultsDirPath, "rssi", tag);
408 std::string filenameUePositions = BuildFileNameString(resultsDirPath, "ue-positions", tag);
409 std::string filenameGnbPositions = BuildFileNameString(resultsDirPath, "gnb-positions", tag);
410 std::string filenameDistances = BuildFileNameString(resultsDirPath, "distances", tag);
411
412 m_outSinrFile.open(filenameSinr.c_str());
413 m_outSinrFile.setf(std::ios_base::fixed);
414
415 if (!m_outSinrFile.is_open())
416 {
417 NS_ABORT_MSG("Can't open file " << filenameSinr);
418 }
419
420 m_outSnrFile.open(filenameSnr.c_str());
421 m_outSnrFile.setf(std::ios_base::fixed);
422
423 if (!m_outSnrFile.is_open())
424 {
425 NS_ABORT_MSG("Can't open file " << filenameSnr);
426 }
427
428 m_outRssiFile.open(filenameRssi.c_str());
429 m_outRssiFile.setf(std::ios_base::fixed);
430
431 if (!m_outRssiFile.is_open())
432 {
433 NS_ABORT_MSG("Can't open file " << filenameRssi);
434 }
435
436 m_outUePositionsFile.open(filenameUePositions.c_str());
437 m_outUePositionsFile.setf(std::ios_base::fixed);
438
439 if (!m_outUePositionsFile.is_open())
440 {
441 NS_ABORT_MSG("Can't open file " << filenameUePositions);
442 }
443
444 m_outGnbPositionsFile.open(filenameGnbPositions.c_str());
445 m_outGnbPositionsFile.setf(std::ios_base::fixed);
446
447 if (!m_outGnbPositionsFile.is_open())
448 {
449 NS_ABORT_MSG("Can't open file " << filenameGnbPositions);
450 }
451
452 m_outDistancesFile.open(filenameDistances.c_str());
453 m_outDistancesFile.setf(std::ios_base::fixed);
454
455 if (!m_outDistancesFile.is_open())
456 {
457 NS_ABORT_MSG("Can't open file " << filenameDistances);
458 }
459
460 // create base stations and mobile terminals
461 NodeContainer gNbNodes;
462 NodeContainer ueNodes;
463 MobilityHelper mobility;
464
465 gNbNodes.Create(12);
466 ueNodes.Create(ueCount);
467
468 // Creating positions of the gNB according to the 3GPP TR 38.901 Figure 7.2.-1
469 Ptr<ListPositionAllocator> gNbPositionAlloc = CreateObject<ListPositionAllocator>();
470
471 for (uint8_t j = 0; j < 2; j++)
472 {
473 for (uint8_t i = 0; i < 6; i++)
474 {
475 gNbPositionAlloc->Add(Vector(i * 20, j * 20, gNbHeight));
476 }
477 }
478
479 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
480 mobility.SetPositionAllocator(gNbPositionAlloc);
481 mobility.Install(gNbNodes);
482
483 double minBigBoxX = -10.0;
484 double minBigBoxY = -15.0;
485 double maxBigBoxX = 110.0;
486 double maxBigBoxY = 35.0;
487
488 // Creating positions of the UEs according to the 3GPP TR 38.901 and
489 // R11700144, uniformly randombly distributed in the rectangular area
490
491 NodeContainer selectedUeNodes;
492 for (uint8_t j = 0; j < 2; j++)
493 {
494 double minSmallBoxY = minBigBoxY + j * (maxBigBoxY - minBigBoxY) / 2;
495
496 for (uint8_t i = 0; i < 6; i++)
497 {
498 double minSmallBoxX = minBigBoxX + i * (maxBigBoxX - minBigBoxX) / 6;
499 Ptr<UniformRandomVariable> ueRandomVarX = CreateObject<UniformRandomVariable>();
500
501 double minX = minSmallBoxX;
502 double maxX = minSmallBoxX + (maxBigBoxX - minBigBoxX) / 6 - 0.0001;
503 double minY = minSmallBoxY;
504 double maxY = minSmallBoxY + (maxBigBoxY - minBigBoxY) / 2 - 0.0001;
505
506 Ptr<RandomBoxPositionAllocator> ueRandomRectPosAlloc =
507 CreateObject<RandomBoxPositionAllocator>();
508 ueRandomVarX->SetAttribute("Min", DoubleValue(minX));
509 ueRandomVarX->SetAttribute("Max", DoubleValue(maxX));
510 ueRandomRectPosAlloc->SetX(ueRandomVarX);
511 Ptr<UniformRandomVariable> ueRandomVarY = CreateObject<UniformRandomVariable>();
512 ueRandomVarY->SetAttribute("Min", DoubleValue(minY));
513 ueRandomVarY->SetAttribute("Max", DoubleValue(maxY));
514 ueRandomRectPosAlloc->SetY(ueRandomVarY);
515 Ptr<ConstantRandomVariable> ueRandomVarZ = CreateObject<ConstantRandomVariable>();
516 ueRandomVarZ->SetAttribute("Constant", DoubleValue(ueHeight));
517 ueRandomRectPosAlloc->SetZ(ueRandomVarZ);
518
519 uint8_t smallBoxIndex = j * 6 + i;
520
521 NodeContainer smallBoxCandidateNodes;
522 NodeContainer smallBoxGnbNode;
523
524 smallBoxGnbNode.Add(gNbNodes.Get(smallBoxIndex));
525
526 for (uint32_t n = smallBoxIndex * ueCount / 12;
527 n < smallBoxIndex * static_cast<uint32_t>(ueCount / 12) +
528 static_cast<uint32_t>(ueCount / 12);
529 n++)
530 {
531 smallBoxCandidateNodes.Add(ueNodes.Get(n));
532 }
533 mobility.SetPositionAllocator(ueRandomRectPosAlloc);
534 mobility.Install(smallBoxCandidateNodes);
535 NodeContainer sn =
536 SelectWellPlacedUes(smallBoxCandidateNodes, smallBoxGnbNode, minDistance, 10);
537 selectedUeNodes.Add(sn);
538 }
539 }
540
541 for (uint32_t j = 0; j < selectedUeNodes.GetN(); j++)
542 {
543 Vector v = selectedUeNodes.Get(j)->GetObject<MobilityModel>()->GetPosition();
544 m_outUePositionsFile << j << "\t" << v.x << "\t" << v.y << "\t" << v.z << " " << std::endl;
545 }
546
547 for (uint32_t j = 0; j < gNbNodes.GetN(); j++)
548 {
549 Vector v = gNbNodes.Get(j)->GetObject<MobilityModel>()->GetPosition();
550 m_outGnbPositionsFile << j << "\t" << v.x << "\t" << v.y << "\t" << v.z << " " << std::endl;
551 }
552
553 m_outUePositionsFile.close();
554 m_outGnbPositionsFile.close();
555 m_outDistancesFile.close();
556
557 // setup the nr simulation
558 Ptr<NrHelper> nrHelper = CreateObject<NrHelper>();
559 Ptr<NrPointToPointEpcHelper> nrEpcHelper = CreateObject<NrPointToPointEpcHelper>();
560 Ptr<IdealBeamformingHelper> idealBeamformingHelper = CreateObject<IdealBeamformingHelper>();
561 Ptr<NrChannelHelper> channelHelper = CreateObject<NrChannelHelper>();
562
563 nrHelper->SetBeamformingHelper(idealBeamformingHelper);
564 nrHelper->SetEpcHelper(nrEpcHelper);
565 channelHelper->ConfigureFactories(indoorScenario, "Default", "ThreeGpp");
566
567 /*
568 * Spectrum division. We create one operational band, containing one
569 * component carrier, which in turn contains a single bandwidth part
570 * centered at the frequency specified by the input parameters.
571 *
572 * The configured spectrum division is:
573 * |------------------------Band-------------------------|
574 * |-------------------------CC--------------------------|
575 * |-------------------------BWP-------------------------|
576 *
577 * Each spectrum part length is, as well, specified by the input parameters.
578 * The band will use the indoor channel modeling specified by scenario.
579 */
581 CcBwpCreator ccBwpCreator;
582 const uint8_t numCcPerBand = 1;
583
584 // Create the configuration for the CcBwpHelper. SimpleOperationBandConf creates
585 // a single BWP per CC
586 CcBwpCreator::SimpleOperationBandConf bandConf(centralFrequencyBand,
587 bandwidthBand,
588 numCcPerBand);
589
590 // By using the configuration created, make the operation band
591 OperationBandInfo band = ccBwpCreator.CreateOperationBandContiguousCc(bandConf);
592 // Set and create the channel for the band
593 channelHelper->AssignChannelsToBands({band});
594 allBwps = CcBwpCreator::GetAllBwps({band});
595
596 // Disable channel matrix update to speed up the simulation execution
597 // Config::SetDefault ("ns3::Nr3gppChannel::UpdatePeriod", TimeValue (MilliSeconds(0)));
598 // Config::SetDefault ("ns3::NrRlcUm::MaxTxBufferSize", UintegerValue(999999999));
599 // Config::SetDefault ("ns3::NrRlcUmLowLat::MaxTxBufferSize", UintegerValue(999999999));
600 Config::SetDefault("ns3::NrGnbRrc::SrsPeriodicity", UintegerValue(320));
601
602 if (cellScan)
603 {
604 idealBeamformingHelper->SetAttribute("BeamformingMethod",
605 TypeIdValue(CellScanBeamforming::GetTypeId()));
606 idealBeamformingHelper->SetBeamformingAlgorithmAttribute("BeamSearchAngleStep",
607 DoubleValue(beamSearchAngleStep));
608 }
609 else
610 {
611 idealBeamformingHelper->SetAttribute("BeamformingMethod",
612 TypeIdValue(DirectPathBeamforming::GetTypeId()));
613 }
614
615 nrHelper->SetSchedulerTypeId(TypeId::LookupByName("ns3::NrMacSchedulerTdmaPF"));
616
617 // Antennas for all the UEs - Should be 2x4 = 8 antenna elements
618 nrHelper->SetUeAntennaAttribute("NumRows", UintegerValue(2));
619 nrHelper->SetUeAntennaAttribute("NumColumns", UintegerValue(4));
620 // Antenna element type for UEs
621 if (ueAntennaModel)
622 {
623 nrHelper->SetUeAntennaAttribute("AntennaElement",
624 PointerValue(CreateObject<IsotropicAntennaModel>()));
625 }
626 else
627 {
628 nrHelper->SetUeAntennaAttribute("AntennaElement",
629 PointerValue(CreateObject<ThreeGppAntennaModel>()));
630 }
631 // Antennas for all the gNbs - Should be 4x8 = 32 antenna elements
632 nrHelper->SetGnbAntennaAttribute("NumRows", UintegerValue(4));
633 nrHelper->SetGnbAntennaAttribute("NumColumns", UintegerValue(8));
634 // Antenna element type for gNBs
635 if (gNbAntennaModel)
636 {
637 nrHelper->SetGnbAntennaAttribute("AntennaElement",
638 PointerValue(CreateObject<IsotropicAntennaModel>()));
639 }
640 else
641 {
642 nrHelper->SetGnbAntennaAttribute("AntennaElement",
643 PointerValue(CreateObject<ThreeGppAntennaModel>()));
644 }
645
646 // Setting antenna polarization for gNB and UE
647 if (dropParam.gnbAntennaPolarization)
648 {
649 nrHelper->SetGnbAntennaAttribute("IsPolarized", BooleanValue(true));
650 }
651 if (dropParam.ueAntennaPolarization)
652 {
653 nrHelper->SetUeAntennaAttribute("IsPolarized", BooleanValue(true));
654 }
655 nrHelper->SetGnbAntennaAttribute("NumVerticalPorts", UintegerValue(dropParam.numVPortsGnb));
656 nrHelper->SetGnbAntennaAttribute("NumHorizontalPorts", UintegerValue(dropParam.numHPortsGnb));
657 nrHelper->SetUeAntennaAttribute("NumVerticalPorts", UintegerValue(dropParam.numVPortsUe));
658 nrHelper->SetUeAntennaAttribute("NumHorizontalPorts", UintegerValue(dropParam.numHPortsUe));
659 // mobility.SetPositionAllocator (ueRandomRectPosAlloc);
660 // install nr net devices
661 NetDeviceContainer gNbDevs = nrHelper->InstallGnbDevice(gNbNodes, allBwps);
662 NetDeviceContainer ueNetDevs = nrHelper->InstallUeDevice(selectedUeNodes, allBwps);
663
664 int64_t randomStream = 1;
665 randomStream += nrHelper->AssignStreams(gNbDevs, randomStream);
666 randomStream += nrHelper->AssignStreams(ueNetDevs, randomStream);
667
668 for (uint32_t i = 0; i < gNbDevs.GetN(); i++)
669 {
670 nrHelper->GetGnbPhy(gNbDevs.Get(i), 0)
671 ->SetAttribute("Numerology", UintegerValue(numerology));
672 // Remove log operation when input is in dBm
673 nrHelper->GetGnbPhy(gNbDevs.Get(i), 0)->SetAttribute("TxPower", DoubleValue(totalTxPower));
674 // gNB noise figure shall be set to 7 dB
675 nrHelper->GetGnbPhy(gNbDevs.Get(i), 0)->SetAttribute("NoiseFigure", DoubleValue(7));
676 }
677 for (uint32_t j = 0; j < ueNetDevs.GetN(); j++)
678 {
679 // UE noise figure shall be set to 10 dB
680 nrHelper->GetUePhy(ueNetDevs.Get(j), 0)->SetAttribute("NoiseFigure", DoubleValue(10));
681 }
682
683 // create the internet and install the IP stack on the UEs
684 // get SGW/PGW and create a single RemoteHost
685 auto [remoteHost, remoteHostIpv4Address] =
686 nrEpcHelper->SetupRemoteHost("100Gb/s", 2500, Seconds(0.000));
687
688 InternetStackHelper internet;
689 internet.Install(ueNodes);
690 Ipv4InterfaceContainer ueIpIface;
691 ueIpIface = nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueNetDevs));
692
693 // attach UEs to the closest gNB
694 nrHelper->AttachToClosestGnb(ueNetDevs, gNbDevs);
695
696 // assign IP address to UEs, and install UDP downlink applications
697 uint16_t dlPort = 1234;
698 ApplicationContainer clientAppsDl;
699 ApplicationContainer serverAppsDl;
700
701 Time udpInterval =
702 Time::FromDouble((packetSize * 8) / static_cast<double>(udpRate.GetBitRate()), Time::S);
703
704 UdpServerHelper dlPacketSinkHelper(dlPort);
705 serverAppsDl.Add(dlPacketSinkHelper.Install(ueNodes));
706
707 // configure UDP downlink traffic
708 for (uint32_t i = 0; i < ueNetDevs.GetN(); i++)
709 {
710 UdpClientHelper dlClient(ueIpIface.GetAddress(i), dlPort);
711 dlClient.SetAttribute("MaxPackets", UintegerValue(0xFFFFFFFF));
712 dlClient.SetAttribute("PacketSize", UintegerValue(packetSize));
713 dlClient.SetAttribute(
714 "Interval",
715 TimeValue(udpInterval)); // we try to saturate, we just need to measure during a short
716 // time, how much traffic can handle each BWP
717 clientAppsDl.Add(dlClient.Install(remoteHost));
718 }
719
720 // start UDP server and client apps
721 serverAppsDl.Start(udpAppStartTimeDl);
722 clientAppsDl.Start(udpAppStartTimeDl);
723
724 serverAppsDl.Stop(udpAppStopTimeDl);
725 clientAppsDl.Stop(udpAppStopTimeDl);
726
727 for (uint32_t i = 0; i < ueNetDevs.GetN(); i++)
728 {
729 Ptr<NrSpectrumPhy> ue1SpectrumPhy =
730 DynamicCast<NrUeNetDevice>(ueNetDevs.Get(i))->GetPhy(0)->GetSpectrumPhy();
731 ue1SpectrumPhy->TraceConnectWithoutContext("RxPacketTraceUe",
732 MakeBoundCallback(&UeReceptionTrace, this));
733 Ptr<NrInterference> ue1SpectrumPhyInterference = ue1SpectrumPhy->GetNrInterference();
734 NS_ABORT_IF(!ue1SpectrumPhyInterference);
735 ue1SpectrumPhyInterference->TraceConnectWithoutContext(
736 "SnrPerProcessedChunk",
737 MakeBoundCallback(&UeSnrPerProcessedChunkTrace, this));
738 ue1SpectrumPhyInterference->TraceConnectWithoutContext(
739 "RssiPerProcessedChunk",
740 MakeBoundCallback(&UeRssiPerProcessedChunkTrace, this));
741 }
742
743 Simulator::Stop(simTime);
744 Simulator::Run();
745 Simulator::Destroy();
746}
747
748int
749main(int argc, char* argv[])
750{
751 // Parameters according to R1-1703534 3GPP TSG RAN WG1 Meetging #88, 2017
752 // Evaluation assumptions for Phase 1 NR MIMO system level calibration,
753 double centralFrequencyBand = 30e9;
754 double bandwidthBand = 40e6;
755 uint16_t numerology = 2;
756 double totalTxPower = 23;
757
758 uint32_t duration = 150;
759 bool cellScan = false;
760 double beamSearchAngleStep = 10.0;
761 bool enableGnbIso = true;
762 bool enableUeIso = true;
763 std::string indoorScenario = "InH-OfficeOpen";
764 double speed = 3.00;
765 bool polarizedAntennas = false;
766 std::string outdir = "./";
767 std::string simTag = "";
768 uint8_t numVPortsGnb = 1;
769 uint8_t numHPortsGnb = 1;
770 uint8_t numVPortsUe = 1;
771 uint8_t numHPortsUe = 1;
772
773 CommandLine cmd(__FILE__);
774
775 cmd.AddValue("duration",
776 "Simulation duration in ms, should be greater than 100 ms to allow the collection "
777 "of traces",
778 duration);
779 cmd.AddValue("cellScan",
780 "Use beam search method to determine beamforming vector,"
781 "true to use cell scanning method",
782 cellScan);
783 cmd.AddValue("beamSearchAngleStep",
784 "Beam search angle step for beam search method",
785 beamSearchAngleStep);
786 cmd.AddValue("enableGnbIso", "Enable Isotropic antenna for the gNB", enableGnbIso);
787 cmd.AddValue("enableGnbIso", "Enable Isotropic antenna for the UE", enableUeIso);
788 cmd.AddValue("indoorScenario",
789 "The indoor scenario to be used can be: InH-OfficeMixed or InH-OfficeOpen",
790 indoorScenario);
791 cmd.AddValue("speed", "UE speed in km/h", speed);
792 cmd.AddValue("outdir", "directory where to store the simulation results", outdir);
793 cmd.AddValue("polarizedAntennas",
794 "Set true to to make UE and Gnb anetnna polarized",
795 polarizedAntennas);
796 cmd.AddValue("simTag",
797 "tag to be appended to output filenames to distinguish simulation campaigns",
798 simTag);
799 cmd.AddValue("vportGnb", "Set GNB Vertical Ports", numVPortsGnb);
800 cmd.AddValue("hportGnb", "Set GNB Horizontal Ports", numHPortsGnb);
801 cmd.AddValue("vportUe", "Set UE Vertical Ports", numVPortsUe);
802 cmd.AddValue("hportUE", "Set UE Horizontal Ports", numHPortsUe);
803
804 cmd.Parse(argc, argv);
805
806 ConfigStore inputConfig;
807 inputConfig.ConfigureDefaults();
808
809 Nr3gppIndoorCalibration phase1CalibrationScenario;
810
811 DroppingParameters dropParam = {polarizedAntennas,
812 polarizedAntennas,
813 numVPortsGnb,
814 numHPortsGnb,
815 numVPortsUe,
816 numHPortsUe};
817
818 phase1CalibrationScenario.Run(centralFrequencyBand,
819 bandwidthBand,
820 numerology,
821 totalTxPower,
822 cellScan,
823 beamSearchAngleStep,
824 enableGnbIso,
825 enableUeIso,
826 indoorScenario,
827 speed,
828 outdir,
829 simTag,
830 duration,
831 dropParam);
832 return 0;
833}
Manages the correct creation of operation bands, component carriers and bandwidth parts.
OperationBandInfo CreateOperationBandContiguousCc(const SimpleOperationBandConf &conf)
Create an operation band with the CC specified.
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.
static TypeId GetTypeId()
Get the type id.
void UeRssiPerProcessedChunkTrace(Nr3gppIndoorCalibration *scenario, double rssidBm)
void UeSnrPerProcessedChunkTrace(Nr3gppIndoorCalibration *scenario, double snr)
std::string BuildFileNameString(std::string directoryName, std::string filePrefix, std::string tag)
std::string BuildTag(bool gNbAntennaModel, bool ueAntennaModel, std::string scenario, double speed)
void UeReceptionTrace(Nr3gppIndoorCalibration *scenario, RxPacketTraceParams params)
std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > BandwidthPartInfoPtrVector
vector of unique_ptr of BandwidthPartInfo
Minimum configuration requirements for a OperationBand.
Operation band information structure.
The RxPacketTraceParams struct.