5#include "realistic-beamforming-helper.h"
8#include <ns3/nr-gnb-net-device.h>
9#include <ns3/nr-gnb-phy.h>
10#include <ns3/nr-spectrum-phy.h>
11#include <ns3/nr-ue-net-device.h>
12#include <ns3/nr-ue-phy.h>
13#include <ns3/nr-ue-rrc.h>
14#include <ns3/vector.h>
19NS_LOG_COMPONENT_DEFINE(
"RealisticBeamformingHelper");
20NS_OBJECT_ENSURE_REGISTERED(RealisticBeamformingHelper);
25 static TypeId tid = TypeId(
"ns3::RealisticBeamformingHelper")
27 .AddConstructor<RealisticBeamformingHelper>();
32RealisticBeamformingHelper::DoDispose()
34 for (
auto& it : m_spectrumPhyPairToAlgorithm)
38 m_spectrumPhyPairToAlgorithm.clear();
43 const Ptr<NrUeNetDevice>& ueDev)
45 NS_LOG_FUNCTION(
this);
46 for (std::size_t ccId = 0; ccId < gNbDev->GetCcMapSize(); ccId++)
48 Ptr<NrSpectrumPhy> gnbSpectrumPhy = gNbDev->GetPhy(ccId)->GetSpectrumPhy();
49 Ptr<NrSpectrumPhy> ueSpectrumPhy = ueDev->GetPhy(ccId)->GetSpectrumPhy();
52 m_spectrumPhyPairToAlgorithm.find(std::make_pair(gnbSpectrumPhy, ueSpectrumPhy));
53 NS_ABORT_MSG_IF(itAlgorithms != m_spectrumPhyPairToAlgorithm.end(),
54 "Realistic beamforming task already created for the provided devices");
58 Ptr<RealisticBeamformingAlgorithm> beamformingAlgorithm =
61 beamformingAlgorithm->Install(gnbSpectrumPhy, ueSpectrumPhy, gNbDev->GetScheduler(ccId));
63 m_spectrumPhyPairToAlgorithm[std::make_pair(gnbSpectrumPhy, ueSpectrumPhy)] =
67 gnbSpectrumPhy->AddSrsSinrReportCallback(
69 beamformingAlgorithm));
70 gnbSpectrumPhy->AddSrsSnrReportCallback(
72 beamformingAlgorithm->SetTriggerCallback(
78RealisticBeamformingHelper::GetBeamformingVectors(
const Ptr<NrSpectrumPhy>& gnbSpectrumPhy,
79 const Ptr<NrSpectrumPhy>& ueSpectrumPhy)
const
81 auto itAlgo = m_spectrumPhyPairToAlgorithm.find(std::make_pair(gnbSpectrumPhy, ueSpectrumPhy));
82 NS_ABORT_MSG_IF(itAlgo == m_spectrumPhyPairToAlgorithm.end(),
83 "There is no created task/algorithm for the specified pair of antenna arrays.");
84 return itAlgo->second->GetBeamformingVectors();
90 NS_LOG_FUNCTION(
this);