5#ifndef NR_INITIAL_ASSOC_H
6#define NR_INITIAL_ASSOC_H
7#include "ns3/nr-module.h"
12const uint16_t NR_NUM_BANDS_FOR_SSB = 20;
13const double TRANSMIT_POWER_INIT_ASSOC = 30.0;
41 Ptr<ThreeGppChannelModel> channelModel{
nullptr};
42 Ptr<ThreeGppPropagationLossModel> pathLossModel{
nullptr};
43 Ptr<const SpectrumModel> spectralModel{
nullptr};
44 Ptr<ThreeGppSpectrumPropagationLossModel> spectrumPropModel{
nullptr};
51 Ptr<MobilityModel> ueMobility{
nullptr};
52 Ptr<MobilityModel> gnbMobility{
nullptr};
61 std::vector<Ptr<UniformPlanarArray>>
72 double maxPsdFound = 0.0;
138 void InitializeIntfSet(uint16_t numIntfs,
bool useRelRsrp,
double relRsrpThreshold);
143 std::vector<double>
GetInterference(
const std::vector<uint16_t>& idxVal)
const;
159 const double relRsrpThreshold,
160 const double totalInterference)
const;
228 Ptr<UniformPlanarArray> ExtractGnbParameters(
const Ptr<NetDevice>& gnbDevice,
240 double ComputeRxPsd(Ptr<const SpectrumSignalParameters> spectrumSigParam)
const;
247 PhasedArrayModel::ComplexVector GenBeamforming(
double angRow,
249 Ptr<UniformPlanarArray> gnbArrayModel)
const;
254 double ComputeRsrpRatio(
double totalRsrp, std::vector<uint16_t> idxVal);
264 void ParseColBeamAngles(std::string colAngles);
269 void ParseRowBeamAngles(std::string rowAngles);
271 Ptr<const NetDevice> m_ueDevice{
273 NetDeviceContainer m_gnbDevices;
275 double m_handoffMargin{0.0};
276 size_t m_startSsb{0};
277 size_t m_numBandsSsb{NR_NUM_BANDS_FOR_SSB};
279 uint8_t m_numMainInterfererGnb{6};
280 size_t m_numIntfGnbs{m_numMainInterfererGnb};
281 double m_rsrpRatio{0.0};
282 NetDeviceContainer m_intfGnbDevs;
283 std::vector<double> m_maxRsrps;
284 double m_rsrpAsscGnb;
285 Ptr<NetDevice> m_associatedGnb{
nullptr};
287 std::vector<NrAnglePair> m_bestBfVectors;
288 PhasedArrayModel::ComplexVector m_beamformingVector;
290 std::vector<double> m_rowBeamAngles;
292 std::vector<double> m_colBeamAngles;
295 double m_primaryCarrierIndex{0};
Ptr< const NetDevice > GetUeDevice() const
Get UE device for which initial association is required.
static TypeId GetTypeId()
Get the type ID.
void SetNumMainInterfererGnb(uint8_t numInterfere)
Set number of main interferer gNBs.
Ptr< NetDevice > GetAssociatedGnb() const
Get the gNB associated gNB with the UE.
void SetUeActivePanel(int8_t panelIndex) const
Set the active panel for the UE device in NrSpectrumPhy.
double GetAssociatedRsrp() const
Get RSRP of associated gNB.
std::vector< double > GetColBeamAngles() const
Get col angles of the beam used.
size_t GetNumIntfGnbsByRelRsrp(const std::vector< double > cumSumIntf, const double relRsrpThreshold, const double totalInterference) const
Get the number of interference gNB based on Relative RSRP value.
void SetPrimaryCarrier(double index)
Set the primary BWP or carrier.
double GetCarrierFrequency() const
Get carrier frequency.
void SetUeDevice(const Ptr< NetDevice > &ueDev)
Set UE device for which initial association is required.
uint8_t GetUeActivePanel() const
Get the index of the active panel for the UE device in NrSpectrumPhy.
void SetHandoffMargin(double margin)
Set hand off margin in dB.
void SetColBeamAngles(std::vector< double > colVect)
Set column beam angles.
NetDeviceContainer GetInterferingGnbs() const
Get the gNBs which are main interferer with the UE.
std::pair< Ptr< NetDevice >, double > FindAssociatedGnb()
Find the gNB associated with the UE.
bool CheckNumBeamsAllowed() const
Check whether number of beams is corresponds to standard.
void InitializeIntfSet(uint16_t numIntfs, bool useRelRsrp, double relRsrpThreshold)
Create a container of gNBs forming a main interfering set with the UE.
double GetTotalInterference(const std::vector< double > &cumSumIntf) const
Calculate total interference based on RSRP values from gNBs.
std::vector< double > GetInterference(const std::vector< uint16_t > &idxVal) const
Calculate the cumulative sum of RSRP values from gNBs.
double GetPrimaryCarrier() const
Get the primary BWP or carrier.
void SetRowBeamAngles(std::vector< double > rowVect)
Set row beam angles.
uint8_t GetNumMainInterfererGnb() const
Get number of main interferer gNBs.
NrAnglePair GetBestBfv(uint64_t gnbId) const
Get the best beam from a given gNB to the UE.
void SetGnbDevices(const NetDeviceContainer &gnbDevices)
Set gnb devices among which association is done.
void SetStartSsbRb(uint16_t startSsb)
Set start RB for SSB.
double GetHandoffMargin() const
Get handoff margin.
double GetMaxRsrp(uint64_t gnbId) const
Get the max RSRP from a given gNB.
double GetRelativeRsrpRatio() const
Get relative RSRP of remaining gNBs to that of the main one.
std::vector< double > GetRowBeamAngles() const
Get row angles of the beam used.
void SetNumSsbRb(uint16_t numSsbRb)
Set number of RBs for association.
Angle pair in degrees for the row and column angle of beam direction for uniform planar array NrIniti...
AntennaArrayModels struct to store copy of antenna array of gNB and UE to do beamforming later.
std::vector< Ptr< UniformPlanarArray > > ueArrayModel
Copy of UE antenna panels' array model.
Ptr< UniformPlanarArray > gnbArrayModel
Copy of gNB antenna array model. Modified to reduce complexity.
ChannelParams struct to set channel model, pathloss model, spectral model and spectrumprop model to e...
LocalSearchParams struct format to keep ChannelParams, Mobilities, and AntennaArrayModels of UE and g...
Mobilities struct to keep mobility model of ue and gNB.