5G-LENA nr-v3.1-69-g2dd513a7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
beamforming-helper-base.cc
1// Copyright (c) 2020 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#include "beamforming-helper-base.h"
6
7#include <ns3/log.h>
8#include <ns3/node.h>
9#include <ns3/nr-gnb-net-device.h>
10#include <ns3/nr-gnb-phy.h>
11#include <ns3/nr-spectrum-phy.h>
12#include <ns3/nr-ue-net-device.h>
13#include <ns3/nr-ue-phy.h>
14#include <ns3/vector.h>
15
16namespace ns3
17{
18
19NS_LOG_COMPONENT_DEFINE("BeamformingHelperBase");
20NS_OBJECT_ENSURE_REGISTERED(BeamformingHelperBase);
21
23{
24 // TODO Auto-generated constructor stub
25 NS_LOG_FUNCTION(this);
26}
27
29{
30 // TODO Auto-generated destructor stub
31 NS_LOG_FUNCTION(this);
32}
33
34TypeId
36{
37 static TypeId tid = TypeId("ns3::BeamformingHelperBase").SetParent<Object>();
38 return tid;
39}
40
41void
42BeamformingHelperBase::RunTask(const Ptr<NrSpectrumPhy>& gnbSpectrumPhy,
43 const Ptr<NrSpectrumPhy>& ueSpectrumPhy) const
44{
45 NS_LOG_FUNCTION(this);
46 NS_LOG_INFO(" Run beamforming task for gNB node Id:"
47 << gnbSpectrumPhy->GetDevice()->GetNode()->GetId()
48 << " and UE node Id:" << ueSpectrumPhy->GetDevice()->GetNode()->GetId());
49 BeamformingVectorPair bfPair = GetBeamformingVectors(gnbSpectrumPhy, ueSpectrumPhy);
50
51 NS_ASSERT(bfPair.first.first.GetSize() && bfPair.second.first.GetSize());
52 gnbSpectrumPhy->GetBeamManager()->SaveBeamformingVector(bfPair.first,
53 ueSpectrumPhy->GetDevice());
54 ueSpectrumPhy->GetBeamManager()->SaveBeamformingVector(bfPair.second,
55 gnbSpectrumPhy->GetDevice());
56 ueSpectrumPhy->GetBeamManager()->ChangeBeamformingVector(gnbSpectrumPhy->GetDevice());
57}
58
59void
61 const AttributeValue& v)
62{
63 NS_LOG_FUNCTION(this);
64 m_algorithmFactory.Set(n, v);
65}
66
67} // namespace ns3
BeamformingHelperBase()
BeamformingHelperBase constructor.
static TypeId GetTypeId()
Get the Type ID.
void SetBeamformingAlgorithmAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the beafmorming algorithm that will be created.
ObjectFactory m_algorithmFactory
Object factory that will be used to create beamforming algorithms.
virtual BeamformingVectorPair GetBeamformingVectors(const Ptr< NrSpectrumPhy > &gnbSpectrumPhy, const Ptr< NrSpectrumPhy > &ueSpectrumPhy) const =0
Function that will call the configured algorithm for the specified devices and obtain the beamforming...
~BeamformingHelperBase() override
~BeamformingHelperBase destructor
virtual void RunTask(const Ptr< NrSpectrumPhy > &gnbSpectrumPhy, const Ptr< NrSpectrumPhy > &ueSpectrumPhy) const
This function runs the beamforming algorithm among the provided gNB and UE device,...