7#include "nr-bearer-stats-calculator.h"
8#include "nr-channel-helper.h"
9#include "nr-epc-helper.h"
10#include "nr-mac-rx-trace.h"
11#include "nr-phy-rx-trace.h"
13#include "ns3/bandwidth-part-gnb.h"
14#include "ns3/bandwidth-part-ue.h"
15#include "ns3/beam-manager.h"
16#include "ns3/buildings-channel-condition-model.h"
17#include "ns3/bwp-manager-algorithm.h"
18#include "ns3/bwp-manager-gnb.h"
19#include "ns3/bwp-manager-ue.h"
20#include "ns3/config.h"
21#include "ns3/deprecated.h"
22#include "ns3/multi-model-spectrum-channel.h"
24#include "ns3/nr-ch-access-manager.h"
25#include "ns3/nr-chunk-processor.h"
26#include "ns3/nr-csi-rs-filter.h"
27#include "ns3/nr-epc-gnb-application.h"
28#include "ns3/nr-epc-ue-nas.h"
29#include "ns3/nr-epc-x2.h"
30#include "ns3/nr-fh-control.h"
31#include "ns3/nr-gnb-mac.h"
32#include "ns3/nr-gnb-net-device.h"
33#include "ns3/nr-gnb-phy.h"
34#include "ns3/nr-initial-association.h"
35#include "ns3/nr-mac-scheduler-tdma-rr.h"
36#include "ns3/nr-pm-search-full.h"
37#include "ns3/nr-rrc-protocol-ideal.h"
38#include "ns3/nr-rrc-protocol-real.h"
39#include "ns3/nr-ue-mac.h"
40#include "ns3/nr-ue-net-device.h"
41#include "ns3/nr-ue-phy.h"
42#include "ns3/nr-ue-rrc.h"
43#include "ns3/pointer.h"
44#include "ns3/three-gpp-channel-model.h"
45#include "ns3/three-gpp-propagation-loss-model.h"
46#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
47#include "ns3/three-gpp-v2v-channel-condition-model.h"
48#include "ns3/three-gpp-v2v-propagation-loss-model.h"
49#include "ns3/uniform-planar-array.h"
57NS_LOG_COMPONENT_DEFINE(
"NrHelper");
59NS_OBJECT_ENSURE_REGISTERED(NrHelper);
63 NS_LOG_FUNCTION(
this);
64 m_channelFactory.SetTypeId(MultiModelSpectrumChannel::GetTypeId());
65 m_gnbNetDeviceFactory.SetTypeId(NrGnbNetDevice::GetTypeId());
76 m_ueAntennaFactory.SetTypeId(UniformPlanarArray::GetTypeId());
77 m_gnbAntennaFactory.SetTypeId(UniformPlanarArray::GetTypeId());
84 m_spectrumPropagationFactory.SetTypeId(ThreeGppSpectrumPropagationLossModel::GetTypeId());
90 m_pathlossModelFactory.SetTypeId(ThreeGppPropagationLossModel::GetTypeId());
91 m_channelConditionModelFactory.SetTypeId(ThreeGppChannelConditionModel::GetTypeId());
94 Config::SetDefault(
"ns3::NrEpsBearer::Release", UintegerValue(18));
99 NS_LOG_FUNCTION(
this);
100 if (m_beamformingHelper)
102 m_beamformingHelper->Dispose();
104 m_beamformingHelper =
nullptr;
111 TypeId(
"ns3::NrHelper")
113 .AddConstructor<NrHelper>()
114 .AddAttribute(
"EnableMimoFeedback",
115 "Generate CQI feedback with RI and PMI for MIMO support",
117 MakeBooleanAccessor(&NrHelper::m_enableMimoFeedback),
118 MakeBooleanChecker())
121 "Signals and measurements that will be used for CQI feedback if available."
122 "Supported configurations are: CQI_PDSCH_MIMO = 1, CQI_CSI_RS = 2, "
123 "CQI_PDSCH_MIMO|CQI_CSI_RS = 3, "
124 "CQI_CSI_RS|CQI_CSI_IM = 6, CQI_PDSCH_MIMO|CQI_CSI_RS|CQI_CSI_IM = 7, and "
125 "CQI_PDSCH_SISO = 8.",
126 UintegerValue(CQI_CSI_IM | CQI_CSI_RS | CQI_PDSCH_MIMO),
127 MakeUintegerAccessor(&NrHelper::m_csiFeedbackFlags),
128 MakeUintegerChecker<uint8_t>(0x0, 0x08))
129 .AddAttribute(
"PmSearchMethod",
130 "Type of the precoding matrix search method.",
134 .AddAttribute(
"UseIdealRrc",
135 "If true, NrRrcProtocolIdeal will be used for RRC signaling. "
136 "If false, NrRrcProtocolReal will be used.",
138 MakeBooleanAccessor(&NrHelper::m_useIdealRrc),
139 MakeBooleanChecker())
140 .AddAttribute(
"HandoverAlgorithm",
141 "The type of handover algorithm to be used for gNBs. "
142 "The allowed values for this attributes are the type names "
143 "of any class inheriting from ns3::LteHandoverAlgorithm.",
144 StringValue(
"ns3::NrNoOpHandoverAlgorithm"),
145 MakeStringAccessor(&NrHelper::SetHandoverAlgorithmType,
146 &NrHelper::GetHandoverAlgorithmType),
147 MakeStringChecker());
151std::pair<double, BandwidthPartInfoPtrVector>
153 const std::string& scenario,
154 const std::string& channelCondition,
155 const std::string& channelModel)
158 double totalBandwidth = 0.0;
159 auto channelHelper = CreateObject<NrChannelHelper>();
160 channelHelper->ConfigureFactories(scenario, channelCondition, channelModel);
161 for (
auto& bandConf : bandConfs)
164 totalBandwidth += bandConf.m_channelBandwidth;
166 std::vector<std::reference_wrapper<OperationBandInfo>> bandsRefs(m_bands.rbegin(),
170 channelHelper->AssignChannelsToBands(bandsRefs);
177 NS_LOG_FUNCTION(gnbDevice);
178 Ptr<const NrGnbNetDevice> netDevice = DynamicCast<const NrGnbNetDevice>(gnbDevice);
179 if (netDevice ==
nullptr)
183 return netDevice->GetCcMapSize();
189 NS_LOG_FUNCTION(gnbDevice << bwpIndex);
190 NS_ASSERT(bwpIndex < UINT8_MAX);
191 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
192 if (netDevice ==
nullptr)
196 return netDevice->GetPhy(
static_cast<uint8_t
>(bwpIndex));
202 NS_LOG_FUNCTION(gnbDevice << bwpIndex);
203 NS_ASSERT(bwpIndex < UINT8_MAX);
204 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
205 if (netDevice ==
nullptr)
209 return netDevice->GetMac(
static_cast<uint8_t
>(bwpIndex));
215 NS_LOG_FUNCTION(ueDevice << bwpIndex);
216 NS_ASSERT(bwpIndex < UINT8_MAX);
217 Ptr<NrUeNetDevice> netDevice = DynamicCast<NrUeNetDevice>(ueDevice);
218 if (netDevice ==
nullptr)
222 return netDevice->GetMac(
static_cast<uint8_t
>(bwpIndex));
228 NS_LOG_FUNCTION(ueDevice << bwpIndex);
229 NS_ASSERT(bwpIndex < UINT8_MAX);
230 Ptr<NrUeNetDevice> netDevice = DynamicCast<NrUeNetDevice>(ueDevice);
231 if (netDevice ==
nullptr)
235 return netDevice->GetPhy(
static_cast<uint8_t
>(bwpIndex));
241 NS_LOG_FUNCTION(gnbDevice);
243 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
244 if (netDevice ==
nullptr)
249 return netDevice->GetBwpManager();
255 NS_LOG_FUNCTION(ueDevice);
257 Ptr<NrUeNetDevice> netDevice = DynamicCast<NrUeNetDevice>(ueDevice);
258 if (netDevice ==
nullptr)
263 return netDevice->GetBwpManager();
269 NS_LOG_FUNCTION(gnbDevice << bwpIndex);
271 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
272 if (netDevice ==
nullptr)
277 return netDevice->GetScheduler(bwpIndex);
294 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>>& allBwps)
296 NS_LOG_FUNCTION(
this);
297 NetDeviceContainer devices;
298 for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
301 Ptr<NetDevice> device = InstallSingleUeDevice(node, allBwps);
302 device->SetAddress(Mac48Address::Allocate());
310 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps)
312 NS_LOG_FUNCTION(
this);
313 NetDeviceContainer devices;
314 for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
317 Ptr<NetDevice> device = InstallSingleGnbDevice(node, allBwps);
318 device->SetAddress(Mac48Address::Allocate());
327 for (uint32_t i = 0; i < netDevs.GetN(); i++)
329 auto ueNetDev = DynamicCast<NrUeNetDevice>(netDevs.Get(i));
330 auto gnbNetDev = DynamicCast<NrGnbNetDevice>(netDevs.Get(i));
333 std::cerr <<
"Deprecation warning: UpdateConfig is no longer needed for UE device types"
339 <<
"Deprecation warning: UpdateConfig is no longer needed for gNB device types"
346NrHelper::CreateUeMac()
const
348 NS_LOG_FUNCTION(
this);
349 Ptr<NrUeMac> mac = m_ueMacFactory.Create<
NrUeMac>();
354NrHelper::CreateUePhy(
const Ptr<Node>& n,
356 const Ptr<NrUeNetDevice>& dev,
360 NS_LOG_FUNCTION(
this);
362 Ptr<NrUePhy> phy = m_uePhyFactory.Create<NrUePhy>();
364 NS_ASSERT(bwp->GetChannel() !=
nullptr);
366 phy->InstallCentralFrequency(bwp->m_centralFrequency);
368 phy->ScheduleStartEventLoop(n->GetId(), 0, 0, 0);
371 Ptr<NrChAccessManager> cam =
372 DynamicCast<NrChAccessManager>(m_ueChannelAccessManagerFactory.Create());
377 phy->SetCsiFeedbackType(m_csiFeedbackFlags);
379 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
382 "MobilityModel needs to be set on node before calling NrHelper::InstallUeDevice ()");
384 Ptr<NrSpectrumPhy> channelPhy =
385 m_ueSpectrumFactory.Create<NrSpectrumPhy>();
387 channelPhy->SetPhyDlHarqFeedbackCallback(dlHarqCallback);
389 channelPhy->SetIsGnb(
false);
390 channelPhy->SetDevice(dev);
392 auto antenna = m_ueAntennaFactory.Create();
393 channelPhy->SetAntenna(antenna);
395 cam->SetNrSpectrumPhy(channelPhy);
397 Ptr<NrChunkProcessor> pData = Create<NrChunkProcessor>();
399 channelPhy->AddDataSinrChunkProcessor(pData);
401 Ptr<NrMimoChunkProcessor> pDataMimo{
nullptr};
402 auto phasedChannel = bwp->GetChannel()->GetPhasedArraySpectrumPropagationLossModel();
405 pDataMimo = Create<NrMimoChunkProcessor>();
407 channelPhy->AddDataMimoChunkProcessor(pDataMimo);
409 if (m_csiFeedbackFlags & CQI_PDSCH_MIMO)
415 if (m_csiFeedbackFlags & CQI_CSI_RS)
417 Ptr<NrMimoChunkProcessor> pCsiRs = Create<NrMimoChunkProcessor>();
419 channelPhy->AddCsiRsMimoChunkProcessor(pCsiRs);
421 if (m_csiFeedbackFlags & CQI_CSI_IM)
423 Ptr<NrMimoChunkProcessor> pCsiIm = Create<NrMimoChunkProcessor>();
425 channelPhy->AddCsiImMimoChunkProcessor(pCsiIm);
429 if (!phasedChannel || (m_csiFeedbackFlags == CQI_PDSCH_SISO))
435 Ptr<NrChunkProcessor> pRs = Create<NrChunkProcessor>();
437 channelPhy->AddRsPowerChunkProcessor(pRs);
439 Ptr<NrChunkProcessor> pSinr = Create<NrChunkProcessor>();
441 channelPhy->AddDlCtrlSinrChunkProcessor(pSinr);
443 channelPhy->SetChannel(bwp->GetChannel());
444 channelPhy->InstallPhy(phy);
445 channelPhy->SetMobility(mm);
447 channelPhy->SetPhyRxCtrlEndOkCallback(phyRxCtrlCallback);
450 auto uniformPlanarArray = DynamicCast<UniformPlanarArray>(antenna);
451 if (uniformPlanarArray)
453 Ptr<BeamManager> beamManager = m_ueBeamManagerFactory.Create<BeamManager>();
454 beamManager->Configure(uniformPlanarArray);
455 channelPhy->SetBeamManager(beamManager);
457 phy->InstallSpectrumPhy(channelPhy);
462NrHelper::InstallSingleUeDevice(
464 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps)
466 NS_LOG_FUNCTION(
this);
468 Ptr<NrUeNetDevice> dev = m_ueNetDeviceFactory.Create<NrUeNetDevice>();
471 std::map<uint8_t, Ptr<BandwidthPartUe>> ueCcMap;
474 for (uint32_t bwpId = 0; bwpId < allBwps.size(); ++bwpId)
476 Ptr<BandwidthPartUe> cc = CreateObject<BandwidthPartUe>();
477 double bwInKhz = allBwps[bwpId].get()->m_channelBandwidth / 1000.0;
478 NS_ABORT_MSG_IF(bwInKhz / 100.0 > 65535.0,
479 "A bandwidth of " << bwInKhz / 100.0 <<
" kHz cannot be represented");
480 cc->SetUlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
481 cc->SetDlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
485 auto mac = CreateUeMac();
488 auto phy = CreateUePhy(
490 allBwps[bwpId].get(),
495 phy->SetBwpId(bwpId);
500 cc->SetAsPrimary(
true);
504 cc->SetAsPrimary(
false);
507 ueCcMap.insert(std::make_pair(bwpId, cc));
510 Ptr<NrUeComponentCarrierManager> ccmUe =
511 DynamicCast<NrUeComponentCarrierManager>(CreateObject<BwpManagerUe>());
512 DynamicCast<BwpManagerUe>(ccmUe)->SetBwpManagerAlgorithm(
513 m_ueBwpManagerAlgoFactory.Create<BwpManagerAlgorithm>());
515 UintegerValue primaryUlIndex;
516 dev->GetAttribute(
"PrimaryUlIndex", primaryUlIndex);
517 NS_ASSERT_MSG(primaryUlIndex.Get() < ueCcMap.size(),
518 "UL primary index out of bounds. Configure PrimaryUlIndex attribute of "
519 "NrUeNetDevice correctly.");
521 Ptr<NrUeRrc> rrc = CreateObject<NrUeRrc>();
522 rrc->SetPrimaryUlIndex(primaryUlIndex.Get());
523 rrc->m_numberOfComponentCarriers = ueCcMap.size();
525 rrc->InitializeSap();
526 rrc->SetNrMacSapProvider(ccmUe->GetNrMacSapProvider());
528 rrc->SetNrCcmRrcSapProvider(ccmUe->GetNrCcmRrcSapProvider());
529 ccmUe->SetNrCcmRrcSapUser(rrc->GetNrCcmRrcSapUser());
530 ccmUe->SetNumberOfComponentCarriers(ueCcMap.size());
534 Ptr<NrUeRrcProtocolIdeal> rrcProtocol = CreateObject<NrUeRrcProtocolIdeal>();
535 rrcProtocol->SetUeRrc(rrc);
536 rrc->AggregateObject(rrcProtocol);
537 rrcProtocol->SetNrUeRrcSapProvider(rrc->GetNrUeRrcSapProvider());
538 rrc->SetNrUeRrcSapUser(rrcProtocol->GetNrUeRrcSapUser());
542 Ptr<nr::UeRrcProtocolReal> rrcProtocol = CreateObject<nr::UeRrcProtocolReal>();
543 rrcProtocol->SetUeRrc(rrc);
544 rrc->AggregateObject(rrcProtocol);
545 rrcProtocol->SetNrUeRrcSapProvider(rrc->GetNrUeRrcSapProvider());
546 rrc->SetNrUeRrcSapUser(rrcProtocol->GetNrUeRrcSapUser());
549 if (m_nrEpcHelper !=
nullptr)
551 rrc->SetUseRlcSm(
false);
555 rrc->SetUseRlcSm(
true);
557 Ptr<NrEpcUeNas> nas = CreateObject<NrEpcUeNas>();
559 nas->SetAsSapProvider(rrc->GetAsSapProvider());
561 nas->SetForwardUpCallback(MakeCallback(&NrUeNetDevice::Receive, dev));
563 rrc->SetAsSapUser(nas->GetAsSapUser());
565 for (
auto& it : ueCcMap)
567 rrc->SetNrUeCmacSapProvider(it.second->GetMac()->GetUeCmacSapProvider(), it.first);
568 it.second->GetMac()->SetUeCmacSapUser(rrc->GetNrUeCmacSapUser(it.first));
570 it.second->GetPhy()->SetUeCphySapUser(rrc->GetNrUeCphySapUser());
571 rrc->SetNrUeCphySapProvider(it.second->GetPhy()->GetUeCphySapProvider(), it.first);
573 it.second->GetPhy()->SetPhySapUser(it.second->GetMac()->GetPhySapUser());
574 it.second->GetMac()->SetPhySapProvider(it.second->GetPhy()->GetPhySapProvider());
577 ccmUe->SetComponentCarrierMacSapProviders(it.first,
578 it.second->GetMac()->GetUeMacSapProvider());
582 NS_FATAL_ERROR(
"Error in SetComponentCarrierMacSapProviders");
586 dev->SetCcMap(ueCcMap);
587 dev->SetAttribute(
"nrUeRrc", PointerValue(rrc));
588 dev->SetAttribute(
"NrEpcUeNas", PointerValue(nas));
589 dev->SetAttribute(
"NrUeComponentCarrierManager", PointerValue(ccmUe));
590 dev->SetAttribute(
"Imsi", UintegerValue(n->GetId()));
594 if (m_nrEpcHelper !=
nullptr)
596 m_nrEpcHelper->AddUe(dev, dev->GetImsi());
599 rrc->InitializeSrb0();
604NrHelper::CreateGnbPhy(
const Ptr<Node>& n,
606 const Ptr<NrGnbNetDevice>& dev,
609 NS_LOG_FUNCTION(
this);
611 Ptr<NrGnbPhy> phy = m_gnbPhyFactory.Create<NrGnbPhy>();
613 DoubleValue frequency;
614 phy->InstallCentralFrequency(bwp->m_centralFrequency);
616 phy->ScheduleStartEventLoop(n->GetId(), 0, 0, 0);
619 Ptr<NrChAccessManager> cam =
620 DynamicCast<NrChAccessManager>(m_gnbChannelAccessManagerFactory.Create());
624 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
627 "MobilityModel needs to be set on node before calling NrHelper::InstallGnbDevice ()");
629 Ptr<NrSpectrumPhy> channelPhy = m_gnbSpectrumFactory.Create<NrSpectrumPhy>();
630 auto antenna = m_gnbAntennaFactory.Create();
631 channelPhy->SetAntenna(antenna);
632 cam->SetNrSpectrumPhy(channelPhy);
634 channelPhy->SetIsGnb(
true);
635 channelPhy->SetDevice(dev);
636 channelPhy->SetChannel(
639 channelPhy->InstallPhy(phy);
641 Ptr<NrChunkProcessor> pData =
642 Create<NrChunkProcessor>();
643 Ptr<NrChunkProcessor> pSrs =
644 Create<NrChunkProcessor>();
645 auto phasedChannel = bwp->GetChannel()->GetPhasedArraySpectrumPropagationLossModel();
660 auto pDataMimo = Create<NrMimoChunkProcessor>();
661 pDataMimo->AddCallback(
663 channelPhy->AddDataMimoChunkProcessor(pDataMimo);
666 channelPhy->AddDataSinrChunkProcessor(pData);
667 channelPhy->AddSrsSinrChunkProcessor(pSrs);
668 channelPhy->SetMobility(mm);
669 channelPhy->SetPhyRxDataEndOkCallback(
671 channelPhy->SetPhyRxCtrlEndOkCallback(phyEndCtrlCallback);
673 channelPhy->SetPhyUlHarqFeedbackCallback(
676 auto uniformPlanarArray = DynamicCast<UniformPlanarArray>(antenna);
677 if (uniformPlanarArray)
679 Ptr<BeamManager> beamManager = m_gnbBeamManagerFactory.Create<BeamManager>();
680 beamManager->Configure(uniformPlanarArray);
681 channelPhy->SetBeamManager(beamManager);
683 phy->InstallSpectrumPhy(channelPhy);
684 if ((m_csiFeedbackFlags & CQI_CSI_RS) && phasedChannel)
692NrHelper::CreateGnbMac()
694 NS_LOG_FUNCTION(
this);
696 Ptr<NrGnbMac> mac = m_gnbMacFactory.Create<NrGnbMac>();
701NrHelper::CreateGnbSched()
703 NS_LOG_FUNCTION(
this);
705 auto sched = m_schedFactory.Create<NrMacSchedulerNs3>();
706 auto dlAmc = m_gnbDlAmcFactory.Create<NrAmc>();
707 auto ulAmc = m_gnbUlAmcFactory.Create<NrAmc>();
709 sched->InstallDlAmc(dlAmc);
710 sched->InstallUlAmc(ulAmc);
716NrHelper::CreateNrFhControl()
718 NS_LOG_FUNCTION(
this);
720 Ptr<NrFhControl> fhControl = m_fhControlFactory.Create<NrFhControl>();
725NrHelper::InstallSingleGnbDevice(
727 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps)
729 NS_ABORT_MSG_IF(m_cellIdCounter == 65535,
"max num gNBs exceeded");
731 Ptr<NrGnbNetDevice> dev = m_gnbNetDeviceFactory.Create<NrGnbNetDevice>();
733 NS_LOG_DEBUG(
"Creating gNB, cellId = " << m_cellIdCounter);
734 uint16_t cellId = m_cellIdCounter++;
735 dev->SetCellId(cellId);
739 std::map<uint8_t, Ptr<BandwidthPartGnb>> ccMap;
741 auto fhControl = CreateNrFhControl();
742 fhControl->SetPhysicalCellId(cellId);
746 dev->SetNrFhControl(fhControl);
749 for (uint32_t bwpId = 0; bwpId < allBwps.size(); ++bwpId)
751 NS_LOG_DEBUG(
"Creating BandwidthPart, id = " << bwpId);
752 Ptr<BandwidthPartGnb> cc = CreateObject<BandwidthPartGnb>();
753 double bwInKhz = allBwps[bwpId].get()->m_channelBandwidth / 1000.0;
754 NS_ABORT_MSG_IF(bwInKhz / 100.0 > 65535.0,
755 "A bandwidth of " << bwInKhz / 100.0 <<
" kHz cannot be represented");
757 cc->SetUlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
758 cc->SetDlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
761 cc->SetCellId(cellId);
762 cc->SetCsgId(m_cellIdCounter++);
764 auto phy = CreateGnbPhy(
766 allBwps[bwpId].get(),
769 phy->SetBwpId(bwpId);
772 auto mac = CreateGnbMac();
774 phy->GetCam()->SetNrGnbMac(mac);
776 auto sched = CreateGnbSched();
777 cc->SetNrMacScheduler(sched);
781 cc->SetAsPrimary(
true);
785 cc->SetAsPrimary(
false);
788 ccMap.insert(std::make_pair(bwpId, cc));
791 Ptr<NrGnbRrc> rrc = CreateObject<NrGnbRrc>();
792 Ptr<NrGnbComponentCarrierManager> ccmGnbManager =
793 DynamicCast<NrGnbComponentCarrierManager>(CreateObject<BwpManagerGnb>());
794 DynamicCast<BwpManagerGnb>(ccmGnbManager)
795 ->SetBwpManagerAlgorithm(m_gnbBwpManagerAlgoFactory.Create<BwpManagerAlgorithm>());
800 std::map<uint8_t, Ptr<BandwidthPartGnb>> ccPhyConfMap;
801 for (
const auto& i : ccMap)
803 Ptr<BandwidthPartGnb> c = i.second;
804 ccPhyConfMap.insert(std::make_pair(i.first, c));
808 rrc->SetNrCcmRrcSapProvider(ccmGnbManager->GetNrCcmRrcSapProvider());
809 ccmGnbManager->SetNrCcmRrcSapUser(rrc->GetNrCcmRrcSapUser());
813 ccmGnbManager->SetNumberOfComponentCarriers(ccMap.size());
814 rrc->ConfigureCarriers(ccPhyConfMap);
819 Ptr<NrGnbRrcProtocolIdeal> rrcProtocol = CreateObject<NrGnbRrcProtocolIdeal>();
820 rrcProtocol->SetNrGnbRrcSapProvider(rrc->GetNrGnbRrcSapProvider());
821 rrc->SetNrGnbRrcSapUser(rrcProtocol->GetNrGnbRrcSapUser());
822 rrc->AggregateObject(rrcProtocol);
826 Ptr<nr::NrGnbRrcProtocolReal> rrcProtocol = CreateObject<nr::NrGnbRrcProtocolReal>();
827 rrcProtocol->SetNrGnbRrcSapProvider(rrc->GetNrGnbRrcSapProvider());
828 rrc->SetNrGnbRrcSapUser(rrcProtocol->GetNrGnbRrcSapUser());
829 rrc->AggregateObject(rrcProtocol);
832 if (m_nrEpcHelper !=
nullptr)
834 EnumValue<NrGnbRrc::NrEpsBearerToRlcMapping_t> epsBearerToRlcMapping;
835 rrc->GetAttribute(
"EpsBearerToRlcMapping", epsBearerToRlcMapping);
837 if (epsBearerToRlcMapping.Get() == NrGnbRrc::RLC_SM_ALWAYS)
839 rrc->SetAttribute(
"EpsBearerToRlcMapping", EnumValue(NrGnbRrc::RLC_UM_ALWAYS));
852 rrc->SetNrMacSapProvider(ccmGnbManager->GetNrMacSapProvider());
853 rrc->SetForwardUpCallback(MakeCallback(&NrGnbNetDevice::Receive, dev));
855 for (
auto& it : ccMap)
857 it.second->GetPhy()->SetGnbCphySapUser(rrc->GetNrGnbCphySapUser(it.first));
858 rrc->SetNrGnbCphySapProvider(it.second->GetPhy()->GetGnbCphySapProvider(), it.first);
860 rrc->SetNrGnbCmacSapProvider(it.second->GetMac()->GetGnbCmacSapProvider(), it.first);
861 it.second->GetMac()->SetGnbCmacSapUser(rrc->GetNrGnbCmacSapUser(it.first));
864 it.second->GetPhy()->SetPhySapUser(it.second->GetMac()->GetPhySapUser());
865 it.second->GetMac()->SetPhySapProvider(it.second->GetPhy()->GetPhySapProvider());
869 it.second->GetMac()->SetNrMacSchedSapProvider(
870 it.second->GetScheduler()->GetMacSchedSapProvider());
871 it.second->GetMac()->SetNrMacCschedSapProvider(
872 it.second->GetScheduler()->GetMacCschedSapProvider());
874 it.second->GetScheduler()->SetMacSchedSapUser(it.second->GetMac()->GetNrMacSchedSapUser());
875 it.second->GetScheduler()->SetMacCschedSapUser(
876 it.second->GetMac()->GetNrMacCschedSapUser());
879 it.second->GetMac()->SetNrCcmMacSapUser(ccmGnbManager->GetNrCcmMacSapUser());
880 ccmGnbManager->SetCcmMacSapProviders(it.first,
881 it.second->GetMac()->GetNrCcmMacSapProvider());
885 ccmGnbManager->SetMacSapProvider(it.first, it.second->GetMac()->GetMacSapProvider());
891 it.second->GetScheduler()->SetNrFhSchedSapProvider(
892 dev->GetNrFhControl()->GetNrFhSchedSapProvider());
893 dev->GetNrFhControl()->SetNrFhSchedSapUser(
895 it.second->GetScheduler()->GetNrFhSchedSapUser());
896 it.second->GetPhy()->SetNrFhPhySapProvider(
897 dev->GetNrFhControl()->GetNrFhPhySapProvider());
898 dev->GetNrFhControl()->SetNrFhPhySapUser(it.first,
899 it.second->GetPhy()->GetNrFhPhySapUser());
903 dev->SetAttribute(
"NrGnbComponentCarrierManager", PointerValue(ccmGnbManager));
904 dev->SetCcMap(ccMap);
905 dev->SetAttribute(
"NrGnbRrc", PointerValue(rrc));
909 if (m_nrEpcHelper !=
nullptr)
911 NS_LOG_INFO(
"adding this gNB to the EPC");
912 m_nrEpcHelper->AddGnb(n, dev, dev->GetCellIds());
913 Ptr<NrEpcGnbApplication> gnbApp = n->GetApplication(0)->GetObject<NrEpcGnbApplication>();
914 NS_ASSERT_MSG(gnbApp !=
nullptr,
"cannot retrieve NrEpcGnbApplication");
917 rrc->SetS1SapProvider(gnbApp->GetS1SapProvider());
918 gnbApp->SetS1SapUser(rrc->GetS1SapUser());
921 Ptr<NrEpcX2> x2 = n->GetObject<NrEpcX2>();
922 x2->SetEpcX2SapUser(rrc->GetEpcX2SapUser());
923 rrc->SetEpcX2SapProvider(x2->GetEpcX2SapProvider());
929NrHelper::GetHandoverAlgorithmType()
const
931 return m_handoverAlgorithmFactory.GetTypeId().GetName();
935NrHelper::SetHandoverAlgorithmType(std::string type)
937 NS_LOG_FUNCTION(
this << type);
938 m_handoverAlgorithmFactory = ObjectFactory();
939 m_handoverAlgorithmFactory.SetTypeId(type);
943NrHelper::SetHandoverAlgorithmAttribute(std::string n,
const AttributeValue& v)
945 NS_LOG_FUNCTION(
this << n);
946 m_handoverAlgorithmFactory.Set(n, v);
950NrHelper::AddX2Interface(NodeContainer gnbNodes)
952 NS_LOG_FUNCTION(
this);
954 NS_ASSERT_MSG(m_nrEpcHelper,
"X2 interfaces cannot be set up when the EPC is not used");
956 for (
auto i = gnbNodes.Begin(); i != gnbNodes.End(); ++i)
958 for (
auto j = i + 1; j != gnbNodes.End(); ++j)
960 AddX2Interface(*i, *j);
966NrHelper::AddX2Interface(Ptr<Node> gnbNode1, Ptr<Node> gnbNode2)
968 NS_LOG_FUNCTION(
this);
969 NS_LOG_INFO(
"setting up the X2 interface");
971 m_nrEpcHelper->AddX2Interface(gnbNode1, gnbNode2);
975NrHelper::HandoverRequest(Time hoTime,
976 Ptr<NetDevice> ueDev,
977 Ptr<NetDevice> sourceGnbDev,
978 Ptr<NetDevice> targetGnbDev)
980 NS_LOG_FUNCTION(
this << ueDev << sourceGnbDev << targetGnbDev);
981 NS_ASSERT_MSG(m_nrEpcHelper,
982 "Handover requires the use of the EPC - did you forget to call "
983 "NrHelper::SetEpcHelper () ?");
984 uint16_t targetCellId = targetGnbDev->GetObject<NrGnbNetDevice>()->GetCellId();
985 Simulator::Schedule(hoTime,
986 &NrHelper::DoHandoverRequest,
994NrHelper::HandoverRequest(Time hoTime,
995 Ptr<NetDevice> ueDev,
996 Ptr<NetDevice> sourceGnbDev,
997 uint16_t targetCellId)
999 NS_LOG_FUNCTION(
this << ueDev << sourceGnbDev << targetCellId);
1000 NS_ASSERT_MSG(m_nrEpcHelper,
1001 "Handover requires the use of the EPC - did you forget to call "
1002 "NrHelper::SetEpcHelper () ?");
1003 Simulator::Schedule(hoTime,
1004 &NrHelper::DoHandoverRequest,
1012NrHelper::DoHandoverRequest(Ptr<NetDevice> ueDev,
1013 Ptr<NetDevice> sourceGnbDev,
1014 uint16_t targetCellId)
1016 NS_LOG_FUNCTION(
this << ueDev << sourceGnbDev << targetCellId);
1018 Ptr<NrGnbRrc> sourceRrc = sourceGnbDev->GetObject<NrGnbNetDevice>()->GetRrc();
1019 uint16_t rnti = ueDev->GetObject<NrUeNetDevice>()->GetRrc()->GetRnti();
1020 sourceRrc->SendHandoverRequest(rnti, targetCellId);
1025 const NetDeviceContainer& enbDevices)
1027 NS_LOG_FUNCTION(
this);
1029 for (
auto i = ueDevices.Begin(); i != ueDevices.End(); i++)
1038 NS_LOG_FUNCTION(
this);
1040 NS_ASSERT_MSG(enbDevices.GetN() > 0,
"empty enb device container");
1043 ueDevice->GetObject<
NrUeNetDevice>()->SetInitAssoc(nrInitAssoc);
1045 nrInitAssoc->SetUeDevice(ueDevice);
1046 nrInitAssoc->SetGnbDevices(enbDevices);
1047 nrInitAssoc->SetColBeamAngles(m_initialParams.
colAngles);
1048 nrInitAssoc->SetRowBeamAngles(m_initialParams.
rowAngles);
1049 nrInitAssoc->FindAssociatedGnb();
1050 NS_ASSERT_MSG(nrInitAssoc->CheckNumBeamsAllowed(),
1051 "Number of gNB beams in this frequency is not supported");
1052 auto maxRsrpEnbDevice = nrInitAssoc->GetAssociatedGnb();
1053 NS_ASSERT(maxRsrpEnbDevice);
1060 const NetDeviceContainer& gnbDevices)
1062 NS_LOG_FUNCTION(
this);
1064 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); i++)
1073 NS_LOG_FUNCTION(
this);
1074 NS_ASSERT_MSG(gnbDevices.GetN() > 0,
"empty gnb device container");
1075 Vector uepos = ueDevice->GetNode()->GetObject<MobilityModel>()->GetPosition();
1076 double minDistance = std::numeric_limits<double>::infinity();
1077 Ptr<NetDevice> closestGnbDevice;
1078 for (NetDeviceContainer::Iterator i = gnbDevices.Begin(); i != gnbDevices.End(); ++i)
1080 Vector gnbpos = (*i)->GetNode()->GetObject<MobilityModel>()->GetPosition();
1081 double distance = CalculateDistance(uepos, gnbpos);
1082 if (distance < minDistance)
1084 minDistance = distance;
1085 closestGnbDevice = *i;
1088 NS_ASSERT(closestGnbDevice);
1096 Ptr<NrGnbNetDevice> gnbNetDev = gnbDevice->GetObject<
NrGnbNetDevice>();
1097 Ptr<NrUeNetDevice> ueNetDev = ueDevice->GetObject<
NrUeNetDevice>();
1099 NS_ABORT_IF(gnbNetDev ==
nullptr || ueNetDev ==
nullptr);
1101 if (!gnbNetDev->IsCellConfigured())
1103 gnbNetDev->ConfigureCell();
1105 for (uint32_t i = 0; i < gnbNetDev->GetCcMapSize(); ++i)
1107 gnbNetDev->GetPhy(i)->RegisterUe(ueNetDev->GetImsi(), ueNetDev);
1108 ueNetDev->GetPhy(i)->RegisterToGnb(gnbNetDev->GetBwpId(i));
1109 ueNetDev->GetPhy(i)->SetDlAmc(
1110 DynamicCast<NrMacSchedulerNs3>(gnbNetDev->GetScheduler(i))->GetDlAmc());
1111 ueNetDev->GetPhy(i)->SetDlCtrlSyms(gnbNetDev->GetMac(i)->GetDlCtrlSyms());
1112 ueNetDev->GetPhy(i)->SetUlCtrlSyms(gnbNetDev->GetMac(i)->GetUlCtrlSyms());
1113 ueNetDev->GetPhy(i)->SetNumRbPerRbg(gnbNetDev->GetMac(i)->GetNumRbPerRbg());
1114 ueNetDev->GetPhy(i)->SetRbOverhead(gnbNetDev->GetPhy(i)->GetRbOverhead());
1115 ueNetDev->GetPhy(i)->SetSymbolsPerSlot(gnbNetDev->GetPhy(i)->GetSymbolsPerSlot());
1116 ueNetDev->GetPhy(i)->SetNumerology(gnbNetDev->GetPhy(i)->GetNumerology());
1117 ueNetDev->GetPhy(i)->SetPattern(gnbNetDev->GetPhy(i)->GetPattern());
1118 Ptr<NrEpcUeNas> ueNas = ueNetDev->GetNas();
1119 ueNas->Connect(gnbNetDev->GetBwpId(i), gnbNetDev->GetEarfcn(i));
1121 if (m_enableMimoFeedback)
1124 auto pmSearch = m_pmSearchFactory.Create<
NrPmSearch>();
1125 ueNetDev->GetPhy(i)->SetPmSearch(pmSearch);
1127 gnbNetDev->GetPhy(i)->GetSpectrumPhy()->GetAntenna()->GetObject<PhasedArrayModel>();
1129 ueNetDev->GetPhy(i)->GetSpectrumPhy()->GetAntenna()->GetObject<PhasedArrayModel>();
1131 gnbAnt->GetNumHorizontalPorts(),
1132 gnbAnt->GetNumVerticalPorts());
1133 pmSearch->SetUeParams(ueAnt->GetNumPorts());
1134 pmSearch->InitCodebooks();
1141 m_nrEpcHelper->ActivateEpsBearer(ueDevice,
1142 ueNetDev->GetImsi(),
1150 ueNetDev->SetTargetGnb(gnbNetDev);
1153 if (m_beamformingHelper)
1155 m_beamformingHelper->AddBeamformingTask(gnbNetDev, ueNetDev);
1164 NS_LOG_FUNCTION(
this);
1165 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1176 NS_LOG_FUNCTION(
this);
1178 NS_ASSERT_MSG(m_nrEpcHelper,
"dedicated EPS bearers cannot be set up when the EPC is not used");
1180 uint64_t imsi = ueDevice->GetObject<
NrUeNetDevice>()->GetImsi();
1181 uint8_t bearerId = m_nrEpcHelper->ActivateEpsBearer(ueDevice, imsi, tft, bearer);
1187 Ptr<NetDevice> gnbDevice,
1190 NS_LOG_FUNCTION(
this << ueDevice << bearerId);
1191 NS_ASSERT_MSG(m_nrEpcHelper !=
nullptr,
1192 "Dedicated EPS bearers cannot be de-activated when the EPC is not used");
1193 NS_ASSERT_MSG(bearerId != 1,
1194 "Default bearer cannot be de-activated until and unless and UE is released");
1196 DoDeActivateDedicatedEpsBearer(ueDevice, gnbDevice, bearerId);
1202 NS_LOG_FUNCTION(
this);
1203 m_ueMacFactory.Set(n, v);
1209 NS_LOG_FUNCTION(
this);
1210 m_gnbMacFactory.Set(n, v);
1216 NS_LOG_FUNCTION(
this);
1217 m_gnbSpectrumFactory.Set(n, v);
1223 NS_LOG_FUNCTION(
this);
1224 m_ueSpectrumFactory.Set(n, v);
1230 NS_LOG_FUNCTION(
this);
1231 m_ueChannelAccessManagerFactory.Set(n, v);
1237 NS_LOG_FUNCTION(
this);
1238 m_gnbChannelAccessManagerFactory.Set(n, v);
1244 NS_LOG_FUNCTION(
this);
1245 m_schedFactory.Set(n, v);
1251 NS_LOG_FUNCTION(
this);
1252 m_uePhyFactory.Set(n, v);
1258 NS_LOG_FUNCTION(
this);
1259 m_gnbPhyFactory.Set(n, v);
1265 NS_LOG_FUNCTION(
this);
1266 m_ueAntennaFactory.Set(n, v);
1272 NS_LOG_FUNCTION(
this);
1273 m_gnbAntennaFactory.Set(n, v);
1279 NS_LOG_FUNCTION(
this);
1280 m_ueAntennaFactory.SetTypeId(typeId);
1286 NS_LOG_FUNCTION(
this);
1287 m_gnbAntennaFactory.SetTypeId(typeId);
1293 NS_LOG_FUNCTION(
this);
1294 m_ueChannelAccessManagerFactory.SetTypeId(typeId);
1300 NS_LOG_FUNCTION(
this);
1301 m_gnbChannelAccessManagerFactory.SetTypeId(typeId);
1307 NS_LOG_FUNCTION(
this);
1308 m_schedFactory.SetTypeId(typeId);
1314 NS_LOG_FUNCTION(
this);
1315 m_ueBwpManagerAlgoFactory.SetTypeId(typeId);
1321 NS_LOG_FUNCTION(
this);
1322 m_ueBwpManagerAlgoFactory.Set(n, v);
1328 NS_LOG_FUNCTION(
this);
1329 m_gnbDlAmcFactory.Set(n, v);
1335 NS_LOG_FUNCTION(
this);
1336 m_gnbUlAmcFactory.Set(n, v);
1340NrHelper::SetGnbBeamManagerAttribute(
const std::string& n,
const AttributeValue& v)
1342 NS_LOG_FUNCTION(
this);
1343 m_gnbBeamManagerFactory.Set(n, v);
1349 NS_LOG_FUNCTION(
this);
1350 m_gnbBeamManagerFactory.SetTypeId(typeId);
1354NrHelper::SetFhControlAttribute(
const std::string& n,
const AttributeValue& v)
1356 NS_LOG_FUNCTION(
this);
1357 m_fhControlFactory.Set(n, v);
1363 NS_LOG_FUNCTION(
this);
1372 NS_LOG_FUNCTION(
this);
1387 for (NetDeviceContainer::Iterator i = gnbNetDevices.Begin(); i != gnbNetDevices.End(); ++i)
1389 Ptr<NrGnbNetDevice> gnbNetDev = DynamicCast<NrGnbNetDevice>(*i);
1391 for (uint32_t j = 0; j < gnbNetDev->GetCcMapSize(); j++)
1393 gnbNetDev->GetNrFhControl()->SetFhNumerology(j, gnbNetDev->GetPhy(j)->GetNumerology());
1395 gnbNetDev->GetNrFhControl()->SetErrorModelType(
1396 DynamicCast<NrMacSchedulerNs3>(gnbNetDev->GetScheduler(j))
1398 ->GetErrorModelType()
1407 int64_t currentStream = stream;
1408 Ptr<NetDevice> netDevice;
1409 for (NetDeviceContainer::Iterator i = c.Begin(); i != c.End(); ++i)
1412 Ptr<NrGnbNetDevice> nrGnb = DynamicCast<NrGnbNetDevice>(netDevice);
1415 for (uint32_t bwp = 0; bwp < nrGnb->GetCcMapSize(); bwp++)
1417 currentStream += nrGnb->GetPhy(bwp)->GetSpectrumPhy()->AssignStreams(currentStream);
1418 currentStream += nrGnb->GetScheduler(bwp)->AssignStreams(currentStream);
1420 DoAssignStreamsToChannelObjects(nrGnb->GetPhy(bwp)->GetSpectrumPhy(),
1425 Ptr<NrUeNetDevice> nrUe = DynamicCast<NrUeNetDevice>(netDevice);
1428 for (uint32_t bwp = 0; bwp < nrUe->GetCcMapSize(); bwp++)
1430 currentStream += nrUe->GetPhy(bwp)->GetSpectrumPhy()->AssignStreams(currentStream);
1431 currentStream += nrUe->GetMac(bwp)->AssignStreams(currentStream);
1433 DoAssignStreamsToChannelObjects(nrUe->GetPhy(bwp)->GetSpectrumPhy(),
1439 return (currentStream - stream);
1443NrHelper::DoAssignStreamsToChannelObjects(Ptr<NrSpectrumPhy> phy, int64_t currentStream)
1445 int64_t initialStream = currentStream;
1447 Ptr<ThreeGppPropagationLossModel> propagationLossModel =
1448 DynamicCast<ThreeGppPropagationLossModel>(
1449 phy->GetSpectrumChannel()->GetPropagationLossModel());
1450 if (!propagationLossModel)
1453 phy->GetSpectrumChannel()->GetPropagationLossModel()->AssignStreams(currentStream);
1454 return currentStream - initialStream;
1457 if (std::find(m_channelObjectsWithAssignedStreams.begin(),
1458 m_channelObjectsWithAssignedStreams.end(),
1459 propagationLossModel) == m_channelObjectsWithAssignedStreams.end())
1461 currentStream += propagationLossModel->AssignStreams(currentStream);
1462 m_channelObjectsWithAssignedStreams.emplace_back(propagationLossModel);
1465 Ptr<ChannelConditionModel> channelConditionModel =
1466 propagationLossModel->GetChannelConditionModel();
1468 if (std::find(m_channelObjectsWithAssignedStreams.begin(),
1469 m_channelObjectsWithAssignedStreams.end(),
1470 channelConditionModel) == m_channelObjectsWithAssignedStreams.end())
1472 currentStream += channelConditionModel->AssignStreams(currentStream);
1473 m_channelObjectsWithAssignedStreams.emplace_back(channelConditionModel);
1476 Ptr<ThreeGppSpectrumPropagationLossModel> spectrumLossModel =
1477 DynamicCast<ThreeGppSpectrumPropagationLossModel>(
1478 phy->GetSpectrumChannel()->GetPhasedArraySpectrumPropagationLossModel());
1480 if (spectrumLossModel)
1482 if (std::find(m_channelObjectsWithAssignedStreams.begin(),
1483 m_channelObjectsWithAssignedStreams.end(),
1484 spectrumLossModel) == m_channelObjectsWithAssignedStreams.end())
1486 Ptr<ThreeGppChannelModel> channel =
1487 DynamicCast<ThreeGppChannelModel>(spectrumLossModel->GetChannelModel());
1488 currentStream += channel->AssignStreams(currentStream);
1489 m_channelObjectsWithAssignedStreams.emplace_back(spectrumLossModel);
1493 return currentStream - initialStream;
1499 NS_LOG_FUNCTION(
this);
1500 m_gnbBwpManagerAlgoFactory.SetTypeId(typeId);
1506 NS_LOG_FUNCTION(
this);
1507 m_gnbBwpManagerAlgoFactory.Set(n, v);
1511NrHelper::DoDeActivateDedicatedEpsBearer(Ptr<NetDevice> ueDevice,
1512 Ptr<NetDevice> gnbDevice,
1515 NS_LOG_FUNCTION(
this << ueDevice << bearerId);
1518 uint64_t imsi = ueDevice->GetObject<
NrUeNetDevice>()->GetImsi();
1519 uint16_t rnti = ueDevice->GetObject<
NrUeNetDevice>()->GetRrc()->GetRnti();
1521 Ptr<NrGnbRrc> gnbRrc = gnbDevice->GetObject<
NrGnbNetDevice>()->GetRrc();
1523 gnbRrc->DoSendReleaseDataRadioBearer(imsi, rnti, bearerId);
1535 m_beamformingHelper = beamformingHelper;
1536 m_beamformingHelper->Initialize();
1539class NrDrbActivator :
public SimpleRefCount<NrDrbActivator>
1542 NrDrbActivator(Ptr<NetDevice> ueDevice,
NrEpsBearer bearer);
1543 static void ActivateCallback(Ptr<NrDrbActivator> a,
1544 std::string context,
1548 void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti);
1552 Ptr<NetDevice> m_ueDevice;
1557NrDrbActivator::NrDrbActivator(Ptr<NetDevice> ueDevice, NrEpsBearer bearer)
1559 m_ueDevice(ueDevice),
1561 m_imsi(m_ueDevice->GetObject<NrUeNetDevice>()->GetImsi())
1566NrDrbActivator::ActivateCallback(Ptr<NrDrbActivator> a,
1567 std::string context,
1572 NS_LOG_FUNCTION(a << context << imsi << cellId << rnti);
1573 a->ActivateDrb(imsi, cellId, rnti);
1577NrDrbActivator::ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
1579 NS_LOG_FUNCTION(
this << imsi << cellId << rnti << m_active);
1580 if ((!m_active) && (imsi == m_imsi))
1582 Ptr<NrUeRrc> ueRrc = m_ueDevice->GetObject<NrUeNetDevice>()->GetRrc();
1583 NS_ASSERT(ueRrc->GetState() == NrUeRrc::CONNECTED_NORMALLY);
1584 uint16_t rnti = ueRrc->GetRnti();
1585 Ptr<const NrGnbNetDevice> nrGnbDevice =
1586 m_ueDevice->GetObject<NrUeNetDevice>()->GetTargetGnb();
1587 Ptr<NrGnbRrc> gnbRrc = nrGnbDevice->GetObject<NrGnbNetDevice>()->GetRrc();
1588 NS_ASSERT(gnbRrc->HasCellId(ueRrc->GetCellId()));
1589 Ptr<NrUeManager> ueManager = gnbRrc->GetUeManager(rnti);
1590 NS_ASSERT(ueManager->GetState() == NrUeManager::CONNECTED_NORMALLY ||
1591 ueManager->GetState() == NrUeManager::CONNECTION_RECONFIGURATION);
1592 NrEpcGnbS1SapUser::DataRadioBearerSetupRequestParameters params;
1594 params.bearer = m_bearer;
1595 params.bearerId = 0;
1597 gnbRrc->GetS1SapUser()->DataRadioBearerSetupRequest(params);
1605 NS_LOG_FUNCTION(
this);
1606 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1615 NS_LOG_FUNCTION(
this << ueDevice);
1616 NS_ASSERT_MSG(!m_nrEpcHelper,
"this method must not be used when the EPC is being used");
1623 Ptr<const NrGnbNetDevice> nrGnbDevice = ueDevice->GetObject<
NrUeNetDevice>()->GetTargetGnb();
1625 std::ostringstream path;
1626 path <<
"/NodeList/" << nrGnbDevice->GetNode()->GetId() <<
"/DeviceList/"
1627 << nrGnbDevice->GetIfIndex() <<
"/NrGnbRrc/ConnectionEstablished";
1628 Ptr<NrDrbActivator> arg = Create<NrDrbActivator>(ueDevice, bearer);
1629 Config::Connect(path.str(), MakeBoundCallback(&NrDrbActivator::ActivateCallback, arg));
1659 m_phyStats = CreateObject<NrPhyRxTrace>();
1669 m_macStats = CreateObject<NrMacRxTrace>();
1677 NS_LOG_FUNCTION(
this);
1678 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/DlDataSinr",
1682 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/SpectrumPhy/RxPacketTraceUe",
1683 MakeBoundCallback(&NrPhyRxTrace::RxPacketTraceUeCallback,
GetPhyRxTrace()));
1689 NS_LOG_FUNCTION(
this);
1690 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/DlCtrlSinr",
1697 NS_LOG_FUNCTION(
this);
1698 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/GnbPhyRxedCtrlMsgsTrace",
1700 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/GnbPhyTxedCtrlMsgsTrace",
1707 NS_LOG_FUNCTION(
this);
1708 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/GnbMacRxedCtrlMsgsTrace",
1710 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/GnbMacTxedCtrlMsgsTrace",
1717 NS_LOG_FUNCTION(
this);
1719 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyRxedCtrlMsgsTrace",
1722 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyTxedCtrlMsgsTrace",
1724 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyRxedDlDciTrace",
1727 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyTxedHarqFeedbackTrace",
1734 NS_LOG_FUNCTION(
this);
1736 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUeMac/UeMacRxedCtrlMsgsTrace",
1739 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUeMac/UeMacTxedCtrlMsgsTrace",
1746 NS_LOG_FUNCTION(
this);
1748 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/SpectrumPhy/RxPacketTraceGnb",
1749 MakeBoundCallback(&NrPhyRxTrace::RxPacketTraceGnbCallback,
GetPhyRxTrace()));
1755 NS_LOG_FUNCTION(
this);
1757 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/SpectrumPhy/ReportGnbTxRxPacketCount",
1758 MakeBoundCallback(&NrPhyRxTrace::ReportPacketCountGnbCallback,
GetPhyRxTrace()));
1764 NS_LOG_FUNCTION(
this);
1765 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/SpectrumPhy/"
1766 "ReportUeTxRxPacketCount",
1767 MakeBoundCallback(&NrPhyRxTrace::ReportPacketCountUeCallback,
GetPhyRxTrace()));
1773 NS_LOG_FUNCTION(
this);
1774 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/ReportDownlinkTbSize",
1775 MakeBoundCallback(&NrPhyRxTrace::ReportDownLinkTBSize,
GetPhyRxTrace()));
1781 NS_LOG_FUNCTION(
this);
1782 Ptr<NrBearerStatsSimple> rlcStats = CreateObject<NrBearerStatsSimple>(
"RLC");
1783 m_radioBearerStatsConnectorSimpleTraces.
EnableRlcStats(rlcStats);
1789 NS_LOG_FUNCTION(
this);
1790 Ptr<NrBearerStatsSimple> pdcpStats = CreateObject<NrBearerStatsSimple>(
"PDCP");
1797 NS_LOG_FUNCTION(
this);
1798 Ptr<NrBearerStatsCalculator> rlcStats = CreateObject<NrBearerStatsCalculator>(
"RLC");
1805 NS_LOG_FUNCTION(
this);
1806 Ptr<NrBearerStatsCalculator> pdcpStats = CreateObject<NrBearerStatsCalculator>(
"PDCP");
1810Ptr<NrBearerStatsCalculator>
1813 return DynamicCast<NrBearerStatsCalculator>(
1814 m_radioBearerStatsConnectorCalculator.
GetRlcStats());
1817Ptr<NrBearerStatsCalculator>
1820 return DynamicCast<NrBearerStatsCalculator>(
1827 NS_LOG_FUNCTION(
this);
1828 if (!m_macSchedStats)
1830 m_macSchedStats = CreateObject<NrMacSchedulingStats>();
1833 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/DlScheduling",
1840 NS_LOG_FUNCTION(
this);
1841 if (!m_macSchedStats)
1843 m_macSchedStats = CreateObject<NrMacSchedulingStats>();
1846 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/UlScheduling",
1853 NS_LOG_FUNCTION(
this);
1854 Config::Connect(
"/ChannelList/*/$ns3::SpectrumChannel/PathLoss",
1859NrHelper::EnableDlCtrlPathlossTraces(NetDeviceContainer& ueDevs)
1861 NS_LOG_FUNCTION(
this);
1863 for (uint32_t i = 0; i < ueDevs.GetN(); i++)
1865 Ptr<NrUeNetDevice> ueDev = DynamicCast<NrUeNetDevice>(ueDevs.Get(i));
1866 NS_ASSERT_MSG(ueDev,
1867 "To EnableDlCtrlPathlossTracesfunction is passed device "
1868 "container that contains non UE devices.");
1869 for (uint32_t j = 0; j < ueDev->GetCcMapSize(); j++)
1871 Ptr<NrUePhy> nrUePhy = ueDev->GetPhy(j);
1872 Ptr<NrSpectrumPhy> nrSpectrumPhy = nrUePhy->GetSpectrumPhy();
1873 nrSpectrumPhy->EnableDlCtrlPathlossTrace();
1877 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/NrSpectrumPhy/"
1883NrHelper::EnableDlDataPathlossTraces(NetDeviceContainer& ueDevs)
1885 NS_LOG_FUNCTION(
this);
1887 NS_ASSERT_MSG(ueDevs.GetN(),
1888 "Passed an empty UE net device container EnableDlDataPathlossTraces function");
1890 for (uint32_t i = 0; i < ueDevs.GetN(); i++)
1892 Ptr<NrUeNetDevice> ueDev = DynamicCast<NrUeNetDevice>(ueDevs.Get(i));
1893 NS_ASSERT_MSG(ueDev,
1894 "To EnableDlDataPathlossTracesfunction is passed device "
1895 "container that contains non UE devices.");
1896 for (uint32_t j = 0; j < ueDev->GetCcMapSize(); j++)
1898 Ptr<NrUePhy> nrUePhy = ueDev->GetPhy(j);
1899 Ptr<NrSpectrumPhy> nrSpectrumPhy = nrUePhy->GetSpectrumPhy();
1900 nrSpectrumPhy->EnableDlDataPathlossTrace();
1904 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/NrSpectrumPhy/"
1912 m_pmSearchFactory.SetTypeId(typeId);
1918 m_initialAttachmentFactory.SetTypeId(typeId);
1924 NS_LOG_FUNCTION(
this);
1925 m_pmSearchFactory.Set(name, value);
1931 NS_LOG_FUNCTION(
this);
1932 m_initialAttachmentFactory.Set(name, value);
1939 "The number of horizontal ports of gNB must divide number of element columns");
1941 "The number of vertical ports of gNB must divide number of element rows");
1943 auto antFactory = ObjectFactory{};
1960 "The number of horizontal ports of UE must divide number of element columns");
1962 "The number of vertical ports of UE must divide number of element rows");
1964 auto antFactory = ObjectFactory{};
1981 SetAttribute(
"EnableMimoFeedback", BooleanValue(
true));
1999 Ptr<const SpectrumTransmitFilter> p = channel->GetSpectrumTransmitFilter();
2003 if (DynamicCast<const NrCsiRsFilter>(p))
2005 NS_LOG_DEBUG(
"Found existing NrCsiRsFilter for spectrum channel " << channel);
2010 NS_LOG_DEBUG(
"Found different SpectrumTransmitFilter for channel " << channel);
2016 Ptr<NrCsiRsFilter> pCsiRsFilter = CreateObject<NrCsiRsFilter>();
2017 channel->AddSpectrumTransmitFilter(pCsiRsFilter);
2018 NS_LOG_DEBUG(
"Adding NrCsiRsFilter to channel " << channel);
2026 m_initialParams = params;
static TypeId GetTypeId()
GetTypeId.
static TypeId GetTypeId()
GetTypeId.
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()
GetTypeId.
Ptr< NrBearerStatsBase > GetPdcpStats()
void EnablePdcpStats(Ptr< NrBearerStatsBase > pdcpStats)
void EnableRlcStats(Ptr< NrBearerStatsBase > rlcStats)
Ptr< NrBearerStatsBase > GetRlcStats()
Base helper class to handle the creation of the EPC entities.
static Ptr< NrEpcTft > Default()
This class contains the specification of EPS Bearers.
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
static TypeId GetTypeId()
GetTypeId.
static TypeId GetTypeId()
Get the TypeId.
The NrGnbNetDevice class.
void RouteIngoingCtrlMsgs(const std::list< Ptr< NrControlMessage > > &msgList, uint8_t sourceBwpId)
The gNB received a CTRL message list.
void GenerateDataCqiReport(const SpectrumValue &sinr)
Generate a DL CQI report.
void ReportUlHarqFeedback(const UlHarqInfo &mes)
Get the HARQ feedback from NrSpectrumPhy and forward it to the scheduler.
void PhyDataPacketReceived(const Ptr< Packet > &p)
Receive a PHY data packet.
static TypeId GetTypeId()
Get Type id.
void EnableDlDataPhyTraces()
Enable DL DATA PHY traces.
static Ptr< BwpManagerGnb > GetBwpManagerGnb(const Ptr< NetDevice > &gnbDevice)
Get the BwpManager of the GNB.
std::pair< double, BandwidthPartInfoPtrVector > CreateBandwidthParts(std::vector< CcBwpCreator::SimpleOperationBandConf > bandConfs, const std::string &scenario="RMa", const std::string &channelCondition="Default", const std::string &channelModel="ThreeGpp")
Create BandwidthParts from a vector of band configurations.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, NrEpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
void UpdateDeviceConfigs(const NetDeviceContainer &netDevs)
Update NetDevice configuration of one or more devices.
static Ptr< NrUeMac > GetUeMac(const Ptr< NetDevice > &ueDevice, uint32_t bwpIndex)
Get a pointer to the MAC of the UE at the specified BWP.
void EnableTraces()
Enables the following traces: Transmitted/Received Control Messages DL/UL Phy Traces RLC traces PDCP ...
void SetupInitialAssoc(const InitialAssocParams ¶ms)
Set parameters for max RSRP based Initial Association.
void ConfigureFhControl(NetDeviceContainer gnbNetDevices)
Configure FH Control of each cell.
NetDeviceContainer InstallGnbDevice(const NodeContainer &c, const std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > allBwps)
Install one (or more) GNBs.
void SetBeamformingHelper(Ptr< BeamformingHelperBase > beamformingHelper)
Set an ideal beamforming helper.
void SetGnbDlAmcAttribute(const std::string &n, const AttributeValue &v)
NrHelper()
NrHelper constructor.
Ptr< NrBearerStatsCalculator > GetPdcpStatsCalculator()
Get the PDCP stats calculator object.
void DeActivateDedicatedEpsBearer(Ptr< NetDevice > ueDevice, Ptr< NetDevice > gnbDevice, uint8_t bearerId)
Manually trigger dedicated bearer de-activation at specific simulation time.
void EnableUePhyCtrlMsgsTraces()
Enable UE PHY CTRL TX and RX traces.
void EnableRlcSimpleTraces()
Enable RLC simple traces (DL RLC TX, DL RLC RX, UL DL TX, UL DL RX)
void SetUeAntennaAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE antenna, before it is created.
void SetUeChannelAccessManagerAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE channel access manager, before it is created.
bool GetSnrTest() const
GetSnrTest.
void EnableGnbPhyCtrlMsgsTraces()
Enable gNB PHY CTRL TX and RX traces.
~NrHelper() override
~NrHelper
void SetGnbBwpManagerAlgorithmTypeId(const TypeId &typeId)
Set the TypeId of the GNB BWP Manager. Works only before it is created.
static Ptr< BwpManagerUe > GetBwpManagerUe(const Ptr< NetDevice > &ueDevice)
Get the BwpManager of the UE.
void EnableDlMacSchedTraces()
void SetInitialAssocAttribute(const std::string &name, const AttributeValue &value)
Set attribute of the initial attachment algorithm.
void SetUeMacAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE MAC, before it is created.
void SetUlErrorModel(const std::string &errorModelTypeId)
Set the ErrorModel for UL AMC and UE spectrum at the same time.
void SetUeBwpManagerAlgorithmTypeId(const TypeId &typeId)
Set the TypeId of the UE BWP Manager. Works only before it is created.
void EnableUlPhyTraces()
Enable UL PHY traces.
void EnablePathlossTraces()
Enable trace sinks for DL and UL pathloss.
Ptr< NrMacRxTrace > GetMacRxTrace()
Get the mac stats trace object.
void AttachToClosestGnb(const NetDeviceContainer &ueDevices, const NetDeviceContainer &gnbDevices)
Attach the UE specified to the closest GNB.
void SetPmSearchAttribute(const std::string &name, const AttributeValue &value)
Set attribute of the precoding matrix search algorithm.
void SetGnbAntennaAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB antenna, before it is created.
void SetGnbAntennaTypeId(const std::string &)
Set a different TypeId for the GNB antenna device.
void SetupGnbAntennas(const AntennaParams &ap)
Set parameters for gNB and UE antenna arrays.
void AttachToMaxRsrpGnb(const NetDeviceContainer &ueDevices, const NetDeviceContainer &gnbDevices)
Attach the UE specified to the max RSRP associated GNB.
static Ptr< NrGnbPhy > GetGnbPhy(const Ptr< NetDevice > &gnbDevice, uint32_t bwpIndex)
Get a pointer to the PHY of the GNB at the specified BWP.
void AttachToGnb(const Ptr< NetDevice > &ueDevice, const Ptr< NetDevice > &gnbDevice)
Attach a UE to a particular GNB.
void EnableUlMacSchedTraces()
void SetGnbUlAmcAttribute(const std::string &n, const AttributeValue &v)
void SetInitialAssocTypeId(const TypeId &typeId)
Set TypeId of the initial attachment algorithm.
static uint32_t GetNumberBwp(const Ptr< const NetDevice > &gnbDevice)
Get the number of configured BWP for a specific GNB NetDevice.
void AddNrCsiRsFilter(Ptr< SpectrumChannel > channel)
void EnableGnbMacCtrlMsgsTraces()
Enable gNB MAC CTRL TX and RX traces.
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, NrEpsBearer bearer, Ptr< NrEpcTft > tft)
void SetUeChannelAccessManagerTypeId(const TypeId &typeId)
Set the TypeId of the UE Channel Access Manager. Works only before it is created.
void SetUeAntennaTypeId(const std::string &)
Set a different TypeId for the UE antenna device.
Ptr< NrBearerStatsCalculator > GetRlcStatsCalculator()
Get the RLC stats calculator object.
void EnableTransportBlockTrace()
Enable transport block trace.
void EnableGnbPacketCountTrace()
Enable gNB packet count trace.
void SetDlErrorModel(const std::string &errorModelTypeId)
Set the ErrorModel for DL AMC and GNB spectrum at the same time.
void EnableRlcE2eTraces()
Enable RLC calculator and end-to-end RCL traces to file.
void EnablePdcpSimpleTraces()
Enable PDCP traces (DL PDCP TX, DL PDCP RX, UL PDCP TX, UL PDCP RX)
static Ptr< NrMacScheduler > GetScheduler(const Ptr< NetDevice > &gnbDevice, uint32_t bwpIndex)
Get the Scheduler from the GNB specified.
void SetUeBwpManagerAlgorithmAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB BWP Manager, before it is created.
void SetEpcHelper(Ptr< NrEpcHelper > NrEpcHelper)
void SetGnbMacAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB MAC, before it is created.
void SetGnbPhyAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB PHY, before it is created.
void EnableDlCtrlPhyTraces()
Enable DL CTRL PHY traces.
void SetupUeAntennas(const AntennaParams &ap)
Set parameters for gNB and UE antenna arrays.
static Ptr< NrGnbMac > GetGnbMac(const Ptr< NetDevice > &gnbDevice, uint32_t bwpIndex)
Get a pointer to the MAC of the GNB at the specified BWP.
void SetUePhyAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE PHY, before it is created.
static Ptr< NrUePhy > GetUePhy(const Ptr< NetDevice > &ueDevice, uint32_t bwpIndex)
Get a pointer to the PHY of the UE at the specified BWP.
void SetupMimoPmi(const MimoPmiParams &mp)
Set parameters for PMI search in MIMO operation.
void EnableUePacketCountTrace()
Enable UE packet count trace.
static TypeId GetTypeId()
GetTypeId.
void SetUeSpectrumAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE spectrum, before it is created.
void SetSchedulerAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the scheduler, before it is created.
void EnableUeMacCtrlMsgsTraces()
Enable UE MAC CTRL TX and RX traces.
void SetSchedulerTypeId(const TypeId &typeId)
Set the Scheduler TypeId. Works only before it is created.
void SetGnbBwpManagerAlgorithmAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB BWP Manager, before it is created.
Ptr< NrPhyRxTrace > GetPhyRxTrace()
Get the phy traces object.
void SetGnbSpectrumAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB spectrum, before it is created.
NetDeviceContainer InstallUeDevice(const NodeContainer &c, const std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > &allBwps)
Install one (or more) UEs.
void SetGnbChannelAccessManagerAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB channel access manager, before it is created.
void EnablePdcpE2eTraces()
Enable PDCP calculator and end-to-end PDCP traces to file.
void SetGnbChannelAccessManagerTypeId(const TypeId &typeId)
Set the TypeId of the GNB Channel Access Manager. Works only before it is created.
void EnableFhControl()
Enable FH Control.
void SetGnbBeamManagerTypeId(const TypeId &typeId)
Set the TypeId of the beam manager.
void SetPmSearchTypeId(const TypeId &typeId)
Set TypeId of the precoding matrix search algorithm.
void SetSnrTest(bool snrTest)
SetSnrTest.
static TypeId GetTypeId()
Get the type ID.
static void RxedGnbMacCtrlMsgsCallback(Ptr< NrMacRxTrace > macStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void TxedGnbMacCtrlMsgsCallback(Ptr< NrMacRxTrace > macStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void RxedUeMacCtrlMsgsCallback(Ptr< NrMacRxTrace > macStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void TxedUeMacCtrlMsgsCallback(Ptr< NrMacRxTrace > macStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static TypeId GetTypeId()
GetTypeId.
static void UlSchedulingCallback(Ptr< NrMacSchedulingStats > macStats, std::string path, NrSchedulingCallbackInfo traceInfo)
static void DlSchedulingCallback(Ptr< NrMacSchedulingStats > macStats, std::string path, NrSchedulingCallbackInfo traceInfo)
static void RxedGnbPhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void ReportDlDataPathloss(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint8_t bwpId, uint32_t ueNodeId, double lossDb, uint8_t cqi)
Write DL DATA pathloss values in a file.
static void PathlossTraceCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
Trace sink for spectrum channel pathloss trace.
static void TxedGnbPhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void TxedUePhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void TxedUePhyHarqFeedbackCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, uint8_t harqId, uint32_t k1Delay)
static void RxedUePhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void DlCtrlSinrCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double avgSinr, uint16_t bwpId)
Trace sink for DL Average SINR of CTRL (in dB).
static void RxedUePhyDlDciCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, uint8_t harqId, uint32_t k1Delay)
static void DlDataSinrCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double avgSinr, uint16_t bwpId)
Trace sink for DL Average SINR of DATA (in dB).
static void ReportDlCtrlPathloss(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint8_t bwpId, uint32_t ueNodeId, double lossDb)
Write DL CTRL pathloss values in a file.
static TypeId GetTypeId()
Get TypeId.
Base class for searching optimal precoding matrices and creating full CQI/PMI feedback This is a most...
void SetGnbParams(bool isDualPol, size_t numHPorts, size_t numVPorts)
Set the antenna parameters of the gNB antenna.
void UpdateSinrPerceived(const SpectrumValue &sinr)
SpectrumPhy that will be called when the SINR for the received DATA is being calculated by the interf...
static TypeId GetTypeId()
Get the object TypeId.
std::function< void(const std::list< Ptr< NrControlMessage > > &, uint8_t)> NrPhyRxCtrlEndOkCallback
This callback method type is used to notify that CTRL is received.
void UpdateSrsSinrPerceived(const SpectrumValue &srsSinr)
SpectrumPhy that will be called when the SINR for the received SRS at gNB is being calculated by the ...
void UpdateMimoSinrPerceived(const std::vector< MimoSinrChunk > &sinr)
Store the SINR chunks for all received signals at end of interference calculations.
Callback< void, const DlHarqInfo & > NrPhyDlHarqFeedbackCallback
void ReportDlCtrlSinr(const SpectrumValue &sinr)
Called when DlCtrlSinr is fired.
The MAC class for the UE.
static TypeId GetTypeId()
Get the Type id.
The User Equipment NetDevice.
void RouteIngoingCtrlMsgs(const std::list< Ptr< NrControlMessage > > &msgList, uint8_t sourceBwpId)
The UE received a CTRL message list.
static TypeId GetTypeId()
GetTypeId.
void EnqueueDlHarqFeedback(const DlHarqInfo &m) const
Spectrum has calculated the HarqFeedback for one DL transmission, and give it to the NetDevice of the...
void ReceivePss(uint16_t cellId, const Ptr< SpectrumValue > &p)
Receive PSS and calculate RSRQ in dBm.
void CsiRsReceived(const std::vector< MimoSignalChunk > &csiRsSignal)
A callback function that is called from NrMimoChunkProcessor when CSI-RS is being received....
void GenerateDlCqiReport(const SpectrumValue &sinr)
Generate a DL CQI report.
void PdschMimoReceived(const std::vector< MimoSignalChunk > &pdschMimoChunks)
Function is called when PDSCH is received by the UE. It contains the channel and interference informa...
void PhyDataPacketReceived(const Ptr< Packet > &p)
Receive a PHY data packet.
void ReportRsReceivedPower(const SpectrumValue &power)
Called when rsReceivedPower is fired.
void CsiImEnded(const std::vector< MimoSignalChunk > &csiImSignalChunks)
Function is called when CSI-IM finishes, and this function triggers the update of the interference co...
static TypeId GetTypeId()
Get the object TypeId.
std::unique_ptr< BandwidthPartInfo > BandwidthPartInfoPtr
unique_ptr of BandwidthPartInfo
parameters of the gNB or UE antenna arrays
size_t nAntRows
Number of antenna element rows (vertical height)
bool isDualPolarized
true if antennas are cross-polarized (dual-polarized)
double downtiltAngle
Downtilt angle in radians.
double bearingAngle
Bearing angle in radians.
std::string antennaElem
Antenna type.
size_t nHorizPorts
Number of antenna ports in horizontal direction.
size_t nVertPorts
Number of antenna ports in vertical direction.
size_t nAntCols
Number of antenna element columns (horizontal width)
double polSlantAngle
Polarization slant angle in radians.
Parameters for initial attachment association.
double handoffMargin
Handoff margin for Initial assocc.
std::vector< double > rowAngles
vector of angles to set in initial assocc
double primaryCarrierIndex
primary carrier index for Initial assocc
std::vector< double > colAngles
vector of angles to set in initial assocc
parameters for the search of optimal rank and precoding matrix indicator (RI, PMI)
double rankThreshold
Limits the selection of ranks determined by SVD decomposition.
std::string downsamplingTechnique
Sub-band compression technique.
uint8_t subbandSize
Number of PRBs per subband for downsampling.
std::string rankTechnique
Select technique that determines ranks in non-exhaustive search.
std::string fullSearchCb
Codebook when using full-search algorithm.
std::string pmSearchMethod
Precoding matrix search algorithm.