15#include "ns3/boolean.h"
16#include <ns3/double.h>
108 : m_ffrSapUser(nullptr),
109 m_ffrRrcSapUser(nullptr),
134 TypeId(
"ns3::LteFfrEnhancedAlgorithm")
138 .AddAttribute(
"UlSubBandOffset",
139 "Uplink SubBand Offset for this cell in number of Resource Block Groups",
144 "UlReuse3SubBandwidth",
145 "Uplink Reuse 3 SubBandwidth Configuration in number of Resource Block Groups",
150 "UlReuse1SubBandwidth",
151 "Uplink Reuse 1 SubBandwidth Configuration in number of Resource Block Groups",
157 "Downlink SubBand Offset for this cell in number of Resource Block Groups",
162 "DlReuse3SubBandwidth",
163 "Downlink Reuse 3 SubBandwidth Configuration in number of Resource Block Groups",
168 "DlReuse1SubBandwidth",
169 "Downlink Reuse 1 SubBandwidth Configuration in number of Resource Block Groups",
175 "If the RSRQ of is worse than this threshold, UE should be served in Edge sub-band",
179 .AddAttribute(
"CenterAreaPowerOffset",
180 "PdschConfigDedicated::Pa value for Center Sub-band, default value dB0",
184 .AddAttribute(
"EdgeAreaPowerOffset",
185 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
189 .AddAttribute(
"DlCqiThreshold",
190 "If the DL-CQI for RBG of is higher than this threshold, transmission on "
195 .AddAttribute(
"UlCqiThreshold",
196 "If the UL-CQI for RBG of is higher than this threshold, transmission on "
201 .AddAttribute(
"CenterAreaTpc",
202 "TPC value which will be set in DL-DCI for UEs in center area"
203 "Absolute mode is used, default value 1 is mapped to -1 according to"
204 "TS36.213 Table 5.1.1.1-2",
208 .AddAttribute(
"EdgeAreaTpc",
209 "TPC value which will be set in DL-DCI for UEs in edge area"
210 "Absolute mode is used, default value 1 is mapped to -1 according to"
211 "TS36.213 Table 5.1.1.1-2",
261 NS_LOG_LOGIC(
this <<
" requesting Event A1 measurements"
327 NS_ASSERT_MSG(s >= 0.0,
"negative spectral efficiency = " << s);
357 "DlSubBandOffset + DlReuse3SubBandwidth + DlReuse1SubBandwidth higher than DlBandwidth");
362 uint8_t index = offset + i;
371 uint8_t index = offset + i;
382 uint8_t index = 0 * offset + i;
385 index = 1 * offset + i;
388 index = 2 * offset + i;
417 "UlSubBandOffset + UlReuse3SubBandwidth + UlReuse1SubBandwidth higher than UlBandwidth");
422 uint8_t index = offset + i;
431 uint8_t index = offset + i;
442 uint8_t index = 0 * offset + i;
445 index = 1 * offset + i;
448 index = 2 * offset + i;
473 std::vector<bool> rbgAvailableMap = it->second;
474 for (
uint32_t i = 0; i < rbgMap.size(); i++)
476 NS_LOG_INFO(
"\t rbgId: " << i <<
" available " << (
int)rbgAvailableMap.at(i));
477 if (rbgAvailableMap.at(i))
479 rbgMap.at(i) =
false;
497 auto it =
m_ues.find(rnti);
498 if (it ==
m_ues.end())
503 it =
m_ues.find(rnti);
511 bool isCenterUe =
false;
512 bool isEdgeUe =
false;
523 if (isPrimarySegmentRbg)
525 NS_LOG_INFO(
"PRIMARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId);
526 return (isReuse1Rbg && isCenterUe) || (isReuse3Rbg && isEdgeUe);
528 else if (isSecondarySegmentRbg && isCenterUe)
531 NS_LOG_INFO(
"SECONDARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId);
535 NS_LOG_INFO(
"RNTI: " << rnti <<
" rbgId: " << rbgId
536 <<
" available: " << it->second.at(rbgId));
537 if (it->second.at(rbgId))
568 std::vector<bool> rbAvailableMap = it->second;
569 for (
uint32_t i = 0; i < rbgMap.size(); i++)
571 NS_LOG_INFO(
"\t rbgId: " << i <<
" available " << (
int)rbAvailableMap.at(i));
572 if (rbAvailableMap.at(i))
574 rbgMap.at(i) =
false;
597 auto it =
m_ues.find(rnti);
598 if (it ==
m_ues.end())
603 it =
m_ues.find(rnti);
611 bool isCenterUe =
false;
612 bool isEdgeUe =
false;
623 if (isPrimarySegmentRbg)
625 return (isReuse1Rbg && isCenterUe) || (isReuse3Rbg && isEdgeUe);
627 else if (isSecondarySegmentRbg && isCenterUe)
630 NS_LOG_INFO(
"UL SECONDARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId);
634 NS_LOG_INFO(
"RNTI: " << rnti <<
" rbgId: " << rbgId
635 <<
" available: " << it->second.at(rbgId));
636 if (it->second.at(rbgId))
654 for (
unsigned int i = 0; i < params.m_cqiList.size(); i++)
658 NS_LOG_INFO(
"subband CQI reporting high layer configured");
660 uint16_t rnti = params.m_cqiList.at(i).m_rnti;
662 auto ueIt =
m_ues.find(rnti);
663 if (ueIt !=
m_ues.end())
680 std::pair<uint16_t, SbMeasResult_s>(rnti,
681 params.m_cqiList.at(i).m_sbMeasResult));
686 (*it).second = params.m_cqiList.at(i).m_sbMeasResult;
699 uint16_t rnti = it->first;
700 std::vector<bool> rbgAvailableMap;
702 for (
uint32_t i = 0; i < (*it).second.m_higherLayerSelected.size(); i++)
704 uint8_t rbgCqi = (*it).second.m_higherLayerSelected.at(i).m_sbCqi.at(0);
710 NS_LOG_INFO(
this <<
" RNTI " << rnti <<
" RBG " << i <<
" DL-CQI: " << (
int)rbgCqi);
714 bool isSecondarySegmentRbg =
false;
720 rbgAvailable = (isSecondarySegmentRbg ? rbgAvailable :
false);
722 rbgAvailableMap.push_back(rbgAvailable);
731 uint16_t rnti = it->first;
732 std::vector<bool> dlRbgAvailableMap = it->second;
733 std::vector<bool> ulRbAvailableMap;
736 for (
uint32_t j = 0; j < dlRbgAvailableMap.size(); j++)
739 for (
uint32_t i = 0; i < rbgSize; i++)
742 ulRbAvailableMap[index] = dlRbgAvailableMap[j];
762 double s = log2(1 + (std::pow(10, sinr / 10) / ((-std::log(5.0 * 0.00005)) / 1.5)));
764 NS_LOG_INFO(
this <<
" RNTI " << rnti <<
" new SRS-CQI for RB " << j <<
" value "
765 << sinr <<
" UL-CQI: " << cqi);
774 NS_LOG_WARN(
"Method should not be called, because it is empty");
780 std::map<uint16_t, std::vector<double>> ulCqiMap)
782 auto itCqi = ulCqiMap.find(rnti);
783 if (itCqi == ulCqiMap.end())
792 unsigned int sinrNum = 0;
795 double sinr = (*itCqi).second.at(i);
802 double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
804 (*itCqi).second.at(rb) = estimatedSinr;
805 return estimatedSinr;
830 auto it =
m_ues.find(rnti);
831 if (it ==
m_ues.end())
857 return minContinuousUlBandwidth;
860 minContinuousUlBandwidth =
863 : minContinuousUlBandwidth;
865 minContinuousUlBandwidth =
868 : minContinuousUlBandwidth;
870 NS_LOG_INFO(
"minContinuousUlBandwidth: " << (
int)minContinuousUlBandwidth);
872 return minContinuousUlBandwidth;
889 auto it =
m_ues.find(rnti);
890 if (it ==
m_ues.end())
895 it =
m_ues.find(rnti);
900 NS_LOG_INFO(
"UE RNTI: " << rnti <<
" will be served in Edge sub-band");
912 NS_LOG_INFO(
"UE RNTI: " << rnti <<
" will be served in Center sub-band");
927 NS_LOG_WARN(
"Method should not be called, because it is empty");
static double fpS11dot3toDouble(uint16_t val)
Convert from fixed point S11.3 notation to double.
The abstract base class of a Frequency Reuse algorithm.
bool m_needReconfiguration
If true FR algorithm will be reconfigured.
uint8_t m_frCellTypeId
FFR cell type ID for automatic configuration.
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
bool m_enabledInUplink
If true FR algorithm will also work in Uplink.
uint8_t m_dlBandwidth
downlink bandwidth in RBs
uint8_t m_ulBandwidth
uplink bandwidth in RBs
Enhanced Fractional Frequency Reuse algorithm implementation.
uint8_t m_ulSubBandOffset
UL subband offset.
void DoDispose() override
Destructor implementation.
void DoInitialize() override
Initialize() implementation.
void SetLteFfrSapUser(LteFfrSapUser *s) override
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
uint8_t m_measId
The expected measurement identity.
LteFfrSapProvider * m_ffrSapProvider
FFR SAP provider.
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set downlink configuration.
void InitializeDownlinkRbgMaps()
Initialize downlink RBG maps.
friend class MemberLteFfrSapProvider< LteFfrEnhancedAlgorithm >
let the forwarder class access the protected and private members
std::vector< bool > m_dlRbgMap
DL RBG map.
double EstimateUlSinr(uint16_t rnti, uint16_t rb, std::map< uint16_t, std::vector< double > > ulCqiMap)
Initialize uplink RBG maps.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_dlSubBandOffset
DL subband offset.
uint8_t m_ulCqiThreshold
UL CQI threshold.
std::map< uint16_t, std::vector< bool > > m_dlRbgAvailableforUe
DL RBG available for UE.
void Reconfigure() override
Automatic FR reconfiguration.
std::vector< bool > m_dlSecondarySegmentRbgMap
DL secondary segment RBG map.
uint8_t m_centerAreaPowerOffset
Center area power offset.
uint8_t m_dlCqiThreshold
DL CQI threshold.
uint8_t m_centerAreaTpc
Center area TPC.
std::vector< bool > m_ulReuse1RbgMap
UL reuse 1 RBG map.
bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
std::vector< bool > m_dlPrimarySegmentRbgMap
DL primary segment RBG map.
std::vector< bool > DoGetAvailableUlRbg() override
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
LteFfrRrcSapProvider * GetLteFfrRrcSapProvider() override
Export the "provider" part of the LteFfrRrcSap interface.
uint8_t m_edgeAreaTpc
Edge are TPC.
std::vector< bool > m_ulPrimarySegmentRbgMap
UL primary segment RBG map.
LteFfrSapProvider * GetLteFfrSapProvider() override
Export the "provider" part of the LteFfrSap interface.
uint8_t m_dlReuse1SubBandwidth
DL reuse 1 subband bandwidth.
LteFfrRrcSapUser * m_ffrRrcSapUser
FFR RRC SAP user.
std::vector< bool > m_dlReuse3RbgMap
DL reuse 3 RBG map.
friend class MemberLteFfrRrcSapProvider< LteFfrEnhancedAlgorithm >
let the forwarder class access the protected and private members
uint8_t DoGetTpc(uint16_t rnti) override
DoGetTpc for UE.
int GetCqiFromSpectralEfficiency(double s)
Get CQI from spectral efficiency.
std::vector< bool > m_ulReuse3RbgMap
UL reuse 3 RBG map.
std::map< uint16_t, SbMeasResult_s > m_dlCqi
Map of UE's DL CQI A30 received.
void SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
Set uplink configuration.
uint8_t m_ulReuse1SubBandwidth
UL reuse 1 subbandwidth.
uint8_t m_rsrqThreshold
RSRQ threshold.
LteFfrSapUser * m_ffrSapUser
FFR SAP user.
uint16_t DoGetMinContinuousUlBandwidth() override
DoGetMinContinuousUlBandwidth in number of RB.
LteFfrEnhancedAlgorithm()
Creates a trivial ffr algorithm instance.
std::map< uint16_t, uint8_t > m_ues
UEs.
void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params) override
DoRecvLoadInformation.
void DoReportUlCqiInfo(const FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms) override
DoReportUlCqiInfo.
std::map< uint16_t, std::vector< bool > > m_ulRbAvailableforUe
UL RB available for UE.
std::vector< bool > m_ulRbgMap
UL RBG Map.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
std::vector< bool > m_dlReuse1RbgMap
DL reuse 1 RBG map.
void InitializeUplinkRbgMaps()
Initialize uplink RBG maps.
void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s) override
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
void DoReportDlCqiInfo(const FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms) override
DoReportDlCqiInfo.
uint8_t m_ulReuse3SubBandwidth
UL reuse 3 subbandwidth.
std::vector< bool > m_ulSecondarySegmentRbgMap
UL secondary segment RBG map.
uint8_t m_edgeAreaPowerOffset
Edge area power offset.
~LteFfrEnhancedAlgorithm() override
bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti) override
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
uint8_t m_dlReuse3SubBandwidth
DL reuse 3 subband bandwidth.
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
std::vector< bool > DoGetAvailableDlRbg() override
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
virtual void SetPdschConfigDedicated(uint16_t rnti, LteRrcSap::PdschConfigDedicated pdschConfigDedicated)=0
Instruct the eNodeB RRC entity to perform RrcConnectionReconfiguration to inform UE about new PdschCo...
virtual uint8_t AddUeMeasReportConfigForFfr(LteRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
virtual void DoInitialize()
Initialize() implementation.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
constexpr double NO_SINR
Value for SINR outside the range defined by FF-API, used to indicate that there is no CQI for this el...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
const uint16_t NUM_DOWNLINK_CONFS(sizeof(g_ffrEnhancedDownlinkDefaultConfiguration)/sizeof(FfrEnhancedDownlinkDefaultConfiguration))
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
static const double SpectralEfficiencyForCqi[16]
Table of CQI index and its spectral efficiency.
static const FfrEnhancedDownlinkDefaultConfiguration g_ffrEnhancedDownlinkDefaultConfiguration[]
The enhanced downlink default configuration.
static const FfrEnhancedUplinkDefaultConfiguration g_ffrEnhancedUplinkDefaultConfiguration[]
The enhanced uplink default configuration.
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
FfrEnhancedDownlinkDefaultConfiguration structure.
uint8_t dlReuse1SubBandwidth
reuse 1 subbandwidth
uint8_t dlBandwidth
DL bandwidth.
uint8_t dlSubBandOffset
DL subband offset.
uint8_t dlReuse3SubBandwidth
reuse 3 subbandwidth
FfrEnhancedUplinkDefaultConfiguration structure.
uint8_t ulReuse3SubBandwidth
UL reuse 3 subbandwidth.
uint8_t ulSubBandOffset
UL subband offset.
uint8_t ulReuse1SubBandwidth
UL reuse 1 subbandwidth.
uint8_t ulBandwidth
UL bandwidth.
uint8_t rsrqResult
the RSRQ result
uint8_t rsrpResult
the RSRP result
MeasResultPCell measResultPCell
measurement result primary cell
PdschConfigDedicated structure.
Specifies criteria for triggering of an E-UTRA measurement reporting event.
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
@ RSRQ
Reference Signal Received Quality.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
enum ns3::LteRrcSap::ReportConfigEutra::@65 reportInterval
Report interval enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@63 triggerQuantity
Trigger type enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t range
Value range used in RSRP/RSRQ threshold.