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) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
19 * Ghada Badawy <gbadawy@gmail.com> | 19 * Ghada Badawy <gbadawy@gmail.com> |
20 * Sébastien Deronne <sebastien.deronne@gmail.com> | 20 * Sébastien Deronne <sebastien.deronne@gmail.com> |
21 * | 21 * |
22 * Ported from yans-wifi-phy.cc by several contributors starting | 22 * Ported from yans-wifi-phy.cc by several contributors starting |
23 * with Nicola Baldo and Dean Armstrong | 23 * with Nicola Baldo and Dean Armstrong |
24 */ | 24 */ |
25 | 25 |
26 #include "spectrum-wifi-phy.h" | 26 #include "spectrum-wifi-phy.h" |
27 #include "ns3/wifi-spectrum-value-helper.h" | 27 #include "ns3/wifi-spectrum-value-helper.h" |
| 28 #include "ns3/abort.h" |
28 #include "ns3/log.h" | 29 #include "ns3/log.h" |
29 #include "ns3/boolean.h" | 30 #include "ns3/boolean.h" |
30 #include "wifi-spectrum-signal-parameters.h" | 31 #include "wifi-spectrum-signal-parameters.h" |
31 #include "wifi-utils.h" | 32 #include "wifi-utils.h" |
32 | 33 |
33 namespace ns3 { | 34 namespace ns3 { |
34 | 35 |
35 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhy"); | 36 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhy"); |
36 | 37 |
37 NS_OBJECT_ENSURE_REGISTERED (SpectrumWifiPhy); | 38 NS_OBJECT_ENSURE_REGISTERED (SpectrumWifiPhy); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 100 } |
100 else | 101 else |
101 { | 102 { |
102 if (GetFrequency () == 0) | 103 if (GetFrequency () == 0) |
103 { | 104 { |
104 NS_LOG_DEBUG ("Frequency is not set; returning 0"); | 105 NS_LOG_DEBUG ("Frequency is not set; returning 0"); |
105 return 0; | 106 return 0; |
106 } | 107 } |
107 else | 108 else |
108 { | 109 { |
109 NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of ("
<< GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")"); | 110 uint8_t channelWidth = GetChannelWidth (); |
110 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFreq
uency (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ()); | 111 NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of ("
<< GetFrequency () << ", " << +channelWidth << ")"); |
| 112 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFreq
uency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth)); |
111 } | 113 } |
112 } | 114 } |
113 return m_rxSpectrumModel; | 115 return m_rxSpectrumModel; |
114 } | 116 } |
115 | 117 |
116 Ptr<Channel> | 118 Ptr<Channel> |
117 SpectrumWifiPhy::GetChannel (void) const | 119 SpectrumWifiPhy::GetChannel (void) const |
118 { | 120 { |
119 return m_channel; | 121 return m_channel; |
120 } | 122 } |
121 | 123 |
122 void | 124 void |
123 SpectrumWifiPhy::SetChannel (const Ptr<SpectrumChannel> channel) | 125 SpectrumWifiPhy::SetChannel (const Ptr<SpectrumChannel> channel) |
124 { | 126 { |
125 m_channel = channel; | 127 m_channel = channel; |
126 } | 128 } |
127 | 129 |
128 void | 130 void |
129 SpectrumWifiPhy::ResetSpectrumModel (void) | 131 SpectrumWifiPhy::ResetSpectrumModel (void) |
130 { | 132 { |
131 NS_LOG_FUNCTION (this); | 133 NS_LOG_FUNCTION (this); |
132 NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time"); | 134 NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time"); |
133 NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of
(" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")"); | 135 uint8_t channelWidth = GetChannelWidth (); |
| 136 NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of
(" << GetFrequency () << ", " << +channelWidth << ")"); |
134 // Replace existing spectrum model with new one, and must call AddRx () | 137 // Replace existing spectrum model with new one, and must call AddRx () |
135 // on the SpectrumChannel to provide this new spectrum model to it | 138 // on the SpectrumChannel to provide this new spectrum model to it |
136 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency ()
, GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ()); | 139 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency ()
, channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth)); |
137 m_channel->AddRx (m_wifiSpectrumPhyInterface); | 140 m_channel->AddRx (m_wifiSpectrumPhyInterface); |
138 } | 141 } |
139 | 142 |
140 void | 143 void |
141 SpectrumWifiPhy::SetChannelNumber (uint8_t nch) | 144 SpectrumWifiPhy::SetChannelNumber (uint8_t nch) |
142 { | 145 { |
143 NS_LOG_FUNCTION (this << (uint16_t) nch); | 146 NS_LOG_FUNCTION (this << +nch); |
144 WifiPhy::SetChannelNumber (nch); | 147 WifiPhy::SetChannelNumber (nch); |
145 if (IsInitialized ()) | 148 if (IsInitialized ()) |
146 { | 149 { |
147 ResetSpectrumModel (); | 150 ResetSpectrumModel (); |
148 } | 151 } |
149 } | 152 } |
150 | 153 |
151 void | 154 void |
152 SpectrumWifiPhy::SetFrequency (uint16_t freq) | 155 SpectrumWifiPhy::SetFrequency (uint16_t freq) |
153 { | 156 { |
154 NS_LOG_FUNCTION (this << freq); | 157 NS_LOG_FUNCTION (this << freq); |
155 WifiPhy::SetFrequency (freq); | 158 WifiPhy::SetFrequency (freq); |
156 if (IsInitialized ()) | 159 if (IsInitialized ()) |
157 { | 160 { |
158 ResetSpectrumModel (); | 161 ResetSpectrumModel (); |
159 } | 162 } |
160 } | 163 } |
161 | 164 |
162 void | 165 void |
163 SpectrumWifiPhy::SetChannelWidth (uint8_t channelwidth) | 166 SpectrumWifiPhy::SetChannelWidth (uint8_t channelwidth) |
164 { | 167 { |
165 NS_LOG_FUNCTION (this << (uint16_t) channelwidth); | 168 NS_LOG_FUNCTION (this << +channelwidth); |
166 WifiPhy::SetChannelWidth (channelwidth); | 169 WifiPhy::SetChannelWidth (channelwidth); |
167 if (IsInitialized ()) | 170 if (IsInitialized ()) |
168 { | 171 { |
169 ResetSpectrumModel (); | 172 ResetSpectrumModel (); |
170 } | 173 } |
171 } | 174 } |
172 | 175 |
173 void | 176 void |
174 SpectrumWifiPhy::ConfigureStandard (WifiPhyStandard standard) | 177 SpectrumWifiPhy::ConfigureStandard (WifiPhyStandard standard) |
175 { | 178 { |
176 NS_LOG_FUNCTION (this << standard); | 179 NS_LOG_FUNCTION (this << standard); |
177 WifiPhy::ConfigureStandard (standard); | 180 WifiPhy::ConfigureStandard (standard); |
178 if (IsInitialized ()) | 181 if (IsInitialized ()) |
179 { | 182 { |
180 ResetSpectrumModel (); | 183 ResetSpectrumModel (); |
181 } | 184 } |
182 } | 185 } |
183 | 186 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 NS_LOG_DEBUG ("Received signal with PSD " << *receivedSignalPsd << " and durat
ion " << rxDuration.As (Time::NS)); | 220 NS_LOG_DEBUG ("Received signal with PSD " << *receivedSignalPsd << " and durat
ion " << rxDuration.As (Time::NS)); |
218 uint32_t senderNodeId = 0; | 221 uint32_t senderNodeId = 0; |
219 if (rxParams->txPhy) | 222 if (rxParams->txPhy) |
220 { | 223 { |
221 senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId (); | 224 senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId (); |
222 } | 225 } |
223 NS_LOG_DEBUG ("Received signal from " << senderNodeId << " with unfiltered pow
er " << WToDbm (Integral (*receivedSignalPsd)) << " dBm"); | 226 NS_LOG_DEBUG ("Received signal from " << senderNodeId << " with unfiltered pow
er " << WToDbm (Integral (*receivedSignalPsd)) << " dBm"); |
224 // Integrate over our receive bandwidth (i.e., all that the receive | 227 // Integrate over our receive bandwidth (i.e., all that the receive |
225 // spectral mask representing our filtering allows) to find the | 228 // spectral mask representing our filtering allows) to find the |
226 // total energy apparent to the "demodulator". | 229 // total energy apparent to the "demodulator". |
227 Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFreque
ncy (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ()); | 230 uint8_t channelWidth = GetChannelWidth (); |
| 231 Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFreque
ncy (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth)); |
228 SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd); | 232 SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd); |
229 // Add receiver antenna gain | 233 // Add receiver antenna gain |
230 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << Integra
l (filteredSignal)); | 234 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << Integra
l (filteredSignal)); |
231 double rxPowerW = Integral (filteredSignal) * DbToRatio (GetRxGain ()); | 235 double rxPowerW = Integral (filteredSignal) * DbToRatio (GetRxGain ()); |
232 NS_LOG_DEBUG ("Signal power received after antenna gain: " << rxPowerW << " W
(" << WToDbm (rxPowerW) << " dBm)"); | 236 NS_LOG_DEBUG ("Signal power received after antenna gain: " << rxPowerW << " W
(" << WToDbm (rxPowerW) << " dBm)"); |
233 | 237 |
234 Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSigna
lParameters> (rxParams); | 238 Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSigna
lParameters> (rxParams); |
235 | 239 |
236 // Log the signal arrival to the trace source | 240 // Log the signal arrival to the trace source |
237 m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDu
ration); | 241 m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDu
ration); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 { | 283 { |
280 NS_LOG_FUNCTION (this << device); | 284 NS_LOG_FUNCTION (this << device); |
281 m_wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface> (); | 285 m_wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface> (); |
282 m_wifiSpectrumPhyInterface->SetSpectrumWifiPhy (this); | 286 m_wifiSpectrumPhyInterface->SetSpectrumWifiPhy (this); |
283 m_wifiSpectrumPhyInterface->SetDevice (device); | 287 m_wifiSpectrumPhyInterface->SetDevice (device); |
284 } | 288 } |
285 | 289 |
286 Ptr<SpectrumValue> | 290 Ptr<SpectrumValue> |
287 SpectrumWifiPhy::GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t ch
annelWidth, double txPowerW, WifiModulationClass modulationClass) const | 291 SpectrumWifiPhy::GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t ch
annelWidth, double txPowerW, WifiModulationClass modulationClass) const |
288 { | 292 { |
289 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW); | 293 NS_LOG_FUNCTION (centerFrequency << +channelWidth << txPowerW); |
290 Ptr<SpectrumValue> v; | 294 Ptr<SpectrumValue> v; |
291 switch (modulationClass) | 295 switch (modulationClass) |
292 { | 296 { |
293 case WIFI_MOD_CLASS_OFDM: | 297 case WIFI_MOD_CLASS_OFDM: |
294 case WIFI_MOD_CLASS_ERP_OFDM: | 298 case WIFI_MOD_CLASS_ERP_OFDM: |
295 v = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (centerFrequ
ency, channelWidth, txPowerW, GetGuardBandwidth ()); | 299 v = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (centerFrequ
ency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth)); |
296 break; | 300 break; |
297 case WIFI_MOD_CLASS_DSSS: | 301 case WIFI_MOD_CLASS_DSSS: |
298 case WIFI_MOD_CLASS_HR_DSSS: | 302 case WIFI_MOD_CLASS_HR_DSSS: |
299 v = WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity (centerFrequ
ency, txPowerW, GetGuardBandwidth ()); | 303 NS_ABORT_MSG_IF (channelWidth != 22, "Invalid channel width for DSSS"); |
| 304 v = WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity (centerFrequ
ency, txPowerW, GetGuardBandwidth (channelWidth)); |
300 break; | 305 break; |
301 case WIFI_MOD_CLASS_HT: | 306 case WIFI_MOD_CLASS_HT: |
302 case WIFI_MOD_CLASS_VHT: | 307 case WIFI_MOD_CLASS_VHT: |
303 v = WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (centerFre
quency, channelWidth, txPowerW, GetGuardBandwidth ()); | 308 v = WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (centerFre
quency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth)); |
304 break; | 309 break; |
305 case WIFI_MOD_CLASS_HE: | 310 case WIFI_MOD_CLASS_HE: |
306 v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFre
quency, channelWidth, txPowerW, GetGuardBandwidth ()); | 311 v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFre
quency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth)); |
307 break; | 312 break; |
308 default: | 313 default: |
309 NS_FATAL_ERROR ("modulation class unknown: " << modulationClass); | 314 NS_FATAL_ERROR ("modulation class unknown: " << modulationClass); |
310 break; | 315 break; |
311 } | 316 } |
312 return v; | 317 return v; |
313 } | 318 } |
314 | 319 |
| 320 uint32_t |
| 321 SpectrumWifiPhy::GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const |
| 322 { |
| 323 NS_LOG_FUNCTION (this << txVector); |
| 324 uint32_t centerFrequencyForSupportedWidth = GetFrequency (); |
| 325 uint8_t supportedWidth = GetChannelWidth (); |
| 326 uint8_t currentWidth = txVector.GetChannelWidth (); |
| 327 if (currentWidth != supportedWidth) |
| 328 { |
| 329 uint32_t startingFrequency = centerFrequencyForSupportedWidth - static_cas
t<uint32_t> (supportedWidth / 2); |
| 330 return startingFrequency + static_cast<uint32_t> (currentWidth / 2); // pr
imary channel is in the lower part (for the time being) |
| 331 } |
| 332 return centerFrequencyForSupportedWidth; |
| 333 } |
| 334 |
315 void | 335 void |
316 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura
tion) | 336 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura
tion) |
317 { | 337 { |
318 NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPo
werDbm (txVector.GetTxPowerLevel ()) << "dBm"); | 338 NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPo
werDbm (txVector.GetTxPowerLevel ()) << "dBm"); |
319 double txPowerWatts = DbmToW (GetPowerDbm (txVector.GetTxPowerLevel ()) + GetT
xGain ()); | 339 double txPowerWatts = DbmToW (GetPowerDbm (txVector.GetTxPowerLevel ()) + GetT
xGain ()); |
320 Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (GetFrequency (
), GetChannelWidth (), txPowerWatts, txVector.GetMode ().GetModulationClass ()); | 340 Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (GetCenterFrequ
encyForChannelWidth (txVector), txVector.GetChannelWidth (), txPowerWatts, txVec
tor.GetMode ().GetModulationClass ()); |
321 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParamete
rs> (); | 341 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParamete
rs> (); |
322 txParams->duration = txDuration; | 342 txParams->duration = txDuration; |
323 txParams->psd = txPowerSpectrum; | 343 txParams->psd = txPowerSpectrum; |
324 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe fo
rgot to call CreateWifiSpectrumPhyInterface?"); | 344 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe fo
rgot to call CreateWifiSpectrumPhyInterface?"); |
325 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> (); | 345 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> (); |
326 txParams->txAntenna = m_antenna; | 346 txParams->txAntenna = m_antenna; |
327 txParams->packet = packet; | 347 txParams->packet = packet; |
328 NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) <<
" dBm on channel " << (uint16_t) GetChannelNumber ()); | 348 NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) <<
" dBm on channel " << +GetChannelNumber ()); |
329 NS_LOG_DEBUG ("Starting transmission with integrated spectrum power " << WToDb
m (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectr
um->GetSpectrumModel ()->GetUid ()); | 349 NS_LOG_DEBUG ("Starting transmission with integrated spectrum power " << WToDb
m (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectr
um->GetSpectrumModel ()->GetUid ()); |
330 m_channel->StartTx (txParams); | 350 m_channel->StartTx (txParams); |
331 } | 351 } |
332 | 352 |
333 double | 353 double |
334 SpectrumWifiPhy::GetBandBandwidth (void) const | 354 SpectrumWifiPhy::GetBandBandwidth (void) const |
335 { | 355 { |
336 double bandBandwidth = 0; | 356 double bandBandwidth = 0; |
337 switch (GetStandard ()) | 357 switch (GetStandard ()) |
338 { | 358 { |
339 case WIFI_PHY_STANDARD_80211a: | 359 case WIFI_PHY_STANDARD_80211a: |
340 case WIFI_PHY_STANDARD_80211g: | 360 case WIFI_PHY_STANDARD_80211g: |
341 case WIFI_PHY_STANDARD_holland: | 361 case WIFI_PHY_STANDARD_holland: |
342 case WIFI_PHY_STANDARD_80211_10MHZ: | |
343 case WIFI_PHY_STANDARD_80211_5MHZ: | |
344 case WIFI_PHY_STANDARD_80211b: | 362 case WIFI_PHY_STANDARD_80211b: |
345 case WIFI_PHY_STANDARD_80211n_2_4GHZ: | 363 case WIFI_PHY_STANDARD_80211n_2_4GHZ: |
346 case WIFI_PHY_STANDARD_80211n_5GHZ: | 364 case WIFI_PHY_STANDARD_80211n_5GHZ: |
347 case WIFI_PHY_STANDARD_80211ac: | 365 case WIFI_PHY_STANDARD_80211ac: |
348 // Use OFDM subcarrier width of 312.5 KHz as band granularity | 366 // Use OFDM subcarrier width of 312.5 KHz as band granularity |
349 bandBandwidth = 312500; | 367 bandBandwidth = 312500; |
350 break; | 368 break; |
| 369 case WIFI_PHY_STANDARD_80211_10MHZ: |
| 370 // Use OFDM subcarrier width of 156.25 KHz as band granularity |
| 371 bandBandwidth = 156250; |
| 372 break; |
| 373 case WIFI_PHY_STANDARD_80211_5MHZ: |
| 374 // Use OFDM subcarrier width of 78.125 KHz as band granularity |
| 375 bandBandwidth = 78125; |
| 376 break; |
351 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: | 377 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: |
352 case WIFI_PHY_STANDARD_80211ax_5GHZ: | 378 case WIFI_PHY_STANDARD_80211ax_5GHZ: |
353 // Use OFDM subcarrier width of 78.125 KHz as band granularity | 379 // Use OFDM subcarrier width of 78.125 KHz as band granularity |
354 bandBandwidth = 78125; | 380 bandBandwidth = 78125; |
355 break; | 381 break; |
356 default: | 382 default: |
357 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); | 383 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); |
358 break; | 384 break; |
359 } | 385 } |
360 return bandBandwidth; | 386 return bandBandwidth; |
361 } | 387 } |
362 | 388 |
363 uint8_t | 389 uint8_t |
364 SpectrumWifiPhy::GetGuardBandwidth (void) const | 390 SpectrumWifiPhy::GetGuardBandwidth (uint8_t currentChannelWidth) const |
365 { | 391 { |
366 uint8_t guardBandwidth = 0; | 392 uint8_t maximumGuardBandwidth = 20; |
367 switch (GetStandard ()) | 393 switch (GetStandard ()) |
368 { | 394 { |
| 395 case WIFI_PHY_STANDARD_80211b: |
| 396 // Ideal transmit spectrum masks considered for DSSS, so statically take 1
0 MHz |
| 397 return 10; |
369 case WIFI_PHY_STANDARD_80211a: | 398 case WIFI_PHY_STANDARD_80211a: |
370 case WIFI_PHY_STANDARD_80211g: | 399 case WIFI_PHY_STANDARD_80211g: |
371 case WIFI_PHY_STANDARD_holland: | 400 case WIFI_PHY_STANDARD_holland: |
372 case WIFI_PHY_STANDARD_80211_10MHZ: | |
373 case WIFI_PHY_STANDARD_80211_5MHZ: | |
374 case WIFI_PHY_STANDARD_80211b: | |
375 case WIFI_PHY_STANDARD_80211n_2_4GHZ: | 401 case WIFI_PHY_STANDARD_80211n_2_4GHZ: |
376 case WIFI_PHY_STANDARD_80211n_5GHZ: | 402 case WIFI_PHY_STANDARD_80211n_5GHZ: |
377 case WIFI_PHY_STANDARD_80211ac: | 403 case WIFI_PHY_STANDARD_80211ac: |
378 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: | 404 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: |
379 case WIFI_PHY_STANDARD_80211ax_5GHZ: | 405 case WIFI_PHY_STANDARD_80211ax_5GHZ: |
380 // Provide enough guard band to model spectrum mask | 406 maximumGuardBandwidth = 20; |
381 guardBandwidth = GetChannelWidth (); | 407 break; |
| 408 case WIFI_PHY_STANDARD_80211_10MHZ: |
| 409 maximumGuardBandwidth = 10; |
| 410 break; |
| 411 case WIFI_PHY_STANDARD_80211_5MHZ: |
| 412 maximumGuardBandwidth = 5; |
382 break; | 413 break; |
383 default: | 414 default: |
384 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); | 415 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); |
385 break; | 416 break; |
386 } | 417 } |
387 return guardBandwidth; | 418 |
| 419 // In order to properly model out of band transmissions for OFDM, the guard |
| 420 // band has been configured so as to expand the modeled spectrum up to the |
| 421 // outermost referenced point in "Transmit spectrum mask" sections' PSDs of |
| 422 // each PHY specification of 802.11-2016 standard, when possible. It can thus
ultimately |
| 423 // correspond to the currently considered channel bandwidth (which can be diff
erent from |
| 424 // supported channel width) if this bandwidth is not above the standard specif
ic limitation. |
| 425 // This limitation has been added so as to constrain out of band transmission
modeling |
| 426 // to the immediately neighboring (non-overlapping) channels. |
| 427 return (currentChannelWidth <= maximumGuardBandwidth) ? currentChannelWidth :
maximumGuardBandwidth; |
388 } | 428 } |
389 | 429 |
390 } //namespace ns3 | 430 } //namespace ns3 |
LEFT | RIGHT |