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/nr-component-carrier.h"
14#include <ns3/net-device-container.h>
15#include <ns3/node-container.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;
225 const NodeContainer& c,
226 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>>& allBwps);
234 const NodeContainer& c,
235 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps);
242 static uint32_t
GetNumberBwp(
const Ptr<const NetDevice>& gnbDevice);
249 static Ptr<NrGnbPhy>
GetGnbPhy(
const Ptr<NetDevice>& gnbDevice, uint32_t bwpIndex);
256 static Ptr<NrGnbMac>
GetGnbMac(
const Ptr<NetDevice>& gnbDevice, uint32_t bwpIndex);
263 static Ptr<NrUeMac>
GetUeMac(
const Ptr<NetDevice>& ueDevice, uint32_t bwpIndex);
270 static Ptr<NrUePhy>
GetUePhy(
const Ptr<NetDevice>& ueDevice, uint32_t bwpIndex);
276 static Ptr<BwpManagerGnb>
GetBwpManagerGnb(
const Ptr<NetDevice>& gnbDevice);
282 static Ptr<BwpManagerUe>
GetBwpManagerUe(
const Ptr<NetDevice>& ueDevice);
289 static Ptr<NrMacScheduler>
GetScheduler(
const Ptr<NetDevice>& gnbDevice, uint32_t bwpIndex);
302 void AttachToGnb(
const Ptr<NetDevice>& ueDevice,
const Ptr<NetDevice>& gnbDevice);
424 Ptr<NetDevice> gnbDevice,
593 void SetPhasedArraySpectrumPropagationLossModelTypeId(
const TypeId& typeId);
610 const AttributeValue& v);
653 void SetGnbBeamManagerAttribute(
const std::string& n,
const AttributeValue& v);
828 void EnableDlCtrlPathlossTraces(NetDeviceContainer& netDeviceContainer);
837 void EnableDlDataPathlossTraces(NetDeviceContainer& netDeviceContainer);
901 std::vector<CcBwpCreator::SimpleOperationBandConf> bandConfs);
910 void AddX2Interface(NodeContainer gnbNodes);
911 void AddX2Interface(Ptr<Node> gnbNode1, Ptr<Node> gnbNode2);
913 std::string GetHandoverAlgorithmType()
const;
914 void SetHandoverAlgorithmType(std::string type);
915 void SetHandoverAlgorithmAttribute(std::string n,
const AttributeValue& v);
916 void HandoverRequest(Time hoTime,
917 Ptr<NetDevice> ueDev,
918 Ptr<NetDevice> sourceGnbDev,
919 Ptr<NetDevice> targetGnbDev);
920 void HandoverRequest(Time hoTime,
921 Ptr<NetDevice> ueDev,
922 Ptr<NetDevice> sourceGnbDev,
923 uint16_t targetCellId);
926 bool m_enableMimoFeedback{
false};
927 ObjectFactory m_pmSearchFactory;
944 int64_t DoAssignStreamsToChannelObjects(Ptr<NrSpectrumPhy> phy, int64_t currentStream);
955 void DoDeActivateDedicatedEpsBearer(Ptr<NetDevice> ueDevice,
956 Ptr<NetDevice> gnbDevice,
959 Ptr<NrGnbPhy> CreateGnbPhy(
const Ptr<Node>& n,
960 const std::unique_ptr<BandwidthPartInfo>& bwp,
961 const Ptr<NrGnbNetDevice>& dev,
963 Ptr<NrMacScheduler> CreateGnbSched();
964 Ptr<NrGnbMac> CreateGnbMac();
966 Ptr<NrUeMac> CreateUeMac()
const;
967 Ptr<NrUePhy> CreateUePhy(
const Ptr<Node>& n,
968 const std::unique_ptr<BandwidthPartInfo>& bwp,
969 const Ptr<NrUeNetDevice>& dev,
973 Ptr<NetDevice> InstallSingleUeDevice(
975 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps);
976 Ptr<NetDevice> InstallSingleGnbDevice(
978 const std::vector<std::reference_wrapper<BandwidthPartInfoPtr>> allBwps);
980 void DoHandoverRequest(Ptr<NetDevice> ueDev,
981 Ptr<NetDevice> sourceGnbDev,
982 uint16_t targetCellId);
985 ObjectFactory m_gnbNetDeviceFactory;
986 ObjectFactory m_ueNetDeviceFactory;
987 ObjectFactory m_channelFactory;
988 ObjectFactory m_ueMacFactory;
989 ObjectFactory m_gnbMacFactory;
990 ObjectFactory m_ueSpectrumFactory;
991 ObjectFactory m_gnbSpectrumFactory;
992 ObjectFactory m_uePhyFactory;
993 ObjectFactory m_gnbPhyFactory;
994 ObjectFactory m_ueChannelAccessManagerFactory;
995 ObjectFactory m_gnbChannelAccessManagerFactory;
996 ObjectFactory m_schedFactory;
997 ObjectFactory m_ueAntennaFactory;
998 ObjectFactory m_gnbAntennaFactory;
999 ObjectFactory m_gnbBwpManagerAlgoFactory;
1000 ObjectFactory m_ueBwpManagerAlgoFactory;
1001 ObjectFactory m_channelConditionModelFactory;
1002 ObjectFactory m_spectrumPropagationFactory;
1003 ObjectFactory m_pathlossModelFactory;
1004 ObjectFactory m_gnbDlAmcFactory;
1005 ObjectFactory m_gnbUlAmcFactory;
1006 ObjectFactory m_gnbBeamManagerFactory;
1007 ObjectFactory m_ueBeamManagerFactory;
1008 ObjectFactory m_handoverAlgorithmFactory;
1010 uint16_t m_cellIdCounter{1};
1012 Ptr<NrEpcHelper> m_nrEpcHelper{
nullptr};
1013 Ptr<BeamformingHelperBase> m_beamformingHelper{
nullptr};
1015 bool m_snrTest{
false};
1017 Ptr<NrPhyRxTrace> m_phyStats;
1018 Ptr<NrMacRxTrace> m_macStats;
1020 NrBearerStatsConnector
1021 m_radioBearerStatsConnectorSimpleTraces;
1023 NrBearerStatsConnector
1024 m_radioBearerStatsConnectorCalculator;
1027 std::map<uint8_t, NrComponentCarrier> m_componentCarrierPhyParams;
1028 std::vector<Ptr<Object>>
1029 m_channelObjectsWithAssignedStreams;
1032 Ptr<NrMacSchedulingStats> m_macSchedStats;
1034 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 for a correct setup of every NR simulation.
void EnableDlDataPhyTraces()
Enable DL DATA PHY traces.
static Ptr< BwpManagerGnb > GetBwpManagerGnb(const Ptr< NetDevice > &gnbDevice)
Get the BwpManager of the GNB.
void AttachToClosestGnb(NetDeviceContainer ueDevices, NetDeviceContainer gnbDevices)
Attach the UE specified to the closest GNB.
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, NrEpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices.
void SetPhasedArraySpectrumPropagationLossModelAttribute(const std::string &n, const AttributeValue &v)
Set an attribute for the PhasedArraySpectrumPropagationLossModel before it is created.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
void UpdateDeviceConfigs(const NetDeviceContainer &netDevs)
Update netdevice configuration of one or more UEs and/or gNBs.
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 ...
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()
std::pair< double, BandwidthPartInfoPtrVector > CreateBandwidthParts(std::vector< CcBwpCreator::SimpleOperationBandConf > bandConfs)
Create BandwidthParts from a vector of band configurations.
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.
OperationBandFlags
Flags for OperationBand initialization.
@ INIT_PROPAGATION
Initialize the propagation loss model.
@ INIT_FADING
Initialize the fading model.
@ INIT_CHANNEL
Initialize the channel model.
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 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 SetupGnbAntennas(const AntennaParams &ap)
Set parameters for gNB and UE antenna arrays.
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)
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.
Ptr< NrBearerStatsCalculator > GetRlcStatsCalculator()
Get the RLC stats calculator object.
void EnableTransportBlockTrace()
Enable transport block trace.
void InitializeOperationBand(OperationBandInfo *band, uint8_t flags=INIT_PROPAGATION|INIT_FADING|INIT_CHANNEL)
Initialize the bandwidth parts by creating and configuring the channel models, if they are not alread...
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 SetPathlossAttribute(const std::string &n, const AttributeValue &v)
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 SetChannelConditionModelAttribute(const std::string &n, const AttributeValue &v)
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 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
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 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 the search of optimal rank and precoding matrix indicator (RI, PMI)
uint8_t rankLimit
Limit maximum MIMO rank to model limited UE capabilities.
std::string downsamplingTechnique
Sub-band compression technique.
uint8_t subbandSize
Number of PRBs per subband for downsampling.
std::string fullSearchCb
Codebook when using full-search algorithm.
std::string pmSearchMethod
Precoding matrix search algorithm.
Operation band information structure.