7#ifndef SRC_NR_MODEL_NR_PHY_MAC_COMMON_H
8#define SRC_NR_MODEL_NR_PHY_MAC_COMMON_H
10#include "nr-error-model.h"
14#include <ns3/matrix-array.h>
15#include <ns3/object.h>
16#include <ns3/string.h>
22#include <unordered_map>
30 template <
class First,
class Second>
31 First& operator()(std::pair<First, Second>& p)
36 template <
class First,
class Second>
37 First& operator()(
typename std::map<First, Second>::iterator& p)
42 template <
class First,
class Second>
43 const First& operator()(
const std::pair<First, Second>& p)
48 template <
class First,
class Second>
49 const First& operator()(
const typename std::map<First, Second>::iterator& p)
57 template <
class First,
class Second>
58 Second& operator()(std::pair<First, Second>& p)
63 template <
class First,
class Second>
64 Second& operator()(
typename std::map<First, Second>::iterator& p)
69 template <
class First,
class Second>
70 Second& operator()(
typename std::unordered_map<First, Second>::iterator& p)
75 template <
class First,
class Second>
76 const Second& operator()(
const std::pair<First, Second>& p)
81 template <
class First,
class Second>
82 const Second& operator()(
const typename std::map<First, Second>::iterator& p)
87 template <
class First,
class Second>
88 const Second& operator()(
const typename std::unordered_map<First, Second>::iterator& p)
97enum CsiFeedbackFlag : uint8_t
99 CQI_PDSCH_MIMO = 0x01,
102 CQI_PDSCH_SISO = 0x08
141 const std::vector<uint8_t>& rbgBitmask)
171 Ptr<const ComplexMatrixArray> precMats,
184 m_precMats(precMats),
213 m_precMats(o.m_precMats),
231 Ptr<const ComplexMatrixArray> m_precMats{
nullptr};
271 bool m_isOmni{
false};
272 std::shared_ptr<DciInfoElementTdma> m_dci;
273 std::vector<RlcPduInfo> m_rlcPduInfo;
277 NS_ASSERT(m_dci !=
nullptr);
278 return (m_dci->m_symStart < o.m_dci->m_symStart);
284 std::shared_ptr<DciInfoElementTdma>
411 std::vector<double> m_sinr;
437 std::vector<uint8_t> m_bufferStatus;
468 std::vector<struct RlcPduInfo> m_rlcPduElements;
480 uint32_t m_subframeno;
492 uint32_t m_subframeno;
508 const std::vector<int>& rbBitmap,
509 uint8_t harqProcessId,
578 bool errorModelEnabled,
596 m_tbler(errorModelEnabled ? tbInfo.
m_outputOfEM->m_tbler : 0),
601 uint64_t m_cellId{0};
603 uint32_t m_frameNum{std::numeric_limits<uint32_t>::max()};
604 uint8_t m_subframeNum{std::numeric_limits<uint8_t>::max()};
605 uint16_t m_slotNum{std::numeric_limits<uint16_t>::max()};
606 uint8_t m_symStart{std::numeric_limits<uint8_t>::max()};
607 uint8_t m_numSym{std::numeric_limits<uint8_t>::max()};
608 uint32_t m_tbSize{0};
609 uint8_t m_mcs{std::numeric_limits<uint8_t>::max()};
610 uint8_t m_rank{std::numeric_limits<uint8_t>::max()};
611 uint8_t m_rv{std::numeric_limits<uint8_t>::max()};
613 double m_sinrMin{-1.0};
614 double m_tbler{-1.0};
615 bool m_corrupt{
false};
616 uint16_t m_bwpId{std::numeric_limits<uint16_t>::max()};
617 uint32_t m_rbAssignedNum{std::numeric_limits<uint32_t>::max()};
618 uint8_t m_cqi{std::numeric_limits<uint8_t>::max()};
667 return m_harqStatus == ACK;
677 std::vector<uint16_t> m_ulReception;
691 return m_receptionStatus == Ok;
uint8_t GetSubframe() const
GetSubframe.
uint8_t GetSlot() const
GetSlot.
uint32_t GetFrame() const
GetFrame.
static std::ostream & operator<<(std::ostream &os, const TrafficTypeConf &item)
operator << for TrafficTypeConf
NrSchedulingCallbackInfo structure.
uint32_t m_tbSize
TB size.
uint8_t m_ndi
New data indicator.
uint8_t m_symStart
starting symbol index
uint8_t m_subframeNum
subframe number
uint16_t m_frameNum
frame number
uint8_t m_bwpId
Bandwidth Part ID.
uint16_t m_slotNum
slot number
uint8_t m_numSym
number of symbols
Scheduling information. Despite the name, it is not TDMA.
const uint8_t m_tpc
Tx power control command.
const uint32_t m_tbSize
TB size.
DciInfoElementTdma(uint16_t rnti, DciFormat format, uint8_t symStart, uint8_t numSym, uint8_t mcs, uint8_t rank, Ptr< const ComplexMatrixArray > precMats, uint32_t tbs, uint8_t ndi, uint8_t rv, VarTtiType type, uint8_t bwpIndex, uint8_t tpc)
Construct to build brand new DCI. Please remember to update manually the HARQ process ID and the RBG ...
const DciFormat m_format
DCI format.
const uint8_t m_rank
the rank number (the number of MIMO layers)
const uint16_t m_rnti
RNTI of the UE.
const uint8_t m_bwpIndex
BWP Index to identify to which BWP this DCI applies to.
uint8_t m_harqProcess
HARQ process id.
DciInfoElementTdma(uint8_t symStart, uint8_t numSym, uint8_t ndi, uint8_t rv, const DciInfoElementTdma &o)
Copy constructor except for some values that have to be overwritten.
VarTtiType
The VarTtiType enum.
@ CTRL
Used for DL/UL CTRL.
@ DATA
Used for DL/UL DATA.
@ SRS
Used for SRS (it would be like DCI format 2_3)
std::vector< uint8_t > m_rbgBitmask
RBG mask: 0 if the RBG is not used, 1 otherwise.
DciInfoElementTdma(uint8_t symStart, uint8_t numSym, DciFormat format, VarTtiType type, const std::vector< uint8_t > &rbgBitmask)
Constructor used in NrUePhy to build local DCI for DL and UL control.
const VarTtiType m_type
Var TTI type.
const uint8_t m_symStart
starting symbol index for flexible TTI scheme
const uint8_t m_numSym
number of symbols for flexible TTI scheme
const uint8_t m_rv
Redundancy Version.
const uint8_t m_ndi
New Data Indicator.
DciFormat
Format of the DCI.
Ptr< const ComplexMatrixArray > m_optPrecMat
Precoding matrix for each RB.
std::vector< size_t > m_sbPmis
Subband PMI values (i2, indices of W2 matrices)
uint8_t m_mcs
MCS (can be derived from CQI feedback)
size_t m_wbPmi
Wideband precoding matrix index.
uint8_t m_wbCqi
Wideband CQI.
std::vector< uint8_t > m_sbCqis
Subband CQI values.
uint8_t m_ri
the rank indicator, or simply the rank number
enum ns3::DlCqiInfo::DlCqiType WB
The type of the CQI.
A struct that contains info for the DL HARQ.
uint8_t m_numRetx
Num of Retx.
enum ns3::DlHarqInfo::HarqStatus NACK
HARQ status.
HarqStatus
Status of the DL Harq: ACKed or NACKed.
bool IsReceivedOk() const override
Information about the expected transport block at a certain point in the slot.
uint8_t m_ndi
New data indicator.
bool m_isDownlink
is Downlink?
uint8_t m_harqProcessId
HARQ process ID (MAC)
uint8_t m_symStart
Sym start.
std::vector< int > m_rbBitmap
RB Bitmap.
The GnbPhyPacketCountParameter struct.
Store information about HARQ.
uint8_t m_harqProcessId
ProcessId.
uint8_t m_bwpIndex
BWP identifier, uniquely identifies BWP within the UE.
virtual bool IsReceivedOk() const =0
See section 4.3.14 macCEListElement.
uint8_t raPreambleId
RA preamble ID, initialize with out of range values.
std::shared_ptr< DciInfoElementTdma > ulMsg3Dci
UL MSG3 DCI that will be sent through RAR message.
The structure used for the CQI feedback message that contains the optimum CQI, RI,...
Ptr< const ComplexMatrixArray > m_optPrecMat
Precoding matrix for each RB.
DlCqiInfo::DlCqiType m_cqiType
CQI type (WB or SB)
size_t m_wbPmi
Wideband precoding matrix index.
uint8_t m_rank
Rank of the channel matrix (supported number of MIMO layers)
uint8_t m_mcs
Modulation and coding scheme supported by current channel.
std::vector< size_t > m_sbPmis
Subband PMI values (i2, indices of W2 matrices)
uint8_t m_wbCqi
Wideband CQI.
size_t m_tbSize
Expected TB size when allocating all resources.
std::vector< uint8_t > m_sbCqis
Subband CQI values.
The RlcListElement struct.
The RxPacketTraceParams struct.
The SlotAllocInfo struct.
SfnSf m_sfnSf
SfnSf of this allocation.
bool operator<(const SlotAllocInfo &rhs) const
operator < (less than)
AllocationType m_type
Allocations type.
std::vector< NrBuildRarListElement_s > m_buildRarList
build rar list that will be sent to UE
bool ContainsDlCtrlAllocation() const
void Merge(const SlotAllocInfo &other)
Merge the input parameter to this SlotAllocInfo.
uint32_t m_numSymAlloc
Number of allocated symbols.
bool ContainsUlCtrlAllocation() const
bool ContainsDataAllocation() const
Check if we have data allocations.
AllocationType
Enum which indicates the allocations that are inside the allocation info.
@ BOTH
DL and UL allocations.
bool ContainsUlMsg3Allocation() const
Check if we have UL MSG3 allocations.
std::deque< VarTtiAllocInfo > m_varTtiAllocInfo
queue of allocations
bool m_harqFeedbackSent
Indicate if the feedback has been sent for an entire TB.
double m_sinrMin
MIN SINR (only between the RB used to transmit the TB)
void UpdatePerceivedSinr(const SpectrumValue &perceivedSinr)
Update minimum and average SINR of the transport block based on perceived SINR.
ExpectedTb m_expected
Expected data from the PHY. Filled by AddExpectedTb.
double m_sinrAvg
AVG SINR (only for the RB used to transmit the TB)
bool m_isCorrupted
True if the ErrorModel indicates that the TB is corrupted.
Ptr< NrErrorModelOutput > m_outputOfEM
Output of the Error Model (depends on the EM type)
The UePhyPacketCountParameter struct.
A struct that contains info for the UL HARQ.
uint8_t m_tpc
Transmit Power Control.
uint8_t m_numRetx
Num of Retx.
bool IsReceivedOk() const override
See section 4.3.4 logicalChannelConfigListElement.
enum ns3::nr::LogicalChannelConfigListElement_s::QosBearerType_e NotValid_QosBearerType
the QOS bearer type
uint64_t m_eRabMaximulBitrateUl
ERAB maximum bit rate UL.
Direction_e
Direction enum.
uint64_t m_eRabMaximulBitrateDl
ERAB maximum bit rate DL.
uint64_t m_eRabGuaranteedBitrateUl
ERAB guaranteed bit rate UL.
uint8_t m_logicalChannelGroup
logical channel group
enum ns3::nr::LogicalChannelConfigListElement_s::Direction_e NotValid
the direction
QosBearerType_e
QosBearerType enum.
uint64_t m_eRabGuaranteedBitrateDl
ERAB guaranteed bit rate DL.
uint8_t m_logicalChannelIdentity
logical channel identity
See section 4.3.14 macCEListElement.
enum ns3::nr::MacCeListElement_s::MacCeType_e NotValid
MAC CE type.
struct MacCeValue_u m_macCeValue
MAC CE value.
MacCeType_e
MAC CE type enum.
See section 4.3.15 macCEValue.
std::vector< uint8_t > m_bufferStatus
buffer status
See section 4.3.6 rachListElement.
uint16_t m_estimatedSize
estimated size
See section 4.3.3 vendorSpecificListElement.
Ptr< VendorSpecificValue > m_value
value
Base class for storing the values of vendor specific parameters.