5G-LENA nr-v3.0-33-g7aea1e4
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
beamforming-helper-base.cc
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
3// Copyright (c) 2020 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4//
5// SPDX-License-Identifier: GPL-2.0-only
6
7#include "beamforming-helper-base.h"
8
9#include <ns3/log.h>
10#include <ns3/node.h>
11#include <ns3/nr-gnb-net-device.h>
12#include <ns3/nr-gnb-phy.h>
13#include <ns3/nr-spectrum-phy.h>
14#include <ns3/nr-ue-net-device.h>
15#include <ns3/nr-ue-phy.h>
16#include <ns3/vector.h>
17
18namespace ns3
19{
20
21NS_LOG_COMPONENT_DEFINE("BeamformingHelperBase");
22NS_OBJECT_ENSURE_REGISTERED(BeamformingHelperBase);
23
25{
26 // TODO Auto-generated constructor stub
27 NS_LOG_FUNCTION(this);
28}
29
31{
32 // TODO Auto-generated destructor stub
33 NS_LOG_FUNCTION(this);
34}
35
36TypeId
38{
39 static TypeId tid = TypeId("ns3::BeamformingHelperBase").SetParent<Object>();
40 return tid;
41}
42
43void
44BeamformingHelperBase::RunTask(const Ptr<NrSpectrumPhy>& gnbSpectrumPhy,
45 const Ptr<NrSpectrumPhy>& ueSpectrumPhy) const
46{
47 NS_LOG_FUNCTION(this);
48 NS_LOG_INFO(" Run beamforming task for gNB node Id:"
49 << gnbSpectrumPhy->GetDevice()->GetNode()->GetId()
50 << " and UE node Id:" << ueSpectrumPhy->GetDevice()->GetNode()->GetId());
51 BeamformingVectorPair bfPair = GetBeamformingVectors(gnbSpectrumPhy, ueSpectrumPhy);
52
53 NS_ASSERT(bfPair.first.first.GetSize() && bfPair.second.first.GetSize());
54 gnbSpectrumPhy->GetBeamManager()->SaveBeamformingVector(bfPair.first,
55 ueSpectrumPhy->GetDevice());
56 ueSpectrumPhy->GetBeamManager()->SaveBeamformingVector(bfPair.second,
57 gnbSpectrumPhy->GetDevice());
58 ueSpectrumPhy->GetBeamManager()->ChangeBeamformingVector(gnbSpectrumPhy->GetDevice());
59}
60
61void
63 const AttributeValue& v)
64{
65 NS_LOG_FUNCTION(this);
66 m_algorithmFactory.Set(n, v);
67}
68
69} // 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,...