A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-anr.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 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Original work authors (from lte-enb-rrc.cc):
19 * Nicola Baldo <nbaldo@cttc.es>
20 * Marco Miozzo <mmiozzo@cttc.es>
21 * Manuel Requena <manuel.requena@cttc.es>
22 *
23 * Converted to ANR interface by:
24 * Budiarto Herman <budiarto.herman@magister.fi>
25 */
26
27#ifndef LTE_ANR_H
28#define LTE_ANR_H
29
30#include "lte-anr-sap.h"
31#include "lte-rrc-sap.h"
32
33#include <ns3/object.h>
34
35#include <map>
36
37namespace ns3
38{
39
40class LteAnrSapProvider;
41class LteAnrSapUser;
42class LteNeighbourRelation;
43
44/**
45 * \brief Automatic Neighbour Relation function.
46 *
47 * ANR is a conceptually a list of neighbouring cells called the Neighbour
48 * Relation Table (NRT). ANR has the capability of automatically inserting new
49 * entries into NRT based on measurement reports obtained from the eNodeB RRC
50 * instance. Besides this, ANR also supports manual insertion and accepts
51 * queries for the NRT content.
52 *
53 * The LteHelper class automatically installs one ANR instance for each eNodeB
54 * RRC instance. When installed, ANR will assist the eNodeB RRC's handover
55 * function, e.g., by preventing an X2-based handover execution if there is no
56 * X2 interface to the target neighbour cell. If this is not desired, it can be
57 * disabled by the following code sample:
58 *
59 * Config::SetDefault ("ns3::LteHelper::AnrEnabled", BooleanValue (false));
60 * Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
61 *
62 * The communication between an ANR instance and the eNodeB RRC instance is done
63 * through the *ANR SAP* interface. The ANR instance corresponds to the
64 * "provider" part of this interface, while the eNodeB RRC instance takes the
65 * role of the "user" part. The following code skeleton establishes the
66 * connection between both instances:
67 *
68 * Ptr<LteEnbRrc> u = ...;
69 * Ptr<LteAnr> p = ...;
70 * u->SetLteAnrSapProvider (p->GetLteAnrSapProvider ());
71 * p->SetLteAnrSapUser (u->GetLteAnrSapUser ());
72 *
73 * However, user rarely needs to use the above code, since it has already been
74 * taken care by LteHelper::InstallEnbDevice.
75 *
76 * The current ANR model is inspired from Section 22.3.2a and 22.3.3 of 3GPP
77 * TS 36.300.
78 *
79 * \sa SetLteAnrSapProvider, SetLteAnrSapUser
80 */
81class LteAnr : public Object
82{
83 public:
84 /**
85 * \brief Creates an ANR instance.
86 * \param servingCellId the cell ID of the eNodeB instance whom this ANR
87 * instance is to be associated with
88 */
89 LteAnr(uint16_t servingCellId);
90 ~LteAnr() override;
91
92 /**
93 * \brief Get the type ID.
94 * \return the object TypeId
95 */
96 static TypeId GetTypeId();
97
98 /**
99 * \brief Provide an advance information about a related neighbouring cell
100 * and add it as a new Neighbour Relation entry.
101 * \param cellId the cell ID of the new neighbour
102 *
103 * This function simulates the Neighbour Relation addition operation by
104 * network operations and maintenance, as depicted in Section 22.3.2a of
105 * 3GPP TS 36.300.
106 *
107 * An entry added by this function will have the NoRemove flag set to TRUE and
108 * the NoHo flag set to TRUE. Hence, the cell may not act as the target cell
109 * of a handover, unless a measurement report of the cell is received, which
110 * will update the NoHo flag to FALSE.
111 */
112 void AddNeighbourRelation(uint16_t cellId);
113
114 /**
115 * \brief Remove an existing Neighbour Relation entry.
116 * \param cellId the cell ID to be removed from the NRT
117 *
118 * This function simulates the Neighbour Relation removal operation by
119 * network operations and maintenance, as depicted in Section 22.3.2a of
120 * 3GPP TS 36.300.
121 */
122 void RemoveNeighbourRelation(uint16_t cellId);
123
124 /**
125 * \brief Set the "user" part of the ANR SAP interface that this ANR instance
126 * will interact with.
127 * \param s a reference to the "user" part of the interface, typically a
128 * member of an LteEnbRrc instance
129 */
130 virtual void SetLteAnrSapUser(LteAnrSapUser* s);
131
132 /**
133 * \brief Export the "provider" part of the ANR SAP interface.
134 * \return the reference to the "provider" part of the interface, typically to
135 * be kept by an LteEnbRrc instance
136 */
138
139 /// let the forwarder class access the protected and private members
140 friend class MemberLteAnrSapProvider<LteAnr>;
141
142 protected:
143 // inherited from Object
144 void DoInitialize() override;
145 void DoDispose() override;
146
147 private:
148 // ANR SAP PROVIDER IMPLEMENTATION
149
150 /**
151 * \brief Implementation of LteAnrSapProvider::ReportUeMeas.
152 * \param measResults a single report of one measurement identity
153 */
154 void DoReportUeMeas(LteRrcSap::MeasResults measResults);
155
156 /**
157 * \brief Implementation of LteAnrSapProvider::AddNeighbourRelation.
158 * \param cellId the Physical Cell ID of the new neighbouring cell
159 */
160 void DoAddNeighbourRelation(uint16_t cellId);
161
162 /**
163 * \brief Implementation of LteAnrSapProvider::GetNoRemove.
164 * \param cellId the Physical Cell ID of the neighbouring cell of interest
165 * \return if true, the Neighbour Relation shall *not* be removed from the NRT
166 */
167 bool DoGetNoRemove(uint16_t cellId) const;
168
169 /**
170 * \brief Implementation of LteAnrSapProvider::GetNoHo.
171 * \param cellId the Physical Cell ID of the neighbouring cell of interest
172 * \return if true, the Neighbour Relation shall *not* be used by the eNodeB
173 * for handover reasons
174 */
175 bool DoGetNoHo(uint16_t cellId) const;
176
177 /**
178 * \brief Implementation of LteAnrSapProvider::GetNoX2.
179 * \param cellId the Physical Cell ID of the neighbouring cell of interest
180 * \return if true, the Neighbour Relation shall *not* use an X2 interface in
181 * order to initiate procedures towards the eNodeB parenting the
182 * target cell
183 */
184 bool DoGetNoX2(uint16_t cellId) const;
185
186 // ANR SAP
187
188 /**
189 * \brief Reference to the "provider" part of the ANR SAP interface, which is
190 * automatically created when this class instantiates.
191 */
193
194 /**
195 * \brief Reference to the "user" part of the ANR SAP interface, which is
196 * provided by the eNodeB RRC instance.
197 */
199
200 // ATTRIBUTE
201
202 /// The attribute Threshold.
203 uint8_t m_threshold;
204
205 /**
206 * \brief Neighbour Relation between two eNodeBs (serving eNodeB and neighbour
207 * eNodeB).
208 */
210 {
211 bool noRemove; ///< no remove
212 bool noHo; ///< no HO
213 bool noX2; ///< no X2
214 bool detectedAsNeighbour; ///< detected as neighbor
215 };
216
217 /// cellId
218 typedef std::map<uint16_t, NeighbourRelation_t> NeighbourRelationTable_t;
219
220 /// neighbor relation table
222
223 /**
224 * \internal methods
225 * \param cellId
226 * \returns the neighbor relation
227 */
228 const NeighbourRelation_t* Find(uint16_t cellId) const;
229
230 /// The expected measurement identity
231 uint8_t m_measId;
232
233 /// Serving cell ID
235
236}; // end of class LteAnr
237
238} // end of namespace ns3
239
240#endif /* LTE_ANR_H */
Automatic Neighbour Relation function.
Definition: lte-anr.h:82
~LteAnr() override
Definition: lte-anr.cc:49
void DoInitialize() override
Initialize() implementation.
Definition: lte-anr.cc:124
virtual LteAnrSapProvider * GetLteAnrSapProvider()
Export the "provider" part of the ANR SAP interface.
Definition: lte-anr.cc:117
void DoReportUeMeas(LteRrcSap::MeasResults measResults)
Implementation of LteAnrSapProvider::ReportUeMeas.
Definition: lte-anr.cc:147
bool DoGetNoHo(uint16_t cellId) const
Implementation of LteAnrSapProvider::GetNoHo.
Definition: lte-anr.cc:228
LteAnrSapProvider * m_anrSapProvider
Reference to the "provider" part of the ANR SAP interface, which is automatically created when this c...
Definition: lte-anr.h:192
uint8_t m_measId
The expected measurement identity.
Definition: lte-anr.h:231
LteAnrSapUser * m_anrSapUser
Reference to the "user" part of the ANR SAP interface, which is provided by the eNodeB RRC instance.
Definition: lte-anr.h:198
static TypeId GetTypeId()
Get the type ID.
Definition: lte-anr.cc:55
void RemoveNeighbourRelation(uint16_t cellId)
Remove an existing Neighbour Relation entry.
Definition: lte-anr.cc:96
bool DoGetNoRemove(uint16_t cellId) const
Implementation of LteAnrSapProvider::GetNoRemove.
Definition: lte-anr.cc:221
const NeighbourRelation_t * Find(uint16_t cellId) const
Definition: lte-anr.cc:242
uint8_t m_threshold
The attribute Threshold.
Definition: lte-anr.h:203
NeighbourRelationTable_t m_neighbourRelationTable
neighbor relation table
Definition: lte-anr.h:221
void DoAddNeighbourRelation(uint16_t cellId)
Implementation of LteAnrSapProvider::AddNeighbourRelation.
Definition: lte-anr.cc:214
void AddNeighbourRelation(uint16_t cellId)
Provide an advance information about a related neighbouring cell and add it as a new Neighbour Relati...
Definition: lte-anr.cc:73
uint16_t m_servingCellId
Serving cell ID.
Definition: lte-anr.h:234
std::map< uint16_t, NeighbourRelation_t > NeighbourRelationTable_t
cellId
Definition: lte-anr.h:218
bool DoGetNoX2(uint16_t cellId) const
Implementation of LteAnrSapProvider::GetNoX2.
Definition: lte-anr.cc:235
virtual void SetLteAnrSapUser(LteAnrSapUser *s)
Set the "user" part of the ANR SAP interface that this ANR instance will interact with.
Definition: lte-anr.cc:110
void DoDispose() override
Destructor implementation.
Definition: lte-anr.cc:139
Service Access Point (SAP) offered by the ANR instance to the eNodeB RRC instance.
Definition: lte-anr-sap.h:37
Service Access Point (SAP) offered by the eNodeB RRC instance to the ANR instance.
Definition: lte-anr-sap.h:95
Template for the implementation of the LteAnrSapProvider as a member of an owner class of type C to w...
Definition: lte-anr-sap.h:124
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Neighbour Relation between two eNodeBs (serving eNodeB and neighbour eNodeB).
Definition: lte-anr.h:210
bool detectedAsNeighbour
detected as neighbor
Definition: lte-anr.h:214
MeasResults structure.
Definition: lte-rrc-sap.h:717