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) 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 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 | 285 |
286 Ptr<SpectrumValue> | 286 Ptr<SpectrumValue> |
287 SpectrumWifiPhy::GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t ch annelWidth, double txPowerW, WifiModulationClass modulationClass) const | 287 SpectrumWifiPhy::GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t ch annelWidth, double txPowerW, WifiModulationClass modulationClass) const |
288 { | 288 { |
289 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW); | 289 NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW); |
290 Ptr<SpectrumValue> v; | 290 Ptr<SpectrumValue> v; |
291 switch (modulationClass) | 291 switch (modulationClass) |
292 { | 292 { |
293 case WIFI_MOD_CLASS_OFDM: | 293 case WIFI_MOD_CLASS_OFDM: |
294 case WIFI_MOD_CLASS_ERP_OFDM: | 294 case WIFI_MOD_CLASS_ERP_OFDM: |
295 v = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (centerFrequ ency, channelWidth, txPowerW, GetGuardBandwidth ()); | 295 v = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (centerFrequ ency, channelWidth, txPowerW, channelWidth); |
S. Deronne
2018/02/24 09:57:29
why channelWidth is provided 2 times? Passing the
Rediet
2018/02/26 16:22:34
Acknowledged. Changed logic.
| |
296 break; | 296 break; |
297 case WIFI_MOD_CLASS_DSSS: | 297 case WIFI_MOD_CLASS_DSSS: |
298 case WIFI_MOD_CLASS_HR_DSSS: | 298 case WIFI_MOD_CLASS_HR_DSSS: |
299 v = WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity (centerFrequ ency, txPowerW, GetGuardBandwidth ()); | 299 v = WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity (centerFrequ ency, txPowerW, channelWidth); |
300 break; | 300 break; |
301 case WIFI_MOD_CLASS_HT: | 301 case WIFI_MOD_CLASS_HT: |
302 case WIFI_MOD_CLASS_VHT: | 302 case WIFI_MOD_CLASS_VHT: |
303 v = WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (centerFre quency, channelWidth, txPowerW, GetGuardBandwidth ()); | 303 v = WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity (centerFre quency, channelWidth, txPowerW, channelWidth); |
S. Deronne
2018/02/24 09:57:29
same comment
Rediet
2018/02/26 16:22:34
Acknowledged.
| |
304 break; | 304 break; |
305 case WIFI_MOD_CLASS_HE: | 305 case WIFI_MOD_CLASS_HE: |
306 v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFre quency, channelWidth, txPowerW, GetGuardBandwidth ()); | 306 v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFre quency, channelWidth, txPowerW, channelWidth); |
S. Deronne
2018/02/24 09:57:29
same comment
Rediet
2018/02/26 16:22:34
Acknowledged.
| |
307 break; | 307 break; |
308 default: | 308 default: |
309 NS_FATAL_ERROR ("modulation class unknown: " << modulationClass); | 309 NS_FATAL_ERROR ("modulation class unknown: " << modulationClass); |
310 break; | 310 break; |
311 } | 311 } |
312 return v; | 312 return v; |
313 } | 313 } |
314 | 314 |
315 uint32_t | |
316 SpectrumWifiPhy::GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const | |
317 { | |
318 NS_LOG_FUNCTION (txVector); | |
S. Deronne
2018/02/24 09:57:29
this << txVector
Rediet
2018/02/26 16:22:34
Acknowledged.
| |
319 uint32_t centerFrequencyForSupportedWidth = GetFrequency (); | |
320 uint32_t supportedWidth = static_cast<uint32_t> (GetChannelWidth ()); | |
S. Deronne
2018/02/24 09:57:29
why uint32_t? Width should be limited to uint8_t
Rediet
2018/02/26 16:22:34
Acknowledged.
| |
321 uint32_t currentWidth = static_cast<uint32_t> (txVector.GetChannelWidth ()); | |
322 if (currentWidth != supportedWidth) | |
323 { | |
324 uint32_t startingFrequency = centerFrequencyForSupportedWidth - (supported Width / 2); | |
325 return startingFrequency + (currentWidth / 2); // primary channel is in th e lower part (for the time being) | |
326 } | |
327 return centerFrequencyForSupportedWidth; | |
S. Deronne
2018/02/24 09:57:29
I am even thinking this should be pushed appart fr
Rediet
2018/02/26 16:22:34
Already done in bug 2843
| |
328 } | |
329 | |
315 void | 330 void |
316 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura tion) | 331 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura tion) |
317 { | 332 { |
318 NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPo werDbm (txVector.GetTxPowerLevel ()) << "dBm"); | 333 NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPo werDbm (txVector.GetTxPowerLevel ()) << "dBm"); |
319 double txPowerWatts = DbmToW (GetPowerDbm (txVector.GetTxPowerLevel ()) + GetT xGain ()); | 334 double txPowerWatts = DbmToW (GetPowerDbm (txVector.GetTxPowerLevel ()) + GetT xGain ()); |
320 Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (GetFrequency ( ), GetChannelWidth (), txPowerWatts, txVector.GetMode ().GetModulationClass ()); | 335 Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (GetCenterFrequ encyForChannelWidth (txVector), txVector.GetChannelWidth (), txPowerWatts, txVec tor.GetMode ().GetModulationClass ()); |
S. Deronne
2018/02/24 09:57:28
same comment here
Rediet
2018/02/26 16:22:35
Acknowledged.
| |
321 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParamete rs> (); | 336 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParamete rs> (); |
322 txParams->duration = txDuration; | 337 txParams->duration = txDuration; |
323 txParams->psd = txPowerSpectrum; | 338 txParams->psd = txPowerSpectrum; |
324 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe fo rgot to call CreateWifiSpectrumPhyInterface?"); | 339 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe fo rgot to call CreateWifiSpectrumPhyInterface?"); |
325 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> (); | 340 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> (); |
326 txParams->txAntenna = m_antenna; | 341 txParams->txAntenna = m_antenna; |
327 txParams->packet = packet; | 342 txParams->packet = packet; |
328 NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) << " dBm on channel " << (uint16_t) GetChannelNumber ()); | 343 NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) << " dBm on channel " << (uint16_t) GetChannelNumber ()); |
329 NS_LOG_DEBUG ("Starting transmission with integrated spectrum power " << WToDb m (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectr um->GetSpectrumModel ()->GetUid ()); | 344 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); | 345 m_channel->StartTx (txParams); |
(...skipping 22 matching lines...) Expand all Loading... | |
353 // Use OFDM subcarrier width of 78.125 KHz as band granularity | 368 // Use OFDM subcarrier width of 78.125 KHz as band granularity |
354 bandBandwidth = 78125; | 369 bandBandwidth = 78125; |
355 break; | 370 break; |
356 default: | 371 default: |
357 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); | 372 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); |
358 break; | 373 break; |
359 } | 374 } |
360 return bandBandwidth; | 375 return bandBandwidth; |
361 } | 376 } |
362 | 377 |
363 uint32_t | 378 uint8_t |
S. Deronne
2018/02/24 09:57:29
currently double in ns-3-dev...
Rediet
2018/02/26 16:22:35
Already replied above. Also note that because of p
| |
364 SpectrumWifiPhy::GetGuardBandwidth (void) const | 379 SpectrumWifiPhy::GetGuardBandwidth (void) const |
365 { | 380 { |
366 double guardBandwidth = 0; | 381 uint8_t guardBandwidth = 0; |
367 switch (GetStandard ()) | 382 switch (GetStandard ()) |
368 { | 383 { |
369 case WIFI_PHY_STANDARD_80211a: | 384 case WIFI_PHY_STANDARD_80211a: |
370 case WIFI_PHY_STANDARD_80211g: | 385 case WIFI_PHY_STANDARD_80211g: |
371 case WIFI_PHY_STANDARD_holland: | 386 case WIFI_PHY_STANDARD_holland: |
372 case WIFI_PHY_STANDARD_80211_10MHZ: | 387 case WIFI_PHY_STANDARD_80211_10MHZ: |
373 case WIFI_PHY_STANDARD_80211_5MHZ: | 388 case WIFI_PHY_STANDARD_80211_5MHZ: |
374 case WIFI_PHY_STANDARD_80211b: | 389 case WIFI_PHY_STANDARD_80211b: |
375 case WIFI_PHY_STANDARD_80211n_2_4GHZ: | 390 case WIFI_PHY_STANDARD_80211n_2_4GHZ: |
376 case WIFI_PHY_STANDARD_80211n_5GHZ: | 391 case WIFI_PHY_STANDARD_80211n_5GHZ: |
377 case WIFI_PHY_STANDARD_80211ac: | 392 case WIFI_PHY_STANDARD_80211ac: |
378 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: | 393 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: |
379 case WIFI_PHY_STANDARD_80211ax_5GHZ: | 394 case WIFI_PHY_STANDARD_80211ax_5GHZ: |
380 // Provide enough guard band to model spectrum mask | 395 // Provide enough guard band to model spectrum mask |
381 guardBandwidth = uint32_t (GetChannelWidth ()); | 396 guardBandwidth = GetChannelWidth (); |
S. Deronne
2017/10/24 19:26:16
why this? In case the channel width is for example
Rediet
2017/10/30 15:07:57
I wanted to follow the spectrum mask as defined by
|
S. Deronne
2018/02/24 09:57:29
why?
Rediet
2018/02/26 16:22:34
Explained in the code (newly added patchset 7).
|
382 break; | 397 break; |
383 default: | 398 default: |
384 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); | 399 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); |
385 break; | 400 break; |
386 } | 401 } |
387 return guardBandwidth; | 402 return guardBandwidth; |
388 } | 403 } |
389 | 404 |
390 } //namespace ns3 | 405 } //namespace ns3 |
LEFT | RIGHT |