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) 2015 Danilo Abrignani | 3 * Copyright (c) 2015 Danilo Abrignani |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 m_ulEarfcn = ulEarfcn; | 118 m_ulEarfcn = ulEarfcn; |
119 } | 119 } |
120 | 120 |
121 void | 121 void |
122 CcHelper::SetDlEarfcn (uint32_t dlEarfcn) | 122 CcHelper::SetDlEarfcn (uint32_t dlEarfcn) |
123 { | 123 { |
124 m_dlEarfcn = dlEarfcn; | 124 m_dlEarfcn = dlEarfcn; |
125 } | 125 } |
126 | 126 |
127 void | 127 void |
128 CcHelper::SetDlBandwidth (uint16_t dlBandwidth) | 128 CcHelper::SetDlBandwidth (uint8_t dlBandwidth) |
129 { | 129 { |
130 m_dlBandwidth = dlBandwidth; | 130 m_dlBandwidth = dlBandwidth; |
131 } | 131 } |
132 | 132 |
133 void | 133 void |
134 CcHelper::SetUlBandwidth (uint16_t ulBandwidth) | 134 CcHelper::SetUlBandwidth (uint8_t ulBandwidth) |
135 { | 135 { |
136 m_ulBandwidth = ulBandwidth; | 136 m_ulBandwidth = ulBandwidth; |
137 } | 137 } |
138 | 138 |
139 uint16_t | 139 uint16_t |
140 CcHelper::GetNumberOfComponentCarriers () | 140 CcHelper::GetNumberOfComponentCarriers () |
141 { | 141 { |
142 return m_numberOfComponentCarriers; | 142 return m_numberOfComponentCarriers; |
143 } | 143 } |
144 | 144 |
145 uint32_t CcHelper::GetUlEarfcn () | 145 uint32_t CcHelper::GetUlEarfcn () |
146 { | 146 { |
147 return m_ulEarfcn; | 147 return m_ulEarfcn; |
148 } | 148 } |
149 | 149 |
150 uint32_t CcHelper::GetDlEarfcn () | 150 uint32_t CcHelper::GetDlEarfcn () |
151 { | 151 { |
152 return m_dlEarfcn; | 152 return m_dlEarfcn; |
153 } | 153 } |
154 | 154 |
155 uint16_t CcHelper::GetDlBandwidth () | 155 uint8_t CcHelper::GetDlBandwidth () |
156 { | 156 { |
157 return m_dlBandwidth; | 157 return m_dlBandwidth; |
158 } | 158 } |
159 | 159 |
160 uint16_t CcHelper::GetUlBandwidth () | 160 uint8_t CcHelper::GetUlBandwidth () |
161 { | 161 { |
162 return m_ulBandwidth; | 162 return m_ulBandwidth; |
163 } | 163 } |
164 | 164 |
165 ComponentCarrier | 165 ComponentCarrier |
166 CcHelper::DoCreateSingleCc (uint16_t ulBandwidth, uint16_t dlBandwidth, uint32_t
ulEarfcn, uint32_t dlEarfcn, bool isPrimary) | 166 CcHelper::DoCreateSingleCc (uint8_t ulBandwidth, uint8_t dlBandwidth, uint32_t u
lEarfcn, uint32_t dlEarfcn, bool isPrimary) |
167 { | 167 { |
168 return CreateSingleCc (ulBandwidth, dlBandwidth, ulEarfcn, dlEarfcn, isPrimary
); | 168 return CreateSingleCc (ulBandwidth, dlBandwidth, ulEarfcn, dlEarfcn, isPrimary
); |
169 } | 169 } |
170 | 170 |
171 std::map< uint8_t, ComponentCarrier > | 171 std::map< uint8_t, ComponentCarrier > |
172 CcHelper::EquallySpacedCcs () | 172 CcHelper::EquallySpacedCcs () |
173 { | 173 { |
174 std::map< uint8_t, ComponentCarrier > ccmap; | 174 std::map< uint8_t, ComponentCarrier > ccmap; |
175 | 175 |
176 uint32_t ulEarfcn = m_ulEarfcn; | 176 uint32_t ulEarfcn = m_ulEarfcn; |
177 uint32_t dlEarfcn = m_dlEarfcn; | 177 uint32_t dlEarfcn = m_dlEarfcn; |
178 uint32_t maxBandwidthRb = std::max<uint32_t> (m_ulBandwidth, m_dlBandwidth); | 178 uint8_t maxBandwidthRb = std::max<uint8_t> (m_ulBandwidth, m_dlBandwidth); |
179 | 179 |
180 // Convert bandwidth from RBs to kHz | 180 // Convert bandwidth from RBs to kHz |
181 uint32_t maxBandwidthKhz = LteSpectrumValueHelper::GetChannelBandwidth(maxBand
widthRb) / 1e3; | 181 uint32_t maxBandwidthKhz = static_cast<uint32_t>(LteSpectrumValueHelper::GetCh
annelBandwidth(maxBandwidthRb) / 1e3); |
182 | 182 |
183 for (uint8_t i = 0; i < m_numberOfComponentCarriers; i++) | 183 for (uint8_t i = 0; i < m_numberOfComponentCarriers; i++) |
184 { | 184 { |
185 // Make sure we stay within the same band. | 185 // Make sure we stay within the same band. |
186 if (LteSpectrumValueHelper::GetUplinkCarrierBand (ulEarfcn) != | 186 if (LteSpectrumValueHelper::GetUplinkCarrierBand (ulEarfcn) != |
187 LteSpectrumValueHelper::GetUplinkCarrierBand (m_ulEarfcn) | 187 LteSpectrumValueHelper::GetUplinkCarrierBand (m_ulEarfcn) |
188 || LteSpectrumValueHelper::GetDownlinkCarrierBand (dlEarfcn) != | 188 || LteSpectrumValueHelper::GetDownlinkCarrierBand (dlEarfcn) != |
189 LteSpectrumValueHelper::GetDownlinkCarrierBand (m_dlEarfcn)) | 189 LteSpectrumValueHelper::GetDownlinkCarrierBand (m_dlEarfcn)) |
190 { | 190 { |
191 NS_FATAL_ERROR ("Band is not wide enough to allocate " << +m_numberOfC
omponentCarriers << " CCs"); | 191 NS_FATAL_ERROR ("Band is not wide enough to allocate " << +m_numberOfC
omponentCarriers << " CCs"); |
(...skipping 19 matching lines...) Expand all Loading... |
211 | 211 |
212 // Unit of EARFCN corresponds to 100kHz. | 212 // Unit of EARFCN corresponds to 100kHz. |
213 uint32_t earfcnShift = frequencyShift / 100; | 213 uint32_t earfcnShift = frequencyShift / 100; |
214 ulEarfcn += earfcnShift; | 214 ulEarfcn += earfcnShift; |
215 dlEarfcn += earfcnShift; | 215 dlEarfcn += earfcnShift; |
216 } | 216 } |
217 | 217 |
218 return ccmap; | 218 return ccmap; |
219 } | 219 } |
220 ComponentCarrier | 220 ComponentCarrier |
221 CcHelper::CreateSingleCc (uint16_t ulBandwidth, uint16_t dlBandwidth, uint32_t u
lEarfcn, uint32_t dlEarfcn, bool isPrimary) | 221 CcHelper::CreateSingleCc (uint8_t ulBandwidth, uint8_t dlBandwidth, uint32_t ulE
arfcn, uint32_t dlEarfcn, bool isPrimary) |
222 { | 222 { |
223 ComponentCarrier cc; | 223 ComponentCarrier cc; |
224 if ( m_ulEarfcn != 0) | 224 if ( m_ulEarfcn != 0) |
225 { | 225 { |
226 cc.SetUlEarfcn (ulEarfcn); | 226 cc.SetUlEarfcn (ulEarfcn); |
227 } | 227 } |
228 else· | 228 else· |
229 { | 229 { |
230 uint16_t ul = cc.GetUlEarfcn () + ulEarfcn; | 230 uint32_t ul = cc.GetUlEarfcn () + ulEarfcn; |
231 cc.SetUlEarfcn (ul); | 231 cc.SetUlEarfcn (ul); |
232 } | 232 } |
233 if ( m_dlEarfcn != 0) | 233 if ( m_dlEarfcn != 0) |
234 { | 234 { |
235 cc.SetDlEarfcn (dlEarfcn); | 235 cc.SetDlEarfcn (dlEarfcn); |
236 } | 236 } |
237 else· | 237 else· |
238 { | 238 { |
239 uint16_t dl = cc.GetDlEarfcn () + dlEarfcn; | 239 uint32_t dl = cc.GetDlEarfcn () + dlEarfcn; |
240 cc.SetDlEarfcn (dl); | 240 cc.SetDlEarfcn (dl); |
241 } | 241 } |
242 cc.SetDlBandwidth (dlBandwidth); | 242 cc.SetDlBandwidth (dlBandwidth); |
243 cc.SetUlBandwidth (ulBandwidth); | 243 cc.SetUlBandwidth (ulBandwidth); |
244 | 244 |
245 cc.SetAsPrimary (isPrimary); | 245 cc.SetAsPrimary (isPrimary); |
246 | 246 |
247 return cc; | 247 return cc; |
248 | 248 |
249 | 249 |
250 } | 250 } |
251 | 251 |
252 } // namespace ns3 | 252 } // namespace ns3 |
OLD | NEW |