OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * Copyright (c) 2013 Budiarto Herman | 4 * Copyright (c) 2013 Budiarto Herman |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 10 matching lines...) Expand all Loading... |
21 * - Marco Miozzo <mmiozzo@cttc.es> | 21 * - Marco Miozzo <mmiozzo@cttc.es> |
22 * - Manuel Requena <manuel.requena@cttc.es> | 22 * - Manuel Requena <manuel.requena@cttc.es> |
23 * | 23 * |
24 * Converted to handover algorithm interface by: | 24 * Converted to handover algorithm interface by: |
25 * - Budiarto Herman <budiarto.herman@magister.fi> | 25 * - Budiarto Herman <budiarto.herman@magister.fi> |
26 */ | 26 */ |
27 | 27 |
28 #include "a2-a4-rsrq-handover-algorithm.h" | 28 #include "a2-a4-rsrq-handover-algorithm.h" |
29 #include <ns3/log.h> | 29 #include <ns3/log.h> |
30 #include <ns3/uinteger.h> | 30 #include <ns3/uinteger.h> |
| 31 #include <algorithm> |
31 | 32 |
32 namespace ns3 { | 33 namespace ns3 { |
33 | 34 |
34 NS_LOG_COMPONENT_DEFINE ("A2A4RsrqHandoverAlgorithm"); | 35 NS_LOG_COMPONENT_DEFINE ("A2A4RsrqHandoverAlgorithm"); |
35 | 36 |
36 NS_OBJECT_ENSURE_REGISTERED (A2A4RsrqHandoverAlgorithm); | 37 NS_OBJECT_ENSURE_REGISTERED (A2A4RsrqHandoverAlgorithm); |
37 | 38 |
38 | 39 |
39 /////////////////////////////////////////// | 40 /////////////////////////////////////////// |
40 // Handover Management SAP forwarder | 41 // Handover Management SAP forwarder |
41 /////////////////////////////////////////// | 42 /////////////////////////////////////////// |
42 | 43 |
43 | 44 |
44 A2A4RsrqHandoverAlgorithm::A2A4RsrqHandoverAlgorithm () | 45 A2A4RsrqHandoverAlgorithm::A2A4RsrqHandoverAlgorithm () |
45 : m_a2MeasId (0), | 46 : m_servingCellThreshold (30), |
46 m_a4MeasId (0), | |
47 m_servingCellThreshold (30), | |
48 m_neighbourCellOffset (1), | 47 m_neighbourCellOffset (1), |
49 m_handoverManagementSapUser (0) | 48 m_handoverManagementSapUser (0) |
50 { | 49 { |
51 NS_LOG_FUNCTION (this); | 50 NS_LOG_FUNCTION (this); |
52 m_handoverManagementSapProvider = new MemberLteHandoverManagementSapProvider<A
2A4RsrqHandoverAlgorithm> (this); | 51 m_handoverManagementSapProvider = new MemberLteHandoverManagementSapProvider<A
2A4RsrqHandoverAlgorithm> (this); |
53 } | 52 } |
54 | 53 |
55 | 54 |
56 A2A4RsrqHandoverAlgorithm::~A2A4RsrqHandoverAlgorithm () | 55 A2A4RsrqHandoverAlgorithm::~A2A4RsrqHandoverAlgorithm () |
57 { | 56 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 NS_LOG_FUNCTION (this); | 107 NS_LOG_FUNCTION (this); |
109 | 108 |
110 NS_LOG_LOGIC (this << " requesting Event A2 measurements" | 109 NS_LOG_LOGIC (this << " requesting Event A2 measurements" |
111 << " (threshold=" << (uint16_t) m_servingCellThreshold << "
)"); | 110 << " (threshold=" << (uint16_t) m_servingCellThreshold << "
)"); |
112 LteRrcSap::ReportConfigEutra reportConfigA2; | 111 LteRrcSap::ReportConfigEutra reportConfigA2; |
113 reportConfigA2.eventId = LteRrcSap::ReportConfigEutra::EVENT_A2; | 112 reportConfigA2.eventId = LteRrcSap::ReportConfigEutra::EVENT_A2; |
114 reportConfigA2.threshold1.choice = LteRrcSap::ThresholdEutra::THRESHOLD_RSRQ; | 113 reportConfigA2.threshold1.choice = LteRrcSap::ThresholdEutra::THRESHOLD_RSRQ; |
115 reportConfigA2.threshold1.range = m_servingCellThreshold; | 114 reportConfigA2.threshold1.range = m_servingCellThreshold; |
116 reportConfigA2.triggerQuantity = LteRrcSap::ReportConfigEutra::RSRQ; | 115 reportConfigA2.triggerQuantity = LteRrcSap::ReportConfigEutra::RSRQ; |
117 reportConfigA2.reportInterval = LteRrcSap::ReportConfigEutra::MS240; | 116 reportConfigA2.reportInterval = LteRrcSap::ReportConfigEutra::MS240; |
118 m_a2MeasId = m_handoverManagementSapUser->AddUeMeasReportConfigForHandover (re
portConfigA2); | 117 m_a2MeasIds = m_handoverManagementSapUser->AddUeMeasReportConfigForHandover (r
eportConfigA2); |
119 | 118 |
120 NS_LOG_LOGIC (this << " requesting Event A4 measurements" | 119 NS_LOG_LOGIC (this << " requesting Event A4 measurements" |
121 << " (threshold=0)"); | 120 << " (threshold=0)"); |
122 LteRrcSap::ReportConfigEutra reportConfigA4; | 121 LteRrcSap::ReportConfigEutra reportConfigA4; |
123 reportConfigA4.eventId = LteRrcSap::ReportConfigEutra::EVENT_A4; | 122 reportConfigA4.eventId = LteRrcSap::ReportConfigEutra::EVENT_A4; |
124 reportConfigA4.threshold1.choice = LteRrcSap::ThresholdEutra::THRESHOLD_RSRQ; | 123 reportConfigA4.threshold1.choice = LteRrcSap::ThresholdEutra::THRESHOLD_RSRQ; |
125 reportConfigA4.threshold1.range = 0; // intentionally very low threshold | 124 reportConfigA4.threshold1.range = 0; // intentionally very low threshold |
126 reportConfigA4.triggerQuantity = LteRrcSap::ReportConfigEutra::RSRQ; | 125 reportConfigA4.triggerQuantity = LteRrcSap::ReportConfigEutra::RSRQ; |
127 reportConfigA4.reportInterval = LteRrcSap::ReportConfigEutra::MS480; | 126 reportConfigA4.reportInterval = LteRrcSap::ReportConfigEutra::MS480; |
128 m_a4MeasId = m_handoverManagementSapUser->AddUeMeasReportConfigForHandover (re
portConfigA4); | 127 m_a4MeasIds = m_handoverManagementSapUser->AddUeMeasReportConfigForHandover (r
eportConfigA4); |
129 | 128 |
130 LteHandoverAlgorithm::DoInitialize (); | 129 LteHandoverAlgorithm::DoInitialize (); |
131 } | 130 } |
132 | 131 |
133 | 132 |
134 void | 133 void |
135 A2A4RsrqHandoverAlgorithm::DoDispose () | 134 A2A4RsrqHandoverAlgorithm::DoDispose () |
136 { | 135 { |
137 NS_LOG_FUNCTION (this); | 136 NS_LOG_FUNCTION (this); |
138 delete m_handoverManagementSapProvider; | 137 delete m_handoverManagementSapProvider; |
139 } | 138 } |
140 | 139 |
141 | 140 |
142 void | 141 void |
143 A2A4RsrqHandoverAlgorithm::DoReportUeMeas (uint16_t rnti, | 142 A2A4RsrqHandoverAlgorithm::DoReportUeMeas (uint16_t rnti, |
144 LteRrcSap::MeasResults measResults) | 143 LteRrcSap::MeasResults measResults) |
145 { | 144 { |
146 NS_LOG_FUNCTION (this << rnti << (uint16_t) measResults.measId); | 145 NS_LOG_FUNCTION (this << rnti << (uint16_t) measResults.measId); |
147 | 146 |
148 if (measResults.measId == m_a2MeasId) | 147 if (std::find (begin (m_a2MeasIds), end (m_a2MeasIds), measResults.measId) !=
std::end (m_a2MeasIds)) |
149 { | 148 { |
150 NS_ASSERT_MSG (measResults.rsrqResult <= m_servingCellThreshold, | 149 NS_ASSERT_MSG (measResults.measResultPCell.rsrqResult <= m_servingCellThre
shold, |
151 "Invalid UE measurement report"); | 150 "Invalid UE measurement report"); |
152 EvaluateHandover (rnti, measResults.rsrqResult); | 151 EvaluateHandover (rnti, measResults.measResultPCell.rsrqResult); |
153 } | 152 } |
154 else if (measResults.measId == m_a4MeasId) | 153 else if (std::find (begin (m_a4MeasIds), end (m_a4MeasIds), measResults.measId
) != std::end (m_a4MeasIds)) |
155 { | 154 { |
156 if (measResults.haveMeasResultNeighCells | 155 if (measResults.haveMeasResultNeighCells |
157 && !measResults.measResultListEutra.empty ()) | 156 && !measResults.measResultListEutra.empty ()) |
158 { | 157 { |
159 for (std::list <LteRrcSap::MeasResultEutra>::iterator it = measResults
.measResultListEutra.begin (); | 158 for (std::list <LteRrcSap::MeasResultEutra>::iterator it = measResults
.measResultListEutra.begin (); |
160 it != measResults.measResultListEutra.end (); | 159 it != measResults.measResultListEutra.end (); |
161 ++it) | 160 ++it) |
162 { | 161 { |
163 NS_ASSERT_MSG (it->haveRsrqResult == true, | 162 NS_ASSERT_MSG (it->haveRsrqResult == true, |
164 "RSRQ measurement is missing from cellId " << it->p
hysCellId); | 163 "RSRQ measurement is missing from cellId " << it->p
hysCellId); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 neighbourCellMeasures->m_cellId = cellId; | 282 neighbourCellMeasures->m_cellId = cellId; |
284 neighbourCellMeasures->m_rsrp = 0; | 283 neighbourCellMeasures->m_rsrp = 0; |
285 neighbourCellMeasures->m_rsrq = rsrq; | 284 neighbourCellMeasures->m_rsrq = rsrq; |
286 it1->second[cellId] = neighbourCellMeasures; | 285 it1->second[cellId] = neighbourCellMeasures; |
287 } | 286 } |
288 | 287 |
289 } // end of UpdateNeighbourMeasurements | 288 } // end of UpdateNeighbourMeasurements |
290 | 289 |
291 | 290 |
292 } // end of namespace ns3 | 291 } // end of namespace ns3 |
OLD | NEW |