7#include "nr-a3-rsrp-handover-algorithm.h"
11#include "ns3/double.h"
20NS_LOG_COMPONENT_DEFINE(
"NrA3RsrpHandoverAlgorithm");
22NS_OBJECT_ENSURE_REGISTERED(NrA3RsrpHandoverAlgorithm);
25 : m_handoverManagementSapUser(nullptr)
27 NS_LOG_FUNCTION(
this);
28 m_handoverManagementSapProvider =
32NrA3RsrpHandoverAlgorithm::~NrA3RsrpHandoverAlgorithm()
34 NS_LOG_FUNCTION(
this);
41 TypeId(
"ns3::NrA3RsrpHandoverAlgorithm")
47 "Handover margin (hysteresis) in dB "
48 "(rounded to the nearest multiple of 0.5 dB)",
50 MakeDoubleAccessor(&NrA3RsrpHandoverAlgorithm::m_hysteresisDb),
51 MakeDoubleChecker<uint8_t>(0.0, 15.0))
53 .AddAttribute(
"TimeToTrigger",
54 "Time during which neighbour cell's RSRP "
55 "must continuously higher than serving cell's RSRP "
56 "in order to trigger a handover",
57 TimeValue(MilliSeconds(256)),
59 MakeTimeAccessor(&NrA3RsrpHandoverAlgorithm::m_timeToTrigger),
67 NS_LOG_FUNCTION(
this << s);
68 m_handoverManagementSapUser = s;
74 NS_LOG_FUNCTION(
this);
75 return m_handoverManagementSapProvider;
79NrA3RsrpHandoverAlgorithm::DoInitialize()
81 NS_LOG_FUNCTION(
this);
83 uint8_t hysteresisIeValue =
85 NS_LOG_LOGIC(
this <<
" requesting Event A3 measurements"
86 <<
" (hysteresis=" << (uint16_t)hysteresisIeValue <<
")"
87 <<
" (ttt=" << m_timeToTrigger.As(Time::MS) <<
")");
93 reportConfig.
timeToTrigger = m_timeToTrigger.GetMilliSeconds();
99 NrHandoverAlgorithm::DoInitialize();
103NrA3RsrpHandoverAlgorithm::DoDispose()
105 NS_LOG_FUNCTION(
this);
106 delete m_handoverManagementSapProvider;
112 NS_LOG_FUNCTION(
this << rnti << (uint16_t)measResults.
measId);
114 if (std::find(begin(m_measIds), end(m_measIds), measResults.
measId) == std::end(m_measIds))
116 NS_LOG_WARN(
"Ignoring measId " << (uint16_t)measResults.
measId);
122 uint16_t bestNeighbourCellId = 0;
123 uint8_t bestNeighbourRsrp = 0;
129 if (it->haveRsrpResult)
131 if ((bestNeighbourRsrp < it->rsrpResult) && IsValidNeighbour(it->physCellId))
133 bestNeighbourCellId = it->physCellId;
134 bestNeighbourRsrp = it->rsrpResult;
139 NS_LOG_WARN(
"RSRP measurement is missing from cell ID " << it->physCellId);
143 if (bestNeighbourCellId > 0)
145 NS_LOG_LOGIC(
"Trigger Handover to cellId " << bestNeighbourCellId);
146 NS_LOG_LOGIC(
"target cell RSRP " << (uint16_t)bestNeighbourRsrp);
150 m_handoverManagementSapUser->
TriggerHandover(rnti, bestNeighbourCellId);
156 this <<
" Event A3 received without measurement results from neighbouring cells");
162NrA3RsrpHandoverAlgorithm::IsValidNeighbour(uint16_t cellId)
164 NS_LOG_FUNCTION(
this << cellId);
Implementation of the strongest cell handover algorithm, based on RSRP measurements and Event A3.
NrA3RsrpHandoverAlgorithm()
Creates a strongest cell handover algorithm instance.
void SetNrHandoverManagementSapUser(NrHandoverManagementSapUser *s) override
Set the "user" part of the Handover Management SAP interface that this handover algorithm instance wi...
friend class MemberNrHandoverManagementSapProvider< NrA3RsrpHandoverAlgorithm >
let the forwarder class access the protected and private members
static TypeId GetTypeId()
Get the type ID.
void DoReportUeMeas(uint16_t rnti, NrRrcSap::MeasResults measResults) override
Implementation of NrHandoverManagementSapProvider::ReportUeMeas.
NrHandoverManagementSapProvider * GetNrHandoverManagementSapProvider() override
Export the "provider" part of the Handover Management SAP interface.
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 void TriggerHandover(uint16_t rnti, uint16_t targetCellId)=0
Instruct the eNodeB RRC entity to prepare a handover.
virtual std::vector< uint8_t > AddUeMeasReportConfigForHandover(NrRrcSap::ReportConfigEutra reportConfig)=0
Request a certain reporting configuration to be fulfilled by the UEs attached to the eNodeB entity.
static uint8_t ActualHysteresis2IeValue(double hysteresisDb)
Returns the IE value of hysteresis.
uint8_t rsrpResult
the RSRP result
bool haveMeasResultNeighCells
have measure result neighbor cells
MeasResultPCell measResultPCell
measurement result primary cell
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
Specifies criteria for triggering of an E-UTRA measurement reporting event.
enum ns3::NrRrcSap::ReportConfigEutra::@5 triggerQuantity
Trigger type enumeration.
@ RSRP
Reference Signal Received Power.
enum ns3::NrRrcSap::ReportConfigEutra::@7 reportInterval
Report interval enumeration.
@ EVENT_A3
Event A3: Neighbour becomes amount of offset better than PCell.
enum ns3::NrRrcSap::ReportConfigEutra::@4 eventId
Event enumeration.