OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 case WIFI_MOD_CLASS_HE: | 307 case WIFI_MOD_CLASS_HE: |
308 v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFre
quency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth)); | 308 v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFre
quency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth)); |
309 break; | 309 break; |
310 default: | 310 default: |
311 NS_FATAL_ERROR ("modulation class unknown: " << modulationClass); | 311 NS_FATAL_ERROR ("modulation class unknown: " << modulationClass); |
312 break; | 312 break; |
313 } | 313 } |
314 return v; | 314 return v; |
315 } | 315 } |
316 | 316 |
317 uint32_t | 317 uint16_t |
318 SpectrumWifiPhy::GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const | 318 SpectrumWifiPhy::GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const |
319 { | 319 { |
320 NS_LOG_FUNCTION (this << txVector); | 320 NS_LOG_FUNCTION (this << txVector); |
321 uint32_t centerFrequencyForSupportedWidth = GetFrequency (); | 321 uint16_t centerFrequencyForSupportedWidth = GetFrequency (); |
322 uint16_t supportedWidth = GetChannelWidth (); | 322 uint16_t supportedWidth = GetChannelWidth (); |
323 uint16_t currentWidth = txVector.GetChannelWidth (); | 323 uint16_t currentWidth = txVector.GetChannelWidth (); |
324 if (currentWidth != supportedWidth) | 324 if (currentWidth != supportedWidth) |
325 { | 325 { |
326 uint32_t startingFrequency = centerFrequencyForSupportedWidth - static_cas
t<uint32_t> (supportedWidth / 2); | 326 uint16_t startingFrequency = centerFrequencyForSupportedWidth - (supported
Width / 2); |
327 return startingFrequency + static_cast<uint32_t> (currentWidth / 2); // pr
imary channel is in the lower part (for the time being) | 327 return startingFrequency + (currentWidth / 2); // primary channel is in th
e lower part (for the time being) |
328 } | 328 } |
329 return centerFrequencyForSupportedWidth; | 329 return centerFrequencyForSupportedWidth; |
330 } | 330 } |
331 | 331 |
332 void | 332 void |
333 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura
tion) | 333 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura
tion) |
334 { | 334 { |
335 NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPo
werDbm (txVector.GetTxPowerLevel ()) << "dBm"); | 335 NS_LOG_DEBUG ("Start transmission: signal power before antenna gain=" << GetPo
werDbm (txVector.GetTxPowerLevel ()) << "dBm"); |
336 double txPowerWatts = DbmToW (GetPowerDbm (txVector.GetTxPowerLevel ()) + GetT
xGain ()); | 336 double txPowerWatts = DbmToW (GetPowerDbm (txVector.GetTxPowerLevel ()) + GetT
xGain ()); |
337 Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (GetCenterFrequ
encyForChannelWidth (txVector), txVector.GetChannelWidth (), txPowerWatts, txVec
tor.GetMode ().GetModulationClass ()); | 337 Ptr<SpectrumValue> txPowerSpectrum = GetTxPowerSpectralDensity (static_cast<ui
nt16_t> (GetCenterFrequencyForChannelWidth (txVector)), txVector.GetChannelWidth
(), txPowerWatts, txVector.GetMode ().GetModulationClass ()); |
338 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParamete
rs> (); | 338 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParamete
rs> (); |
339 txParams->duration = txDuration; | 339 txParams->duration = txDuration; |
340 txParams->psd = txPowerSpectrum; | 340 txParams->psd = txPowerSpectrum; |
341 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe fo
rgot to call CreateWifiSpectrumPhyInterface?"); | 341 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe fo
rgot to call CreateWifiSpectrumPhyInterface?"); |
342 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> (); | 342 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> (); |
343 txParams->txAntenna = m_antenna; | 343 txParams->txAntenna = m_antenna; |
344 txParams->packet = packet; | 344 txParams->packet = packet; |
345 NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) <<
" dBm on channel " << +GetChannelNumber ()); | 345 NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) <<
" dBm on channel " << +GetChannelNumber ()); |
346 NS_LOG_DEBUG ("Starting transmission with integrated spectrum power " << WToDb
m (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectr
um->GetSpectrumModel ()->GetUid ()); | 346 NS_LOG_DEBUG ("Starting transmission with integrated spectrum power " << WToDb
m (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectr
um->GetSpectrumModel ()->GetUid ()); |
347 m_channel->StartTx (txParams); | 347 m_channel->StartTx (txParams); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 //outermost referenced point in "Transmit spectrum mask" sections' PSDs of | 399 //outermost referenced point in "Transmit spectrum mask" sections' PSDs of |
400 //each PHY specification of 802.11-2016 standard. It thus ultimately corre
sponds | 400 //each PHY specification of 802.11-2016 standard. It thus ultimately corre
sponds |
401 //to the currently considered channel bandwidth (which can be different fr
om | 401 //to the currently considered channel bandwidth (which can be different fr
om |
402 //supported channel width). | 402 //supported channel width). |
403 guardBandwidth = currentChannelWidth; | 403 guardBandwidth = currentChannelWidth; |
404 } | 404 } |
405 return guardBandwidth; | 405 return guardBandwidth; |
406 } | 406 } |
407 | 407 |
408 } //namespace ns3 | 408 } //namespace ns3 |
OLD | NEW |