60 static TypeId tid =
TypeId (
"ns3::LteFfrDistributedAlgorithm")
62 .AddConstructor<LteFfrDistributedAlgorithm> ()
63 .AddAttribute (
"CalculationInterval",
64 "Time interval between calculation of Edge sub-band, Default value 1 second",
68 .AddAttribute (
"RsrqThreshold",
69 "If the RSRQ of is worse than this threshold, UE should be served in Edge sub-band",
72 MakeUintegerChecker<uint8_t> ())
73 .AddAttribute (
"RsrpDifferenceThreshold",
74 "If the difference between the power of the signal received by UE from "
75 "the serving cell and the power of the signal received from the adjacent cell is less "
76 "than a RsrpDifferenceThreshold value, the cell weight is incremented",
79 MakeUintegerChecker<uint8_t> ())
80 .AddAttribute (
"CenterPowerOffset",
81 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
84 MakeUintegerChecker<uint8_t> ())
85 .AddAttribute (
"EdgePowerOffset",
86 "PdschConfigDedicated::Pa value for Edge Sub-band, default value dB0",
89 MakeUintegerChecker<uint8_t> ())
90 .AddAttribute (
"EdgeRbNum",
91 "Number of RB that can be used in edge Sub-band",
94 MakeUintegerChecker<uint8_t> ())
95 .AddAttribute (
"CenterAreaTpc",
96 "TPC value which will be set in DL-DCI for UEs in center area"
97 "Absolute mode is used, default value 1 is mapped to -1 according to"
98 "TS36.213 Table 5.1.1.1-2",
101 MakeUintegerChecker<uint8_t> ())
102 .AddAttribute (
"EdgeAreaTpc",
103 "TPC value which will be set in DL-DCI for UEs in edge area"
104 "Absolute mode is used, default value 1 is mapped to -1 according to"
105 "TS36.213 Table 5.1.1.1-2",
108 MakeUintegerChecker<uint8_t> ())
158 NS_LOG_LOGIC (
this <<
" requesting Event A1 and A4 measurements"
159 <<
" (threshold = 0" <<
")");
251 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
252 if (it ==
m_ues.end ())
264 return (edgeRbg && edgeUe) || (!edgeRbg && !edgeUe);
292 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
293 if (it ==
m_ues.end ())
305 return (edgeRbg && edgeUe) || (!edgeRbg && !edgeUe);
312 NS_LOG_WARN (
"Method should not be called, because it is empty");
319 NS_LOG_WARN (
"Method should not be called, because it is empty");
326 NS_LOG_WARN (
"Method should not be called, because it is empty");
349 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
350 if (it ==
m_ues.end ())
376 return minContinuousUlBandwidth;
379 minContinuousUlBandwidth =
382 return minContinuousUlBandwidth;
391 <<
" RSRP: " << (uint16_t)measResults.
rsrpResult
392 <<
" RSRQ: " << (uint16_t)measResults.
rsrqResult);
397 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
398 if (it ==
m_ues.end ())
403 it =
m_ues.find (rnti);
408 NS_LOG_INFO (
"UE RNTI: " << rnti <<
" will be served in Center sub-band");
420 NS_LOG_INFO (
"UE RNTI: " << rnti <<
" will be served in Edge sub-band");
431 std::map< uint16_t, uint8_t >::iterator it =
m_ues.find (rnti);
432 if (it ==
m_ues.end ())
442 for (std::list <LteRrcSap::MeasResultEutra>::iterator it = measResults.
measResultListEutra.begin ();
447 "RSRP measurement is missing from cellId " << it->physCellId);
449 "RSRQ measurement is missing from cellId " << it->physCellId);
455 if ((*ncIt) == it->physCellId)
468 NS_LOG_WARN (
this <<
" Event A4 received without measurement results from neighbouring cells");
492 MeasurementTable_t::iterator it1;
493 MeasurementRow_t::iterator it2;
497 uint32_t edgeUeNum = 0;
498 std::map< uint16_t, uint8_t >::iterator areaIt;
499 for (areaIt =
m_ues.begin (); areaIt !=
m_ues.end (); areaIt++)
511 std::map< uint16_t, uint8_t >::iterator areaIt =
m_ues.find (it1->first);
517 servingCellMeasures = 0;
518 neighbourCellMeasures = 0;
521 if (it2 != it1->second.end ())
523 servingCellMeasures = it2->second;
530 for (it2 = it1->second.begin (); it2 != it1->second.end (); it2++)
534 neighbourCellMeasures = it2->second;
541 if (servingCellMeasures && neighbourCellMeasures)
543 int16_t rsrpDifference = servingCellMeasures->
m_rsrp - neighbourCellMeasures->
m_rsrp;
545 <<
" NeighborCellId: " << neighbourCellMeasures->
m_cellId
546 <<
" RSRP Serving: " << (
int)servingCellMeasures->
m_rsrp
547 <<
" RSRP Neighbor: " << (
int)neighbourCellMeasures->
m_rsrp
548 <<
" RSRP Difference: " << (
int)rsrpDifference);
558 std::map< uint16_t, uint64_t > metricA;
559 for (uint16_t i = 0; i < rbgNum; i++)
564 std::map<uint16_t, uint32_t>::iterator cellIt;
567 NS_LOG_INFO (
"CellId: " <<
m_cellId <<
" NeighborCellId: " << cellIt->first <<
" Weight: " << cellIt->second);
569 std::map<uint16_t, std::vector <bool> >::iterator rntpIt =
m_rntp.find (cellIt->first);
570 if (rntpIt ==
m_rntp.end ())
575 for (uint8_t i = 0; i < rbgNum; i++)
577 metricA[i] += cellIt->second * rntpIt->second[i];
581 std::vector<uint16_t> sortedRbgByMetric;
582 std::multimap< uint64_t, uint16_t > sortedMetricA;
583 for (std::map<uint16_t, uint64_t>::const_iterator it = metricA.begin (); it != metricA.end (); ++it)
585 sortedMetricA.insert (std::pair<uint64_t, uint16_t> (it->second, it->first));
588 for (std::multimap< uint64_t, uint16_t >::const_iterator it = sortedMetricA.begin ();
589 it != sortedMetricA.end (); ++it)
591 sortedRbgByMetric.push_back (it->second);
601 uint32_t rbgIndex = sortedRbgByMetric[i];
602 for (
int k = 0; k < rbgSize; k++)
604 uint32_t rbIndex = rbgSize * rbgIndex + k;
621 NS_LOG_INFO (
"SendLoadInformation to CellId : " << targetCellId );
623 std::vector<EpcX2Sap::UlInterferenceOverloadIndicationItem> m_currentUlInterferenceOverloadIndicationList;
624 std::vector <EpcX2Sap::UlHighInterferenceInformationItem> m_currentUlHighInterferenceInformationList;
647 <<
" Recv X2 message: LOAD INFORMATION from CellId:" << params.
cellInformationList[0].sourceCellId);
655 std::map<uint16_t, std::vector <bool> >::iterator it =
m_rntp.find (neighborCellId);
662 m_rntp.insert (std::pair<uint16_t, std::vector <bool> > (neighborCellId, params.
cellInformationList[0].relativeNarrowbandTxBand.rntpPerPrbList));
674 MeasurementTable_t::iterator it1;
681 std::pair<MeasurementTable_t::iterator, bool> ret;
682 ret =
m_ueMeasures.insert (std::pair<uint16_t, MeasurementRow_t> (rnti, row));
689 std::map<uint16_t, Ptr<UeMeasure> >::iterator it2;
690 it2 = it1->second.find (cellId);
692 if (it2 != it1->second.end ())
694 cellMeasures = it2->second;
695 cellMeasures->m_cellId = cellId;
696 cellMeasures->m_rsrp = rsrp;
697 cellMeasures->m_rsrq = rsrq;
702 cellMeasures = Create<UeMeasure> ();
703 cellMeasures->m_cellId = cellId;
704 cellMeasures->m_rsrp = rsrp;
705 cellMeasures->m_rsrq = rsrq;
706 it1->second[cellId] = cellMeasures;
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteFfrRrcSapProvider::ReportUeMeas.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
uint8_t m_edgePowerOffset
Template for the implementation of the LteFfrRrcSapProvider as a member of an owner class of type C t...
std::vector< bool > m_ulEdgeRbgMap
LteFfrDistributedAlgorithm()
Smart pointer class similar to boost::intrusive_ptr.
LteFfrSapUser * m_ffrSapUser
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 "...
uint8_t m_rsrpDifferenceThreshold
EventId m_calculationEvent
std::vector< bool > m_dlEdgeRbgMap
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
LteFfrRrcSapUser * m_ffrRrcSapUser
std::list< MeasResultEutra > measResultListEutra
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Specifies criteria for triggering of an E-UTRA measurement reporting event.
uint8_t m_ulBandwidth
uplink bandwidth in RBs
RSRP is used for the threshold.
enum ns3::LteRrcSap::ReportConfigEutra::@72 eventId
Choice of E-UTRA event triggered reporting criteria.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void SendLoadInformation(uint16_t targetCellId)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
MeasurementTable_t m_ueMeasures
uint8_t m_egdeSubBandRsrqThreshold
std::map< uint16_t, std::vector< bool > > m_rntp
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
enum ns3::LteRrcSap::ReportConfigEutra::@76 reportInterval
Indicates the interval between periodical reports.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
std::vector< uint16_t > m_neigborCell
virtual std::vector< bool > DoGetAvailableUlRbg()
Implementation of LteFfrSapProvider::GetAvailableUlRbg.
static TypeId GetTypeId()
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...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
virtual bool DoIsUlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsUlRbgAvailableForUe.
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.
AttributeValue implementation for Time.
void InitializeDownlinkRbgMaps()
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the MAC Scheduler ins...
Hold an unsigned integer type.
virtual LteFfrSapProvider * GetLteFfrSapProvider()
Export the "provider" part of the LteFfrSap interface.
virtual void Reconfigure()
Automatic FR reconfiguration.
bool m_enabledInUplink
If true FR algorithm will also work in Uplink.
bool m_needReconfiguration
If true FR algorithm will be reconfigured.
std::map< uint16_t, uint8_t > m_ues
Event A4: Neighbour becomes better than absolute threshold.
uint8_t m_dlBandwidth
downlink bandwidth in RBs
virtual void SendLoadInformation(EpcX2Sap::LoadInformationParams params)=0
SendLoadInformation.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
virtual void DoDispose()
Destructor implementation.
virtual std::vector< bool > DoGetAvailableDlRbg()
Implementation of LteFfrSapProvider::GetAvailableDlRbg.
virtual bool DoIsDlRbgAvailableForUe(int i, uint16_t rnti)
Implementation of LteFfrSapProvider::IsDlRbgAvailableForUe.
virtual void DoReportUlCqiInfo(const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ¶ms)
DoReportUlCqiInfo.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The abstract base class of a Frequency Reuse algorithm.
enum ns3::LteRrcSap::ThresholdEutra::@70 choice
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)
bool haveMeasResultNeighCells
uint8_t range
Value range used in RSRP/RSRQ threshold.
std::vector< bool > m_dlRbgMap
void SetDownlinkConfiguration(uint16_t cellId, uint8_t bandwidth)
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
std::vector< bool > rntpPerPrbList
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Reference Signal Received Power.
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.
void UpdateNeighbourMeasurements(uint16_t rnti, uint16_t cellId, uint8_t rsrp, uint8_t rsrq)
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
virtual ~LteFfrDistributedAlgorithm()
Time m_calculationInterval
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
LteFfrRrcSapProvider * m_ffrRrcSapProvider
virtual void DoRecvLoadInformation(EpcX2Sap::LoadInformationParams params)
DoRecvLoadInformation.
Time Seconds(double value)
Construct a Time in the indicated unit.
int GetRbgSize(int dlbandwidth)
Get RBG size for DL Bandwidth according to table 7.1.6.1-1 of 36.213.
std::map< uint16_t, uint32_t > m_cellWeightMap
std::map< uint16_t, Ptr< UeMeasure > > MeasurementRow_t
LteFfrSapProvider * m_ffrSapProvider
Relative Narrowband Tx Power (RNTP) as it is used in the LOAD INFORMATION message.
uint8_t m_centerPowerOffset
virtual void DoInitialize()
Initialize() implementation.
virtual void SetLteFfrSapUser(LteFfrSapUser *s)
Set the "user" part of the LteFfrSap interface that this frequency reuse algorithm instance will inte...
std::vector< bool > m_ulRbgMap
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void DoReportDlCqiInfo(const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters ¶ms)
DoReportDlCqiInfo.
Event A1: Serving becomes better than absolute threshold.
a unique identifier for an interface.
virtual uint8_t DoGetTpc(uint16_t rnti)
DoGetTpc for UE.
TypeId SetParent(TypeId tid)
virtual uint8_t DoGetMinContinuousUlBandwidth()
DoGetMinContinuousUlBandwidth in number of RB.
virtual void DoInitialize(void)
Initialize() implementation.
virtual LteFfrRrcSapProvider * GetLteFfrRrcSapProvider()
Export the "provider" part of the LteFfrRrcSap interface.
void InitializeUplinkRbgMaps()