Left: | ||
Right: |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 else | 100 else |
101 { | 101 { |
102 if (GetFrequency () == 0) | 102 if (GetFrequency () == 0) |
103 { | 103 { |
104 NS_LOG_DEBUG ("Frequency is not set; returning 0"); | 104 NS_LOG_DEBUG ("Frequency is not set; returning 0"); |
105 return 0; | 105 return 0; |
106 } | 106 } |
107 else | 107 else |
108 { | 108 { |
109 NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")"); | 109 NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")"); |
110 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFreq uency (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ()); | 110 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFreq uency (), GetChannelWidth (), GetBandBandwidth (), static_cast<uint8_t>(GetGuard Bandwidth ())); |
111 } | 111 } |
112 } | 112 } |
113 return m_rxSpectrumModel; | 113 return m_rxSpectrumModel; |
114 } | 114 } |
115 | 115 |
116 Ptr<Channel> | 116 Ptr<Channel> |
117 SpectrumWifiPhy::GetChannel (void) const | 117 SpectrumWifiPhy::GetChannel (void) const |
118 { | 118 { |
119 return m_channel; | 119 return m_channel; |
120 } | 120 } |
121 | 121 |
122 void | 122 void |
123 SpectrumWifiPhy::SetChannel (const Ptr<SpectrumChannel> channel) | 123 SpectrumWifiPhy::SetChannel (const Ptr<SpectrumChannel> channel) |
124 { | 124 { |
125 m_channel = channel; | 125 m_channel = channel; |
126 } | 126 } |
127 | 127 |
128 void | 128 void |
129 SpectrumWifiPhy::ResetSpectrumModel (void) | 129 SpectrumWifiPhy::ResetSpectrumModel (void) |
130 { | 130 { |
131 NS_LOG_FUNCTION (this); | 131 NS_LOG_FUNCTION (this); |
132 NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time"); | 132 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 () << ")"); | 133 NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")"); |
134 // Replace existing spectrum model with new one, and must call AddRx () | 134 // Replace existing spectrum model with new one, and must call AddRx () |
135 // on the SpectrumChannel to provide this new spectrum model to it | 135 // on the SpectrumChannel to provide this new spectrum model to it |
136 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency () , GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ()); | 136 m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency () , GetChannelWidth (), GetBandBandwidth (), static_cast<uint8_t>(GetGuardBandwidt h ())); |
137 m_channel->AddRx (m_wifiSpectrumPhyInterface); | 137 m_channel->AddRx (m_wifiSpectrumPhyInterface); |
138 } | 138 } |
139 | 139 |
140 void | 140 void |
141 SpectrumWifiPhy::SetChannelNumber (uint8_t nch) | 141 SpectrumWifiPhy::SetChannelNumber (uint8_t nch) |
142 { | 142 { |
143 NS_LOG_FUNCTION (this << (uint16_t) nch); | 143 NS_LOG_FUNCTION (this << (uint16_t) nch); |
144 WifiPhy::SetChannelNumber (nch); | 144 WifiPhy::SetChannelNumber (nch); |
145 if (IsInitialized ()) | 145 if (IsInitialized ()) |
146 { | 146 { |
(...skipping 70 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)); | 217 NS_LOG_DEBUG ("Received signal with PSD " << *receivedSignalPsd << " and durat ion " << rxDuration.As (Time::NS)); |
218 uint32_t senderNodeId = 0; | 218 uint32_t senderNodeId = 0; |
219 if (rxParams->txPhy) | 219 if (rxParams->txPhy) |
220 { | 220 { |
221 senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId (); | 221 senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId (); |
222 } | 222 } |
223 NS_LOG_DEBUG ("Received signal from " << senderNodeId << " with unfiltered pow er " << WToDbm (Integral (*receivedSignalPsd)) << " dBm"); | 223 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 | 224 // Integrate over our receive bandwidth (i.e., all that the receive |
225 // spectral mask representing our filtering allows) to find the | 225 // spectral mask representing our filtering allows) to find the |
226 // total energy apparent to the "demodulator". | 226 // total energy apparent to the "demodulator". |
227 Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFreque ncy (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ()); | 227 Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFreque ncy (), GetChannelWidth (), GetBandBandwidth (), static_cast<uint8_t>(GetGuardBa ndwidth ())); |
228 SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd); | 228 SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd); |
229 // Add receiver antenna gain | 229 // Add receiver antenna gain |
230 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << Integra l (filteredSignal)); | 230 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << Integra l (filteredSignal)); |
231 double rxPowerW = Integral (filteredSignal) * DbToRatio (GetRxGain ()); | 231 double rxPowerW = Integral (filteredSignal) * DbToRatio (GetRxGain ()); |
232 NS_LOG_DEBUG ("Signal power received after antenna gain: " << rxPowerW << " W (" << WToDbm (rxPowerW) << " dBm)"); | 232 NS_LOG_DEBUG ("Signal power received after antenna gain: " << rxPowerW << " W (" << WToDbm (rxPowerW) << " dBm)"); |
233 | 233 |
234 Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSigna lParameters> (rxParams); | 234 Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSigna lParameters> (rxParams); |
235 | 235 |
236 // Log the signal arrival to the trace source | 236 // Log the signal arrival to the trace source |
237 m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDu ration); | 237 m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDu ration); |
(...skipping 47 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, static_cast<uint8_t>(GetGuardBandwidth ())); |
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, static_cast<uint8_t>(GetGuardBandwidth ())); |
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, static_cast<uint8_t>(GetGuardBandwidth ())); |
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, static_cast<uint8_t>(GetGuardBandwidth ())); |
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 void | 315 void |
316 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura tion) | 316 SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura tion) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 case WIFI_PHY_STANDARD_80211ac: | 377 case WIFI_PHY_STANDARD_80211ac: |
378 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: | 378 case WIFI_PHY_STANDARD_80211ax_2_4GHZ: |
379 case WIFI_PHY_STANDARD_80211ax_5GHZ: | 379 case WIFI_PHY_STANDARD_80211ax_5GHZ: |
380 // Use 10 MHZ | 380 // Use 10 MHZ |
381 guardBandwidth = 10; | 381 guardBandwidth = 10; |
382 break; | 382 break; |
383 default: | 383 default: |
384 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); | 384 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ()); |
385 break; | 385 break; |
386 } | 386 } |
387 return guardBandwidth; | 387 return static_cast<uint32_t>(guardBandwidth); |
S. Deronne
2017/12/17 15:39:15
32 or 8 bits for guardBandwidth?
ammo6818-vandals.uidaho.edu
2017/12/20 04:16:34
guardBandwidth changed to uint32_t from double
S. Deronne
2017/12/22 22:28:21
?
| |
388 } | 388 } |
389 | 389 |
390 } //namespace ns3 | 390 } //namespace ns3 |
OLD | NEW |