5G-LENA nr-v3.3-18-g7e4df5bb
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
realistic-beamforming-algorithm.h
1// Copyright (c) 2020 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#ifndef SRC_NR_MODEL_REALISTIC_BEAMFORMING_ALGORITHM_H_
6#define SRC_NR_MODEL_REALISTIC_BEAMFORMING_ALGORITHM_H_
7
8#include "nr-gnb-net-device.h"
9#include "nr-mac-scheduler.h"
10#include "nr-spectrum-phy.h"
11#include "nr-ue-net-device.h"
12#include "realistic-bf-manager.h"
13
14#include "ns3/three-gpp-channel-model.h"
15#include <ns3/object.h>
16
17#include <queue>
18
19namespace ns3
20{
21
22class SpectrumModel;
23class SpectrumValue;
24class RealisticBeamformingHelper;
25class NrRealisticBeamformingTestCase;
26
48class RealisticBeamformingAlgorithm : public Object
49{
51 friend NrRealisticBeamformingTestCase;
52
53 public:
54 /*
55 * \brief The structure that contains the information about the update time,
56 * srsSinr and the channel matrix.
57 */
59 {
62 double srsSinr;
63 Ptr<const MatrixBasedChannelModel::ChannelMatrix>
66 };
67
68 /*
69 * \brief The structure that contains the information about what is the trigger
70 * of the realistic beamforming algorithm, and the periodicity or the delay.
71 */
73 {
74 RealisticBfManager::TriggerEvent event;
75 uint16_t updatePeriodicity;
76 Time updateDelay;
77 };
78
83 /*
84 * \brief It is necessary to call this function in order to have
85 * initialized a pair of gNB and UE spectrum phys for which will be
86 * called this algorithm.
87 * \param gnbSpectrumPhy gNB's spectrumPhy instance for which will work this algorithm
88 * \param ueSpectrumPhy UE's spectrumPhy instance of for which will work this algorithm
89 * \param scheduler the pointer to the MAC scheduler to obtain the number of
90 * SRS symbols
91 */
92 void Install(const Ptr<NrSpectrumPhy>& gnbSpectrumPhy,
93 const Ptr<NrSpectrumPhy>& ueSpectrumPhy,
94 const Ptr<NrMacScheduler>& scheduler);
99 static TypeId GetTypeId();
108 int64_t AssignStreams(int64_t stream);
115 virtual BeamformingVectorPair GetBeamformingVectors();
119 double GetBeamSearchAngleStep() const;
124 void SetBeamSearchAngleStep(double beamSearchAngleStep);
131 void NotifySrsSinrReport(uint16_t cellId, uint16_t rnti, double srsSinr);
138 void NotifySrsSnrReport(uint16_t cellId, uint16_t rnti, double srsSnr);
145 void NotifySrsReport(uint16_t cellId, uint16_t rnti, double srsReport);
150 typedef Callback<void, const Ptr<NrSpectrumPhy>&, const Ptr<NrSpectrumPhy>&>
152 /*
153 * \brief Set whether to use SRS SNR report
154 * \bool v boolean indicator, if true then SRS SNR report will be used
155 */
156 void SetUseSnrSrs(bool v);
157 /*
158 * \brief Get whether the algorithm uses SRS SNR report
159 * \return the boolean indicator indicating whether SRS SNR is used
160 */
161 bool UseSnrSrs() const;
162
163 private:
168 uint8_t GetSrsSymbolsPerSlot();
169
174 RealisticBeamformingAlgorithm::TriggerEventConf GetTriggerEventConf() const;
175
186 void NotifyHelper();
187
188 /*
189 * \brief Sets RealisticBeamformingHelperCallback that will be notified when it is necessary to
190 * update the beamforming vectors. Function RunTask will then call back
191 * RealisticBeamformingAlgorithm that notified it about the necessity to update the beamforming
192 * vectors. It is done in this way, in order to split functionalities and responsibilities of
193 * the BF helper class, and BF algorithm class. BF helper class takes care of necessary BF
194 * vector updates, and necessary calls of BeamManager class. While BF algorithm class takes care
195 * of trigger event, parameters, and algorithm, but it is not responsible to update the
196 * beamforming vector of devices. param callback the realistic beamforming helper callback
197 */
198 void SetTriggerCallback(RealisticBfHelperCallback callback);
207 Ptr<const MatrixBasedChannelModel::ChannelMatrix> GetChannelMatrix() const;
220 UniformPlanarArray::ComplexVector GetEstimatedLongTermComponent(
221 const Ptr<const MatrixBasedChannelModel::ChannelMatrix>& channelMatrix,
222 const UniformPlanarArray::ComplexVector& aW,
223 const UniformPlanarArray::ComplexVector& bW,
224 Ptr<const MobilityModel> a,
225 Ptr<const MobilityModel> b,
226 double srsSinr,
227 Ptr<const PhasedArrayModel> aArray,
228 Ptr<const PhasedArrayModel> bArray) const;
229
230 /*
231 * \brief Calculates the total metric based on the each element of the long term component
232 * \param longTermComponent the vector of complex numbers representing the long term component
233 * per cluster
234 */
235 double CalculateTheEstimatedLongTermMetric(
236 const UniformPlanarArray::ComplexVector& longTermComponent) const;
237
241 void RemoveUsedDelayedUpdateInfo();
242
243 void DoDispose() override;
244
245 // attribute members, configuration variables
246 double m_beamSearchAngleStep{30};
248 bool m_useSnrSrs{true};
249 // variable members, counters, and saving values
250 double m_maxSrsSinrPerSlot{
251 0};
253 std::queue<DelayedUpdateInfo>
254 m_delayedUpdateInfo;
256 uint8_t m_srsSymbolsCounter{0};
258 uint16_t m_srsPeriodicityCounter{
259 0};
261 // m_srsSymbolsPerSlotCounter reaches the number of symbols per SRS transmission,
262 // i.e., when SRS transmissions in the current slot have finished*/
263 Ptr<NormalRandomVariable>
264 m_normalRandomVariable;
265 RealisticBfHelperCallback m_helperCallback;
267 // the helper will be notified through this callback
268 /*
269 * \brief Parameters needed to pass to helper once that the helpers callback functions is being
270 * called
271 */
272 Ptr<NrGnbNetDevice> m_gnbDevice;
273 Ptr<NrUeNetDevice> m_ueDevice;
274 Ptr<NrSpectrumPhy> m_gnbSpectrumPhy;
275 Ptr<NrSpectrumPhy> m_ueSpectrumPhy;
276 Ptr<NrMacScheduler> m_scheduler;
277 Ptr<NrUePhy> m_nrUePhy;
278};
279
280} // namespace ns3
281#endif
Generate "Real" beamforming vectors This class is inherited by all algorithms that do not assume the ...
Callback< void, const Ptr< NrSpectrumPhy > &, const Ptr< NrSpectrumPhy > & > RealisticBfHelperCallback
RunTask callback will be triggered when the event for updating the beamforming vectors occurs The par...
void NotifySrsReport(uint16_t cellId, uint16_t rnti, double srsReport)
Saves SRS report (SNR or SINR depending on the configuration)
virtual BeamformingVectorPair GetBeamformingVectors()
Function that generates the beamforming vectors for a pair of communicating devices by using the dire...
void SetBeamSearchAngleStep(double beamSearchAngleStep)
Sets the value of BeamSearchAngleStep attribute.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model....
void NotifySrsSnrReport(uint16_t cellId, uint16_t rnti, double srsSnr)
Saves SRS SNR report.
void NotifySrsSinrReport(uint16_t cellId, uint16_t rnti, double srsSinr)
Saves SRS SINR report.
Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix