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) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 /// LteSpectrumModelId structure | 201 /// LteSpectrumModelId structure |
202 struct LteSpectrumModelId | 202 struct LteSpectrumModelId |
203 { | 203 { |
204 /** | 204 /** |
205 * Constructor | 205 * Constructor |
206 * | 206 * |
207 * \param f earfcn | 207 * \param f earfcn |
208 * \param b bandwidth | 208 * \param b bandwidth |
209 */ | 209 */ |
210 LteSpectrumModelId (uint32_t f, uint8_t b); | 210 LteSpectrumModelId (uint32_t f, uint16_t b); |
211 uint32_t earfcn; ///< EARFCN | 211 uint32_t earfcn; ///< EARFCN |
212 uint8_t bandwidth; ///< bandwidth | 212 uint16_t bandwidth; ///< bandwidth |
213 }; | 213 }; |
214 | 214 |
215 LteSpectrumModelId::LteSpectrumModelId (uint32_t f, uint8_t b) | 215 LteSpectrumModelId::LteSpectrumModelId (uint32_t f, uint16_t b) |
216 : earfcn (f),· | 216 : earfcn (f),· |
217 bandwidth (b) | 217 bandwidth (b) |
218 { | 218 { |
219 } | 219 } |
220 | 220 |
221 /** | 221 /** |
222 * Constructor | 222 * Constructor |
223 * | 223 * |
224 * \param a lhs | 224 * \param a lhs |
225 * \param b rhs | 225 * \param b rhs |
226 * \returns true if earfcn less than of if earfcn equal and bandwidth less than | 226 * \returns true if earfcn less than of if earfcn equal and bandwidth less than |
227 */ | 227 */ |
228 bool | 228 bool |
229 operator < (const LteSpectrumModelId& a, const LteSpectrumModelId& b) | 229 operator < (const LteSpectrumModelId& a, const LteSpectrumModelId& b) |
230 { | 230 { |
231 return ( (a.earfcn < b.earfcn) || ( (a.earfcn == b.earfcn) && (a.bandwidth < b
.bandwidth) ) ); | 231 return ( (a.earfcn < b.earfcn) || ( (a.earfcn == b.earfcn) && (a.bandwidth < b
.bandwidth) ) ); |
232 } | 232 } |
233 · | 233 · |
234 | 234 |
235 static std::map<LteSpectrumModelId, Ptr<SpectrumModel> > g_lteSpectrumModelMap;
///< LTE spectrum model map | 235 static std::map<LteSpectrumModelId, Ptr<SpectrumModel> > g_lteSpectrumModelMap;
///< LTE spectrum model map |
236 | 236 |
237 | 237 |
238 Ptr<SpectrumModel> | 238 Ptr<SpectrumModel> |
239 LteSpectrumValueHelper::GetSpectrumModel (uint32_t earfcn, uint8_t txBandwidthCo
nfiguration) | 239 LteSpectrumValueHelper::GetSpectrumModel (uint32_t earfcn, uint16_t txBandwidthC
onfiguration) |
240 { | 240 { |
241 NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration); | 241 NS_LOG_FUNCTION (earfcn << txBandwidthConfiguration); |
242 Ptr<SpectrumModel> ret; | 242 Ptr<SpectrumModel> ret; |
243 LteSpectrumModelId key (earfcn, txBandwidthConfiguration); | 243 LteSpectrumModelId key (earfcn, txBandwidthConfiguration); |
244 std::map<LteSpectrumModelId, Ptr<SpectrumModel> >::iterator it = g_lteSpectrum
ModelMap.find (key); | 244 std::map<LteSpectrumModelId, Ptr<SpectrumModel> >::iterator it = g_lteSpectrum
ModelMap.find (key); |
245 if (it != g_lteSpectrumModelMap.end ()) | 245 if (it != g_lteSpectrumModelMap.end ()) |
246 { | 246 { |
247 ret = it->second; | 247 ret = it->second; |
248 } | 248 } |
249 else | 249 else |
250 { | 250 { |
251 double fc = GetCarrierFrequency (earfcn); | 251 double fc = GetCarrierFrequency (earfcn); |
252 NS_ASSERT_MSG (fc != 0, "invalid EARFCN=" << earfcn); | 252 NS_ASSERT_MSG (fc != 0, "invalid EARFCN=" << earfcn); |
253 | 253 |
254 double f = fc - (txBandwidthConfiguration * 180e3 / 2.0); | 254 double f = fc - (txBandwidthConfiguration * 180e3 / 2.0); |
255 Bands rbs; | 255 Bands rbs; |
256 for (uint8_t numrb = 0; numrb < txBandwidthConfiguration; ++numrb) | 256 for (uint16_t numrb = 0; numrb < txBandwidthConfiguration; ++numrb) |
257 { | 257 { |
258 BandInfo rb;· | 258 BandInfo rb;· |
259 rb.fl = f; | 259 rb.fl = f; |
260 f += 90e3; | 260 f += 90e3; |
261 rb.fc = f; | 261 rb.fc = f; |
262 f += 90e3; | 262 f += 90e3; |
263 rb.fh = f; | 263 rb.fh = f; |
264 rbs.push_back (rb); | 264 rbs.push_back (rb); |
265 } | 265 } |
266 ret = Create<SpectrumModel> (rbs); | 266 ret = Create<SpectrumModel> (rbs); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 double kT_W_Hz = std::pow (10.0, (kT_dBm_Hz - 30) / 10.0); | 355 double kT_W_Hz = std::pow (10.0, (kT_dBm_Hz - 30) / 10.0); |
356 double noiseFigureLinear = std::pow (10.0, noiseFigureDb / 10.0); | 356 double noiseFigureLinear = std::pow (10.0, noiseFigureDb / 10.0); |
357 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear; | 357 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear; |
358 | 358 |
359 Ptr<SpectrumValue> noisePsd = Create <SpectrumValue> (spectrumModel); | 359 Ptr<SpectrumValue> noisePsd = Create <SpectrumValue> (spectrumModel); |
360 (*noisePsd) = noisePowerSpectralDensity; | 360 (*noisePsd) = noisePowerSpectralDensity; |
361 return noisePsd; | 361 return noisePsd; |
362 } | 362 } |
363 | 363 |
364 } // namespace ns3 | 364 } // namespace ns3 |
OLD | NEW |