30 #include <ns3/uinteger.h>
48 m_servingCellThreshold (30),
49 m_neighbourCellOffset (1),
50 m_handoverManagementSapUser (0)
66 static TypeId tid =
TypeId (
"ns3::A2A4RsrqHandoverAlgorithm")
68 .AddConstructor<A2A4RsrqHandoverAlgorithm> ()
69 .AddAttribute (
"ServingCellThreshold",
70 "If the RSRQ of the serving cell is worse than this threshold, "
71 "neighbour cells are consider for handover",
74 MakeUintegerChecker<uint8_t> (0, 34))
75 .AddAttribute (
"NeighbourCellOffset",
76 "Minimum offset between serving and best neighbour cell to trigger the Handover",
79 MakeUintegerChecker<uint8_t> ())
106 NS_LOG_LOGIC (
this <<
" requesting Event A2 measurements"
116 NS_LOG_LOGIC (
this <<
" requesting Event A4 measurements"
117 <<
" (threshold=0)");
147 "Invalid UE measurement report");
155 for (std::list <LteRrcSap::MeasResultEutra>::iterator it = measResults.
measResultListEutra.begin ();
160 "RSRQ measurement is missing from cellId " << it->physCellId);
166 NS_LOG_WARN (
this <<
" Event A4 received without measurement results from neighbouring cells");
179 uint8_t servingCellRsrq)
183 MeasurementTable_t::iterator it1;
188 NS_LOG_WARN (
"Skipping handover evaluation for RNTI " << rnti <<
" because neighbour cells information is not found");
193 NS_LOG_LOGIC (
"Number of neighbour cells = " << it1->second.size ());
194 uint16_t bestNeighbourCellId = 0;
195 uint8_t bestNeighbourRsrq = 0;
196 MeasurementRow_t::iterator it2;
197 for (it2 = it1->second.begin (); it2 != it1->second.end (); ++it2)
199 if ((it2->second->m_rsrq > bestNeighbourRsrq)
202 bestNeighbourCellId = it2->first;
203 bestNeighbourRsrq = it2->second->m_rsrq;
208 if (bestNeighbourCellId > 0)
210 NS_LOG_LOGIC (
"Best neighbour cellId " << bestNeighbourCellId);
214 NS_LOG_LOGIC (
"Trigger Handover to cellId " << bestNeighbourCellId);
215 NS_LOG_LOGIC (
"target cell RSRQ " << (uint16_t) bestNeighbourRsrq);
216 NS_LOG_LOGIC (
"serving cell RSRQ " << (uint16_t) servingCellRsrq);
220 bestNeighbourCellId);
250 MeasurementTable_t::iterator it1;
257 std::pair<MeasurementTable_t::iterator, bool> ret;
265 std::map<uint16_t, Ptr<UeMeasure> >::iterator it2;
266 it2 = it1->second.find (cellId);
268 if (it2 != it1->second.end ())
270 neighbourCellMeasures = it2->second;
271 neighbourCellMeasures->m_cellId = cellId;
272 neighbourCellMeasures->m_rsrp = 0;
273 neighbourCellMeasures->m_rsrq = rsrq;
278 neighbourCellMeasures = Create<UeMeasure> ();
279 neighbourCellMeasures->m_cellId = cellId;
280 neighbourCellMeasures->m_rsrp = 0;
281 neighbourCellMeasures->m_rsrq = rsrq;
282 it1->second[cellId] = neighbourCellMeasures;
RSRQ is used for the threshold.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
The abstract base class of a handover algorithm that operates using the Handover Management SAP inter...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
MeasurementTable_t m_neighbourCellMeasures
virtual void SetLteHandoverManagementSapUser(LteHandoverManagementSapUser *s)
Set the "user" part of the Handover Management SAP interface that this handover algorithm instance wi...
LteHandoverManagementSapProvider * m_handoverManagementSapProvider
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.
virtual LteHandoverManagementSapProvider * GetLteHandoverManagementSapProvider()
Export the "provider" part of the Handover Management SAP interface.
virtual void TriggerHandover(uint16_t rnti, uint16_t targetCellId)=0
Instruct the eNodeB RRC entity to prepare a handover.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
A2A4RsrqHandoverAlgorithm()
Creates an A2-A4-RSRQ handover algorithm instance.
virtual ~A2A4RsrqHandoverAlgorithm()
uint8_t m_neighbourCellOffset
Event A4: Neighbour becomes better than absolute threshold.
bool IsValidNeighbour(uint16_t cellId)
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteHandoverManagementSapProvider::ReportUeMeas.
static TypeId GetTypeId()
LteHandoverManagementSapUser * m_handoverManagementSapUser
virtual void DoInitialize()
This method is called only once by Object::Initialize.
Hold an unsigned integer type.
Template for the implementation of the LteHandoverManagementSapProvider as a member of an owner class...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
uint8_t m_servingCellThreshold
bool haveMeasResultNeighCells
enum ns3::LteRrcSap::ReportConfigEutra::@73 eventId
Choice of E-UTRA event triggered reporting criteria.
uint8_t range
Value range used in RSRP/RSRQ threshold.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Event A2: Serving becomes worse than absolute threshold.
enum ns3::LteRrcSap::ReportConfigEutra::@77 reportInterval
Indicates the interval between periodical reports.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Service Access Point (SAP) offered by the handover algorithm instance to the eNodeB RRC instance...
enum ns3::LteRrcSap::ReportConfigEutra::@75 triggerQuantity
The quantities used to evaluate the triggering condition for the event, see 3GPP TS 36...
void UpdateNeighbourMeasurements(uint16_t rnti, uint16_t cellId, uint8_t rsrq)
virtual uint8_t AddUeMeasReportConfigForHandover(LteRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity...
std::map< uint16_t, Ptr< UeMeasure > > MeasurementRow_t
Reference Signal Received Quality.
void EvaluateHandover(uint16_t rnti, uint8_t servingCellRsrq)
enum ns3::LteRrcSap::ThresholdEutra::@71 choice
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Service Access Point (SAP) offered by the eNodeB RRC instance to the handover algorithm instance...
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.