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>
40 0.15, 0.23, 0.38, 0.6, 0.88, 1.18,
42 2.73, 3.32, 3.9, 4.52, 5.12, 5.55
64 { 2, 100, 32, 16, 16},
87 { 2, 100, 32, 16, 16},
126 static TypeId tid =
TypeId (
"ns3::LteFfrEnhancedAlgorithm")
130 .AddAttribute (
"UlSubBandOffset",
131 "Uplink SubBand Offset for this cell in number of Resource Block Groups",
134 MakeUintegerChecker<uint8_t> ())
135 .AddAttribute (
"UlReuse3SubBandwidth",
136 "Uplink Reuse 3 SubBandwidth Configuration in number of Resource Block Groups",
139 MakeUintegerChecker<uint8_t> ())
140 .AddAttribute (
"UlReuse1SubBandwidth",
141 "Uplink Reuse 1 SubBandwidth Configuration in number of Resource Block Groups",
144 MakeUintegerChecker<uint8_t> ())
145 .AddAttribute (
"DlSubBandOffset",
146 "Downlink SubBand Offset for this cell in number of Resource Block Groups",
149 MakeUintegerChecker<uint8_t> ())
150 .AddAttribute (
"DlReuse3SubBandwidth",
151 "Downlink Reuse 3 SubBandwidth Configuration in number of Resource Block Groups",
154 MakeUintegerChecker<uint8_t> ())
155 .AddAttribute (
"DlReuse1SubBandwidth",
156 "Downlink Reuse 1 SubBandwidth Configuration in number of Resource Block Groups",
159 MakeUintegerChecker<uint8_t> ())
160 .AddAttribute (
"RsrqThreshold",
161 "If the RSRQ of is worse than this threshold, UE should be served in Edge sub-band",
164 MakeUintegerChecker<uint8_t> ())
165 .AddAttribute (
"CenterAreaPowerOffset",
166 "PdschConfigDedicated::Pa value for Center Sub-band, default value dB0",
169 MakeUintegerChecker<uint8_t> ())
170 .AddAttribute (
"EdgeAreaPowerOffset",
171 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
174 MakeUintegerChecker<uint8_t> ())
175 .AddAttribute (
"DlCqiThreshold",
176 "If the DL-CQI for RBG of is higher than this threshold, transmission on RBG is possible",
179 MakeUintegerChecker<uint8_t> ())
180 .AddAttribute (
"UlCqiThreshold",
181 "If the UL-CQI for RBG of is higher than this threshold, transmission on RBG is possible",
184 MakeUintegerChecker <uint8_t> ())
185 .AddAttribute (
"CenterAreaTpc",
186 "TPC value which will be set in DL-DCI for UEs in center area"
187 "Absolute mode is used, default value 1 is mapped to -1 according to"
188 "TS36.213 Table 5.1.1.1-2",
191 MakeUintegerChecker<uint8_t> ())
192 .AddAttribute (
"EdgeAreaTpc",
193 "TPC value which will be set in DL-DCI for UEs in edge area"
194 "Absolute mode is used, default value 1 is mapped to -1 according to"
195 "TS36.213 Table 5.1.1.1-2",
198 MakeUintegerChecker<uint8_t> ())
250 NS_LOG_LOGIC (
this <<
" requesting Event A1 measurements"
251 <<
" (threshold = 0" <<
")");
311 NS_ASSERT_MSG (s >= 0.0,
"negative spectral efficiency = " << s);
340 "DlSubBandOffset + DlReuse3SubBandwidth + DlReuse1SubBandwidth higher than DlBandwidth");
345 uint8_t index = offset + i;
354 uint8_t index = offset + i;
365 uint8_t index = 0 * offset + i;
368 index = 1 * offset + i;
371 index = 2 * offset + i;
401 "UlSubBandOffset + UlReuse3SubBandwidth + UlReuse1SubBandwidth higher than UlBandwidth");
407 uint8_t index = offset + i;
416 uint8_t index = offset + i;
427 uint8_t index = 0 * offset + i;
430 index = 1 * offset + i;
433 index = 2 * offset + i;
456 std::map <uint16_t, std::vector<bool> >::iterator it;
460 std::vector<bool> rbgAvailableMap = it->second;
461 for (uint32_t i = 0; i < rbgMap.size (); i++)
463 NS_LOG_INFO (
"\t rbgId: " << i <<
" available " << (
int)rbgAvailableMap.at (i));
464 if ( rbgAvailableMap.at (i) ==
true)
466 rbgMap.at (i) =
false;
484 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
485 if (it ==
m_ues.end ())
490 it =
m_ues.find (rnti);
499 bool isCenterUe =
false;
500 bool isEdgeUe =
false;
511 if (isPrimarySegmentRbg)
513 NS_LOG_INFO (
"PRIMARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId );
514 return (isReuse1Rbg && isCenterUe) || (isReuse3Rbg && isEdgeUe);
516 else if (isSecondarySegmentRbg && isCenterUe)
519 NS_LOG_INFO (
"SECONDARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId );
523 NS_LOG_INFO (
"RNTI: " << rnti <<
" rbgId: " << rbgId <<
" available: " << it->second.at (rbgId));
524 if (it->second.at (rbgId) ==
true)
552 std::map <uint16_t, std::vector<bool> >::iterator it;
556 std::vector<bool> rbAvailableMap = it->second;
557 for (uint32_t i = 0; i < rbgMap.size (); i++)
559 NS_LOG_INFO (
"\t rbgId: " << i <<
" available " << (
int)rbAvailableMap.at (i));
560 if ( rbAvailableMap.at (i) ==
true)
562 rbgMap.at (i) =
false;
585 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
586 if (it ==
m_ues.end ())
591 it =
m_ues.find (rnti);
599 bool isCenterUe =
false;
600 bool isEdgeUe =
false;
611 if (isPrimarySegmentRbg)
613 return (isReuse1Rbg && isCenterUe) || (isReuse3Rbg && isEdgeUe);
615 else if (isSecondarySegmentRbg && isCenterUe)
618 NS_LOG_INFO (
"UL SECONDARY SEGMENT RNTI: " << rnti <<
" rbgId: " << rbgId );
622 NS_LOG_INFO (
"RNTI: " << rnti <<
" rbgId: " << rbgId <<
" available: " << it->second.at (rbgId));
623 if (it->second.at (rbgId) ==
true)
640 for (
unsigned int i = 0; i < params.
m_cqiList.size (); i++)
644 NS_LOG_INFO (
"subband CQI reporting high layer configured");
646 std::map <uint16_t,SbMeasResult_s>::iterator it;
647 uint16_t rnti = params.
m_cqiList.at (i).m_rnti;
649 std::map< uint16_t, uint8_t >::iterator ueIt =
m_ues.find (rnti);
650 if (ueIt !=
m_ues.end ())
666 m_dlCqi.insert ( std::pair<uint16_t, SbMeasResult_s > (rnti, params.
m_cqiList.at (i).m_sbMeasResult) );
671 (*it).second = params.
m_cqiList.at (i).m_sbMeasResult;
682 std::map <uint16_t,SbMeasResult_s>::iterator it;
685 uint16_t rnti = it->first;
686 std::vector<bool> rbgAvailableMap;
688 for (uint32_t i = 0; i < (*it).second.m_higherLayerSelected.size (); i++)
690 uint8_t rbgCqi = (*it).second.m_higherLayerSelected.at (i).m_sbCqi.at (0);
696 NS_LOG_INFO (
this <<
" RNTI " << rnti <<
" RBG " << i <<
" DL-CQI: " << (
int)rbgCqi);
700 bool isSecondarySegmentRbg =
false;
706 rbgAvailable = (isSecondarySegmentRbg ==
true) ? rbgAvailable :
false;
708 rbgAvailableMap.push_back (rbgAvailable);
718 uint16_t rnti = it->first;
719 std::vector<bool> dlRbgAvailableMap = it->second;
720 std::vector<bool> ulRbAvailableMap;
723 for (uint32_t j = 0; j < dlRbgAvailableMap.size (); j++)
725 uint32_t index = rbgSize * j;
726 for (uint32_t i = 0; i < rbgSize; i++)
729 ulRbAvailableMap[index] = dlRbgAvailableMap[j];
733 m_ulRbAvailableforUe.insert ( std::pair<uint16_t, std::vector<bool> > (rnti, ulRbAvailableMap ) );
750 double s = log2 ( 1 + (
751 std::pow (10, sinr / 10 ) /
752 ( (-std::log (5.0 * 0.00005 )) / 1.5) ));
754 NS_LOG_INFO (
this <<
" RNTI " << rnti <<
" new SRS-CQI for RB " << j <<
" value " << sinr <<
" UL-CQI: " << cqi);
763 NS_LOG_WARN (
"Method should not be called, because it is empty");
769 std::map <uint16_t, std::vector <double> >::iterator itCqi = ulCqiMap.find (rnti);
770 if (itCqi == ulCqiMap.end ())
779 unsigned int sinrNum = 0;
782 double sinr = (*itCqi).second.at (i);
789 double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
791 (*itCqi).second.at (rb) = estimatedSinr;
792 return (estimatedSinr);
816 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
817 if (it ==
m_ues.end ())
843 return minContinuousUlBandwidth;
846 minContinuousUlBandwidth =
849 minContinuousUlBandwidth =
852 NS_LOG_INFO (
"minContinuousUlBandwidth: " << (
int)minContinuousUlBandwidth);
854 return minContinuousUlBandwidth;
873 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
874 if (it ==
m_ues.end ())
879 it =
m_ues.find (rnti);
884 NS_LOG_INFO (
"UE RNTI: " << rnti <<
" will be served in Edge sub-band");
896 NS_LOG_INFO (
"UE RNTI: " << rnti <<
" will be served in Center sub-band");
910 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.
std::map< uint16_t, SbMeasResult_s > m_dlCqi
Map of UE's DL CQI A30 received.
uint8_t m_ulSubBandOffset
UL subband offset.
virtual void DoDispose()
Destructor implementation.
virtual void SetLteFfrRrcSapUser(LteFfrRrcSapUser *s)
Set the "user" part of the LteFfrRrcSap interface that this frequency reuse algorithm instance will i...
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.
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
std::map< uint16_t, std::vector< bool > > m_dlRbgAvailableforUe
DL RBG available for UE.
std::vector< bool > m_dlSecondarySegmentRbgMap
DL secondary segment RBG map.
uint8_t m_centerAreaPowerOffset
Center area power offset.
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
uint8_t m_dlCqiThreshold
DL CQI threshold.
uint8_t m_centerAreaTpc
Center area TPC.
std::vector< bool > m_ulReuse1RbgMap
UL reuse 1 RBG map.
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
virtual LteFfrRrcSapProvider * GetLteFfrRrcSapProvider()
Export the "provider" part of the LteFfrRrcSap interface.
std::vector< bool > m_dlPrimarySegmentRbgMap
DL primary segment RBG map.
virtual uint16_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
uint8_t m_edgeAreaTpc
Edge are TPC.
virtual void SetLteFfrSapUser(LteFfrSapUser *s)
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
std::vector< bool > m_ulPrimarySegmentRbgMap
UL primary segment RBG map.
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
virtual void Reconfigure()
Automatic FR reconfiguration.
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
int GetCqiFromSpectralEfficiency(double s)
Get CQI from spectral efficiency.
std::vector< bool > m_ulReuse3RbgMap
UL reuse 3 RBG map.
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)
DoReportUlCqiInfo.
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.
LteFfrEnhancedAlgorithm()
Creates a trivial ffr algorithm instance.
std::map< uint16_t, std::vector< bool > > m_ulRbAvailableforUe
UL RB available for UE.
virtual bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
std::vector< bool > m_ulRbgMap
UL RBG Map.
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
virtual void DoReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)
DoReportDlCqiInfo.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
FFR RRC SAP provider.
std::map< uint16_t, uint8_t > m_ues
UEs.
std::vector< bool > m_dlReuse1RbgMap
DL reuse 1 RBG map.
void InitializeUplinkRbgMaps()
Initialize uplink RBG maps.
virtual void DoInitialize()
Initialize() implementation.
uint8_t m_ulReuse3SubBandwidth
UL reuse 3 subbandwidth.
std::vector< bool > m_ulSecondarySegmentRbgMap
UL secondary segment RBG map.
virtual ~LteFfrEnhancedAlgorithm()
uint8_t m_edgeAreaPowerOffset
Edge area power offset.
uint8_t m_dlReuse3SubBandwidth
DL reuse 3 subband bandwidth.
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
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(void)
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...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#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.
static const struct ns3::FfrEnhancedDownlinkDefaultConfiguration g_ffrEnhancedDownlinkDefaultConfiguration[]
the enhanced downlink default configation
const uint16_t NUM_DOWNLINK_CONFS(sizeof(g_ffrEnhancedDownlinkDefaultConfiguration)/sizeof(FfrEnhancedDownlinkDefaultConfiguration))
const uint16_t NUM_UPLINK_CONFS(sizeof(g_ffrEnhancedUplinkDefaultConfiguration)/sizeof(FfrEnhancedUplinkDefaultConfiguration))
static const struct ns3::FfrEnhancedUplinkDefaultConfiguration g_ffrEnhancedUplinkDefaultConfiguration[]
the enhanced uplink default configuration
static const double SpectralEfficiencyForCqi[16]
Table of CQI index and its spectral efficiency.
Parameters of the SCHED_DL_CQI_INFO_REQ primitive.
std::vector< struct CqiListElement_s > m_cqiList
CQI list.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
struct UlCqi_s m_ulCqi
UL CQI.
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.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
@ RSRQ
Reference Signal Received Quality.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
enum ns3::LteRrcSap::ReportConfigEutra::@67 triggerQuantity
Trigger type enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@66 eventId
Event enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@69 reportInterval
Report interval enumeration.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
uint8_t range
Value range used in RSRP/RSRQ threshold.
enum ns3::LteRrcSap::ThresholdEutra::@64 choice
Threshold enumeration.
std::vector< uint16_t > m_sinr
SINR.