8#include "cc-bwp-helper.h"
9#include "ideal-beamforming-helper.h"
10#include "nr-bearer-stats-connector.h"
11#include "nr-mac-scheduling-stats.h"
13#include "ns3/net-device-container.h"
14#include "ns3/node-container.h"
15#include "ns3/nr-component-carrier.h"
16#include "ns3/nr-control-messages.h"
17#include "ns3/nr-eps-bearer.h"
18#include "ns3/nr-spectrum-phy.h"
19#include "ns3/object-factory.h"
27class NrSpectrumValueHelper;
31class NrBearerStatsCalculator;
232 const NodeContainer& c,
233 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>>& allBwps);
241 const NodeContainer& c,
242 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps);
249 static uint32_t
GetNumberBwp(
const Ptr<const NetDevice>& gnbDevice);
256 static Ptr<NrGnbPhy>
GetGnbPhy(
const Ptr<NetDevice>& gnbDevice, uint32_t bwpIndex);
263 static Ptr<NrGnbMac>
GetGnbMac(
const Ptr<NetDevice>& gnbDevice, uint32_t bwpIndex);
270 static Ptr<NrUeMac>
GetUeMac(
const Ptr<NetDevice>& ueDevice, uint32_t bwpIndex);
277 static Ptr<NrUePhy>
GetUePhy(
const Ptr<NetDevice>& ueDevice, uint32_t bwpIndex);
283 static Ptr<BwpManagerGnb>
GetBwpManagerGnb(
const Ptr<NetDevice>& gnbDevice);
289 static Ptr<BwpManagerUe>
GetBwpManagerUe(
const Ptr<NetDevice>& ueDevice);
296 static Ptr<NrMacScheduler>
GetScheduler(
const Ptr<NetDevice>& gnbDevice, uint32_t bwpIndex);
304 const NetDeviceContainer& gnbDevices);
311 const NetDeviceContainer& gnbDevices);
317 void AttachToGnb(
const Ptr<NetDevice>& ueDevice,
const Ptr<NetDevice>& gnbDevice);
416 Ptr<NetDevice> gnbDevice,
626 void SetGnbBeamManagerAttribute(
const std::string& n,
const AttributeValue& v);
696 void SetFhControlAttribute(
const std::string& n,
const AttributeValue& v);
827 void EnableDlCtrlPathlossTraces(NetDeviceContainer& netDeviceContainer);
836 void EnableDlDataPathlossTraces(NetDeviceContainer& netDeviceContainer);
930 std::vector<CcBwpCreator::SimpleOperationBandConf> bandConfs,
931 const std::string& scenario =
"RMa",
932 const std::string& channelCondition =
"Default",
933 const std::string& channelModel =
"ThreeGpp");
958 NS_DEPRECATED(
"Obsolete method")
962 void AddX2Interface(NodeContainer gnbNodes);
963 void AddX2Interface(Ptr<Node> gnbNode1, Ptr<Node> gnbNode2);
965 std::
string GetHandoverAlgorithmType() const;
966 void SetHandoverAlgorithmType(std::
string type);
967 void SetHandoverAlgorithmAttribute(std::
string n, const AttributeValue& v);
968 void HandoverRequest(Time hoTime,
969 Ptr<NetDevice> ueDev,
970 Ptr<NetDevice> sourceGnbDev,
971 Ptr<NetDevice> targetGnbDev);
972 void HandoverRequest(Time hoTime,
973 Ptr<NetDevice> ueDev,
974 Ptr<NetDevice> sourceGnbDev,
975 uint16_t targetCellId);
978 bool m_enableMimoFeedback{
false};
979 ObjectFactory m_pmSearchFactory;
980 uint8_t m_csiFeedbackFlags{
981 CQI_CSI_IM | CQI_CSI_RS |
1000 int64_t DoAssignStreamsToChannelObjects(Ptr<NrSpectrumPhy> phy, int64_t currentStream);
1011 void DoDeActivateDedicatedEpsBearer(Ptr<NetDevice> ueDevice,
1012 Ptr<NetDevice> gnbDevice,
1015 Ptr<NrGnbPhy> CreateGnbPhy(
const Ptr<Node>& n,
1017 const Ptr<NrGnbNetDevice>& dev,
1019 Ptr<NrMacScheduler> CreateGnbSched();
1020 Ptr<NrGnbMac> CreateGnbMac();
1021 Ptr<NrFhControl> CreateNrFhControl();
1023 Ptr<NrUeMac> CreateUeMac()
const;
1024 Ptr<NrUePhy> CreateUePhy(
const Ptr<Node>& n,
1026 const Ptr<NrUeNetDevice>& dev,
1030 Ptr<NetDevice> InstallSingleUeDevice(
1032 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps);
1033 Ptr<NetDevice> InstallSingleGnbDevice(
1035 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps);
1037 void DoHandoverRequest(Ptr<NetDevice> ueDev,
1038 Ptr<NetDevice> sourceGnbDev,
1039 uint16_t targetCellId);
1040 void AttachToClosestGnb(
const Ptr<NetDevice>& ueDevice,
const NetDeviceContainer& gnbDevices);
1042 void AttachToMaxRsrpGnb(
const Ptr<NetDevice>& ueDevice,
const NetDeviceContainer& gnbDevices);
1044 ObjectFactory m_gnbNetDeviceFactory;
1045 ObjectFactory m_ueNetDeviceFactory;
1046 ObjectFactory m_channelFactory;
1047 ObjectFactory m_ueMacFactory;
1048 ObjectFactory m_gnbMacFactory;
1049 ObjectFactory m_ueSpectrumFactory;
1050 ObjectFactory m_gnbSpectrumFactory;
1051 ObjectFactory m_uePhyFactory;
1052 ObjectFactory m_gnbPhyFactory;
1053 ObjectFactory m_ueChannelAccessManagerFactory;
1054 ObjectFactory m_gnbChannelAccessManagerFactory;
1055 ObjectFactory m_schedFactory;
1056 ObjectFactory m_ueAntennaFactory;
1057 ObjectFactory m_gnbAntennaFactory;
1058 ObjectFactory m_gnbBwpManagerAlgoFactory;
1059 ObjectFactory m_ueBwpManagerAlgoFactory;
1060 ObjectFactory m_channelConditionModelFactory;
1061 ObjectFactory m_spectrumPropagationFactory;
1062 ObjectFactory m_pathlossModelFactory;
1063 ObjectFactory m_gnbDlAmcFactory;
1064 ObjectFactory m_gnbUlAmcFactory;
1065 ObjectFactory m_gnbBeamManagerFactory;
1066 ObjectFactory m_ueBeamManagerFactory;
1067 ObjectFactory m_handoverAlgorithmFactory;
1068 ObjectFactory m_fhControlFactory;
1069 ObjectFactory m_initialAttachmentFactory;
1071 uint16_t m_cellIdCounter{1};
1073 Ptr<NrEpcHelper> m_nrEpcHelper{
nullptr};
1074 Ptr<BeamformingHelperBase> m_beamformingHelper{
nullptr};
1076 bool m_snrTest{
false};
1077 bool m_fhEnabled{
false};
1079 Ptr<NrPhyRxTrace> m_phyStats;
1080 Ptr<NrMacRxTrace> m_macStats;
1082 NrBearerStatsConnector
1083 m_radioBearerStatsConnectorSimpleTraces;
1085 NrBearerStatsConnector
1086 m_radioBearerStatsConnectorCalculator;
1089 std::map<uint8_t, NrComponentCarrier> m_componentCarrierPhyParams;
1090 std::vector<Ptr<Object>>
1091 m_channelObjectsWithAssignedStreams;
1094 Ptr<NrMacSchedulingStats> m_macSchedStats;
1096 std::vector<OperationBandInfo> m_bands;
Base helper class to handle the creation of the EPC entities.
This class contains the specification of EPS Bearers.
Helper to set up single- or multi-cell scenarios with NR.
void EnableDlDataPhyTraces()
Enable DL DATA PHY traces.
static Ptr< BwpManagerGnb > GetBwpManagerGnb(const Ptr< NetDevice > &gnbDevice)
Get the BwpManager of the GNB.
std::pair< double, BandwidthPartInfoPtrVector > CreateBandwidthParts(std::vector< CcBwpCreator::SimpleOperationBandConf > bandConfs, const std::string &scenario="RMa", const std::string &channelCondition="Default", const std::string &channelModel="ThreeGpp")
Create BandwidthParts from a vector of band configurations.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, NrEpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
void UpdateDeviceConfigs(const NetDeviceContainer &netDevs)
Update NetDevice configuration of one or more devices.
static Ptr< NrUeMac > GetUeMac(const Ptr< NetDevice > &ueDevice, uint32_t bwpIndex)
Get a pointer to the MAC of the UE at the specified BWP.
void EnableTraces()
Enables the following traces: Transmitted/Received Control Messages DL/UL Phy Traces RLC traces PDCP ...
void SetupInitialAssoc(const InitialAssocParams ¶ms)
Set parameters for max RSRP based Initial Association.
void ConfigureFhControl(NetDeviceContainer gnbNetDevices)
Configure FH Control of each cell.
NetDeviceContainer InstallGnbDevice(const NodeContainer &c, const std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > allBwps)
Install one (or more) GNBs.
void SetBeamformingHelper(Ptr< BeamformingHelperBase > beamformingHelper)
Set an ideal beamforming helper.
void SetGnbDlAmcAttribute(const std::string &n, const AttributeValue &v)
NrHelper()
NrHelper constructor.
Ptr< NrBearerStatsCalculator > GetPdcpStatsCalculator()
Get the PDCP stats calculator object.
void DeActivateDedicatedEpsBearer(Ptr< NetDevice > ueDevice, Ptr< NetDevice > gnbDevice, uint8_t bearerId)
Manually trigger dedicated bearer de-activation at specific simulation time.
void EnableUePhyCtrlMsgsTraces()
Enable UE PHY CTRL TX and RX traces.
void EnableRlcSimpleTraces()
Enable RLC simple traces (DL RLC TX, DL RLC RX, UL DL TX, UL DL RX)
void SetUeAntennaAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE antenna, before it is created.
void SetUeChannelAccessManagerAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE channel access manager, before it is created.
bool GetSnrTest() const
GetSnrTest.
void EnableGnbPhyCtrlMsgsTraces()
Enable gNB PHY CTRL TX and RX traces.
~NrHelper() override
~NrHelper
void SetGnbBwpManagerAlgorithmTypeId(const TypeId &typeId)
Set the TypeId of the GNB BWP Manager. Works only before it is created.
static Ptr< BwpManagerUe > GetBwpManagerUe(const Ptr< NetDevice > &ueDevice)
Get the BwpManager of the UE.
void EnableDlMacSchedTraces()
void SetInitialAssocAttribute(const std::string &name, const AttributeValue &value)
Set attribute of the initial attachment algorithm.
void SetUeMacAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE MAC, before it is created.
void SetUlErrorModel(const std::string &errorModelTypeId)
Set the ErrorModel for UL AMC and UE spectrum at the same time.
void SetUeBwpManagerAlgorithmTypeId(const TypeId &typeId)
Set the TypeId of the UE BWP Manager. Works only before it is created.
void EnableUlPhyTraces()
Enable UL PHY traces.
void EnablePathlossTraces()
Enable trace sinks for DL and UL pathloss.
Ptr< NrMacRxTrace > GetMacRxTrace()
Get the mac stats trace object.
void AttachToClosestGnb(const NetDeviceContainer &ueDevices, const NetDeviceContainer &gnbDevices)
Attach the UE specified to the closest GNB.
void SetPmSearchAttribute(const std::string &name, const AttributeValue &value)
Set attribute of the precoding matrix search algorithm.
void SetGnbAntennaAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB antenna, before it is created.
void SetGnbAntennaTypeId(const std::string &)
Set a different TypeId for the GNB antenna device.
void SetupGnbAntennas(const AntennaParams &ap)
Set parameters for gNB and UE antenna arrays.
void AttachToMaxRsrpGnb(const NetDeviceContainer &ueDevices, const NetDeviceContainer &gnbDevices)
Attach the UE specified to the max RSRP associated GNB.
static Ptr< NrGnbPhy > GetGnbPhy(const Ptr< NetDevice > &gnbDevice, uint32_t bwpIndex)
Get a pointer to the PHY of the GNB at the specified BWP.
void AttachToGnb(const Ptr< NetDevice > &ueDevice, const Ptr< NetDevice > &gnbDevice)
Attach a UE to a particular GNB.
void EnableUlMacSchedTraces()
void SetGnbUlAmcAttribute(const std::string &n, const AttributeValue &v)
void SetInitialAssocTypeId(const TypeId &typeId)
Set TypeId of the initial attachment algorithm.
static uint32_t GetNumberBwp(const Ptr< const NetDevice > &gnbDevice)
Get the number of configured BWP for a specific GNB NetDevice.
void EnableGnbMacCtrlMsgsTraces()
Enable gNB MAC CTRL TX and RX traces.
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, NrEpsBearer bearer, Ptr< NrEpcTft > tft)
void SetUeChannelAccessManagerTypeId(const TypeId &typeId)
Set the TypeId of the UE Channel Access Manager. Works only before it is created.
void SetUeAntennaTypeId(const std::string &)
Set a different TypeId for the UE antenna device.
Ptr< NrBearerStatsCalculator > GetRlcStatsCalculator()
Get the RLC stats calculator object.
void EnableTransportBlockTrace()
Enable transport block trace.
void EnableGnbPacketCountTrace()
Enable gNB packet count trace.
void SetDlErrorModel(const std::string &errorModelTypeId)
Set the ErrorModel for DL AMC and GNB spectrum at the same time.
void EnableRlcE2eTraces()
Enable RLC calculator and end-to-end RCL traces to file.
void EnablePdcpSimpleTraces()
Enable PDCP traces (DL PDCP TX, DL PDCP RX, UL PDCP TX, UL PDCP RX)
static Ptr< NrMacScheduler > GetScheduler(const Ptr< NetDevice > &gnbDevice, uint32_t bwpIndex)
Get the Scheduler from the GNB specified.
void SetUeBwpManagerAlgorithmAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB BWP Manager, before it is created.
void SetEpcHelper(Ptr< NrEpcHelper > NrEpcHelper)
void SetGnbMacAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB MAC, before it is created.
void SetGnbPhyAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB PHY, before it is created.
void EnableDlCtrlPhyTraces()
Enable DL CTRL PHY traces.
void SetupUeAntennas(const AntennaParams &ap)
Set parameters for gNB and UE antenna arrays.
static Ptr< NrGnbMac > GetGnbMac(const Ptr< NetDevice > &gnbDevice, uint32_t bwpIndex)
Get a pointer to the MAC of the GNB at the specified BWP.
void SetUePhyAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE PHY, before it is created.
static Ptr< NrUePhy > GetUePhy(const Ptr< NetDevice > &ueDevice, uint32_t bwpIndex)
Get a pointer to the PHY of the UE at the specified BWP.
void SetupMimoPmi(const MimoPmiParams &mp)
Set parameters for PMI search in MIMO operation.
void EnableUePacketCountTrace()
Enable UE packet count trace.
static TypeId GetTypeId()
GetTypeId.
void SetUeSpectrumAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the UE spectrum, before it is created.
void SetSchedulerAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the scheduler, before it is created.
void EnableUeMacCtrlMsgsTraces()
Enable UE MAC CTRL TX and RX traces.
void SetSchedulerTypeId(const TypeId &typeId)
Set the Scheduler TypeId. Works only before it is created.
void SetGnbBwpManagerAlgorithmAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB BWP Manager, before it is created.
Ptr< NrPhyRxTrace > GetPhyRxTrace()
Get the phy traces object.
void SetGnbSpectrumAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB spectrum, before it is created.
NetDeviceContainer InstallUeDevice(const NodeContainer &c, const std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > &allBwps)
Install one (or more) UEs.
void SetGnbChannelAccessManagerAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the GNB channel access manager, before it is created.
void EnablePdcpE2eTraces()
Enable PDCP calculator and end-to-end PDCP traces to file.
void SetGnbChannelAccessManagerTypeId(const TypeId &typeId)
Set the TypeId of the GNB Channel Access Manager. Works only before it is created.
void EnableFhControl()
Enable FH Control.
void SetGnbBeamManagerTypeId(const TypeId &typeId)
Set the TypeId of the beam manager.
void SetPmSearchTypeId(const TypeId &typeId)
Set TypeId of the precoding matrix search algorithm.
void SetSnrTest(bool snrTest)
SetSnrTest.
std::function< void(const std::list< Ptr< NrControlMessage > > &, uint8_t)> NrPhyRxCtrlEndOkCallback
This callback method type is used to notify that CTRL is received.
Callback< void, const DlHarqInfo & > NrPhyDlHarqFeedbackCallback
std::unique_ptr< BandwidthPartInfo > BandwidthPartInfoPtr
unique_ptr of BandwidthPartInfo
parameters of the gNB or UE antenna arrays
size_t nAntRows
Number of antenna element rows (vertical height)
bool isDualPolarized
true if antennas are cross-polarized (dual-polarized)
double downtiltAngle
Downtilt angle in radians.
double bearingAngle
Bearing angle in radians.
std::string antennaElem
Antenna type.
size_t nHorizPorts
Number of antenna ports in horizontal direction.
size_t nVertPorts
Number of antenna ports in vertical direction.
size_t nAntCols
Number of antenna element columns (horizontal width)
double polSlantAngle
Polarization slant angle in radians.
Parameters for initial attachment association.
double handoffMargin
Handoff margin for Initial assocc.
std::vector< double > rowAngles
vector of angles to set in initial assocc
double primaryCarrierIndex
primary carrier index for Initial assocc
std::vector< double > colAngles
vector of angles to set in initial assocc
parameters for the search of optimal rank and precoding matrix indicator (RI, PMI)
double rankThreshold
Limits the selection of ranks determined by SVD decomposition.
std::string downsamplingTechnique
Sub-band compression technique.
uint8_t subbandSize
Number of PRBs per subband for downsampling.
std::string rankTechnique
Select technique that determines ranks in non-exhaustive search.
std::string fullSearchCb
Codebook when using full-search algorithm.
std::string pmSearchMethod
Precoding matrix search algorithm.