5G-LENA nr-v4.1
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-pm-search.h
1// Copyright (c) 2024 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#ifndef NR_PM_SEARCH_H
6#define NR_PM_SEARCH_H
7
8#include "nr-amc.h"
9#include "nr-mimo-chunk-processor.h"
10#include "nr-mimo-signal.h"
11
12#include "ns3/random-variable-stream.h"
13#include "ns3/uinteger.h"
14
15namespace ns3
16{
17
20class NrPmSearch : public Object
21{
22 public:
25 static TypeId GetTypeId();
26
28 NrPmSearch();
29
32 void SetAmc(Ptr<const NrAmc> amc);
33
39 void SetGnbParams(bool isDualPol, size_t numHPorts, size_t numVPorts);
40
43 void SetUeParams(size_t numTotalPorts);
44
47 void SetSubbandSize(size_t subbandSize);
48
50 size_t GetSubbandSize() const;
51
53 virtual void InitCodebooks() = 0;
54
56 struct PmiUpdate
57 {
58 PmiUpdate() = default;
59
60 PmiUpdate(bool uWb, bool uSb)
61 {
62 updateWb = uWb;
63 updateSb = uSb;
64 }
65
66 bool updateWb{false};
67 bool updateSb{false};
68 };
69
78 virtual PmCqiInfo CreateCqiFeedbackMimo(const NrMimoSignal& rxSignalRb,
79 PmiUpdate pmiUpdate) = 0;
80
84 virtual NrIntfNormChanMat SubbandDownsampling(const NrIntfNormChanMat& channelMatrix);
85
90 size_t numPrbs) const;
91
98
107 int64_t AssignStreams(int64_t stream);
108
112 virtual uint8_t SelectRank(NrIntfNormChanMat& channelMatrix) const;
113
120
121 protected:
122 struct PrecMatParams : public SimpleRefCount<PrecMatParams>
123 {
124 size_t wbPmi{};
125 std::vector<size_t> sbPmis{};
126 ComplexMatrixArray sbPrecMat{};
127 double perfMetric{};
129 };
130
131 size_t m_subbandSize{1};
136 Ptr<UniformRandomVariable>
138
139 bool m_isGnbDualPol{false};
140 size_t m_nGnbHPorts{0};
141 size_t m_nGnbVPorts{0};
142 size_t m_nGnbPorts{0};
143 size_t m_nRxPorts{0};
144
145 Ptr<const NrAmc> m_amc{nullptr};
146
147 uint8_t m_rankLimit{UINT8_MAX};
148 std::vector<uint8_t> m_ranks{};
149 private:
156 size_t GetNumSubbands(const NrIntfNormChanMat& chanMat) const;
157
165 void GetSubbandDownsampleFirstPrb(const NrIntfNormChanMat& chanMat,
166 ComplexMatrixArray& downsampledChanMat) const;
174 void GetSubbandDownsampleRandomPrb(const NrIntfNormChanMat& chanMat,
175 ComplexMatrixArray& downsampledChanMat) const;
176
184 void GetSubbandDownsampleAveragePrb(const NrIntfNormChanMat& chanMat,
185 ComplexMatrixArray& downsampledChanMat) const;
186
187 double m_rankThreshold;
188 RankTechnique m_rankTechnique{Sasaoka};
189};
190
191} // namespace ns3
192
193#endif // NR_PM_SEARCH_H
Base class for searching optimal precoding matrices and creating full CQI/PMI feedback This is a most...
static TypeId GetTypeId()
Get TypeId.
int64_t AssignStreams(int64_t stream)
size_t GetSubbandSize() const
void SetSubbandSize(size_t subbandSize)
Set the subband size (in number of RBs)
Ptr< UniformRandomVariable > m_downsamplingUniRand
Uniform variable stream used to downsample PRBs.
NrPmSearch()
Default constructor.
bool m_enforceSubbandSize
Enforce sub-band sizes according to 3GPP.
void SetGnbParams(bool isDualPol, size_t numHPorts, size_t numVPorts)
Set the antenna parameters of the gNB antenna.
@ FirstPRB
Downsample m_subbandSize samples to bands based on the first PRB.
@ AveragePRB
Downsample m_subbandSize samples to bands based on the average of PRBs.
@ RandomPRB
Downsample m_subbandSize samples to bands based on a random PRB.
uint8_t m_rankLimit
Limit the UE's maximum supported rank.
enum DownsamplingTechnique m_downsamplingTechnique
Technique used to downsample PRBs.
void SetUeParams(size_t numTotalPorts)
Set the antenna parameters of the UE antenna.
virtual void InitCodebooks()=0
Create and initialize the codebook for each rank.
size_t m_nRxPorts
Number of receive ports at this UE.
virtual uint8_t SelectRank(NrIntfNormChanMat &channelMatrix) const
Select the MIMO rank for a given channel matrix.
size_t m_nGnbHPorts
Number of horizontal ports in the gNB antenna array.
Ptr< const NrAmc > m_amc
The NrAmc to be used for computing TB size and MCS.
size_t m_nGnbPorts
Total number of ports in the gNB antenna array.
std::vector< uint8_t > m_ranks
The set of ranks for which to compute precoding matrices.
virtual NrIntfNormChanMat SubbandUpsampling(const NrIntfNormChanMat &precMat, size_t numPrbs) const
Upsample the input per-subband precoding matrix into a per-PRB precoding matrix.
bool m_isGnbDualPol
True when gNB has a dual-polarized antenna array.
virtual PmCqiInfo CreateCqiFeedbackMimo(const NrMimoSignal &rxSignalRb, PmiUpdate pmiUpdate)=0
Create CQI feedback with optimal rank, optimal PMI, and corresponding CQI values. Optimal rank is con...
virtual NrIntfNormChanMat SubbandDownsampling(const NrIntfNormChanMat &channelMatrix)
Downsample the input channel matrix into bins of at most m_subbandSize PRBs.
@ WaterFilling
Select MIMO rank via water-filling technique,.
@ Sasaoka
Select MIMO rank via rank increment capacity technique.
@ SVD
Select MIMO rank via SVD decomposition.
void SetAmc(Ptr< const NrAmc > amc)
Set the AMC object to be used for MCS and TB size calculation.
size_t m_subbandSize
Size of each subband (in number of RBs)
size_t m_nGnbVPorts
Number of vertical ports in the gNB antenna array.
Helper struct for processing and storing received signals for use in CSI feedback.
Parameters that define if PMI should be updated or if previous PMI values are used.
bool updateWb
Defines whether to update WB PMI.
bool updateSb
Defines whether to update SB PMI.
ComplexMatrixArray sbPrecMat
Precoding matrix (nGnbPorts * rank * nSubbands)
std::vector< size_t > sbPmis
Subband PMI values (i2, indices of W2 matrices)
size_t wbPmi
Wideband PMI (i1, index of W1 matrix)
The structure used for the CQI feedback message that contains the optimum CQI, RI,...