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-epc-gnb-application.h"
27#include "ns3/nr-epc-ue-nas.h"
28#include "ns3/nr-epc-x2.h"
29#include "ns3/nr-fh-control.h"
30#include "ns3/nr-gnb-mac.h"
31#include "ns3/nr-gnb-net-device.h"
32#include "ns3/nr-gnb-phy.h"
33#include "ns3/nr-initial-association.h"
34#include "ns3/nr-mac-scheduler-tdma-rr.h"
35#include "ns3/nr-pm-search-full.h"
36#include "ns3/nr-rrc-protocol-ideal.h"
37#include "ns3/nr-rrc-protocol-real.h"
38#include "ns3/nr-ue-mac.h"
39#include "ns3/nr-ue-net-device.h"
40#include "ns3/nr-ue-phy.h"
41#include "ns3/nr-ue-rrc.h"
42#include "ns3/pointer.h"
43#include "ns3/three-gpp-channel-model.h"
44#include "ns3/three-gpp-propagation-loss-model.h"
45#include "ns3/three-gpp-spectrum-propagation-loss-model.h"
46#include "ns3/three-gpp-v2v-channel-condition-model.h"
47#include "ns3/three-gpp-v2v-propagation-loss-model.h"
48#include "ns3/uniform-planar-array.h"
56NS_LOG_COMPONENT_DEFINE(
"NrHelper");
58NS_OBJECT_ENSURE_REGISTERED(NrHelper);
62 NS_LOG_FUNCTION(
this);
63 m_channelFactory.SetTypeId(MultiModelSpectrumChannel::GetTypeId());
64 m_gnbNetDeviceFactory.SetTypeId(NrGnbNetDevice::GetTypeId());
75 m_ueAntennaFactory.SetTypeId(UniformPlanarArray::GetTypeId());
76 m_gnbAntennaFactory.SetTypeId(UniformPlanarArray::GetTypeId());
83 m_spectrumPropagationFactory.SetTypeId(ThreeGppSpectrumPropagationLossModel::GetTypeId());
89 m_pathlossModelFactory.SetTypeId(ThreeGppPropagationLossModel::GetTypeId());
90 m_channelConditionModelFactory.SetTypeId(ThreeGppChannelConditionModel::GetTypeId());
93 Config::SetDefault(
"ns3::NrEpsBearer::Release", UintegerValue(18));
98 NS_LOG_FUNCTION(
this);
99 if (m_beamformingHelper)
101 m_beamformingHelper->Dispose();
103 m_beamformingHelper =
nullptr;
110 TypeId(
"ns3::NrHelper")
112 .AddConstructor<NrHelper>()
113 .AddAttribute(
"EnableMimoFeedback",
114 "Generate CQI feedback with RI and PMI for MIMO support",
116 MakeBooleanAccessor(&NrHelper::m_enableMimoFeedback),
117 MakeBooleanChecker())
120 "Signals and measurements that will be used for CQI feedback if available."
121 "Supported configurations are: CQI_PDSCH_MIMO = 1, CQI_CSI_RS = 2, "
122 "CQI_PDSCH_MIMO|CQI_CSI_RS = 3, "
123 "CQI_CSI_RS|CQI_CSI_IM = 6, CQI_PDSCH_MIMO|CQI_CSI_RS|CQI_CSI_IM = 7, and "
124 "CQI_PDSCH_SISO = 8.",
125 UintegerValue(CQI_PDSCH_MIMO),
126 MakeUintegerAccessor(&NrHelper::m_csiFeedbackFlags),
127 MakeUintegerChecker<uint8_t>(0x0, 0x08))
128 .AddAttribute(
"PmSearchMethod",
129 "Type of the precoding matrix search method.",
133 .AddAttribute(
"UseIdealRrc",
134 "If true, NrRrcProtocolIdeal will be used for RRC signaling. "
135 "If false, NrRrcProtocolReal will be used.",
137 MakeBooleanAccessor(&NrHelper::m_useIdealRrc),
138 MakeBooleanChecker())
139 .AddAttribute(
"HandoverAlgorithm",
140 "The type of handover algorithm to be used for gNBs. "
141 "The allowed values for this attributes are the type names "
142 "of any class inheriting from ns3::LteHandoverAlgorithm.",
143 StringValue(
"ns3::NrNoOpHandoverAlgorithm"),
144 MakeStringAccessor(&NrHelper::SetHandoverAlgorithmType,
145 &NrHelper::GetHandoverAlgorithmType),
146 MakeStringChecker());
150std::pair<double, BandwidthPartInfoPtrVector>
152 const std::string& scenario,
153 const std::string& channelCondition,
154 const std::string& channelModel)
157 double totalBandwidth = 0.0;
158 auto channelHelper = CreateObject<NrChannelHelper>();
159 channelHelper->ConfigureFactories(scenario, channelCondition, channelModel);
160 for (
auto& bandConf : bandConfs)
163 totalBandwidth += bandConf.m_channelBandwidth;
165 std::vector<std::reference_wrapper<OperationBandInfo>> bandsRefs(m_bands.rbegin(),
169 channelHelper->AssignChannelsToBands(bandsRefs);
176 NS_LOG_FUNCTION(gnbDevice);
177 Ptr<const NrGnbNetDevice> netDevice = DynamicCast<const NrGnbNetDevice>(gnbDevice);
178 if (netDevice ==
nullptr)
182 return netDevice->GetCcMapSize();
188 NS_LOG_FUNCTION(gnbDevice << bwpIndex);
189 NS_ASSERT(bwpIndex < UINT8_MAX);
190 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
191 if (netDevice ==
nullptr)
195 return netDevice->GetPhy(
static_cast<uint8_t
>(bwpIndex));
201 NS_LOG_FUNCTION(gnbDevice << bwpIndex);
202 NS_ASSERT(bwpIndex < UINT8_MAX);
203 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
204 if (netDevice ==
nullptr)
208 return netDevice->GetMac(
static_cast<uint8_t
>(bwpIndex));
214 NS_LOG_FUNCTION(ueDevice << bwpIndex);
215 NS_ASSERT(bwpIndex < UINT8_MAX);
216 Ptr<NrUeNetDevice> netDevice = DynamicCast<NrUeNetDevice>(ueDevice);
217 if (netDevice ==
nullptr)
221 return netDevice->GetMac(
static_cast<uint8_t
>(bwpIndex));
227 NS_LOG_FUNCTION(ueDevice << bwpIndex);
228 NS_ASSERT(bwpIndex < UINT8_MAX);
229 Ptr<NrUeNetDevice> netDevice = DynamicCast<NrUeNetDevice>(ueDevice);
230 if (netDevice ==
nullptr)
234 return netDevice->GetPhy(
static_cast<uint8_t
>(bwpIndex));
240 NS_LOG_FUNCTION(gnbDevice);
242 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
243 if (netDevice ==
nullptr)
248 return netDevice->GetBwpManager();
254 NS_LOG_FUNCTION(ueDevice);
256 Ptr<NrUeNetDevice> netDevice = DynamicCast<NrUeNetDevice>(ueDevice);
257 if (netDevice ==
nullptr)
262 return netDevice->GetBwpManager();
268 NS_LOG_FUNCTION(gnbDevice << bwpIndex);
270 Ptr<NrGnbNetDevice> netDevice = DynamicCast<NrGnbNetDevice>(gnbDevice);
271 if (netDevice ==
nullptr)
276 return netDevice->GetScheduler(bwpIndex);
293 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>>& allBwps)
295 NS_LOG_FUNCTION(
this);
296 NetDeviceContainer devices;
297 for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
300 Ptr<NetDevice> device = InstallSingleUeDevice(node, allBwps);
301 device->SetAddress(Mac48Address::Allocate());
309 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps)
311 NS_LOG_FUNCTION(
this);
312 NetDeviceContainer devices;
313 for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
316 Ptr<NetDevice> device = InstallSingleGnbDevice(node, allBwps);
317 device->SetAddress(Mac48Address::Allocate());
326 for (uint32_t i = 0; i < netDevs.GetN(); i++)
328 auto ueNetDev = DynamicCast<NrUeNetDevice>(netDevs.Get(i));
329 auto gnbNetDev = DynamicCast<NrGnbNetDevice>(netDevs.Get(i));
332 std::cerr <<
"Deprecation warning: UpdateConfig is no longer needed for UE device types"
338 <<
"Deprecation warning: UpdateConfig is no longer needed for gNB device types"
345NrHelper::CreateUeMac()
const
347 NS_LOG_FUNCTION(
this);
348 Ptr<NrUeMac> mac = m_ueMacFactory.Create<
NrUeMac>();
353NrHelper::CreateUePhy(
const Ptr<Node>& n,
355 const Ptr<NrUeNetDevice>& dev,
359 NS_LOG_FUNCTION(
this);
361 Ptr<NrUePhy> phy = m_uePhyFactory.Create<NrUePhy>();
363 NS_ASSERT(bwp->GetChannel() !=
nullptr);
365 phy->InstallCentralFrequency(bwp->m_centralFrequency);
367 phy->ScheduleStartEventLoop(n->GetId(), 0, 0, 0);
370 Ptr<NrChAccessManager> cam =
371 DynamicCast<NrChAccessManager>(m_ueChannelAccessManagerFactory.Create());
376 phy->SetCsiFeedbackType(m_csiFeedbackFlags);
378 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
381 "MobilityModel needs to be set on node before calling NrHelper::InstallUeDevice ()");
383 Ptr<NrSpectrumPhy> channelPhy =
384 m_ueSpectrumFactory.Create<NrSpectrumPhy>();
386 channelPhy->SetPhyDlHarqFeedbackCallback(dlHarqCallback);
388 channelPhy->SetIsGnb(
false);
389 channelPhy->SetDevice(dev);
391 bool usingUniformPlanarArray =
392 m_ueAntennaFactory.GetTypeId() == UniformPlanarArray::GetTypeId();
394 for (
auto i = 0; i < channelPhy->GetNumPanels(); i++)
396 auto antenna = m_ueAntennaFactory.Create();
397 channelPhy->AddPanel(antenna);
399 if (usingUniformPlanarArray)
401 Ptr<BeamManager> beamManager = m_ueBeamManagerFactory.Create<BeamManager>();
402 auto uniformPlanarArray = DynamicCast<UniformPlanarArray>(antenna);
403 beamManager->Configure(uniformPlanarArray);
404 channelPhy->AddBeamManager(beamManager);
407 if (usingUniformPlanarArray)
410 channelPhy->ConfigPanelsBearingAngles();
413 cam->SetNrSpectrumPhy(channelPhy);
415 Ptr<NrChunkProcessor> pData = Create<NrChunkProcessor>();
417 channelPhy->AddDataSinrChunkProcessor(pData);
419 Ptr<NrMimoChunkProcessor> pDataMimo{
nullptr};
420 auto phasedChannel = bwp->GetChannel()->GetPhasedArraySpectrumPropagationLossModel();
423 pDataMimo = Create<NrMimoChunkProcessor>();
425 channelPhy->AddDataMimoChunkProcessor(pDataMimo);
427 if (m_csiFeedbackFlags & CQI_PDSCH_MIMO)
433 if (m_csiFeedbackFlags & CQI_CSI_RS)
435 Ptr<NrMimoChunkProcessor> pCsiRs = Create<NrMimoChunkProcessor>();
437 channelPhy->AddCsiRsMimoChunkProcessor(pCsiRs);
439 if (m_csiFeedbackFlags & CQI_CSI_IM)
441 Ptr<NrMimoChunkProcessor> pCsiIm = Create<NrMimoChunkProcessor>();
443 channelPhy->AddCsiImMimoChunkProcessor(pCsiIm);
447 if (!phasedChannel || (m_csiFeedbackFlags == CQI_PDSCH_SISO))
453 Ptr<NrChunkProcessor> pRs = Create<NrChunkProcessor>();
455 channelPhy->AddRsPowerChunkProcessor(pRs);
457 Ptr<NrChunkProcessor> pSinr = Create<NrChunkProcessor>();
459 channelPhy->AddDlCtrlSinrChunkProcessor(pSinr);
461 channelPhy->SetChannel(bwp->GetChannel());
462 channelPhy->InstallPhy(phy);
463 channelPhy->SetMobility(mm);
465 channelPhy->SetPhyRxCtrlEndOkCallback(phyRxCtrlCallback);
467 phy->InstallSpectrumPhy(channelPhy);
472NrHelper::InstallSingleUeDevice(
474 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps)
476 NS_LOG_FUNCTION(
this);
478 Ptr<NrUeNetDevice> dev = m_ueNetDeviceFactory.Create<NrUeNetDevice>();
481 std::map<uint8_t, Ptr<BandwidthPartUe>> ueCcMap;
484 for (uint32_t bwpId = 0; bwpId < allBwps.size(); ++bwpId)
486 Ptr<BandwidthPartUe> cc = CreateObject<BandwidthPartUe>();
487 double bwInKhz = allBwps[bwpId].get()->m_channelBandwidth / 1000.0;
488 NS_ABORT_MSG_IF(bwInKhz / 100.0 > 65535.0,
489 "A bandwidth of " << bwInKhz / 100.0 <<
" kHz cannot be represented");
490 cc->SetUlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
491 cc->SetDlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
495 auto mac = CreateUeMac();
498 auto phy = CreateUePhy(
500 allBwps[bwpId].get(),
505 phy->SetBwpId(bwpId);
510 cc->SetAsPrimary(
true);
514 cc->SetAsPrimary(
false);
517 ueCcMap.insert(std::make_pair(bwpId, cc));
520 Ptr<NrUeComponentCarrierManager> ccmUe =
521 DynamicCast<NrUeComponentCarrierManager>(CreateObject<BwpManagerUe>());
522 DynamicCast<BwpManagerUe>(ccmUe)->SetBwpManagerAlgorithm(
523 m_ueBwpManagerAlgoFactory.Create<BwpManagerAlgorithm>());
525 UintegerValue primaryUlIndex;
526 dev->GetAttribute(
"PrimaryUlIndex", primaryUlIndex);
527 NS_ASSERT_MSG(primaryUlIndex.Get() < ueCcMap.size(),
528 "UL primary index out of bounds. Configure PrimaryUlIndex attribute of "
529 "NrUeNetDevice correctly.");
531 Ptr<NrUeRrc> rrc = CreateObject<NrUeRrc>();
532 rrc->SetPrimaryUlIndex(primaryUlIndex.Get());
533 rrc->m_numberOfComponentCarriers = ueCcMap.size();
535 rrc->InitializeSap();
536 rrc->SetNrMacSapProvider(ccmUe->GetNrMacSapProvider());
538 rrc->SetNrCcmRrcSapProvider(ccmUe->GetNrCcmRrcSapProvider());
539 ccmUe->SetNrCcmRrcSapUser(rrc->GetNrCcmRrcSapUser());
540 ccmUe->SetNumberOfComponentCarriers(ueCcMap.size());
544 Ptr<NrUeRrcProtocolIdeal> rrcProtocol = CreateObject<NrUeRrcProtocolIdeal>();
545 rrcProtocol->SetUeRrc(rrc);
546 rrc->AggregateObject(rrcProtocol);
547 rrcProtocol->SetNrUeRrcSapProvider(rrc->GetNrUeRrcSapProvider());
548 rrc->SetNrUeRrcSapUser(rrcProtocol->GetNrUeRrcSapUser());
552 Ptr<nr::UeRrcProtocolReal> rrcProtocol = CreateObject<nr::UeRrcProtocolReal>();
553 rrcProtocol->SetUeRrc(rrc);
554 rrc->AggregateObject(rrcProtocol);
555 rrcProtocol->SetNrUeRrcSapProvider(rrc->GetNrUeRrcSapProvider());
556 rrc->SetNrUeRrcSapUser(rrcProtocol->GetNrUeRrcSapUser());
559 if (m_nrEpcHelper !=
nullptr)
561 rrc->SetUseRlcSm(
false);
565 rrc->SetUseRlcSm(
true);
567 Ptr<NrEpcUeNas> nas = CreateObject<NrEpcUeNas>();
569 nas->SetAsSapProvider(rrc->GetAsSapProvider());
571 nas->SetForwardUpCallback(MakeCallback(&NrUeNetDevice::Receive, dev));
573 rrc->SetAsSapUser(nas->GetAsSapUser());
575 for (
auto& it : ueCcMap)
577 rrc->SetNrUeCmacSapProvider(it.second->GetMac()->GetUeCmacSapProvider(), it.first);
578 it.second->GetMac()->SetUeCmacSapUser(rrc->GetNrUeCmacSapUser(it.first));
580 it.second->GetPhy()->SetUeCphySapUser(rrc->GetNrUeCphySapUser());
581 rrc->SetNrUeCphySapProvider(it.second->GetPhy()->GetUeCphySapProvider(), it.first);
583 it.second->GetPhy()->SetPhySapUser(it.second->GetMac()->GetPhySapUser());
584 it.second->GetMac()->SetPhySapProvider(it.second->GetPhy()->GetPhySapProvider());
587 ccmUe->SetComponentCarrierMacSapProviders(it.first,
588 it.second->GetMac()->GetUeMacSapProvider());
592 NS_FATAL_ERROR(
"Error in SetComponentCarrierMacSapProviders");
596 dev->SetCcMap(ueCcMap);
597 dev->SetAttribute(
"nrUeRrc", PointerValue(rrc));
598 dev->SetAttribute(
"NrEpcUeNas", PointerValue(nas));
599 dev->SetAttribute(
"NrUeComponentCarrierManager", PointerValue(ccmUe));
600 dev->SetAttribute(
"Imsi", UintegerValue(n->GetId()));
604 if (m_nrEpcHelper !=
nullptr)
606 m_nrEpcHelper->AddUe(dev, dev->GetImsi());
609 rrc->InitializeSrb0();
614NrHelper::CreateGnbPhy(
const Ptr<Node>& n,
616 const Ptr<NrGnbNetDevice>& dev,
619 NS_LOG_FUNCTION(
this);
621 Ptr<NrGnbPhy> phy = m_gnbPhyFactory.Create<NrGnbPhy>();
623 DoubleValue frequency;
624 phy->InstallCentralFrequency(bwp->m_centralFrequency);
626 phy->ScheduleStartEventLoop(n->GetId(), 0, 0, 0);
629 Ptr<NrChAccessManager> cam =
630 DynamicCast<NrChAccessManager>(m_gnbChannelAccessManagerFactory.Create());
634 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
637 "MobilityModel needs to be set on node before calling NrHelper::InstallGnbDevice ()");
639 Ptr<NrSpectrumPhy> channelPhy = m_gnbSpectrumFactory.Create<NrSpectrumPhy>();
640 auto antenna = m_gnbAntennaFactory.Create();
641 channelPhy->SetAntenna(antenna);
642 cam->SetNrSpectrumPhy(channelPhy);
644 channelPhy->SetIsGnb(
true);
645 channelPhy->SetDevice(dev);
646 channelPhy->SetChannel(
649 channelPhy->InstallPhy(phy);
651 Ptr<NrChunkProcessor> pData =
652 Create<NrChunkProcessor>();
653 Ptr<NrChunkProcessor> pSrs =
654 Create<NrChunkProcessor>();
655 auto phasedChannel = bwp->GetChannel()->GetPhasedArraySpectrumPropagationLossModel();
670 auto pDataMimo = Create<NrMimoChunkProcessor>();
671 pDataMimo->AddCallback(
673 channelPhy->AddDataMimoChunkProcessor(pDataMimo);
676 channelPhy->AddDataSinrChunkProcessor(pData);
677 channelPhy->AddSrsSinrChunkProcessor(pSrs);
678 channelPhy->SetMobility(mm);
679 channelPhy->SetPhyRxDataEndOkCallback(
681 channelPhy->SetPhyRxCtrlEndOkCallback(phyEndCtrlCallback);
683 channelPhy->SetPhyUlHarqFeedbackCallback(
686 auto uniformPlanarArray = DynamicCast<UniformPlanarArray>(antenna);
687 if (uniformPlanarArray)
689 Ptr<BeamManager> beamManager = m_gnbBeamManagerFactory.Create<BeamManager>();
690 beamManager->Configure(uniformPlanarArray);
691 channelPhy->SetBeamManager(beamManager);
693 phy->InstallSpectrumPhy(channelPhy);
694 if ((m_csiFeedbackFlags & CQI_CSI_RS) && phasedChannel)
702NrHelper::CreateGnbMac()
704 NS_LOG_FUNCTION(
this);
706 Ptr<NrGnbMac> mac = m_gnbMacFactory.Create<NrGnbMac>();
711NrHelper::CreateGnbSched()
713 NS_LOG_FUNCTION(
this);
715 auto sched = m_schedFactory.Create<NrMacSchedulerNs3>();
716 auto dlAmc = m_gnbDlAmcFactory.Create<NrAmc>();
717 auto ulAmc = m_gnbUlAmcFactory.Create<NrAmc>();
719 sched->InstallDlAmc(dlAmc);
720 sched->InstallUlAmc(ulAmc);
726NrHelper::CreateNrFhControl()
728 NS_LOG_FUNCTION(
this);
730 Ptr<NrFhControl> fhControl = m_fhControlFactory.Create<NrFhControl>();
735NrHelper::InstallSingleGnbDevice(
737 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps)
739 NS_ABORT_MSG_IF(m_cellIdCounter == 65535,
"max num gNBs exceeded");
741 Ptr<NrGnbNetDevice> dev = m_gnbNetDeviceFactory.Create<NrGnbNetDevice>();
743 NS_LOG_DEBUG(
"Creating gNB, cellId = " << m_cellIdCounter);
744 uint16_t cellId = m_cellIdCounter++;
745 dev->SetCellId(cellId);
749 std::map<uint8_t, Ptr<BandwidthPartGnb>> ccMap;
751 auto fhControl = CreateNrFhControl();
752 fhControl->SetPhysicalCellId(cellId);
756 dev->SetNrFhControl(fhControl);
759 for (uint32_t bwpId = 0; bwpId < allBwps.size(); ++bwpId)
761 NS_LOG_DEBUG(
"Creating BandwidthPart, id = " << bwpId);
762 Ptr<BandwidthPartGnb> cc = CreateObject<BandwidthPartGnb>();
763 double bwInKhz = allBwps[bwpId].get()->m_channelBandwidth / 1000.0;
764 NS_ABORT_MSG_IF(bwInKhz / 100.0 > 65535.0,
765 "A bandwidth of " << bwInKhz / 100.0 <<
" kHz cannot be represented");
767 cc->SetUlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
768 cc->SetDlBandwidth(
static_cast<uint16_t
>(bwInKhz / 100));
771 cc->SetCellId(cellId);
772 cc->SetCsgId(m_cellIdCounter++);
774 auto phy = CreateGnbPhy(
776 allBwps[bwpId].get(),
779 phy->SetBwpId(bwpId);
782 auto mac = CreateGnbMac();
784 phy->GetCam()->SetNrGnbMac(mac);
786 auto sched = CreateGnbSched();
787 cc->SetNrMacScheduler(sched);
791 cc->SetAsPrimary(
true);
795 cc->SetAsPrimary(
false);
798 ccMap.insert(std::make_pair(bwpId, cc));
801 Ptr<NrGnbRrc> rrc = CreateObject<NrGnbRrc>();
802 Ptr<NrGnbComponentCarrierManager> ccmGnbManager =
803 DynamicCast<NrGnbComponentCarrierManager>(CreateObject<BwpManagerGnb>());
804 DynamicCast<BwpManagerGnb>(ccmGnbManager)
805 ->SetBwpManagerAlgorithm(m_gnbBwpManagerAlgoFactory.Create<BwpManagerAlgorithm>());
810 std::map<uint8_t, Ptr<BandwidthPartGnb>> ccPhyConfMap;
811 for (
const auto& i : ccMap)
813 Ptr<BandwidthPartGnb> c = i.second;
814 ccPhyConfMap.insert(std::make_pair(i.first, c));
818 rrc->SetNrCcmRrcSapProvider(ccmGnbManager->GetNrCcmRrcSapProvider());
819 ccmGnbManager->SetNrCcmRrcSapUser(rrc->GetNrCcmRrcSapUser());
823 ccmGnbManager->SetNumberOfComponentCarriers(ccMap.size());
824 rrc->ConfigureCarriers(ccPhyConfMap);
829 Ptr<NrGnbRrcProtocolIdeal> rrcProtocol = CreateObject<NrGnbRrcProtocolIdeal>();
830 rrcProtocol->SetNrGnbRrcSapProvider(rrc->GetNrGnbRrcSapProvider());
831 rrc->SetNrGnbRrcSapUser(rrcProtocol->GetNrGnbRrcSapUser());
832 rrc->AggregateObject(rrcProtocol);
836 Ptr<nr::NrGnbRrcProtocolReal> rrcProtocol = CreateObject<nr::NrGnbRrcProtocolReal>();
837 rrcProtocol->SetNrGnbRrcSapProvider(rrc->GetNrGnbRrcSapProvider());
838 rrc->SetNrGnbRrcSapUser(rrcProtocol->GetNrGnbRrcSapUser());
839 rrc->AggregateObject(rrcProtocol);
842 if (m_nrEpcHelper !=
nullptr)
844 EnumValue<NrGnbRrc::NrEpsBearerToRlcMapping_t> epsBearerToRlcMapping;
845 rrc->GetAttribute(
"EpsBearerToRlcMapping", epsBearerToRlcMapping);
847 if (epsBearerToRlcMapping.Get() == NrGnbRrc::RLC_SM_ALWAYS)
849 rrc->SetAttribute(
"EpsBearerToRlcMapping", EnumValue(NrGnbRrc::RLC_UM_ALWAYS));
862 rrc->SetNrMacSapProvider(ccmGnbManager->GetNrMacSapProvider());
863 rrc->SetForwardUpCallback(MakeCallback(&NrGnbNetDevice::Receive, dev));
865 for (
auto& it : ccMap)
867 it.second->GetPhy()->SetGnbCphySapUser(rrc->GetNrGnbCphySapUser(it.first));
868 rrc->SetNrGnbCphySapProvider(it.second->GetPhy()->GetGnbCphySapProvider(), it.first);
870 rrc->SetNrGnbCmacSapProvider(it.second->GetMac()->GetGnbCmacSapProvider(), it.first);
871 it.second->GetMac()->SetGnbCmacSapUser(rrc->GetNrGnbCmacSapUser(it.first));
874 it.second->GetPhy()->SetPhySapUser(it.second->GetMac()->GetPhySapUser());
875 it.second->GetMac()->SetPhySapProvider(it.second->GetPhy()->GetPhySapProvider());
879 it.second->GetMac()->SetNrMacSchedSapProvider(
880 it.second->GetScheduler()->GetMacSchedSapProvider());
881 it.second->GetMac()->SetNrMacCschedSapProvider(
882 it.second->GetScheduler()->GetMacCschedSapProvider());
884 it.second->GetScheduler()->SetMacSchedSapUser(it.second->GetMac()->GetNrMacSchedSapUser());
885 it.second->GetScheduler()->SetMacCschedSapUser(
886 it.second->GetMac()->GetNrMacCschedSapUser());
889 it.second->GetMac()->SetNrCcmMacSapUser(ccmGnbManager->GetNrCcmMacSapUser());
890 ccmGnbManager->SetCcmMacSapProviders(it.first,
891 it.second->GetMac()->GetNrCcmMacSapProvider());
895 ccmGnbManager->SetMacSapProvider(it.first, it.second->GetMac()->GetMacSapProvider());
901 it.second->GetScheduler()->SetNrFhSchedSapProvider(
902 dev->GetNrFhControl()->GetNrFhSchedSapProvider());
903 dev->GetNrFhControl()->SetNrFhSchedSapUser(
905 it.second->GetScheduler()->GetNrFhSchedSapUser());
906 it.second->GetPhy()->SetNrFhPhySapProvider(
907 dev->GetNrFhControl()->GetNrFhPhySapProvider());
908 dev->GetNrFhControl()->SetNrFhPhySapUser(it.first,
909 it.second->GetPhy()->GetNrFhPhySapUser());
913 dev->SetAttribute(
"NrGnbComponentCarrierManager", PointerValue(ccmGnbManager));
914 dev->SetCcMap(ccMap);
915 dev->SetAttribute(
"NrGnbRrc", PointerValue(rrc));
919 if (m_nrEpcHelper !=
nullptr)
921 NS_LOG_INFO(
"adding this gNB to the EPC");
922 m_nrEpcHelper->AddGnb(n, dev, dev->GetCellIds());
923 Ptr<NrEpcGnbApplication> gnbApp = n->GetApplication(0)->GetObject<NrEpcGnbApplication>();
924 NS_ASSERT_MSG(gnbApp !=
nullptr,
"cannot retrieve NrEpcGnbApplication");
927 rrc->SetS1SapProvider(gnbApp->GetS1SapProvider());
928 gnbApp->SetS1SapUser(rrc->GetS1SapUser());
931 Ptr<NrEpcX2> x2 = n->GetObject<NrEpcX2>();
932 x2->SetEpcX2SapUser(rrc->GetEpcX2SapUser());
933 rrc->SetEpcX2SapProvider(x2->GetEpcX2SapProvider());
939NrHelper::GetHandoverAlgorithmType()
const
941 return m_handoverAlgorithmFactory.GetTypeId().GetName();
945NrHelper::SetHandoverAlgorithmType(std::string type)
947 NS_LOG_FUNCTION(
this << type);
948 m_handoverAlgorithmFactory = ObjectFactory();
949 m_handoverAlgorithmFactory.SetTypeId(type);
953NrHelper::SetHandoverAlgorithmAttribute(std::string n,
const AttributeValue& v)
955 NS_LOG_FUNCTION(
this << n);
956 m_handoverAlgorithmFactory.Set(n, v);
960NrHelper::AddX2Interface(NodeContainer gnbNodes)
962 NS_LOG_FUNCTION(
this);
964 NS_ASSERT_MSG(m_nrEpcHelper,
"X2 interfaces cannot be set up when the EPC is not used");
966 for (
auto i = gnbNodes.Begin(); i != gnbNodes.End(); ++i)
968 for (
auto j = i + 1; j != gnbNodes.End(); ++j)
970 AddX2Interface(*i, *j);
976NrHelper::AddX2Interface(Ptr<Node> gnbNode1, Ptr<Node> gnbNode2)
978 NS_LOG_FUNCTION(
this);
979 NS_LOG_INFO(
"setting up the X2 interface");
981 m_nrEpcHelper->AddX2Interface(gnbNode1, gnbNode2);
985NrHelper::HandoverRequest(Time hoTime,
986 Ptr<NetDevice> ueDev,
987 Ptr<NetDevice> sourceGnbDev,
988 Ptr<NetDevice> targetGnbDev)
990 NS_LOG_FUNCTION(
this << ueDev << sourceGnbDev << targetGnbDev);
991 NS_ASSERT_MSG(m_nrEpcHelper,
992 "Handover requires the use of the EPC - did you forget to call "
993 "NrHelper::SetEpcHelper () ?");
994 uint16_t targetCellId = targetGnbDev->GetObject<NrGnbNetDevice>()->GetCellId();
995 Simulator::Schedule(hoTime,
996 &NrHelper::DoHandoverRequest,
1004NrHelper::HandoverRequest(Time hoTime,
1005 Ptr<NetDevice> ueDev,
1006 Ptr<NetDevice> sourceGnbDev,
1007 uint16_t targetCellId)
1009 NS_LOG_FUNCTION(
this << ueDev << sourceGnbDev << targetCellId);
1010 NS_ASSERT_MSG(m_nrEpcHelper,
1011 "Handover requires the use of the EPC - did you forget to call "
1012 "NrHelper::SetEpcHelper () ?");
1013 Simulator::Schedule(hoTime,
1014 &NrHelper::DoHandoverRequest,
1022NrHelper::DoHandoverRequest(Ptr<NetDevice> ueDev,
1023 Ptr<NetDevice> sourceGnbDev,
1024 uint16_t targetCellId)
1026 NS_LOG_FUNCTION(
this << ueDev << sourceGnbDev << targetCellId);
1028 Ptr<NrGnbRrc> sourceRrc = sourceGnbDev->GetObject<NrGnbNetDevice>()->GetRrc();
1029 uint16_t rnti = ueDev->GetObject<NrUeNetDevice>()->GetRrc()->GetRnti();
1030 sourceRrc->SendHandoverRequest(rnti, targetCellId);
1035 const NetDeviceContainer& enbDevices)
1037 NS_LOG_FUNCTION(
this);
1038 NS_ASSERT_MSG(enbDevices.GetN() > 0,
"gNB container should not be empty");
1039 for (
auto i = ueDevices.Begin(); i != ueDevices.End(); i++)
1044 auto ueNetDevCast = DynamicCast<NrUeNetDevice>(*i);
1045 auto gnbNetDevCast = DynamicCast<NrGnbNetDevice>(enbDevices.Get(0));
1046 ueNetDevCast->GetPhy(0)->SetNumerology(gnbNetDevCast->GetPhy(0)->GetNumerology());
1057 NS_LOG_FUNCTION(
this);
1059 NS_ASSERT_MSG(enbDevices.GetN() > 0,
"empty enb device container");
1062 ueDevice->GetObject<
NrUeNetDevice>()->SetInitAssoc(nrInitAssoc);
1064 nrInitAssoc->SetUeDevice(ueDevice);
1065 nrInitAssoc->SetGnbDevices(enbDevices);
1066 nrInitAssoc->SetColBeamAngles(m_initialParams.
colAngles);
1067 nrInitAssoc->SetRowBeamAngles(m_initialParams.
rowAngles);
1068 nrInitAssoc->FindAssociatedGnb();
1069 auto maxRsrpEnbDevice = nrInitAssoc->GetAssociatedGnb();
1070 NS_ASSERT(maxRsrpEnbDevice);
1077 const NetDeviceContainer& gnbDevices)
1079 NS_LOG_FUNCTION(
this);
1081 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); i++)
1090 NS_LOG_FUNCTION(
this);
1091 NS_ASSERT_MSG(gnbDevices.GetN() > 0,
"empty gnb device container");
1092 double minDistance = std::numeric_limits<double>::infinity();
1093 Ptr<NetDevice> closestGnbDevice;
1094 for (NetDeviceContainer::Iterator i = gnbDevices.Begin(); i != gnbDevices.End(); ++i)
1096 Vector gnbpos = (*i)->GetNode()->GetObject<MobilityModel>()->GetPosition();
1097 Vector uepos = ueDevice->GetNode()->GetObject<MobilityModel>()->GetPosition();
1098 auto wraparoundModel =
1099 ueDevice->GetNode()->GetObject<MobilityModel>()->GetObject<HexagonalWraparoundModel>();
1100 if (wraparoundModel)
1102 uepos = wraparoundModel->GetRelativeVirtualPosition(gnbpos, uepos);
1105 double distance = CalculateDistance(uepos, gnbpos);
1106 if (distance < minDistance)
1108 minDistance = distance;
1109 closestGnbDevice = *i;
1112 NS_ASSERT(closestGnbDevice);
1120 Ptr<NrGnbNetDevice> gnbNetDev = gnbDevice->GetObject<
NrGnbNetDevice>();
1121 Ptr<NrUeNetDevice> ueNetDev = ueDevice->GetObject<
NrUeNetDevice>();
1123 NS_ABORT_IF(gnbNetDev ==
nullptr || ueNetDev ==
nullptr);
1125 if (!gnbNetDev->IsCellConfigured())
1127 gnbNetDev->ConfigureCell();
1129 for (uint32_t i = 0; i < gnbNetDev->GetCcMapSize(); ++i)
1131 gnbNetDev->GetPhy(i)->RegisterUe(ueNetDev->GetImsi(), ueNetDev);
1132 ueNetDev->GetPhy(i)->RegisterToGnb(gnbNetDev->GetBwpId(i));
1133 ueNetDev->GetPhy(i)->SetDlAmc(
1134 DynamicCast<NrMacSchedulerNs3>(gnbNetDev->GetScheduler(i))->GetDlAmc());
1135 ueNetDev->GetPhy(i)->SetDlCtrlSyms(gnbNetDev->GetMac(i)->GetDlCtrlSyms());
1136 ueNetDev->GetPhy(i)->SetUlCtrlSyms(gnbNetDev->GetMac(i)->GetUlCtrlSyms());
1137 ueNetDev->GetPhy(i)->SetNumRbPerRbg(gnbNetDev->GetMac(i)->GetNumRbPerRbg());
1138 ueNetDev->GetPhy(i)->SetRbOverhead(gnbNetDev->GetPhy(i)->GetRbOverhead());
1139 ueNetDev->GetPhy(i)->SetSymbolsPerSlot(gnbNetDev->GetPhy(i)->GetSymbolsPerSlot());
1140 ueNetDev->GetPhy(i)->SetNumerology(gnbNetDev->GetPhy(i)->GetNumerology());
1141 ueNetDev->GetPhy(i)->SetPattern(gnbNetDev->GetPhy(i)->GetPattern());
1142 Ptr<NrEpcUeNas> ueNas = ueNetDev->GetNas();
1143 ueNas->Connect(gnbNetDev->GetBwpId(i), gnbNetDev->GetEarfcn(i));
1145 if (m_enableMimoFeedback)
1148 auto pmSearch = m_pmSearchFactory.Create<
NrPmSearch>();
1149 ueNetDev->GetPhy(i)->SetPmSearch(pmSearch);
1151 gnbNetDev->GetPhy(i)->GetSpectrumPhy()->GetAntenna()->GetObject<PhasedArrayModel>();
1153 ueNetDev->GetPhy(i)->GetSpectrumPhy()->GetAntenna()->GetObject<PhasedArrayModel>();
1155 gnbAnt->GetNumHorizontalPorts(),
1156 gnbAnt->GetNumVerticalPorts());
1157 pmSearch->SetUeParams(ueAnt->GetNumPorts());
1158 pmSearch->InitCodebooks();
1165 m_nrEpcHelper->ActivateEpsBearer(ueDevice,
1166 ueNetDev->GetImsi(),
1174 ueNetDev->SetTargetGnb(gnbNetDev);
1177 if (m_beamformingHelper)
1179 m_beamformingHelper->AddBeamformingTask(gnbNetDev, ueNetDev);
1188 NS_LOG_FUNCTION(
this);
1189 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1200 NS_LOG_FUNCTION(
this);
1202 NS_ASSERT_MSG(m_nrEpcHelper,
"dedicated EPS bearers cannot be set up when the EPC is not used");
1204 uint64_t imsi = ueDevice->GetObject<
NrUeNetDevice>()->GetImsi();
1205 uint8_t bearerId = m_nrEpcHelper->ActivateEpsBearer(ueDevice, imsi, tft, bearer);
1211 Ptr<NetDevice> gnbDevice,
1214 NS_LOG_FUNCTION(
this << ueDevice << bearerId);
1215 NS_ASSERT_MSG(m_nrEpcHelper !=
nullptr,
1216 "Dedicated EPS bearers cannot be de-activated when the EPC is not used");
1217 NS_ASSERT_MSG(bearerId != 1,
1218 "Default bearer cannot be de-activated until and unless and UE is released");
1220 DoDeActivateDedicatedEpsBearer(ueDevice, gnbDevice, bearerId);
1226 NS_LOG_FUNCTION(
this);
1227 m_ueMacFactory.Set(n, v);
1233 NS_LOG_FUNCTION(
this);
1234 m_gnbMacFactory.Set(n, v);
1240 NS_LOG_FUNCTION(
this);
1241 m_gnbSpectrumFactory.Set(n, v);
1247 NS_LOG_FUNCTION(
this);
1248 m_ueSpectrumFactory.Set(n, v);
1254 NS_LOG_FUNCTION(
this);
1255 m_ueChannelAccessManagerFactory.Set(n, v);
1261 NS_LOG_FUNCTION(
this);
1262 m_gnbChannelAccessManagerFactory.Set(n, v);
1268 NS_LOG_FUNCTION(
this);
1269 m_schedFactory.Set(n, v);
1275 NS_LOG_FUNCTION(
this);
1276 m_uePhyFactory.Set(n, v);
1282 NS_LOG_FUNCTION(
this);
1283 m_gnbPhyFactory.Set(n, v);
1289 NS_LOG_FUNCTION(
this);
1290 m_ueAntennaFactory.Set(n, v);
1296 NS_LOG_FUNCTION(
this);
1297 m_gnbAntennaFactory.Set(n, v);
1303 NS_LOG_FUNCTION(
this);
1304 m_ueAntennaFactory.SetTypeId(typeId);
1310 NS_LOG_FUNCTION(
this);
1311 m_gnbAntennaFactory.SetTypeId(typeId);
1317 NS_LOG_FUNCTION(
this);
1318 m_ueChannelAccessManagerFactory.SetTypeId(typeId);
1324 NS_LOG_FUNCTION(
this);
1325 m_gnbChannelAccessManagerFactory.SetTypeId(typeId);
1331 NS_LOG_FUNCTION(
this);
1332 m_schedFactory.SetTypeId(typeId);
1338 NS_LOG_FUNCTION(
this);
1339 m_ueBwpManagerAlgoFactory.SetTypeId(typeId);
1345 NS_LOG_FUNCTION(
this);
1346 m_ueBwpManagerAlgoFactory.Set(n, v);
1352 NS_LOG_FUNCTION(
this);
1353 m_gnbDlAmcFactory.Set(n, v);
1359 NS_LOG_FUNCTION(
this);
1360 m_gnbUlAmcFactory.Set(n, v);
1364NrHelper::SetGnbBeamManagerAttribute(
const std::string& n,
const AttributeValue& v)
1366 NS_LOG_FUNCTION(
this);
1367 m_gnbBeamManagerFactory.Set(n, v);
1373 NS_LOG_FUNCTION(
this);
1374 m_gnbBeamManagerFactory.SetTypeId(typeId);
1378NrHelper::SetFhControlAttribute(
const std::string& n,
const AttributeValue& v)
1380 NS_LOG_FUNCTION(
this);
1381 m_fhControlFactory.Set(n, v);
1387 NS_LOG_FUNCTION(
this);
1396 NS_LOG_FUNCTION(
this);
1411 for (NetDeviceContainer::Iterator i = gnbNetDevices.Begin(); i != gnbNetDevices.End(); ++i)
1413 Ptr<NrGnbNetDevice> gnbNetDev = DynamicCast<NrGnbNetDevice>(*i);
1415 for (uint32_t j = 0; j < gnbNetDev->GetCcMapSize(); j++)
1417 gnbNetDev->GetNrFhControl()->SetFhNumerology(j, gnbNetDev->GetPhy(j)->GetNumerology());
1419 gnbNetDev->GetNrFhControl()->SetErrorModelType(
1420 DynamicCast<NrMacSchedulerNs3>(gnbNetDev->GetScheduler(j))
1422 ->GetErrorModelType()
1431 int64_t currentStream = stream;
1432 Ptr<NetDevice> netDevice;
1433 for (NetDeviceContainer::Iterator i = c.Begin(); i != c.End(); ++i)
1436 Ptr<NrGnbNetDevice> nrGnb = DynamicCast<NrGnbNetDevice>(netDevice);
1439 for (uint32_t bwp = 0; bwp < nrGnb->GetCcMapSize(); bwp++)
1441 currentStream += nrGnb->GetPhy(bwp)->GetSpectrumPhy()->AssignStreams(currentStream);
1442 currentStream += nrGnb->GetScheduler(bwp)->AssignStreams(currentStream);
1444 DoAssignStreamsToChannelObjects(nrGnb->GetPhy(bwp)->GetSpectrumPhy(),
1449 Ptr<NrUeNetDevice> nrUe = DynamicCast<NrUeNetDevice>(netDevice);
1452 for (uint32_t bwp = 0; bwp < nrUe->GetCcMapSize(); bwp++)
1454 currentStream += nrUe->GetPhy(bwp)->GetSpectrumPhy()->AssignStreams(currentStream);
1455 currentStream += nrUe->GetMac(bwp)->AssignStreams(currentStream);
1457 DoAssignStreamsToChannelObjects(nrUe->GetPhy(bwp)->GetSpectrumPhy(),
1463 return (currentStream - stream);
1467NrHelper::DoAssignStreamsToChannelObjects(Ptr<NrSpectrumPhy> phy, int64_t currentStream)
1469 int64_t initialStream = currentStream;
1471 Ptr<ThreeGppPropagationLossModel> propagationLossModel =
1472 DynamicCast<ThreeGppPropagationLossModel>(
1473 phy->GetSpectrumChannel()->GetPropagationLossModel());
1474 if (!propagationLossModel)
1477 phy->GetSpectrumChannel()->GetPropagationLossModel()->AssignStreams(currentStream);
1478 return currentStream - initialStream;
1481 if (std::find(m_channelObjectsWithAssignedStreams.begin(),
1482 m_channelObjectsWithAssignedStreams.end(),
1483 propagationLossModel) == m_channelObjectsWithAssignedStreams.end())
1485 currentStream += propagationLossModel->AssignStreams(currentStream);
1486 m_channelObjectsWithAssignedStreams.emplace_back(propagationLossModel);
1489 Ptr<ChannelConditionModel> channelConditionModel =
1490 propagationLossModel->GetChannelConditionModel();
1492 if (std::find(m_channelObjectsWithAssignedStreams.begin(),
1493 m_channelObjectsWithAssignedStreams.end(),
1494 channelConditionModel) == m_channelObjectsWithAssignedStreams.end())
1496 currentStream += channelConditionModel->AssignStreams(currentStream);
1497 m_channelObjectsWithAssignedStreams.emplace_back(channelConditionModel);
1500 Ptr<ThreeGppSpectrumPropagationLossModel> spectrumLossModel =
1501 DynamicCast<ThreeGppSpectrumPropagationLossModel>(
1502 phy->GetSpectrumChannel()->GetPhasedArraySpectrumPropagationLossModel());
1504 if (spectrumLossModel)
1506 if (std::find(m_channelObjectsWithAssignedStreams.begin(),
1507 m_channelObjectsWithAssignedStreams.end(),
1508 spectrumLossModel) == m_channelObjectsWithAssignedStreams.end())
1510 Ptr<ThreeGppChannelModel> channel =
1511 DynamicCast<ThreeGppChannelModel>(spectrumLossModel->GetChannelModel());
1512 currentStream += channel->AssignStreams(currentStream);
1513 m_channelObjectsWithAssignedStreams.emplace_back(spectrumLossModel);
1517 return currentStream - initialStream;
1523 NS_LOG_FUNCTION(
this);
1524 m_gnbBwpManagerAlgoFactory.SetTypeId(typeId);
1530 NS_LOG_FUNCTION(
this);
1531 m_gnbBwpManagerAlgoFactory.Set(n, v);
1535NrHelper::DoDeActivateDedicatedEpsBearer(Ptr<NetDevice> ueDevice,
1536 Ptr<NetDevice> gnbDevice,
1539 NS_LOG_FUNCTION(
this << ueDevice << bearerId);
1542 uint64_t imsi = ueDevice->GetObject<
NrUeNetDevice>()->GetImsi();
1543 uint16_t rnti = ueDevice->GetObject<
NrUeNetDevice>()->GetRrc()->GetRnti();
1545 Ptr<NrGnbRrc> gnbRrc = gnbDevice->GetObject<
NrGnbNetDevice>()->GetRrc();
1547 gnbRrc->DoSendReleaseDataRadioBearer(imsi, rnti, bearerId);
1559 m_beamformingHelper = beamformingHelper;
1560 m_beamformingHelper->Initialize();
1563class NrDrbActivator :
public SimpleRefCount<NrDrbActivator>
1566 NrDrbActivator(Ptr<NetDevice> ueDevice,
NrEpsBearer bearer);
1567 static void ActivateCallback(Ptr<NrDrbActivator> a,
1568 std::string context,
1572 void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti);
1576 Ptr<NetDevice> m_ueDevice;
1581NrDrbActivator::NrDrbActivator(Ptr<NetDevice> ueDevice, NrEpsBearer bearer)
1583 m_ueDevice(ueDevice),
1585 m_imsi(m_ueDevice->GetObject<NrUeNetDevice>()->GetImsi())
1590NrDrbActivator::ActivateCallback(Ptr<NrDrbActivator> a,
1591 std::string context,
1596 NS_LOG_FUNCTION(a << context << imsi << cellId << rnti);
1597 a->ActivateDrb(imsi, cellId, rnti);
1601NrDrbActivator::ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
1603 NS_LOG_FUNCTION(
this << imsi << cellId << rnti << m_active);
1604 if ((!m_active) && (imsi == m_imsi))
1606 Ptr<NrUeRrc> ueRrc = m_ueDevice->GetObject<NrUeNetDevice>()->GetRrc();
1607 NS_ASSERT(ueRrc->GetState() == NrUeRrc::CONNECTED_NORMALLY);
1608 uint16_t rnti = ueRrc->GetRnti();
1609 Ptr<const NrGnbNetDevice> nrGnbDevice =
1610 m_ueDevice->GetObject<NrUeNetDevice>()->GetTargetGnb();
1611 Ptr<NrGnbRrc> gnbRrc = nrGnbDevice->GetObject<NrGnbNetDevice>()->GetRrc();
1612 NS_ASSERT(gnbRrc->HasCellId(ueRrc->GetCellId()));
1613 Ptr<NrUeManager> ueManager = gnbRrc->GetUeManager(rnti);
1614 NS_ASSERT(ueManager->GetState() == NrUeManager::CONNECTED_NORMALLY ||
1615 ueManager->GetState() == NrUeManager::CONNECTION_RECONFIGURATION);
1616 NrEpcGnbS1SapUser::DataRadioBearerSetupRequestParameters params;
1618 params.bearer = m_bearer;
1619 params.bearerId = 0;
1621 gnbRrc->GetS1SapUser()->DataRadioBearerSetupRequest(params);
1629 NS_LOG_FUNCTION(
this);
1630 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1639 NS_LOG_FUNCTION(
this << ueDevice);
1640 NS_ASSERT_MSG(!m_nrEpcHelper,
"this method must not be used when the EPC is being used");
1647 Ptr<const NrGnbNetDevice> nrGnbDevice = ueDevice->GetObject<
NrUeNetDevice>()->GetTargetGnb();
1649 std::ostringstream path;
1650 path <<
"/NodeList/" << nrGnbDevice->GetNode()->GetId() <<
"/DeviceList/"
1651 << nrGnbDevice->GetIfIndex() <<
"/NrGnbRrc/ConnectionEstablished";
1652 Ptr<NrDrbActivator> arg = Create<NrDrbActivator>(ueDevice, bearer);
1653 Config::Connect(path.str(), MakeBoundCallback(&NrDrbActivator::ActivateCallback, arg));
1683 m_phyStats = CreateObject<NrPhyRxTrace>();
1693 m_macStats = CreateObject<NrMacRxTrace>();
1701 NS_LOG_FUNCTION(
this);
1702 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/DlDataSinr",
1706 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/SpectrumPhy/RxPacketTraceUe",
1707 MakeBoundCallback(&NrPhyRxTrace::RxPacketTraceUeCallback,
GetPhyRxTrace()));
1713 NS_LOG_FUNCTION(
this);
1714 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/DlCtrlSinr",
1721 NS_LOG_FUNCTION(
this);
1722 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/GnbPhyRxedCtrlMsgsTrace",
1724 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/GnbPhyTxedCtrlMsgsTrace",
1731 NS_LOG_FUNCTION(
this);
1732 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/GnbMacRxedCtrlMsgsTrace",
1734 Config::Connect(
"/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/GnbMacTxedCtrlMsgsTrace",
1741 NS_LOG_FUNCTION(
this);
1743 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyRxedCtrlMsgsTrace",
1746 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyTxedCtrlMsgsTrace",
1748 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyRxedDlDciTrace",
1751 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/UePhyTxedHarqFeedbackTrace",
1758 NS_LOG_FUNCTION(
this);
1760 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUeMac/UeMacRxedCtrlMsgsTrace",
1763 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUeMac/UeMacTxedCtrlMsgsTrace",
1770 NS_LOG_FUNCTION(
this);
1772 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/SpectrumPhy/RxPacketTraceGnb",
1773 MakeBoundCallback(&NrPhyRxTrace::RxPacketTraceGnbCallback,
GetPhyRxTrace()));
1779 NS_LOG_FUNCTION(
this);
1781 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbPhy/SpectrumPhy/ReportGnbTxRxPacketCount",
1782 MakeBoundCallback(&NrPhyRxTrace::ReportPacketCountGnbCallback,
GetPhyRxTrace()));
1788 NS_LOG_FUNCTION(
this);
1789 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/SpectrumPhy/"
1790 "ReportUeTxRxPacketCount",
1791 MakeBoundCallback(&NrPhyRxTrace::ReportPacketCountUeCallback,
GetPhyRxTrace()));
1797 NS_LOG_FUNCTION(
this);
1798 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/ReportDownlinkTbSize",
1799 MakeBoundCallback(&NrPhyRxTrace::ReportDownLinkTBSize,
GetPhyRxTrace()));
1805 NS_LOG_FUNCTION(
this);
1806 Ptr<NrBearerStatsSimple> rlcStats = CreateObject<NrBearerStatsSimple>(
"RLC");
1807 m_radioBearerStatsConnectorSimpleTraces.
EnableRlcStats(rlcStats);
1813 NS_LOG_FUNCTION(
this);
1814 Ptr<NrBearerStatsSimple> pdcpStats = CreateObject<NrBearerStatsSimple>(
"PDCP");
1821 NS_LOG_FUNCTION(
this);
1822 Ptr<NrBearerStatsCalculator> rlcStats = CreateObject<NrBearerStatsCalculator>(
"RLC");
1829 NS_LOG_FUNCTION(
this);
1830 Ptr<NrBearerStatsCalculator> pdcpStats = CreateObject<NrBearerStatsCalculator>(
"PDCP");
1834Ptr<NrBearerStatsCalculator>
1837 return DynamicCast<NrBearerStatsCalculator>(
1838 m_radioBearerStatsConnectorCalculator.
GetRlcStats());
1841Ptr<NrBearerStatsCalculator>
1844 return DynamicCast<NrBearerStatsCalculator>(
1851 NS_LOG_FUNCTION(
this);
1852 if (!m_macSchedStats)
1854 m_macSchedStats = CreateObject<NrMacSchedulingStats>();
1857 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/DlScheduling",
1864 NS_LOG_FUNCTION(
this);
1865 if (!m_macSchedStats)
1867 m_macSchedStats = CreateObject<NrMacSchedulingStats>();
1870 "/NodeList/*/DeviceList/*/BandwidthPartMap/*/NrGnbMac/UlScheduling",
1877 NS_LOG_FUNCTION(
this);
1878 Config::Connect(
"/ChannelList/*/$ns3::SpectrumChannel/PathLoss",
1883NrHelper::EnableDlCtrlPathlossTraces(NetDeviceContainer& ueDevs)
1885 NS_LOG_FUNCTION(
this);
1887 for (uint32_t i = 0; i < ueDevs.GetN(); i++)
1889 Ptr<NrUeNetDevice> ueDev = DynamicCast<NrUeNetDevice>(ueDevs.Get(i));
1890 NS_ASSERT_MSG(ueDev,
1891 "To EnableDlCtrlPathlossTracesfunction is passed device "
1892 "container that contains non UE devices.");
1893 for (uint32_t j = 0; j < ueDev->GetCcMapSize(); j++)
1895 Ptr<NrUePhy> nrUePhy = ueDev->GetPhy(j);
1896 Ptr<NrSpectrumPhy> nrSpectrumPhy = nrUePhy->GetSpectrumPhy();
1897 nrSpectrumPhy->EnableDlCtrlPathlossTrace();
1901 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/NrSpectrumPhy/"
1907NrHelper::EnableDlDataPathlossTraces(NetDeviceContainer& ueDevs)
1909 NS_LOG_FUNCTION(
this);
1911 NS_ASSERT_MSG(ueDevs.GetN(),
1912 "Passed an empty UE net device container EnableDlDataPathlossTraces function");
1914 for (uint32_t i = 0; i < ueDevs.GetN(); i++)
1916 Ptr<NrUeNetDevice> ueDev = DynamicCast<NrUeNetDevice>(ueDevs.Get(i));
1917 NS_ASSERT_MSG(ueDev,
1918 "To EnableDlDataPathlossTracesfunction is passed device "
1919 "container that contains non UE devices.");
1920 for (uint32_t j = 0; j < ueDev->GetCcMapSize(); j++)
1922 Ptr<NrUePhy> nrUePhy = ueDev->GetPhy(j);
1923 Ptr<NrSpectrumPhy> nrSpectrumPhy = nrUePhy->GetSpectrumPhy();
1924 nrSpectrumPhy->EnableDlDataPathlossTrace();
1928 Config::Connect(
"/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/NrUePhy/NrSpectrumPhy/"
1936 m_pmSearchFactory.SetTypeId(typeId);
1942 m_initialAttachmentFactory.SetTypeId(typeId);
1948 NS_LOG_FUNCTION(
this);
1949 m_pmSearchFactory.Set(name, value);
1955 NS_LOG_FUNCTION(
this);
1956 m_initialAttachmentFactory.Set(name, value);
1963 "The number of horizontal ports of gNB must divide number of element columns");
1965 "The number of vertical ports of gNB must divide number of element rows");
1967 auto antFactory = ObjectFactory{};
1984 "The number of horizontal ports of UE must divide number of element columns");
1986 "The number of vertical ports of UE must divide number of element rows");
1988 auto antFactory = ObjectFactory{};
2005 SetAttribute(
"EnableMimoFeedback", BooleanValue(
true));
2024 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 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.