A Discrete-Event Network Simulator
API
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  * 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 handover algorithm interface by:
24  * - Budiarto Herman <budiarto.herman@magister.fi>
25  */
26 
27 #ifndef A2_A4_RSRQ_HANDOVER_ALGORITHM_H
28 #define A2_A4_RSRQ_HANDOVER_ALGORITHM_H
29 
30 #include <ns3/lte-handover-algorithm.h>
31 #include <ns3/lte-handover-management-sap.h>
32 #include <ns3/lte-rrc-sap.h>
33 #include <ns3/ptr.h>
34 #include <ns3/simple-ref-count.h>
35 
36 #include <map>
37 
38 namespace ns3
39 {
40 
81 {
82  public:
85 
86  ~A2A4RsrqHandoverAlgorithm() override;
87 
92  static TypeId GetTypeId();
93 
94  // inherited from LteHandoverAlgorithm
97 
100 
101  protected:
102  // inherited from Object
103  void DoInitialize() override;
104  void DoDispose() override;
105 
106  // inherited from LteHandoverAlgorithm as a Handover Management SAP implementation
107  void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults) override;
108 
109  private:
116  void EvaluateHandover(uint16_t rnti, uint8_t servingCellRsrq);
117 
125  bool IsValidNeighbour(uint16_t cellId);
126 
137  void UpdateNeighbourMeasurements(uint16_t rnti, uint16_t cellId, uint8_t rsrq);
138 
140  std::vector<uint8_t> m_a2MeasIds;
142  std::vector<uint8_t> m_a4MeasIds;
143 
148  class UeMeasure : public SimpleRefCount<UeMeasure>
149  {
150  public:
151  uint16_t m_cellId;
152  uint8_t m_rsrp;
153  uint8_t m_rsrq;
154  };
155 
160  typedef std::map<uint16_t, Ptr<UeMeasure>> MeasurementRow_t;
161 
166  typedef std::map<uint16_t, MeasurementRow_t> MeasurementTable_t;
167 
170 
178 
185 
190 
191 }; // end of class A2A4RsrqHandoverAlgorithm
192 
193 } // end of namespace ns3
194 
195 #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:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.
MeasResults structure.
Definition: lte-rrc-sap.h:717