A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
a2-a4-rsrq-handover-algorithm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 * Copyright (c) 2013 Budiarto Herman
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Original work authors (from lte-enb-rrc.cc):
8 * Nicola Baldo <nbaldo@cttc.es>
9 * Marco Miozzo <mmiozzo@cttc.es>
10 * Manuel Requena <manuel.requena@cttc.es>
11 *
12 * Converted to handover algorithm interface by:
13 * Budiarto Herman <budiarto.herman@magister.fi>
14 */
15
16#ifndef A2_A4_RSRQ_HANDOVER_ALGORITHM_H
17#define A2_A4_RSRQ_HANDOVER_ALGORITHM_H
18
21#include "lte-rrc-sap.h"
22
23#include <ns3/ptr.h>
24#include <ns3/simple-ref-count.h>
25
26#include <map>
27
28namespace ns3
29{
30
31/**
32 * \brief Handover algorithm implementation based on RSRQ measurements, Event
33 * A2 and Event A4.
34 *
35 * Handover decision made by this algorithm is primarily based on Event A2
36 * measurements (serving cell's RSRQ becomes worse than threshold). When the
37 * event is triggered, the first condition of handover is fulfilled.
38 *
39 * Event A4 measurements (neighbour cell's RSRQ becomes better than threshold)
40 * are used to detect neighbouring cells and their respective RSRQ. When a
41 * neighbouring cell's RSRQ is higher than the serving cell's RSRQ by a certain
42 * offset, then the second condition of handover is fulfilled.
43 *
44 * When the first and second conditions above are fulfilled, the algorithm
45 * informs the eNodeB RRC to trigger a handover.
46 *
47 * The threshold for Event A2 can be configured in the `ServingCellThreshold`
48 * attribute. The offset used in the second condition can also be configured by
49 * setting the `NeighbourCellOffset` attribute.
50 *
51 * The following code snippet is an example of using and configuring the
52 * handover algorithm in a simulation program:
53 *
54 * Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
55 *
56 * NodeContainer enbNodes;
57 * // configure the nodes here...
58 *
59 * lteHelper->SetHandoverAlgorithmType ("ns3::A2A4RsrqHandoverAlgorithm");
60 * lteHelper->SetHandoverAlgorithmAttribute ("ServingCellThreshold",
61 * UintegerValue (30));
62 * lteHelper->SetHandoverAlgorithmAttribute ("NeighbourCellOffset",
63 * UintegerValue (1));
64 * NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
65 *
66 * \note Setting the handover algorithm type and attributes after the call to
67 * LteHelper::InstallEnbDevice does not have any effect to the devices
68 * that have already been installed.
69 */
71{
72 public:
73 /// Creates an A2-A4-RSRQ handover algorithm instance.
75
77
78 /**
79 * \brief Get the type ID.
80 * \return the object TypeId
81 */
82 static TypeId GetTypeId();
83
84 // inherited from LteHandoverAlgorithm
87
88 /// let the forwarder class access the protected and private members
90
91 protected:
92 // inherited from Object
93 void DoInitialize() override;
94 void DoDispose() override;
95
96 // inherited from LteHandoverAlgorithm as a Handover Management SAP implementation
97 void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override;
98
99 private:
100 /**
101 * Called when Event A2 is detected, then trigger a handover if needed.
102 *
103 * \param rnti The RNTI of the UE who reported the event.
104 * \param servingCellRsrq The RSRQ of this cell as reported by the UE.
105 */
106 void EvaluateHandover(uint16_t rnti, uint8_t servingCellRsrq);
107
108 /**
109 * Determines if a neighbour cell is a valid destination for handover.
110 * Currently always return true.
111 *
112 * \param cellId The cell ID of the neighbour cell.
113 * \return True if the cell is a valid destination for handover.
114 */
115 bool IsValidNeighbour(uint16_t cellId);
116
117 /**
118 * Called when Event A4 is reported, then update the measurements table.
119 * If the RNTI and/or cell ID is not found in the table, a corresponding
120 * entry will be created. Only the latest measurements are stored in the
121 * table.
122 *
123 * \param rnti The RNTI of the UE who reported the event.
124 * \param cellId The cell ID of the measured cell.
125 * \param rsrq The RSRQ of the cell as measured by the UE.
126 */
127 void UpdateNeighbourMeasurements(uint16_t rnti, uint16_t cellId, uint8_t rsrq);
128
129 /// The expected measurement identities for A2 measurements.
130 std::vector<uint8_t> m_a2MeasIds;
131 /// The expected measurement identities for A4 measurements.
132 std::vector<uint8_t> m_a4MeasIds;
133
134 /**
135 * Measurements reported by a UE for a cell ID. The values are quantized
136 * according 3GPP TS 36.133 section 9.1.4 and 9.1.7.
137 */
138 class UeMeasure : public SimpleRefCount<UeMeasure>
139 {
140 public:
141 uint16_t m_cellId; ///< Cell ID.
142 uint8_t m_rsrp; ///< RSRP in quantized format. \todo Can be removed?
143 uint8_t m_rsrq; ///< RSRQ in quantized format.
144 };
145
146 /**
147 * Measurements reported by a UE for several cells. The structure is a map
148 * indexed by the cell ID.
149 */
150 typedef std::map<uint16_t, Ptr<UeMeasure>> MeasurementRow_t;
151
152 /**
153 * Measurements reported by several UEs. The structure is a map indexed by
154 * the RNTI of the UE.
155 */
156 typedef std::map<uint16_t, MeasurementRow_t> MeasurementTable_t;
157
158 /// Table of measurement reports from all UEs.
160
161 /**
162 * The `ServingCellThreshold` attribute. If the RSRQ of the serving cell is
163 * worse than this threshold, neighbour cells are consider for handover.
164 * Expressed in quantized range of [0..34] as per Section 9.1.7 of
165 * 3GPP TS 36.133.
166 */
168
169 /**
170 * The `NeighbourCellOffset` attribute. Minimum offset between the serving
171 * and the best neighbour cell to trigger the handover. Expressed in
172 * quantized range of [0..34] as per Section 9.1.7 of 3GPP TS 36.133.
173 */
175
176 /// Interface to the eNodeB RRC instance.
178 /// Receive API calls from the eNodeB RRC instance.
180
181}; // end of class A2A4RsrqHandoverAlgorithm
182
183} // end of namespace ns3
184
185#endif /* A2_A4_RSRQ_HANDOVER_ALGORITHM_H */
Measurements reported by a UE for a cell ID.
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.
std::map< uint16_t, MeasurementRow_t > MeasurementTable_t
Measurements reported by several UEs.
std::map< uint16_t, Ptr< UeMeasure > > MeasurementRow_t
Measurements reported by a UE for several cells.
void DoInitialize() override
Initialize() implementation.
A2A4RsrqHandoverAlgorithm()
Creates an A2-A4-RSRQ handover algorithm instance.
LteHandoverManagementSapProvider * GetLteHandoverManagementSapProvider() override
Export the "provider" part of the Handover Management SAP interface.
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.
std::vector< uint8_t > m_a2MeasIds
The expected measurement identities for A2 measurements.
void UpdateNeighbourMeasurements(uint16_t rnti, uint16_t cellId, uint8_t rsrq)
Called when Event A4 is reported, then update the measurements table.
void DoDispose() override
Destructor implementation.
void SetLteHandoverManagementSapUser(LteHandoverManagementSapUser *s) override
Set the "user" part of the Handover Management SAP interface that this handover algorithm instance wi...
void EvaluateHandover(uint16_t rnti, uint8_t servingCellRsrq)
Called when Event A2 is detected, then trigger a handover if needed.
MeasurementTable_t m_neighbourCellMeasures
Table of measurement reports from all UEs.
uint8_t m_servingCellThreshold
The ServingCellThreshold attribute.
void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override
Implementation of LteHandoverManagementSapProvider::ReportUeMeas.
std::vector< uint8_t > m_a4MeasIds
The expected measurement identities for A4 measurements.
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.
Template for the implementation of the LteHandoverManagementSapProvider as a member of an owner class...
A template-based reference counting class.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.
MeasResults structure.