30 #include <ns3/uinteger.h>
47 m_servingCellThreshold (30),
48 m_neighbourCellOffset (1),
49 m_handoverManagementSapUser (0)
65 static TypeId tid =
TypeId (
"ns3::A2A4RsrqHandoverAlgorithm")
69 .AddAttribute (
"ServingCellThreshold",
70 "If the RSRQ of the serving cell is worse than this "
71 "threshold, neighbour cells are consider for handover. "
72 "Expressed in quantized range of [0..34] as per Section "
73 "9.1.7 of 3GPP TS 36.133.",
76 MakeUintegerChecker<uint8_t> (0, 34))
77 .AddAttribute (
"NeighbourCellOffset",
78 "Minimum offset between the serving and the best neighbour "
79 "cell to trigger the handover. Expressed in quantized "
80 "range of [0..34] as per Section 9.1.7 of 3GPP TS 36.133.",
83 MakeUintegerChecker<uint8_t> ())
110 NS_LOG_LOGIC (
this <<
" requesting Event A2 measurements"
120 NS_LOG_LOGIC (
this <<
" requesting Event A4 measurements"
121 <<
" (threshold=0)");
151 "Invalid UE measurement report");
159 for (std::list <LteRrcSap::MeasResultEutra>::iterator it = measResults.
measResultListEutra.begin ();
164 "RSRQ measurement is missing from cellId " << it->physCellId);
170 NS_LOG_WARN (
this <<
" Event A4 received without measurement results from neighbouring cells");
183 uint8_t servingCellRsrq)
187 MeasurementTable_t::iterator it1;
192 NS_LOG_WARN (
"Skipping handover evaluation for RNTI " << rnti <<
" because neighbour cells information is not found");
197 NS_LOG_LOGIC (
"Number of neighbour cells = " << it1->second.size ());
198 uint16_t bestNeighbourCellId = 0;
199 uint8_t bestNeighbourRsrq = 0;
200 MeasurementRow_t::iterator it2;
201 for (it2 = it1->second.begin (); it2 != it1->second.end (); ++it2)
203 if ((it2->second->m_rsrq > bestNeighbourRsrq)
206 bestNeighbourCellId = it2->first;
207 bestNeighbourRsrq = it2->second->m_rsrq;
212 if (bestNeighbourCellId > 0)
214 NS_LOG_LOGIC (
"Best neighbour cellId " << bestNeighbourCellId);
218 NS_LOG_LOGIC (
"Trigger Handover to cellId " << bestNeighbourCellId);
219 NS_LOG_LOGIC (
"target cell RSRQ " << (uint16_t) bestNeighbourRsrq);
220 NS_LOG_LOGIC (
"serving cell RSRQ " << (uint16_t) servingCellRsrq);
224 bestNeighbourCellId);
254 MeasurementTable_t::iterator it1;
261 std::pair<MeasurementTable_t::iterator, bool> ret;
269 std::map<uint16_t, Ptr<UeMeasure> >::iterator it2;
270 it2 = it1->second.find (cellId);
272 if (it2 != it1->second.end ())
274 neighbourCellMeasures = it2->second;
275 neighbourCellMeasures->m_cellId = cellId;
276 neighbourCellMeasures->m_rsrp = 0;
277 neighbourCellMeasures->m_rsrq = rsrq;
282 neighbourCellMeasures = Create<UeMeasure> ();
283 neighbourCellMeasures->m_cellId = cellId;
284 neighbourCellMeasures->m_rsrp = 0;
285 neighbourCellMeasures->m_rsrq = rsrq;
286 it1->second[cellId] = neighbourCellMeasures;
Handover algorithm implementation based on RSRQ measurements, Event A2 and Event A4.
static TypeId GetTypeId()
Get the type ID.
LteHandoverManagementSapUser * m_handoverManagementSapUser
Interface to the eNodeB RRC instance.
friend class MemberLteHandoverManagementSapProvider< A2A4RsrqHandoverAlgorithm >
let the forwarder class access the protected and private members
std::map< uint16_t, Ptr< UeMeasure > > MeasurementRow_t
Measurements reported by a UE for several cells.
virtual void DoDispose()
Destructor implementation.
virtual void DoInitialize()
Initialize() implementation.
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of LteHandoverManagementSapProvider::ReportUeMeas.
A2A4RsrqHandoverAlgorithm()
Creates an A2-A4-RSRQ handover algorithm instance.
LteHandoverManagementSapProvider * m_handoverManagementSapProvider
Receive API calls from the eNodeB RRC instance.
bool IsValidNeighbour(uint16_t cellId)
Determines if a neighbour cell is a valid destination for handover.
void UpdateNeighbourMeasurements(uint16_t rnti, uint16_t cellId, uint8_t rsrq)
Called when Event A4 is reported, then update the measurements table.
void EvaluateHandover(uint16_t rnti, uint8_t servingCellRsrq)
Called when Event A2 is detected, then trigger a handover if needed.
virtual void SetLteHandoverManagementSapUser(LteHandoverManagementSapUser *s)
Set the "user" part of the Handover Management SAP interface that this handover algorithm instance wi...
MeasurementTable_t m_neighbourCellMeasures
Table of measurement reports from all UEs.
virtual ~A2A4RsrqHandoverAlgorithm()
uint8_t m_a2MeasId
The expected measurement identity for A2 measurements.
uint8_t m_a4MeasId
The expected measurement identity for A4 measurements.
uint8_t m_servingCellThreshold
The ServingCellThreshold attribute.
virtual LteHandoverManagementSapProvider * GetLteHandoverManagementSapProvider()
Export the "provider" part of the Handover Management SAP interface.
uint8_t m_neighbourCellOffset
The NeighbourCellOffset attribute.
The abstract base class of a handover algorithm that operates using the Handover Management SAP inter...
Service Access Point (SAP) offered by the handover algorithm instance to the eNodeB RRC instance.
Service Access Point (SAP) offered by the eNodeB RRC instance to the handover algorithm instance.
virtual uint8_t AddUeMeasReportConfigForHandover(LteRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity.
virtual void TriggerHandover(uint16_t rnti, uint16_t targetCellId)=0
Instruct the eNodeB RRC entity to prepare a handover.
virtual void DoInitialize(void)
Initialize() implementation.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#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_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_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.
bool haveMeasResultNeighCells
have measure result neighbor cells
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
uint8_t rsrqResult
RSRQ result.
Specifies criteria for triggering of an E-UTRA measurement reporting event.
@ RSRQ
Reference Signal Received Quality.
enum ns3::LteRrcSap::ReportConfigEutra::@68 reportInterval
Report interval enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@65 eventId
Event enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@66 triggerQuantity
Trigger type enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
@ EVENT_A4
Event A4: Neighbour becomes better than absolute threshold.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
uint8_t range
Value range used in RSRP/RSRQ threshold.
enum ns3::LteRrcSap::ThresholdEutra::@63 choice
Threshold enumeration.