8#include "nr-phy-mac-common.h"
11#include <ns3/nr-spectrum-value-helper.h>
17class NrControlMessage;
19class AntennaArrayBasicModel;
20class UniformPlanarArray;
101 void SetMacPdu(
const Ptr<Packet>& p,
const SfnSf& sfn, uint8_t symStart, uint16_t rnti);
355 static bool HasDlSlot(
const std::vector<LteNrTddSlotType>& pattern);
363 static bool HasUlSlot(
const std::vector<LteNrTddSlotType>& pattern);
384 static std::string
GetPattern(
const std::vector<LteNrTddSlotType>& pattern);
393 enum NrSpectrumValueHelper::PowerAllocationType powerAllocationType);
430 static bool IsTdd(
const std::vector<LteNrTddSlotType>& pattern);
563 std::unordered_map<uint64_t, Ptr<PacketBurst>>
576 std::list<SlotAllocInfo> m_slotAllocInfo;
577 std::vector<std::list<Ptr<NrControlMessage>>> m_controlMessageQueue;
579 Time m_tbDecodeLatencyUs{MicroSeconds(100)};
580 double m_centralFrequency{-1.0};
581 uint16_t m_channelBandwidth{
585 uint16_t m_cellId{0};
588 uint16_t m_numerology{
590 uint16_t m_symbolsPerSlot{14};
592 uint16_t m_slotsPerSubframe{0};
593 Time m_slotPeriod{0};
594 Time m_symbolPeriod{0};
595 uint32_t m_subcarrierSpacing{0};
600 enum NrSpectrumValueHelper::PowerAllocationType m_powerAllocationType{
601 NrSpectrumValueHelper::UNIFORM_POWER_ALLOCATION_USED};
Representation of a beam id.
The base class for gNb and UE physical layer.
Time GetSymbolPeriod() const
Get SymbolPeriod.
Ptr< NrSpectrumPhy > m_spectrumPhy
Pointer to the (owned) spectrum phy.
SlotAllocInfo RetrieveSlotAllocInfo()
Get the head for the slot allocation info, and delete it from the internal list.
uint16_t GetCellId() const
virtual const SfnSf & GetCurrentSfnSf() const =0
Get the current SfnSf.
uint16_t GetNumerology() const
Get the configured numerology.
Ptr< NrSpectrumPhy > GetSpectrumPhy() const
Retrieve the SpectrumPhy pointer.
void EncodeCtrlMsg(const Ptr< NrControlMessage > &msg)
Take the control messages, and put it in a list that will be sent at the first occasion.
void SetNumerology(uint16_t numerology)
Set GNB or UE numerology.
virtual void SetTbDecodeLatency(const Time &us)
Configures TB decode latency.
std::list< Ptr< NrControlMessage > > m_ctrlMsgs
CTRL messages to be sent.
void DoInitialize() override
DoInitialize method inherited from Object.
void SetRbOverhead(double oh)
Set the bandwidth overhead for calculating the usable RB number.
void PushBackSlotAllocInfo(const SlotAllocInfo &slotAllocInfo)
Store the slot allocation info.
void NotifyConnectionSuccessful()
Notify PHY about the successful RRC connection establishment.
void InstallCentralFrequency(double f)
Install the PHY over a particular central frequency.
Ptr< PacketBurst > GetPacketBurst(SfnSf sf, uint8_t sym, uint16_t rnti)
Retrieve the PacketBurst at the slot/symbol specified.
void SetPowerAllocationType(enum NrSpectrumValueHelper::PowerAllocationType powerAllocationType)
Set power allocation type. There are currently supported two types: one that distributes uniformly en...
static std::string GetPattern(const std::vector< LteNrTddSlotType > &pattern)
Get a string representation of a pattern.
void InstallSpectrumPhy(const Ptr< NrSpectrumPhy > &spectrumPhy)
Set the SpectrumPhy associated with this PHY.
Time GetSlotPeriod() const
Get the slot period.
virtual std::list< Ptr< NrControlMessage > > PopCurrentSlotCtrlMsgs()
Extract and return the message list that is at the beginning of the queue.
virtual void SendRachPreamble(uint32_t PreambleId, uint32_t Rnti)
Send the RachPreamble.
virtual void ScheduleStartEventLoop(uint32_t nodeId, uint16_t frame, uint8_t subframe, uint16_t slot)=0
Schedule the start of the NR event loop.
SlotAllocInfo m_currSlotAllocInfo
Current slot allocation.
NrPhy()
NrPhy constructor.
enum NrSpectrumValueHelper::PowerAllocationType GetPowerAllocationType() const
Get the power allocation type.
void EnqueueCtrlMsgNow(const Ptr< NrControlMessage > &msg)
Enqueue a CTRL message without considering L1L2CtrlLatency.
uint32_t GetChannelBandwidth() const
Retrieve the channel bandwidth, in Hz.
virtual Time GetTbDecodeLatency() const
Returns Transport Block decode latency.
static TypeId GetTypeId()
Get the TypeId of the Object.
SlotAllocInfo & PeekSlotAllocInfo(const SfnSf &sfnsf)
Peek the SlotAllocInfo at the SfnSf specified.
double GetCentralFrequency() const
Retrieve the frequency (in Hz) of this PHY's channel.
void SetMacPdu(const Ptr< Packet > &p, const SfnSf &sfn, uint8_t symStart, uint16_t rnti)
Store a MAC PDU.
double m_noiseFigure
Noise figure (attribute)
virtual uint32_t GetNumRbPerRbg() const =0
Protected function that is used to get the number of resource blocks per resource block group.
void SetSymbolsPerSlot(uint16_t symbolsPerSlot)
Set the number of symbol per slot.
void SetDevice(Ptr< NrNetDevice > d)
Set the owner device.
uint32_t m_raPreambleId
Preamble ID.
Ptr< const SpectrumModel > GetSpectrumModel()
Get the spectrum model of the PHY.
size_t SlotAllocInfoSize() const
Retrieve the size of the SlotAllocInfo list.
double GetNoiseFigure() const
Get the NoiseFigure value.
void SetNoiseFigure(double d)
Set the NoiseFigure value.
double m_txPower
Transmission power (attribute)
void InitializeMessageList()
Initialize the message list.
void DoUpdateRbNum()
Update the number of RB. Usually called after bandwidth changes.
Ptr< SpectrumValue > GetTxPowerSpectralDensity(const std::vector< int > &rbIndexVector)
virtual double GetTxPower() const =0
Retrieve the Tx power.
void SetChannelBandwidth(uint16_t bandwidth)
Function to set the channel bandwidth, used also by child classes, i.e., see functions DoSetDlBanwidt...
uint16_t GetBwpId() const
void PushFrontSlotAllocInfo(const SfnSf &newSfnSf, const SlotAllocInfo &slotAllocInfo)
Store the slot allocation info at the front.
Ptr< NrNetDevice > m_netDevice
Pointer to the owner netDevice.
virtual BeamId GetBeamId(uint16_t rnti) const =0
Get the beam id for the specified user.
uint32_t GetL1L2CtrlLatency() const
bool HasDlSlot() const
Go through the current pattern and see if at least one slot is DL, F or S.
bool SlotAllocInfoExists(const SfnSf &sfnsf) const
Check if the SlotAllocationInfo for that slot exists.
std::unordered_map< uint64_t, Ptr< PacketBurst > > m_packetBurstMap
Map between SfnSf and PacketBurst.
uint32_t GetSubcarrierSpacing() const
Retrieve the subcarrier spacing in Hz. Subcarrier spacing is updated when the numerology is being upd...
uint32_t GetSymbolsPerSlot() const
Get the number of symbols in a slot.
std::vector< LteNrTddSlotType > m_tddPattern
Pattern.
Ptr< SpectrumValue > GetNoisePowerSpectralDensity()
Create Noise Power Spectral density.
bool IsCtrlMsgListEmpty() const
Check if there are no control messages queued for this slot.
NrPhySapProvider * m_phySapProvider
Pointer to the MAC.
double GetRbOverhead() const
Get the bandwidth overhead used when calculating the usable RB number.
bool HasUlSlot() const
Go through the current pattern and see if at least one slot is UL, F or S.
void SetBwpId(uint16_t bwpId)
Set the bwp id. Called by helper.
uint32_t GetRbNum() const
Get the number of Resource block configured.
std::vector< int > FromRBGBitmaskToRBAssignment(const std::vector< bool > rbgBitmask) const
Transform a MAC-made vector of RBG to a PHY-ready vector of SINR indices.
void EnqueueCtrlMessage(const Ptr< NrControlMessage > &m)
Enqueue a ctrl message, keeping in consideration L1L2CtrlDelay.
static bool IsTdd(const std::vector< LteNrTddSlotType > &pattern)
Check if a pattern is TDD.
NrPhySapProvider * GetPhySapProvider()
Retrieve a pointer to an instance of NrPhySapProvider.
void DoDispose() override
DoDispose method inherited from Object.
void DoSetCellId(uint16_t cellId)
Set the cell ID.
SAP interface between the MAC and the PHY.
@ F
DL CTRL + DL DATA + UL DATA + UL CTRL.
The SlotAllocInfo struct.