Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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) 2009 CTTC | 3 * Copyright (c) 2009 CTTC |
4 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 4 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
5 * Copyright (c) 2017 Orange Labs | 5 * Copyright (c) 2017 Orange Labs |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License version 2 as | 8 * it under the terms of the GNU General Public License version 2 as |
9 * published by the Free Software Foundation; | 9 * published by the Free Software Foundation; |
10 * | 10 * |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 double m_bandBandwidth; ///< width of each band (in Hz) | 49 double m_bandBandwidth; ///< width of each band (in Hz) |
50 uint8_t m_guardBandwidth; ///< guard band width (in MHz) | 50 uint8_t m_guardBandwidth; ///< guard band width (in MHz) |
51 }; | 51 }; |
52 | 52 |
53 WifiSpectrumModelId::WifiSpectrumModelId (uint32_t f, uint8_t w, double b, uint8 _t g) | 53 WifiSpectrumModelId::WifiSpectrumModelId (uint32_t f, uint8_t w, double b, uint8 _t g) |
54 : m_centerFrequency (f), | 54 : m_centerFrequency (f), |
55 m_channelWidth (w), | 55 m_channelWidth (w), |
56 m_bandBandwidth (b), | 56 m_bandBandwidth (b), |
57 m_guardBandwidth (g) | 57 m_guardBandwidth (g) |
58 { | 58 { |
59 NS_LOG_FUNCTION (this << f << (uint16_t)w << b << (uint16_t)g); | 59 NS_LOG_FUNCTION (this << f << +w << b << +g); |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * Less than operator | 63 * Less than operator |
64 * \param a the first wifi spectrum to compare | 64 * \param a the first wifi spectrum to compare |
65 * \param b the second wifi spectrum to compare | 65 * \param b the second wifi spectrum to compare |
66 * \returns true if the first spectrum is less than the second spectrum | 66 * \returns true if the first spectrum is less than the second spectrum |
67 */· | 67 */· |
68 bool | 68 bool |
69 operator < (const WifiSpectrumModelId& a, const WifiSpectrumModelId& b) | 69 operator < (const WifiSpectrumModelId& a, const WifiSpectrumModelId& b) |
70 { | 70 { |
71 return ( (a.m_centerFrequency < b.m_centerFrequency) | 71 return ( (a.m_centerFrequency < b.m_centerFrequency) |
72 || ((a.m_centerFrequency == b.m_centerFrequency) && | 72 || ((a.m_centerFrequency == b.m_centerFrequency) && |
73 (a.m_channelWidth < b.m_channelWidth)) | 73 (a.m_channelWidth < b.m_channelWidth)) |
74 || ((a.m_centerFrequency == b.m_centerFrequency) && | 74 || ((a.m_centerFrequency == b.m_centerFrequency) && |
75 (a.m_channelWidth == b.m_channelWidth) && | 75 (a.m_channelWidth == b.m_channelWidth) && |
76 (a.m_bandBandwidth < b.m_bandBandwidth)) // to cover coexistence o f 11ax with legacy case | 76 (a.m_bandBandwidth < b.m_bandBandwidth)) // to cover coexistence o f 11ax with legacy case |
77 || ((a.m_centerFrequency == b.m_centerFrequency) && | 77 || ((a.m_centerFrequency == b.m_centerFrequency) && |
78 (a.m_channelWidth == b.m_channelWidth) && | 78 (a.m_channelWidth == b.m_channelWidth) && |
79 (a.m_bandBandwidth == b.m_bandBandwidth) && | 79 (a.m_bandBandwidth == b.m_bandBandwidth) && |
80 (a.m_guardBandwidth < b.m_guardBandwidth))); // to cover 2.4 GHz c ase, where DSSS coexists with OFDM | 80 (a.m_guardBandwidth < b.m_guardBandwidth))); // to cover 2.4 GHz c ase, where DSSS coexists with OFDM |
81 } | 81 } |
82 | 82 |
83 static std::map<WifiSpectrumModelId, Ptr<SpectrumModel> > g_wifiSpectrumModelMap ; ///< static initializer for the class | 83 static std::map<WifiSpectrumModelId, Ptr<SpectrumModel> > g_wifiSpectrumModelMap ; ///< static initializer for the class |
84 | 84 |
85 Ptr<SpectrumModel> | 85 Ptr<SpectrumModel> |
86 WifiSpectrumValueHelper::GetSpectrumModel (uint32_t centerFrequency, uint8_t cha nnelWidth, double bandBandwidth, uint8_t guardBandwidth) | 86 WifiSpectrumValueHelper::GetSpectrumModel (uint32_t centerFrequency, uint8_t cha nnelWidth, double bandBandwidth, uint8_t guardBandwidth) |
87 { | 87 { |
88 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << bandBandwidth << (uint16_t)guardBandwidth); | 88 NS_LOG_FUNCTION (centerFrequency << +channelWidth << bandBandwidth << +guardBa ndwidth); |
89 Ptr<SpectrumModel> ret; | 89 Ptr<SpectrumModel> ret; |
90 WifiSpectrumModelId key (centerFrequency, channelWidth, bandBandwidth, guardBa ndwidth); | 90 WifiSpectrumModelId key (centerFrequency, channelWidth, bandBandwidth, guardBa ndwidth); |
91 std::map<WifiSpectrumModelId, Ptr<SpectrumModel> >::iterator it = g_wifiSpectr umModelMap.find (key); | 91 std::map<WifiSpectrumModelId, Ptr<SpectrumModel> >::iterator it = g_wifiSpectr umModelMap.find (key); |
92 if (it != g_wifiSpectrumModelMap.end ()) | 92 if (it != g_wifiSpectrumModelMap.end ()) |
93 { | 93 { |
94 ret = it->second; | 94 ret = it->second; |
95 } | 95 } |
96 else | 96 else |
97 { | 97 { |
98 Bands bands; | 98 Bands bands; |
99 double centerFrequencyHz = centerFrequency * 1e6; | 99 double centerFrequencyHz = centerFrequency * 1e6; |
100 double bandwidth = (channelWidth + (2 * guardBandwidth)) * 1e6; | 100 double bandwidth = (channelWidth + (2.0 * guardBandwidth)) * 1e6; |
101 // For OFDM, the center subcarrier is null (at center frequency) | 101 // For OFDM, the center subcarrier is null (at center frequency) |
102 uint32_t numBands = static_cast<uint32_t> ((bandwidth / bandBandwidth) + 0 .5); | 102 uint32_t numBands = static_cast<uint32_t> ((bandwidth / bandBandwidth) + 0 .5); |
103 NS_ASSERT (numBands > 0); | 103 NS_ASSERT (numBands > 0); |
104 if (numBands % 2 == 0) | 104 if (numBands % 2 == 0) |
105 { | 105 { |
106 // round up to the nearest odd number of subbands so that bands | 106 // round up to the nearest odd number of subbands so that bands |
107 // are symmetric around center frequency | 107 // are symmetric around center frequency |
108 NS_LOG_DEBUG ("Total bandwidth evenly divided by 312.5 KHz"); | |
109 numBands += 1;···· | 108 numBands += 1;···· |
110 } | 109 } |
111 NS_ASSERT_MSG (numBands % 2 == 1, "Number of bands should be odd"); | 110 NS_ASSERT_MSG (numBands % 2 == 1, "Number of bands should be odd"); |
111 NS_LOG_DEBUG ("Num bands " << numBands << " band bandwidth " << bandBandwi dth); | |
112 // lay down numBands/2 bands symmetrically around center frequency | 112 // lay down numBands/2 bands symmetrically around center frequency |
113 // and place an additional band at center frequency | 113 // and place an additional band at center frequency |
114 double startingFrequencyHz = centerFrequencyHz - (numBands/2 * bandBandwid th) - bandBandwidth/2; | 114 double startingFrequencyHz = centerFrequencyHz - (numBands/2 * bandBandwid th) - bandBandwidth/2; |
115 for (size_t i = 0; i < numBands; i++)· | 115 for (size_t i = 0; i < numBands; i++)· |
116 { | 116 { |
117 BandInfo info; | 117 BandInfo info; |
118 double f = startingFrequencyHz + (i * bandBandwidth); | 118 double f = startingFrequencyHz + (i * bandBandwidth); |
119 info.fl = f; | 119 info.fl = f; |
120 f += bandBandwidth/2; | 120 f += bandBandwidth/2; |
121 info.fc = f; | 121 info.fc = f; |
122 f += bandBandwidth/2; | 122 f += bandBandwidth/2; |
123 info.fh = f; | 123 info.fh = f; |
124 NS_LOG_DEBUG ("creating band " << i << " (" << info.fl << ":" << info. fc << ":" << info.fh << ")"); | 124 NS_LOG_DEBUG ("creating band " << i << " (" << info.fl << ":" << info. fc << ":" << info.fh << ")"); |
125 bands.push_back (info); | 125 bands.push_back (info); |
126 } | 126 } |
127 ret = Create<SpectrumModel> (bands); | 127 ret = Create<SpectrumModel> (bands); |
128 g_wifiSpectrumModelMap.insert (std::pair<WifiSpectrumModelId, Ptr<Spectrum Model> > (key, ret)); | 128 g_wifiSpectrumModelMap.insert (std::pair<WifiSpectrumModelId, Ptr<Spectrum Model> > (key, ret)); |
129 } | 129 } |
130 NS_LOG_LOGIC ("returning SpectrumModel::GetUid () == " << ret->GetUid ()); | 130 NS_LOG_LOGIC ("returning SpectrumModel::GetUid () == " << ret->GetUid ()); |
131 return ret; | 131 return ret; |
132 } | 132 } |
133 | 133 |
134 // Power allocated to 71 center subbands out of 135 total subbands in the band· | 134 // Power allocated to 71 center subbands out of 135 total subbands in the band· |
135 Ptr<SpectrumValue> | 135 Ptr<SpectrumValue> |
136 WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity (uint32_t centerFreque ncy, double txPowerW, uint8_t guardBandwidth) | 136 WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity (uint32_t centerFreque ncy, double txPowerW, uint8_t guardBandwidth) |
137 { | 137 { |
138 NS_LOG_FUNCTION (centerFrequency << txPowerW << (uint16_t)guardBandwidth); | 138 NS_LOG_FUNCTION (centerFrequency << txPowerW << +guardBandwidth); |
139 uint8_t channelWidth = 22; // DSSS channels are 22 MHz wide | 139 uint8_t channelWidth = 22; // DSSS channels are 22 MHz wide |
140 double bandBandwidth = 312500; | 140 double bandBandwidth = 312500; |
141 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); | 141 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); |
142 Values::iterator vit = c->ValuesBegin (); | 142 Values::iterator vit = c->ValuesBegin (); |
143 Bands::const_iterator bit = c->ConstBandsBegin (); | 143 Bands::const_iterator bit = c->ConstBandsBegin (); |
144 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); | 144 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); |
145 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); | 145 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); |
146 NS_ASSERT (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuard Bands + 1)); | 146 NS_ASSERT (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nGuard Bands + 1)); |
147 // Evenly spread power across 22 MHz | 147 // Evenly spread power across 22 MHz |
148 double txPowerPerBand = txPowerW / nAllocatedBands; | 148 double txPowerPerBand = txPowerW / nAllocatedBands; |
149 for (size_t i = 0; i < c->GetSpectrumModel ()->GetNumBands (); i++, vit++, bit ++) | 149 for (size_t i = 0; i < c->GetSpectrumModel ()->GetNumBands (); i++, vit++, bit ++) |
150 { | 150 { |
151 if ((i >= (nGuardBands / 2)) && (i <= ((nGuardBands / 2) + nAllocatedBands - 1))) | 151 if ((i >= (nGuardBands / 2)) && (i <= ((nGuardBands / 2) + nAllocatedBands - 1))) |
152 { | 152 { |
153 *vit = txPowerPerBand / (bit->fh - bit->fl); | 153 *vit = txPowerPerBand / (bit->fh - bit->fl); |
154 } | 154 } |
155 } | 155 } |
156 return c; | 156 return c; |
157 } | 157 } |
158 | 158 |
159 Ptr<SpectrumValue> | 159 Ptr<SpectrumValue> |
160 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (uint32_t centerFreque ncy, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | 160 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (uint32_t centerFreque ncy, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) |
161 { | 161 { |
162 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin t16_t)guardBandwidth); | 162 NS_LOG_FUNCTION (centerFrequency << +channelWidth << txPowerW << +guardBandwid th); |
163 double bandBandwidth = 0; | |
164 uint32_t innerSlopeWidth = 0; | |
165 switch (channelWidth) | |
166 { | |
167 case 20: | |
168 bandBandwidth = 312500; | |
169 innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5); // [ -11;-9] & [9;11] | |
170 break; | |
171 case 10: | |
172 bandBandwidth = 156250; | |
173 innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5); // [ -5.5;-4.5] & [4.5;5.5] | |
174 break; | |
175 case 5: | |
176 bandBandwidth = 78125; | |
177 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [ -2.75;-2.5] & [2.5;2.75] | |
178 break; | |
179 default: | |
180 NS_FATAL_ERROR ("Channel width " << +channelWidth << " should be correctly set."); | |
181 return 0; | |
182 } | |
183 | |
184 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); | |
185 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); | |
186 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); | |
187 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB ands ()); | |
188 // 52 subcarriers (48 data + 4 pilot) | |
189 // skip guard band and 6 subbands, then place power in 26 subbands, then | |
190 // skip the center subband, then place power in 26 subbands, then skip | |
191 // the final 6 subbands and the guard band. | |
192 double txPowerPerBandW = txPowerW / 52; | |
193 NS_LOG_DEBUG ("Power per band " << txPowerPerBandW << "W"); | |
194 uint32_t start1 = (nGuardBands / 2) + 6; | |
195 uint32_t stop1 = start1 + 26 - 1; | |
196 uint32_t start2 = stop1 + 2; | |
197 uint32_t stop2 = start2 + 26 - 1; | |
198 | |
199 //Build transmit spectrum mask | |
200 std::vector <StartStop> subBands; | |
201 subBands.push_back (std::make_pair (start1, stop1)); | |
202 subBands.push_back (std::make_pair (start2, stop2)); | |
203 StartStop maskBand (0, nAllocatedBands + nGuardBands); | |
204 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | |
205 txPowerPerBandW, nGuardBands, | |
206 innerSlopeWidth, -40.0); // -40 dBr for the outermo st points of the standard defined mask for 11a, 11g and downclocked versions of 11a for 11p | |
207 NormalizeSpectrumMask (c, txPowerW); | |
208 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f ailed"); | |
209 return c; | |
210 } | |
211 | |
212 Ptr<SpectrumValue> | |
213 WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (uint32_t centerFreq uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | |
214 { | |
215 NS_LOG_FUNCTION (centerFrequency << +channelWidth << txPowerW << +guardBandwid th); | |
163 double bandBandwidth = 312500; | 216 double bandBandwidth = 312500; |
164 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); | 217 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); |
165 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); | 218 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); |
166 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); | 219 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); |
167 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB ands ()); | 220 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB ands ()); |
168 double txPowerPerBand = 0.0; | 221 double txPowerPerBandW = 0.0; |
169 uint32_t start1 = 0; | |
170 uint32_t stop1 = 0; | |
171 uint32_t start2 = 0; | |
172 uint32_t stop2 = 0; | |
173 uint32_t innerSlopeWidth = 0; | |
174 //Spectrum mask specific variables | |
175 double lowestPointDbr = -40.0; | |
176 double lowestPointDbm = 0.0; | |
177 switch (channelWidth) | |
178 { | |
179 case 20: | |
180 default: | |
181 // 52 subcarriers (48 data + 4 pilot) | |
182 // skip guard band and 6 subbands, then place power in 26 subbands, then | |
183 // skip the center subband, then place power in 26 subbands, then skip | |
184 // the final 6 subbands and the guard band. | |
185 txPowerPerBand = txPowerW / 52; | |
186 start1 = (nGuardBands / 2) + 6; | |
187 stop1 = start1 + 26 - 1; | |
188 start2 = stop1 + 2; | |
189 stop2 = start2 + 26 - 1; | |
190 innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5); // [ -11;-9] & [9;11] | |
191 lowestPointDbm = -53.0; //dBm/MHz | |
192 break; | |
193 case 10: | |
194 // 28 subcarriers (24 data + 4 pilot) | |
195 // skip guard band and 2 subbands, then place power in 14 subbands, then | |
196 // skip the center subband, then place power in 14 subbands, then skip | |
197 // the final 2 subbands and the guard band. | |
198 txPowerPerBand = txPowerW / 28; | |
199 start1 = (nGuardBands / 2) + 2; | |
200 stop1 = start1 + 14 - 1; | |
201 start2 = stop1 + 2; | |
202 stop2 = start2 + 14 - 1; | |
203 innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5); // [ -5.5;-4.5] & [4.5;5.5] | |
204 lowestPointDbm = -50.0; //dBm/MHz | |
205 break; | |
206 case 5: | |
207 // 16 subcarriers (12 data + 4 pilot) | |
208 // skip guard band and 2 subbands, then place power in 8 subbands, then | |
209 // skip the center subband, then place power in 8 subbands, then skip | |
210 // the final 2 subbands and the guard. | |
211 txPowerPerBand = txPowerW / 16; | |
212 start1 = (nGuardBands / 2) + 2; | |
213 stop1 = start1 + 8 - 1; | |
214 start2 = stop1 + 2; | |
215 stop2 = start2 + 8 - 1; | |
216 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [ -2.75;-2.5] & [2.5;2.75] | |
217 lowestPointDbm = -47.0; //dBm/MHz | |
218 break; | |
219 } | |
220 | |
221 //Build transmit spectrum mask | |
222 std::vector <StartStop> subBands; | |
223 subBands.push_back (std::make_pair (start1, stop1)); | |
224 subBands.push_back (std::make_pair (start2, stop2)); | |
225 StartStop maskBand (0, nAllocatedBands + nGuardBands); | |
226 if (channelWidth > 20) | |
227 { | |
228 //To handle cases where legacy OFDM is used for HT/VHT/HE STAs using bandw idth of 40 MHz and above | |
229 nAllocatedBands = static_cast<uint32_t>(((20e6) / bandBandwidth) + 0.5); | |
230 nGuardBands = nAllocatedBands * 2; | |
231 maskBand.first = start1 - 6 - (nGuardBands / 2); | |
232 maskBand.second = stop2 + 5 + (nGuardBands / 2) + 1; | |
233 } | |
234 | |
235 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | |
236 txPowerPerBand, nGuardBands, | |
237 innerSlopeWidth, lowestPointDbr, lowestPointDbm); | |
238 NormalizeSpectrumMask (c, txPowerW); | |
239 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f ailed"); | |
240 return c; | |
241 } | |
242 | |
243 Ptr<SpectrumValue> | |
244 WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (uint32_t centerFreq uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | |
245 { | |
246 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin t16_t)guardBandwidth); | |
247 double bandBandwidth = 312500; | |
248 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); | |
249 Values::iterator vit = c->ValuesBegin (); | |
micha.rademacher
2017/10/25 13:16:47
unused-but-set-variable
(looks like it is save to
Rediet
2017/10/30 15:07:56
Acknowledged.
| |
250 Bands::const_iterator bit = c->ConstBandsBegin (); | |
micha.rademacher
2017/10/25 13:16:47
unused-but-set-variable
Rediet
2017/10/30 15:07:57
Acknowledged.
| |
251 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); | |
252 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); | |
253 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB ands ()); | |
254 double txPowerPerBand = 0.0; | |
255 // skip the guard band and 4 subbands, then place power in 28 subbands, then | 222 // skip the guard band and 4 subbands, then place power in 28 subbands, then |
256 // skip the center subband, then place power in 28 subbands, then skip | 223 // skip the center subband, then place power in 28 subbands, then skip |
257 // the final 4 subbands and the guard band. | 224 // the final 4 subbands and the guard band. |
258 // Repeat for each 20 MHz band. | 225 // Repeat for each 20 MHz band. |
259 uint32_t start1 = (nGuardBands / 2) + 4; | 226 uint32_t start1 = (nGuardBands / 2) + 4; |
260 uint32_t stop1 = start1 + 28 - 1; | 227 uint32_t stop1 = start1 + 28 - 1; |
261 uint32_t start2 = stop1 + 2; | 228 uint32_t start2 = stop1 + 2; |
262 uint32_t stop2 = start2 + 28 - 1; | 229 uint32_t stop2 = start2 + 28 - 1; |
263 uint32_t start3 = stop2 + (2 * 4); | 230 uint32_t start3 = stop2 + (2 * 4); |
264 uint32_t stop3 = start3 + 28 - 1; | 231 uint32_t stop3 = start3 + 28 - 1; |
(...skipping 21 matching lines...) Expand all Loading... | |
286 uint32_t stop14 = start14 + 28 - 1; | 253 uint32_t stop14 = start14 + 28 - 1; |
287 uint32_t start15 = stop14 + (2 * 4); | 254 uint32_t start15 = stop14 + (2 * 4); |
288 uint32_t stop15 = start15 + 28 - 1; | 255 uint32_t stop15 = start15 + 28 - 1; |
289 uint32_t start16 = stop15 + 2; | 256 uint32_t start16 = stop15 + 2; |
290 uint32_t stop16 = start16 + 28 - 1; | 257 uint32_t stop16 = start16 + 28 - 1; |
291 //Prepare spectrum mask specific variables | 258 //Prepare spectrum mask specific variables |
292 uint32_t innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5); //size in number of subcarriers of the 0dBr<->20dBr slope (2MHz for HT/VHT) | 259 uint32_t innerSlopeWidth = static_cast<uint32_t>((2e6 / bandBandwidth) + 0.5); //size in number of subcarriers of the 0dBr<->20dBr slope (2MHz for HT/VHT) |
293 double lowestPointDbr = (centerFrequency >= 5000) ? | 260 double lowestPointDbr = (centerFrequency >= 5000) ? |
294 -40.0 : //if 5 GHz band | 261 -40.0 : //if 5 GHz band |
295 -45.0; //if 2.4 GHz band | 262 -45.0; //if 2.4 GHz band |
296 double lowestPointDbm = 0.0; //to be defined per channelWidth | |
297 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se nt at 0dBr) | 263 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se nt at 0dBr) |
298 StartStop maskBand (0, nAllocatedBands + nGuardBands); | 264 StartStop maskBand (0, nAllocatedBands + nGuardBands); |
299 switch (channelWidth) | 265 switch (channelWidth) |
300 { | 266 { |
301 case 20: | 267 case 20: |
302 // 56 subcarriers (52 data + 4 pilot) | 268 // 56 subcarriers (52 data + 4 pilot) |
303 txPowerPerBand = txPowerW / 56; | 269 txPowerPerBandW = txPowerW / 56; |
304 lowestPointDbm = -53.0; //dBm/MHz | |
305 subBands.push_back (std::make_pair (start1, stop1)); | 270 subBands.push_back (std::make_pair (start1, stop1)); |
306 subBands.push_back (std::make_pair (start2, stop2)); | 271 subBands.push_back (std::make_pair (start2, stop2)); |
307 break; | 272 break; |
308 case 40: | 273 case 40: |
309 // 112 subcarriers (104 data + 8 pilot)· | 274 // 112 subcarriers (104 data + 8 pilot)· |
310 // possible alternative: 114 subcarriers (108 data + 6 pilot) | 275 // possible alternative: 114 subcarriers (108 data + 6 pilot) |
311 txPowerPerBand = txPowerW / 112; | 276 txPowerPerBandW = txPowerW / 112; |
312 lowestPointDbm = -56.0; //dBm/MHz | |
313 subBands.push_back (std::make_pair (start1, stop1)); | 277 subBands.push_back (std::make_pair (start1, stop1)); |
314 subBands.push_back (std::make_pair (start2, stop2)); | 278 subBands.push_back (std::make_pair (start2, stop2)); |
315 subBands.push_back (std::make_pair (start3, stop3)); | 279 subBands.push_back (std::make_pair (start3, stop3)); |
316 subBands.push_back (std::make_pair (start4, stop4)); | 280 subBands.push_back (std::make_pair (start4, stop4)); |
317 break; | 281 break; |
318 case 80: | 282 case 80: |
319 // 224 subcarriers (208 data + 16 pilot)· | 283 // 224 subcarriers (208 data + 16 pilot)· |
320 // possible alternative: 242 subcarriers (234 data + 8 pilot) | 284 // possible alternative: 242 subcarriers (234 data + 8 pilot) |
321 txPowerPerBand = txPowerW / 224; | 285 txPowerPerBandW = txPowerW / 224; |
322 lowestPointDbm = -59.0; //dBm/MHz | |
323 NS_ASSERT (lowestPointDbr == -40.0); | 286 NS_ASSERT (lowestPointDbr == -40.0); |
324 subBands.push_back (std::make_pair (start1, stop1)); | 287 subBands.push_back (std::make_pair (start1, stop1)); |
325 subBands.push_back (std::make_pair (start2, stop2)); | 288 subBands.push_back (std::make_pair (start2, stop2)); |
326 subBands.push_back (std::make_pair (start3, stop3)); | 289 subBands.push_back (std::make_pair (start3, stop3)); |
327 subBands.push_back (std::make_pair (start4, stop4)); | 290 subBands.push_back (std::make_pair (start4, stop4)); |
328 subBands.push_back (std::make_pair (start5, stop5)); | 291 subBands.push_back (std::make_pair (start5, stop5)); |
329 subBands.push_back (std::make_pair (start6, stop6)); | 292 subBands.push_back (std::make_pair (start6, stop6)); |
330 subBands.push_back (std::make_pair (start7, stop7)); | 293 subBands.push_back (std::make_pair (start7, stop7)); |
331 subBands.push_back (std::make_pair (start8, stop8)); | 294 subBands.push_back (std::make_pair (start8, stop8)); |
332 break; | 295 break; |
333 case 160: | 296 case 160: |
334 // 448 subcarriers (416 data + 32 pilot) | 297 // 448 subcarriers (416 data + 32 pilot) |
335 // possible alternative: 484 subcarriers (468 data + 16 pilot) | 298 // possible alternative: 484 subcarriers (468 data + 16 pilot) |
336 txPowerPerBand = txPowerW / 448; | 299 txPowerPerBandW = txPowerW / 448; |
337 lowestPointDbm = -59.0; //dBm/MHz | |
338 NS_ASSERT (lowestPointDbr == -40.0); | 300 NS_ASSERT (lowestPointDbr == -40.0); |
339 subBands.push_back (std::make_pair (start1, stop1)); | 301 subBands.push_back (std::make_pair (start1, stop1)); |
340 subBands.push_back (std::make_pair (start2, stop2)); | 302 subBands.push_back (std::make_pair (start2, stop2)); |
341 subBands.push_back (std::make_pair (start3, stop3)); | 303 subBands.push_back (std::make_pair (start3, stop3)); |
342 subBands.push_back (std::make_pair (start4, stop4)); | 304 subBands.push_back (std::make_pair (start4, stop4)); |
343 subBands.push_back (std::make_pair (start5, stop5)); | 305 subBands.push_back (std::make_pair (start5, stop5)); |
344 subBands.push_back (std::make_pair (start6, stop6)); | 306 subBands.push_back (std::make_pair (start6, stop6)); |
345 subBands.push_back (std::make_pair (start7, stop7)); | 307 subBands.push_back (std::make_pair (start7, stop7)); |
346 subBands.push_back (std::make_pair (start8, stop8)); | 308 subBands.push_back (std::make_pair (start8, stop8)); |
347 subBands.push_back (std::make_pair (start9, stop9)); | 309 subBands.push_back (std::make_pair (start9, stop9)); |
348 subBands.push_back (std::make_pair (start10, stop10)); | 310 subBands.push_back (std::make_pair (start10, stop10)); |
349 subBands.push_back (std::make_pair (start11, stop11)); | 311 subBands.push_back (std::make_pair (start11, stop11)); |
350 subBands.push_back (std::make_pair (start12, stop12)); | 312 subBands.push_back (std::make_pair (start12, stop12)); |
351 subBands.push_back (std::make_pair (start13, stop13)); | 313 subBands.push_back (std::make_pair (start13, stop13)); |
352 subBands.push_back (std::make_pair (start14, stop14)); | 314 subBands.push_back (std::make_pair (start14, stop14)); |
353 subBands.push_back (std::make_pair (start15, stop15)); | 315 subBands.push_back (std::make_pair (start15, stop15)); |
354 subBands.push_back (std::make_pair (start16, stop16)); | 316 subBands.push_back (std::make_pair (start16, stop16)); |
355 break; | 317 break; |
356 } | 318 } |
357 | 319 |
358 //Build transmit spectrum mask | 320 //Build transmit spectrum mask |
359 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | 321 CreateSpectrumMaskForOfdm (c, subBands, maskBand, |
360 txPowerPerBand, nGuardBands, | 322 txPowerPerBandW, nGuardBands, |
361 innerSlopeWidth, lowestPointDbr, lowestPointDbm); | 323 innerSlopeWidth, lowestPointDbr); |
362 NormalizeSpectrumMask (c, txPowerW); | 324 NormalizeSpectrumMask (c, txPowerW); |
363 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f ailed"); | 325 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f ailed"); |
364 return c; | 326 return c; |
365 } | 327 } |
366 | 328 |
367 Ptr<SpectrumValue> | 329 Ptr<SpectrumValue> |
368 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (uint32_t centerFreq uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) | 330 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (uint32_t centerFreq uency, uint8_t channelWidth, double txPowerW, uint8_t guardBandwidth) |
369 { | 331 { |
370 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW << (uin t16_t)guardBandwidth); | 332 NS_LOG_FUNCTION (centerFrequency << +channelWidth << txPowerW << +guardBandwid th); |
371 double bandBandwidth = 78125; | 333 double bandBandwidth = 78125; |
372 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); | 334 Ptr<SpectrumValue> c = Create<SpectrumValue> (GetSpectrumModel (centerFrequenc y, channelWidth, bandBandwidth, guardBandwidth)); |
373 Values::iterator vit = c->ValuesBegin (); | |
micha.rademacher
2017/10/25 13:16:47
unused-but-set-variable
Rediet
2017/10/30 15:07:57
Acknowledged.
| |
374 Bands::const_iterator bit = c->ConstBandsBegin (); | |
micha.rademacher
2017/10/25 13:16:47
unused-but-set-variable
Rediet
2017/10/30 15:07:56
Acknowledged.
| |
375 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); | 335 uint32_t nGuardBands = static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / ban dBandwidth) + 0.5); |
376 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); | 336 uint32_t nAllocatedBands = static_cast<uint32_t>(((channelWidth * 1e6) / bandB andwidth) + 0.5); |
377 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB ands ()); | 337 NS_ASSERT_MSG (c->GetSpectrumModel ()->GetNumBands () == (nAllocatedBands + nG uardBands + 1), "Unexpected number of bands " << c->GetSpectrumModel ()->GetNumB ands ()); |
378 double txPowerPerBand = 0.0; | 338 double txPowerPerBandW = 0.0; |
379 uint32_t start1; | 339 uint32_t start1; |
380 uint32_t stop1; | 340 uint32_t stop1; |
381 uint32_t start2; | 341 uint32_t start2; |
382 uint32_t stop2; | 342 uint32_t stop2; |
383 uint32_t start3; | 343 uint32_t start3; |
384 uint32_t stop3; | 344 uint32_t stop3; |
385 uint32_t start4; | 345 uint32_t start4; |
386 uint32_t stop4; | 346 uint32_t stop4; |
387 //Prepare spectrum mask specific variables | 347 //Prepare spectrum mask specific variables |
388 uint32_t innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5); //size in number of subcarriers of the 0dBr<->20dBr slope | 348 uint32_t innerSlopeWidth = static_cast<uint32_t>((1e6 / bandBandwidth) + 0.5); //size in number of subcarriers of the 0dBr<->20dBr slope |
389 double lowestPointDbr = (centerFrequency >= 5000) ? | 349 double lowestPointDbr = (centerFrequency >= 5000) ? |
390 -40.0 : //if 5 GHz band | 350 -40.0 : //if 5 GHz band |
391 -45.0; //if 2.4 GHz band | 351 -45.0; //if 2.4 GHz band |
392 double lowestPointDbm = 0.0; //to be defined per channel width | |
393 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se nt at 0dBr) | 352 std::vector <StartStop> subBands; //list of data/pilot-containing subBands (se nt at 0dBr) |
394 StartStop maskBand (0, nAllocatedBands + nGuardBands); | 353 StartStop maskBand (0, nAllocatedBands + nGuardBands); |
395 switch (channelWidth) | 354 switch (channelWidth) |
396 { | 355 { |
397 case 20: | 356 case 20: |
398 // 242 subcarriers (234 data + 8 pilot) | 357 // 242 subcarriers (234 data + 8 pilot) |
399 txPowerPerBand = txPowerW / 242; | 358 txPowerPerBandW = txPowerW / 242; |
400 lowestPointDbm = -53.0; //dBm/MHz | |
401 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [ -10.25;-9.75] & [9.75;10.25] | 359 innerSlopeWidth = static_cast<uint32_t>((5e5 / bandBandwidth) + 0.5); // [ -10.25;-9.75] & [9.75;10.25] |
402 // skip the guard band and 11 subbands, then place power in 121 subbands, then | 360 // skip the guard band and 6 subbands, then place power in 121 subbands, t hen |
403 // skip 3 DC, then place power in 121 subbands, then skip | 361 // skip 3 DC, then place power in 121 subbands, then skip |
404 // the final 11 subbands and the guard band. | 362 // the final 6 subbands and the guard band. |
405 start1 = (nGuardBands / 2) + 12; | 363 start1 = (nGuardBands / 2) + 6; |
406 stop1 = start1 + 121 - 1; | 364 stop1 = start1 + 121 - 1; |
407 start2 = stop1 + 4; | 365 start2 = stop1 + 4; |
408 stop2 = start2 + 121 - 1; | 366 stop2 = start2 + 121 - 1; |
409 subBands.push_back (std::make_pair (start1, stop1)); | 367 subBands.push_back (std::make_pair (start1, stop1)); |
410 subBands.push_back (std::make_pair (start2, stop2)); | 368 subBands.push_back (std::make_pair (start2, stop2)); |
411 break; | 369 break; |
412 case 40: | 370 case 40: |
413 // 484 subcarriers (468 data + 16 pilot) | 371 // 484 subcarriers (468 data + 16 pilot) |
414 txPowerPerBand = txPowerW / 484; | 372 txPowerPerBandW = txPowerW / 484; |
415 lowestPointDbm = -56.0; //dBm/MHz | 373 // skip the guard band and 12 subbands, then place power in 242 subbands, then |
416 // skip the guard band and 11 subbands, then place power in 242 subbands, then | |
417 // skip 5 DC, then place power in 242 subbands, then skip | 374 // skip 5 DC, then place power in 242 subbands, then skip |
418 // the final 11 subbands and the guard band. | 375 // the final 12 subbands and the guard band. |
419 start1 = (nGuardBands / 2) + 12; | 376 start1 = (nGuardBands / 2) + 12; |
420 stop1 = start1 + 242 - 1; | 377 stop1 = start1 + 242 - 1; |
421 start2 = stop1 + 6; | 378 start2 = stop1 + 6; |
422 stop2 = start2 + 242 - 1; | 379 stop2 = start2 + 242 - 1; |
423 subBands.push_back (std::make_pair (start1, stop1)); | 380 subBands.push_back (std::make_pair (start1, stop1)); |
424 subBands.push_back (std::make_pair (start2, stop2)); | 381 subBands.push_back (std::make_pair (start2, stop2)); |
425 break; | 382 break; |
426 case 80: | 383 case 80: |
427 // 996 subcarriers (980 data + 16 pilot) | 384 // 996 subcarriers (980 data + 16 pilot) |
428 txPowerPerBand = txPowerW / 996; | 385 txPowerPerBandW = txPowerW / 996; |
429 lowestPointDbm = -59.0; //dBm/MHz | 386 // skip the guard band and 12 subbands, then place power in 498 subbands, then |
430 // skip the guard band and 11 subbands, then place power in 498 subbands, then | |
431 // skip 5 DC, then place power in 498 subbands, then skip | 387 // skip 5 DC, then place power in 498 subbands, then skip |
432 // the final 11 subbands and the guard band. | 388 // the final 12 subbands and the guard band. |
433 start1 = (nGuardBands / 2) + 12; | 389 start1 = (nGuardBands / 2) + 12; |
434 stop1 = start1 + 498 - 1; | 390 stop1 = start1 + 498 - 1; |
435 start2 = stop1 + 6; | 391 start2 = stop1 + 6; |
436 stop2 = start2 + 498 - 1; | 392 stop2 = start2 + 498 - 1; |
437 subBands.push_back (std::make_pair (start1, stop1)); | 393 subBands.push_back (std::make_pair (start1, stop1)); |
438 subBands.push_back (std::make_pair (start2, stop2)); | 394 subBands.push_back (std::make_pair (start2, stop2)); |
439 break; | 395 break; |
440 case 160: | 396 case 160: |
441 // 2 x 996 subcarriers (2 x 80 MHZ bands) | 397 // 2 x 996 subcarriers (2 x 80 MHZ bands) |
442 txPowerPerBand = txPowerW / (2 * 996); | 398 txPowerPerBandW = txPowerW / (2 * 996); |
443 lowestPointDbm = -59.0; //dBm/MHz | |
444 start1 = (nGuardBands / 2) + 12; | 399 start1 = (nGuardBands / 2) + 12; |
445 stop1 = start1 + 498 - 1; | 400 stop1 = start1 + 498 - 1; |
446 start2 = stop1 + 6; | 401 start2 = stop1 + 6; |
447 stop2 = start2 + 498 - 1; | 402 stop2 = start2 + 498 - 1; |
448 start3 = stop2 + (2 * 12); | 403 start3 = stop2 + (2 * 12); |
449 stop3 = start3 + 498 - 1; | 404 stop3 = start3 + 498 - 1; |
450 start4 = stop3 + 6; | 405 start4 = stop3 + 6; |
451 stop4 = start4 + 498 - 1; | 406 stop4 = start4 + 498 - 1; |
452 subBands.push_back (std::make_pair (start1, stop1)); | 407 subBands.push_back (std::make_pair (start1, stop1)); |
453 subBands.push_back (std::make_pair (start2, stop2)); | 408 subBands.push_back (std::make_pair (start2, stop2)); |
454 subBands.push_back (std::make_pair (start3, stop3)); | 409 subBands.push_back (std::make_pair (start3, stop3)); |
455 subBands.push_back (std::make_pair (start4, stop4)); | 410 subBands.push_back (std::make_pair (start4, stop4)); |
456 break; | 411 break; |
457 default: | 412 default: |
458 NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported"); | 413 NS_FATAL_ERROR ("ChannelWidth " << channelWidth << " unsupported"); |
459 break; | 414 break; |
460 } | 415 } |
461 | 416 |
462 //Build transmit spectrum mask | 417 //Build transmit spectrum mask |
463 CreateSpectrumMaskForOfdm (c, subBands, maskBand, | 418 CreateSpectrumMaskForOfdm (c, subBands, maskBand, |
464 txPowerPerBand, nGuardBands, | 419 txPowerPerBandW, nGuardBands, |
465 innerSlopeWidth, lowestPointDbr, lowestPointDbm); | 420 innerSlopeWidth, lowestPointDbr); |
466 NormalizeSpectrumMask (c, txPowerW); | 421 NormalizeSpectrumMask (c, txPowerW); |
467 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f ailed"); | 422 NS_ASSERT_MSG (std::abs (txPowerW - Integral (*c)) < 1e-6, "Power allocation f ailed"); |
468 return c; | 423 return c; |
469 } | 424 } |
470 | 425 |
471 Ptr<SpectrumValue> | 426 Ptr<SpectrumValue> |
472 WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t centerFrequen cy, uint8_t channelWidth, double bandBandwidth, double noiseFigure, uint8_t guar dBandwidth) | 427 WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t centerFrequen cy, uint8_t channelWidth, double bandBandwidth, double noiseFigure, uint8_t guar dBandwidth) |
473 { | 428 { |
474 Ptr<SpectrumModel> model = GetSpectrumModel (centerFrequency, channelWidth, ba ndBandwidth, guardBandwidth); | 429 Ptr<SpectrumModel> model = GetSpectrumModel (centerFrequency, channelWidth, ba ndBandwidth, guardBandwidth); |
475 return CreateNoisePowerSpectralDensity (noiseFigure, model); | 430 return CreateNoisePowerSpectralDensity (noiseFigure, model); |
476 } | 431 } |
477 | 432 |
478 Ptr<SpectrumValue> | 433 Ptr<SpectrumValue> |
479 WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity (double noiseFigureDb, Ptr<SpectrumModel> spectrumModel) | 434 WifiSpectrumValueHelper::CreateNoisePowerSpectralDensity (double noiseFigureDb, Ptr<SpectrumModel> spectrumModel) |
480 { | 435 { |
481 NS_LOG_FUNCTION (noiseFigureDb << spectrumModel); | 436 NS_LOG_FUNCTION (noiseFigureDb << spectrumModel); |
482 | 437 |
483 // see "LTE - From theory to practice" | 438 // see "LTE - From theory to practice" |
484 // Section 22.4.4.2 Thermal Noise and Receiver Noise Figure | 439 // Section 22.4.4.2 Thermal Noise and Receiver Noise Figure |
485 const double kT_dBm_Hz = -174.0; // dBm/Hz | 440 const double kT_dBm_Hz = -174.0; // dBm/Hz |
486 double kT_W_Hz = std::pow (10.0, (kT_dBm_Hz - 30) / 10.0); | 441 double kT_W_Hz = std::pow (10.0, (kT_dBm_Hz - 30) / 10.0); |
487 double noiseFigureLinear = std::pow (10.0, noiseFigureDb / 10.0); | 442 double noiseFigureLinear = std::pow (10.0, noiseFigureDb / 10.0); |
488 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear; | 443 double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear; |
489 | 444 |
490 Ptr<SpectrumValue> noisePsd = Create <SpectrumValue> (spectrumModel); | 445 Ptr<SpectrumValue> noisePsd = Create <SpectrumValue> (spectrumModel); |
491 (*noisePsd) = noisePowerSpectralDensity; | 446 (*noisePsd) = noisePowerSpectralDensity; |
492 NS_LOG_DEBUG ("NoisePowerSpectralDensity has integrated power of " << Integral (*noisePsd)); | 447 NS_LOG_INFO ("NoisePowerSpectralDensity has integrated power of " << Integral (*noisePsd)); |
493 return noisePsd; | 448 return noisePsd; |
494 } | 449 } |
495 | 450 |
496 Ptr<SpectrumValue> | 451 Ptr<SpectrumValue> |
497 WifiSpectrumValueHelper::CreateRfFilter (uint32_t centerFrequency, uint8_t chann elWidth, double bandGranularity, uint8_t guardBandwidth) | 452 WifiSpectrumValueHelper::CreateRfFilter (uint32_t centerFrequency, uint8_t chann elWidth, double bandGranularity, uint8_t guardBandwidth) |
498 { | 453 { |
499 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << bandGranularity << (uint16_t)guardBandwidth); | 454 NS_LOG_FUNCTION (centerFrequency << +channelWidth << bandGranularity << +guard Bandwidth); |
500 Ptr<SpectrumValue> c = Create <SpectrumValue> (GetSpectrumModel (centerFrequen cy, channelWidth, bandGranularity, guardBandwidth)); | 455 Ptr<SpectrumValue> c = Create <SpectrumValue> (GetSpectrumModel (centerFrequen cy, channelWidth, bandGranularity, guardBandwidth)); |
501 size_t numBands = c->GetSpectrumModel ()->GetNumBands (); | 456 size_t numBands = c->GetSpectrumModel ()->GetNumBands (); |
502 Bands::const_iterator bit = c->ConstBandsBegin (); | 457 Bands::const_iterator bit = c->ConstBandsBegin (); |
503 Values::iterator vit = c->ValuesBegin (); | 458 Values::iterator vit = c->ValuesBegin (); |
504 uint32_t bandBandwidth = static_cast<uint32_t> (bandGranularity); | 459 uint32_t bandBandwidth = static_cast<uint32_t> (bandGranularity); |
505 size_t numBandsInFilter = static_cast<size_t> (channelWidth * 1e6 / bandBandwi dth);· | 460 size_t numBandsInFilter = static_cast<size_t> (channelWidth * 1e6 / bandBandwi dth);· |
506 if (channelWidth % bandBandwidth != 0) | 461 if (channelWidth % bandBandwidth != 0) |
507 { | 462 { |
508 numBandsInFilter += 1; | 463 numBandsInFilter += 1; |
509 } | 464 } |
510 NS_LOG_DEBUG ("Num bands in filter: " << numBandsInFilter); | 465 NS_LOG_INFO ("Num bands in filter: " << numBandsInFilter); |
511 // Set the value of the filter to 1 for the center-most numBandsInFilter | 466 // Set the value of the filter to 1 for the center-most numBandsInFilter |
512 NS_ASSERT_MSG ((numBandsInFilter % 2 == 1) && (numBands % 2 == 1), "Should hav e odd number of bands"); | 467 NS_ASSERT_MSG ((numBandsInFilter % 2 == 1) && (numBands % 2 == 1), "Should hav e odd number of bands"); |
513 size_t startIndex = (numBands - numBandsInFilter) / 2; | 468 size_t startIndex = (numBands - numBandsInFilter) / 2; |
514 vit += startIndex; | 469 vit += startIndex; |
515 bit += startIndex; | 470 bit += startIndex; |
516 for (size_t i = startIndex; i < startIndex + numBandsInFilter; i++, vit++, bit ++) | 471 for (size_t i = startIndex; i < startIndex + numBandsInFilter; i++, vit++, bit ++) |
517 { | 472 { |
518 *vit = 1; | 473 *vit = 1; |
519 } | 474 } |
520 NS_LOG_DEBUG ("Added subbands " << startIndex << " to " << startIndex + numBan dsInFilter << " to filter"); | 475 NS_LOG_LOGIC ("Added subbands " << startIndex << " to " << startIndex + numBan dsInFilter << " to filter"); |
521 return c; | 476 return c; |
522 } | 477 } |
523 | 478 |
524 void | 479 void |
525 WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm (Ptr<SpectrumValue> c, std::v ector <StartStop> allocatedSubBands, StartStop maskBand, | 480 WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm (Ptr<SpectrumValue> c, std::v ector <StartStop> allocatedSubBands, StartStop maskBand, |
526 double txPowerPerBandW, uint 32_t nGuardBands, | 481 double txPowerPerBandW, uint 32_t nGuardBands, |
527 uint32_t innerSlopeWidth, do uble lowestPointDbr, double lowestPointDbm) | 482 uint32_t innerSlopeWidth, do uble lowestPointDbr) |
528 { | 483 { |
529 NS_LOG_FUNCTION (c << allocatedSubBands.front ().first << allocatedSubBands.ba ck ().second << maskBand.first << maskBand.second << txPowerPerBandW << nGuardBa nds << innerSlopeWidth << lowestPointDbr << lowestPointDbm); | 484 NS_LOG_FUNCTION (c << allocatedSubBands.front ().first << allocatedSubBands.ba ck ().second << maskBand.first << maskBand.second << txPowerPerBandW << nGuardBa nds << innerSlopeWidth << lowestPointDbr); |
530 uint32_t numSubBands = allocatedSubBands.size (); | 485 uint32_t numSubBands = allocatedSubBands.size (); |
531 uint32_t numBands = c->GetSpectrumModel ()->GetNumBands (); | 486 uint32_t numBands = c->GetSpectrumModel ()->GetNumBands (); |
532 uint32_t numMaskBands = maskBand.second - maskBand.first + 1; | 487 uint32_t numMaskBands = maskBand.second - maskBand.first + 1; |
533 NS_ASSERT (numSubBands && numBands && numMaskBands); | 488 NS_ASSERT (numSubBands && numBands && numMaskBands); |
534 NS_LOG_DEBUG ("Power per band " << txPowerPerBandW << "W"); | 489 NS_LOG_LOGIC ("Power per band " << txPowerPerBandW << "W"); |
535 | 490 |
536 //Different power levels | 491 //Different power levels |
537 double txPowerPerBandDbm = (10.0 * std::log10 (txPowerPerBandW * 1000.0)); | 492 double txPowerRefDbm = (10.0 * std::log10 (txPowerPerBandW * 1000.0)); |
538 double txPowerMinus20dBr = txPowerPerBandDbm - 20; | 493 double txPowerInnerBandMinDbm = txPowerRefDbm - 20; |
539 double txPowerMinus28dBr = txPowerPerBandDbm - 28; | 494 double txPowerMiddleBandMinDbm = txPowerRefDbm - 28; |
540 double txPowerLowestPoint = txPowerPerBandDbm + lowestPointDbr; //Doing std::m ax (txPowerPerBandDbm + lowestPointDbr, lowestPointDbm) messed up everything for low signals (dBm/MHz to current band granularity conversion needed)... | 495 double txPowerOuterBandMinDbm = txPowerRefDbm + lowestPointDbr; //TODO also ta ke into account dBm/MHz constraints |
496 | |
497 //Determine parameters that will be used to compute non-truncated global spect rum mask | |
498 uint32_t nInbandChannelBands = numMaskBands - (nGuardBands + 1); | |
499 NS_ASSERT (nInbandChannelBands >= (allocatedSubBands.back ().second - allocate dSubBands.front ().first)); | |
500 uint32_t nIdealGuardBands = nInbandChannelBands * 2; //should ideally have as much band on left and right to fully model out of band transmission constraints | |
501 NS_ASSERT (nIdealGuardBands >= nGuardBands && (nIdealGuardBands - nGuardBands) % 2 == 0); | |
502 uint32_t numIdealMaskBands = nInbandChannelBands + nIdealGuardBands + 1; | |
503 NS_ASSERT (numIdealMaskBands >= numMaskBands); | |
504 uint32_t truncationShift = (nIdealGuardBands - nGuardBands) / 2; //shift to ap ply when allocating power to truncated spectrum mask | |
541 | 505 |
542 //Different widths (in number of bands) | 506 //Different widths (in number of bands) |
543 uint32_t outerSlopeWidth = nGuardBands / 4; | 507 uint32_t outerSlopeWidth = nIdealGuardBands / 4; //nIdealGuardBands is the tot al left+right ideal guard band (wrt to in-band channel width). The left/right ou ter part is half of the left/right guard band. |
544 uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2); | 508 uint32_t middleSlopeWidth = outerSlopeWidth - (innerSlopeWidth / 2); |
545 StartStop outerBandLeft (maskBand.first, //to handle cases where allocated cha nnel is under WifiPhy configured channel width. | 509 StartStop outerBandLeft (maskBand.first, //to handle cases where allocated cha nnel is under WifiPhy configured channel width (especially true for mask.second) |
546 maskBand.first + outerSlopeWidth - 1); | 510 maskBand.first + outerSlopeWidth - 1); |
547 StartStop middleBandLeft (outerBandLeft.second + 1, | 511 StartStop middleBandLeft (outerBandLeft.second + 1, |
548 outerBandLeft.second + middleSlopeWidth); | 512 outerBandLeft.second + middleSlopeWidth); |
549 StartStop innerBandLeft (allocatedSubBands.front ().first - innerSlopeWidth, | 513 StartStop innerBandLeft (allocatedSubBands.front ().first + truncationShift - innerSlopeWidth, |
550 allocatedSubBands.front ().first - 1); //better to pl ace slope based on allocated subcarriers | 514 allocatedSubBands.front ().first + truncationShift - 1); //better to place slope based on (shifted) allocated subcarriers |
551 StartStop flatJunctionLeft (middleBandLeft.second + 1, | 515 StartStop flatJunctionLeft (middleBandLeft.second + 1, |
552 innerBandLeft.first - 1); //in order to handle shi ft due to guard subcarriers | 516 innerBandLeft.first - 1); //in order to handle shi ft due to guard subcarriers |
553 StartStop outerBandRight (maskBand.second - outerSlopeWidth + 1, | 517 StartStop outerBandRight (maskBand.second + 2 * truncationShift - outerSlopeWi dth + 1, |
554 maskBand.second); //start from outer edge to be able to compute flat junction width | 518 maskBand.second + 2 * truncationShift); //start from outer edge (of ideal mask) to be able to compute flat junction width |
555 StartStop middleBandRight (outerBandRight.first - middleSlopeWidth, | 519 StartStop middleBandRight (outerBandRight.first - middleSlopeWidth, |
556 outerBandRight.first - 1); | 520 outerBandRight.first - 1); |
557 StartStop innerBandRight (allocatedSubBands.back ().second + 1, | 521 StartStop innerBandRight (allocatedSubBands.back ().second + truncationShift + 1, |
558 allocatedSubBands.back ().second + innerSlopeWidth); | 522 allocatedSubBands.back ().second + truncationShift + innerSlopeWidth); |
559 StartStop flatJunctionRight (innerBandRight.second + 1, | 523 StartStop flatJunctionRight (innerBandRight.second + 1, |
560 middleBandRight.first - 1); | 524 middleBandRight.first - 1); |
561 NS_LOG_DEBUG ("outerBandLeft=[" << outerBandLeft.first << ";" << outerBandLeft .second << "] " << | 525 NS_LOG_DEBUG ("outerBandLeft=[" << outerBandLeft.first << ";" << outerBandLeft .second << "] " << |
562 "middleBandLeft=[" << middleBandLeft.first << ";" << middleBandL eft.second << "] " << | 526 "middleBandLeft=[" << middleBandLeft.first << ";" << middleBandL eft.second << "] " << |
563 "flatJunctionLeft=[" << flatJunctionLeft.first << ";" << flatJun ctionLeft.second << "] " << | 527 "flatJunctionLeft=[" << flatJunctionLeft.first << ";" << flatJun ctionLeft.second << "] " << |
564 "innerBandLeft=[" << innerBandLeft.first << ";" << innerBandLeft .second << "] " << | 528 "innerBandLeft=[" << innerBandLeft.first << ";" << innerBandLeft .second << "] " << |
565 "subBands=[" << allocatedSubBands.front ().first << ";" << alloc atedSubBands.back ().second << "] " << | 529 "subBands=[" << allocatedSubBands.front ().first + truncationShi ft << ";" << allocatedSubBands.back ().second + truncationShift << "] " << |
566 "innerBandRight=[" << innerBandRight.first << ";" << innerBandRi ght.second << "] " << | 530 "innerBandRight=[" << innerBandRight.first << ";" << innerBandRi ght.second << "] " << |
567 "flatJunctionRight=[" << flatJunctionRight.first << ";" << flatJ unctionRight.second << "] " << | 531 "flatJunctionRight=[" << flatJunctionRight.first << ";" << flatJ unctionRight.second << "] " << |
568 "middleBandRight=[" << middleBandRight.first << ";" << middleBan dRight.second << "] " << | 532 "middleBandRight=[" << middleBandRight.first << ";" << middleBan dRight.second << "] " << |
569 "outerBandRight=[" << outerBandRight.first << ";" << outerBandRi ght.second << "] "); | 533 "outerBandRight=[" << outerBandRight.first << ";" << outerBandRi ght.second << "] "); |
570 NS_ASSERT (numMaskBands == ((allocatedSubBands.back ().second - allocatedSubBa nds.front ().first + 1) //equivalent to allocatedBand (includes notches and DC) | 534 NS_ASSERT (numIdealMaskBands == ((allocatedSubBands.back ().second - allocated SubBands.front ().first + 1) //equivalent to allocatedBand (includes notches an d DC) |
571 + 2 * (innerSlopeWidth + middleSlopeWidth + outerSl opeWidth) | 535 + 2 * (innerSlopeWidth + middleSlopeWidth + ou terSlopeWidth) |
572 + (flatJunctionLeft.second - flatJunctionLeft.first + 1) //flat junctions | 536 + (flatJunctionLeft.second - flatJunctionLeft. first + 1) //flat junctions |
573 + (flatJunctionRight.second - flatJunctionRight.fir st + 1))); | 537 + (flatJunctionRight.second - flatJunctionRigh t.first + 1))); |
574 | 538 |
575 //Different slopes | 539 //Different slopes |
576 double innerSlope = 20.0 / innerSlopeWidth; //0 to 20dBr | 540 double innerSlope = 20.0 / innerSlopeWidth; //0 to 20dBr |
577 double middleSlope = 8.0 / middleSlopeWidth; //20 to 28dBr | 541 double middleSlope = 8.0 / middleSlopeWidth; //20 to 28dBr |
578 double outerSlope = (txPowerMinus28dBr - txPowerLowestPoint) / outerSlopeWidth ; | 542 double outerSlope = (txPowerMiddleBandMinDbm - txPowerOuterBandMinDbm) / outer SlopeWidth; |
579 | 543 |
580 //Build spectrum mask | 544 //Build spectrum mask |
581 Values::iterator vit = c->ValuesBegin (); | 545 Values::iterator vit = c->ValuesBegin (); |
582 Bands::const_iterator bit = c->ConstBandsBegin (); | 546 Bands::const_iterator bit = c->ConstBandsBegin (); |
583 double txPowerW = 0.0; | 547 double txPowerW = 0.0; |
584 for (size_t i = 0; i < numBands; i++, vit++, bit++) | 548 for (size_t i = 0; i < numBands; i++, vit++, bit++) |
585 { | 549 { |
550 uint32_t iShift = i + truncationShift; | |
586 if (i < maskBand.first || i > maskBand.second) //outside the spectrum mask | 551 if (i < maskBand.first || i > maskBand.second) //outside the spectrum mask |
587 { | 552 { |
588 txPowerW = 0.0; | 553 txPowerW = 0.0; |
589 } | 554 } |
590 else if (i <= outerBandLeft.second && i >= outerBandLeft.first) //better t o put greater first (less computation) | 555 else if (iShift <= outerBandLeft.second && iShift >= outerBandLeft.first) //better to put greater first (less computation) |
591 { | 556 { |
592 txPowerW = std::pow (10.0, (txPowerLowestPoint + ((i - outerBandLeft.f irst) * outerSlope)) / 10.0) / 1000.0; | 557 txPowerW = DbmToW (txPowerOuterBandMinDbm + ((iShift - outerBandLeft.f irst) * outerSlope)); |
593 } | 558 } |
594 else if (i <= middleBandLeft.second && i >= middleBandLeft.first) | 559 else if (iShift <= middleBandLeft.second && iShift >= middleBandLeft.first ) |
595 { | 560 { |
596 txPowerW = std::pow (10.0, (txPowerMinus28dBr + ((i - middleBandLeft.f irst) * middleSlope)) / 10.0) / 1000.0; | 561 txPowerW = DbmToW (txPowerMiddleBandMinDbm + ((iShift - middleBandLeft .first) * middleSlope)); |
597 } | 562 } |
598 else if (i <= flatJunctionLeft.second && i >= flatJunctionLeft.first) | 563 else if (iShift <= flatJunctionLeft.second && iShift >= flatJunctionLeft.f irst) |
599 { | 564 { |
600 txPowerW = std::pow (10.0, txPowerMinus20dBr / 10.0) / 1000.0; | 565 txPowerW = DbmToW (txPowerInnerBandMinDbm); |
601 } | 566 } |
602 else if (i <= innerBandLeft.second && i >= innerBandLeft.first) | 567 else if (iShift <= innerBandLeft.second && iShift >= innerBandLeft.first) |
603 { | 568 { |
604 txPowerW = std::pow (10.0, (txPowerMinus20dBr + ((i - innerBandLeft.fi rst) * innerSlope)) / 10.0) / 1000.0; | 569 txPowerW = DbmToW (txPowerInnerBandMinDbm + ((iShift - innerBandLeft.f irst) * innerSlope)); |
605 } | 570 } |
606 else if (i <= allocatedSubBands.back ().second && i >= allocatedSubBands.f ront ().first) //roughly in allocated band | 571 else if (i <= allocatedSubBands.back ().second && i >= allocatedSubBands.f ront ().first) //roughly in allocated band |
607 { | 572 { |
608 bool insideSubBand = false; | 573 bool insideSubBand = false; |
609 for (uint32_t j = 0; !insideSubBand && j < numSubBands; j++) //continu e until inside a sub-band | 574 for (uint32_t j = 0; !insideSubBand && j < numSubBands; j++) //continu e until inside a sub-band |
610 { | 575 { |
611 insideSubBand = (i <= allocatedSubBands[j].second) && (i >= alloca tedSubBands[j].first); | 576 insideSubBand = (i <= allocatedSubBands[j].second) && (i >= alloca tedSubBands[j].first); |
612 } | 577 } |
613 if (insideSubBand) | 578 if (insideSubBand) |
614 { | 579 { |
615 txPowerW = txPowerPerBandW; | 580 txPowerW = txPowerPerBandW; |
616 } | 581 } |
617 else | 582 else |
618 { | 583 { |
619 txPowerW = std::pow (10.0, txPowerMinus20dBr / 10.0) / 1000.0; //c onsider that nulled as much as possible inband but power leakage -> -20dBr | 584 txPowerW = DbmToW (txPowerInnerBandMinDbm); //consider that nulled as much as possible inband but power leakage -> -20dBr |
620 } | 585 } |
621 } | 586 } |
622 else if (i <= innerBandRight.second && i >= innerBandRight.first) | 587 else if (iShift <= innerBandRight.second && iShift >= innerBandRight.first ) |
623 { | 588 { |
624 txPowerW = std::pow (10.0, (txPowerPerBandDbm - ((i - innerBandRight.f irst) * innerSlope)) / 10.0) / 1000.0; | 589 txPowerW = DbmToW (txPowerRefDbm - ((iShift - innerBandRight.first + 1 ) * innerSlope)); // +1 so as to be symmetric with left slope |
625 } | 590 } |
626 else if (i <= flatJunctionRight.second && i >= flatJunctionRight.first) | 591 else if (iShift <= flatJunctionRight.second && iShift >= flatJunctionRight .first) |
627 { | 592 { |
628 txPowerW = std::pow (10.0, txPowerMinus20dBr / 10.0) / 1000.0; | 593 txPowerW = DbmToW (txPowerInnerBandMinDbm); |
629 } | 594 } |
630 else if (i <= middleBandRight.second && i >= middleBandRight.first) | 595 else if (iShift <= middleBandRight.second && iShift >= middleBandRight.fir st) |
631 { | 596 { |
632 txPowerW = std::pow (10.0, (txPowerMinus20dBr - ((i - middleBandRight. first) * middleSlope)) / 10.0) / 1000.0; | 597 txPowerW = DbmToW (txPowerInnerBandMinDbm - ((iShift - middleBandRight .first + 1) * middleSlope)); // +1 so as to be symmetric with left slope |
633 } | 598 } |
634 else if (i <= outerBandRight.second && i >= outerBandRight.first) | 599 else if (iShift <= outerBandRight.second && iShift >= outerBandRight.first ) |
635 { | 600 { |
636 txPowerW = std::pow (10.0, (txPowerMinus28dBr - ((i - outerBandRight.f irst) * outerSlope)) / 10.0) / 1000.0; | 601 txPowerW = DbmToW (txPowerMiddleBandMinDbm - ((i - outerBandRight.firs t + 1) * outerSlope)); // +1 so as to be symmetric with left slope |
637 } | 602 } |
638 else | 603 else |
639 { | 604 { |
640 NS_FATAL_ERROR ("Should have handled all cases"); | 605 NS_FATAL_ERROR ("Should have handled all cases"); |
641 } | 606 } |
607 double txPowerDbr = 10 * std::log10 (txPowerW / txPowerPerBandW); | |
608 NS_LOG_LOGIC (uint32_t(i) << " -> " << txPowerDbr); | |
642 *vit = txPowerW / (bit->fh - bit->fl); | 609 *vit = txPowerW / (bit->fh - bit->fl); |
643 } | 610 } |
644 NS_LOG_DEBUG ("Added signal power to subbands " << allocatedSubBands.front (). first << "-" << allocatedSubBands.back ().second); | 611 NS_LOG_INFO ("Added signal power to subbands " << allocatedSubBands.front ().f irst << "-" << allocatedSubBands.back ().second); |
645 } | 612 } |
646 | 613 |
647 void | 614 void |
648 WifiSpectrumValueHelper::NormalizeSpectrumMask (Ptr<SpectrumValue> c, double txP owerW) | 615 WifiSpectrumValueHelper::NormalizeSpectrumMask (Ptr<SpectrumValue> c, double txP owerW) |
649 { | 616 { |
650 NS_LOG_FUNCTION (c << txPowerW); | 617 NS_LOG_FUNCTION (c << txPowerW); |
651 //Normalize power so that total signal power equals transmit power | 618 //Normalize power so that total signal power equals transmit power |
652 double currentTxPowerW = Integral (*c); | 619 double currentTxPowerW = Integral (*c); |
653 double normalizationRatio = currentTxPowerW / txPowerW; | 620 double normalizationRatio = currentTxPowerW / txPowerW; |
654 NS_LOG_DEBUG ("Current power: " << currentTxPowerW << "W vs expected power: " << txPowerW << "W" << | 621 NS_LOG_LOGIC ("Current power: " << currentTxPowerW << "W vs expected power: " << txPowerW << "W" << |
655 " -> ratio (C/E) = " << normalizationRatio); | 622 " -> ratio (C/E) = " << normalizationRatio); |
656 Values::iterator vit = c->ValuesBegin (); | 623 Values::iterator vit = c->ValuesBegin (); |
657 for (size_t i = 0; i < c->GetSpectrumModel ()->GetNumBands (); i++, vit++) | 624 for (size_t i = 0; i < c->GetSpectrumModel ()->GetNumBands (); i++, vit++) |
658 { | 625 { |
659 *vit = (*vit) / normalizationRatio; | 626 *vit = (*vit) / normalizationRatio; |
660 } | 627 } |
628 } | |
629 | |
630 double | |
631 WifiSpectrumValueHelper::DbmToW (double dBm) | |
632 { | |
633 double mW = std::pow (10.0, dBm / 10.0); | |
634 return mW / 1000.0; | |
661 } | 635 } |
662 | 636 |
663 static Ptr<SpectrumModel> g_WifiSpectrumModel5Mhz; ///< static initializer for t he class | 637 static Ptr<SpectrumModel> g_WifiSpectrumModel5Mhz; ///< static initializer for t he class |
664 | 638 |
665 WifiSpectrumValueHelper::~WifiSpectrumValueHelper () | 639 WifiSpectrumValueHelper::~WifiSpectrumValueHelper () |
666 { | 640 { |
667 } | 641 } |
668 | 642 |
669 WifiSpectrumValue5MhzFactory::~WifiSpectrumValue5MhzFactory () | 643 WifiSpectrumValue5MhzFactory::~WifiSpectrumValue5MhzFactory () |
670 { | 644 { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 (*rf)[channel + 3] = 1; | 721 (*rf)[channel + 3] = 1; |
748 (*rf)[channel + 4] = 1; | 722 (*rf)[channel + 4] = 1; |
749 (*rf)[channel + 5] = 1; | 723 (*rf)[channel + 5] = 1; |
750 (*rf)[channel + 6] = 1; | 724 (*rf)[channel + 6] = 1; |
751 | 725 |
752 return rf; | 726 return rf; |
753 } | 727 } |
754 | 728 |
755 | 729 |
756 } // namespace ns3 | 730 } // namespace ns3 |
LEFT | RIGHT |