23 #include "ns3/ff-mac-common.h"
24 #include "ns3/lte-common.h"
25 #include "ns3/lte-vendor-specific-parameters.h"
27 #include "ns3/boolean.h"
28 #include <ns3/double.h>
39 0.15, 0.23, 0.38, 0.6, 0.88, 1.18,
41 2.73, 3.32, 3.9, 4.52, 5.12, 5.55
62 { 2, 100, 32, 16, 16},
84 { 2, 100, 32, 16, 16},
121 static TypeId tid =
TypeId (
"ns3::LteFfrEnhancedAlgorithm")
123 .AddConstructor<LteFfrEnhancedAlgorithm> ()
124 .AddAttribute (
"UlSubBandOffset",
125 "Uplink SubBand Offset for this cell in number of Resource Block Groups",
128 MakeUintegerChecker<uint8_t> ())
129 .AddAttribute (
"UlReuse3SubBandwidth",
130 "Uplink Reuse 3 SubBandwidth Configuration in number of Resource Block Groups",
133 MakeUintegerChecker<uint8_t> ())
134 .AddAttribute (
"UlReuse1SubBandwidth",
135 "Uplink Reuse 1 SubBandwidth Configuration in number of Resource Block Groups",
138 MakeUintegerChecker<uint8_t> ())
139 .AddAttribute (
"DlSubBandOffset",
140 "Downlink SubBand Offset for this cell in number of Resource Block Groups",
143 MakeUintegerChecker<uint8_t> ())
144 .AddAttribute (
"DlReuse3SubBandwidth",
145 "Downlink Reuse 3 SubBandwidth Configuration in number of Resource Block Groups",
148 MakeUintegerChecker<uint8_t> ())
149 .AddAttribute (
"DlReuse1SubBandwidth",
150 "Downlink Reuse 1 SubBandwidth Configuration in number of Resource Block Groups",
153 MakeUintegerChecker<uint8_t> ())
154 .AddAttribute (
"RsrqThreshold",
155 "If the RSRQ of is worse than this threshold, UE should be served in Edge sub-band",
158 MakeUintegerChecker<uint8_t> ())
159 .AddAttribute (
"CenterAreaPowerOffset",
160 "PdschConfigDedicated::Pa value for Center Sub-band, default value dB0",
163 MakeUintegerChecker<uint8_t> ())
164 .AddAttribute (
"EdgeAreaPowerOffset",
165 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
168 MakeUintegerChecker<uint8_t> ())
169 .AddAttribute (
"DlCqiThreshold",
170 "If the DL-CQI for RBG of is higher than this threshold, transmission on RBG is possible",
173 MakeUintegerChecker<uint8_t> ())
174 .AddAttribute (
"UlCqiThreshold",
175 "If the UL-CQI for RBG of is higher than this threshold, transmission on RBG is possible",
178 MakeUintegerChecker <uint8_t> ())
179 .AddAttribute (
"CenterAreaTpc",
180 "TPC value which will be set in DL-DCI for UEs in center area"
181 "Absolute mode is used, default value 1 is mapped to -1 according to"
182 "TS36.213 Table 5.1.1.1-2",
185 MakeUintegerChecker<uint8_t> ())
186 .AddAttribute (
"EdgeAreaTpc",
187 "TPC value which will be set in DL-DCI for UEs in edge area"
188 "Absolute mode is used, default value 1 is mapped to -1 according to"
189 "TS36.213 Table 5.1.1.1-2",
192 MakeUintegerChecker<uint8_t> ())
244 NS_LOG_LOGIC (
this <<
" requesting Event A1 measurements"
245 <<
" (threshold = 0" <<
")");
305 NS_ASSERT_MSG (s >= 0.0,
"negative spectral efficiency = " << s);
307 while ((cqi < 15) && (SpectralEfficiencyForCqi[cqi + 1] < s))
334 "DlSubBandOffset + DlReuse3SubBandwidth + DlReuse1SubBandwidth higher than DlBandwidth");
339 uint8_t index = offset + i;
348 uint8_t index = offset + i;
359 uint8_t index = 0 * offset + i;
362 index = 1 * offset + i;
365 index = 2 * offset + i;
395 "UlSubBandOffset + UlReuse3SubBandwidth + UlReuse1SubBandwidth higher than UlBandwidth");
401 uint8_t index = offset + i;
410 uint8_t index = offset + i;
421 uint8_t index = 0 * offset + i;
424 index = 1 * offset + i;
427 index = 2 * offset + i;
450 std::map <uint16_t, std::vector<bool> >::iterator it;
454 std::vector<bool> rbgAvailableMap = it->second;
455 for (uint32_t i = 0; i < rbgMap.size (); i++)
457 NS_LOG_INFO (
"\t rbgId: " << i <<
" available " << (
int)rbgAvailableMap.at (i));
458 if ( rbgAvailableMap.at (i) ==
true)
460 rbgMap.at (i) =
false;
478 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
479 if (it ==
m_ues.end ())
484 it =
m_ues.find (rnti);
493 bool isCenterUe =
false;
494 bool isEdgeUe =
false;
505 if (isPrimarySegmentRbg)
507 NS_LOG_INFO (
"PRIMARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId );
508 return (isReuse1Rbg && isCenterUe) || (isReuse3Rbg && isEdgeUe);
510 else if (isSecondarySegmentRbg && isCenterUe)
513 NS_LOG_INFO (
"SECONDARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId );
517 NS_LOG_INFO (
"RNTI: " << rnti <<
" rbgId: " << rbgId <<
" available: " << it->second.at (rbgId));
518 if (it->second.at (rbgId) ==
true)
546 std::map <uint16_t, std::vector<bool> >::iterator it;
550 std::vector<bool> rbAvailableMap = it->second;
551 for (uint32_t i = 0; i < rbgMap.size (); i++)
553 NS_LOG_INFO (
"\t rbgId: " << i <<
" available " << (
int)rbAvailableMap.at (i));
554 if ( rbAvailableMap.at (i) ==
true)
556 rbgMap.at (i) =
false;
579 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
580 if (it ==
m_ues.end ())
585 it =
m_ues.find (rnti);
593 bool isCenterUe =
false;
594 bool isEdgeUe =
false;
605 if (isPrimarySegmentRbg)
607 return (isReuse1Rbg && isCenterUe) || (isReuse3Rbg && isEdgeUe);
609 else if (isSecondarySegmentRbg && isCenterUe)
612 NS_LOG_INFO (
"UL SECONDARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId );
616 NS_LOG_INFO (
"RNTI: " << rnti <<
" rbgId: " << rbgId <<
" available: " << it->second.at (rbgId));
617 if (it->second.at (rbgId) ==
true)
634 for (
unsigned int i = 0; i < params.
m_cqiList.size (); i++)
638 NS_LOG_INFO (
"subband CQI reporting high layer configured");
640 std::map <uint16_t,SbMeasResult_s>::iterator it;
641 uint16_t rnti = params.
m_cqiList.at (i).m_rnti;
643 std::map< uint16_t, uint8_t >::iterator ueIt =
m_ues.find (rnti);
644 if (ueIt !=
m_ues.end ())
660 m_dlCqi.insert ( std::pair<uint16_t, SbMeasResult_s > (rnti, params.
m_cqiList.at (i).m_sbMeasResult) );
665 (*it).second = params.
m_cqiList.at (i).m_sbMeasResult;
676 std::map <uint16_t,SbMeasResult_s>::iterator it;
679 uint16_t rnti = it->first;
680 std::vector<bool> rbgAvailableMap;
682 for (uint32_t i = 0; i < (*it).second.m_higherLayerSelected.size (); i++)
684 uint8_t rbgCqi = (*it).second.m_higherLayerSelected.at (i).m_sbCqi.at (0);
690 NS_LOG_INFO (
this <<
" RNTI " << rnti <<
" RBG " << i <<
" DL-CQI: " << (
int)rbgCqi);
694 bool isSecondarySegmentRbg =
false;
700 rbgAvailable = (isSecondarySegmentRbg ==
true) ? rbgAvailable :
false;
702 rbgAvailableMap.push_back (rbgAvailable);
712 uint16_t rnti = it->first;
713 std::vector<bool> dlRbgAvailableMap = it->second;
714 std::vector<bool> ulRbAvailableMap;
717 for (uint32_t j = 0; j < dlRbgAvailableMap.size (); j++)
719 uint32_t index = rbgSize * j;
720 for (uint32_t i = 0; i < rbgSize; i++)
723 ulRbAvailableMap[index] = dlRbgAvailableMap[j];
727 m_ulRbAvailableforUe.insert ( std::pair<uint16_t, std::vector<bool> > (rnti, ulRbAvailableMap ) );
744 double s = log2 ( 1 + (
745 std::pow (10, sinr / 10 ) /
746 ( (-std::log (5.0 * 0.00005 )) / 1.5) ));
748 NS_LOG_INFO (
this <<
" RNTI " << rnti <<
" new SRS-CQI for RB " << j <<
" value " << sinr <<
" UL-CQI: " << cqi);
757 NS_LOG_WARN (
"Method should not be called, because it is empty");
763 std::map <uint16_t, std::vector <double> >::iterator itCqi = ulCqiMap.find (rnti);
764 if (itCqi == ulCqiMap.end ())
776 double sinr = (*itCqi).second.at (i);
783 double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
785 (*itCqi).second.at (rb) = estimatedSinr;
786 return (estimatedSinr);
810 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
811 if (it ==
m_ues.end ())
837 return minContinuousUlBandwidth;
840 minContinuousUlBandwidth =
843 minContinuousUlBandwidth =
846 NS_LOG_INFO (
"minContinuousUlBandwidth: " << (
int)minContinuousUlBandwidth);
848 return minContinuousUlBandwidth;
858 <<
" RSRP: " << (uint16_t)measResults.
rsrpResult
859 <<
" RSRQ: " << (uint16_t)measResults.
rsrqResult);
867 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
868 if (it ==
m_ues.end ())
873 it =
m_ues.find (rnti);
878 NS_LOG_INFO (
"UE RNTI: " << rnti <<
" will be served in Edge sub-band");
890 NS_LOG_INFO (
"UE RNTI: " << rnti <<
" will be served in Center sub-band");
904 NS_LOG_WARN (
"Method should not be called, because it is empty");
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
virtual uint8_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
uint8_t m_ulReuse1SubBandwidth
Template for the implementation of the LteFfrRrcSapProvider as a member of an owner class of type C t...
virtual LteFfrRrcSapProvider * GetLteFfrRrcSapProvider()
Export the "provider" part of the LteFfrRrcSap interface.
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::map< uint16_t, std::vector< bool > > m_dlRbgAvailableforUe
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
std::vector< bool > m_ulSecondarySegmentRbgMap
enum ns3::UlCqi_s::Type_e m_type
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Specifies criteria for triggering of an E-UTRA measurement reporting event.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
std::vector< uint16_t > m_sinr
uint8_t m_ulBandwidth
uplink bandwidth in RBs
std::vector< bool > m_ulReuse3RbgMap
enum ns3::LteRrcSap::ReportConfigEutra::@72 eventId
Choice of E-UTRA event triggered reporting criteria.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
LteFfrEnhancedAlgorithm()
Creates a trivial ffr algorithm instance.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
std::vector< bool > m_ulReuse1RbgMap
enum ns3::LteRrcSap::ReportConfigEutra::@76 reportInterval
Indicates the interval between periodical reports.
virtual void SetLteFfrSapUser(LteFfrSapUser *s)
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
RSRQ is used for the threshold.
virtual uint8_t AddUeMeasReportConfigForFfr(LteRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity...
virtual void DoReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)
DoReportDlCqiInfo.
virtual void DoDispose()
Destructor implementation.
static const struct ns3::FfrEnhancedUplinkDefaultConfiguration g_ffrEnhancedUplinkDefaultConfiguration[]
virtual void SetPdschConfigDedicated(uint16_t rnti, LteRrcSap::PdschConfigDedicated pdschConfigDedicated)=0
Instruct the eNodeB RRC entity to perform RrcConnectionReconfiguration to inform UE about new PdschCo...
Template for the implementation of the LteFfrSapProvider as a member of an owner class of type C to w...
Reference Signal Received Quality.
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
std::map< uint16_t, SbMeasResult_s > m_dlCqi
uint8_t m_dlReuse1SubBandwidth
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Hold an unsigned integer type.
LteFfrSapUser * m_ffrSapUser
uint8_t m_dlReuse3SubBandwidth
bool m_enabledInUplink
If true FR algorithm will also work in Uplink.
bool m_needReconfiguration
If true FR algorithm will be reconfigured.
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
uint8_t m_dlBandwidth
downlink bandwidth in RBs
std::vector< bool > m_dlPrimarySegmentRbgMap
double EstimateUlSinr(uint16_t rnti, uint16_t rb, std::map< uint16_t, std::vector< double > > ulCqiMap)
std::vector< bool > m_dlReuse1RbgMap
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)
DoReportUlCqiInfo.
LteFfrSapProvider * m_ffrSapProvider
virtual void DoInitialize()
Initialize() implementation.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
std::vector< struct CqiListElement_s > m_cqiList
static const struct ns3::FfrEnhancedDownlinkDefaultConfiguration g_ffrEnhancedDownlinkDefaultConfiguration[]
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The abstract base class of a Frequency Reuse algorithm.
uint8_t m_dlSubBandOffset
enum ns3::LteRrcSap::ThresholdEutra::@70 choice
std::vector< bool > m_dlSecondarySegmentRbgMap
uint8_t dlReuse1SubBandwidth
uint8_t m_edgeAreaPowerOffset
uint8_t range
Value range used in RSRP/RSRQ threshold.
uint8_t m_ulReuse3SubBandwidth
void InitializeDownlinkRbgMaps()
uint8_t ulReuse3SubBandwidth
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
uint8_t dlReuse3SubBandwidth
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
uint8_t m_ulSubBandOffset
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
enum ns3::LteRrcSap::ReportConfigEutra::@74 triggerQuantity
The quantities used to evaluate the triggering condition for the event, see 3GPP TS 36...
uint8_t m_frCellTypeId
FFR cell type ID for automatic configuration.
static double fpS11dot3toDouble(uint16_t val)
int GetCqiFromSpectralEfficiency(double s)
virtual void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s)
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
void SetUplinkConfiguration(uint16_t cellId, uint8_t bandwidth)
static TypeId GetTypeId()
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
std::map< uint16_t, uint8_t > m_ues
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
virtual bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
std::vector< bool > m_ulPrimarySegmentRbgMap
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
static const double SpectralEfficiencyForCqi[16]
Table of CQI index and its spectral efficiency.
const uint16_t NUM_DOWNLINK_CONFS(sizeof(g_ffrEnhancedDownlinkDefaultConfiguration)/sizeof(FfrEnhancedDownlinkDefaultConfiguration))
LteFfrRrcSapUser * m_ffrRrcSapUser
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Event A1: Serving becomes better than absolute threshold.
a unique identifier for an interface.
uint8_t ulReuse1SubBandwidth
TypeId SetParent(TypeId tid)
std::vector< bool > m_dlRbgMap
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
std::vector< bool > m_ulRbgMap
std::vector< bool > m_dlReuse3RbgMap
virtual void DoInitialize(void)
Initialize() implementation.
virtual void Reconfigure()
Automatic FR reconfiguration.
std::map< uint16_t, std::vector< bool > > m_ulRbAvailableforUe
virtual ~LteFfrEnhancedAlgorithm()
uint8_t m_centerAreaPowerOffset
void InitializeUplinkRbgMaps()