View | Details | Raw Unified | Return to bug 2460
Collapse All | Expand All

(-)a/examples/energy/energy-model-example.cc (-1 / +1 lines)
 Lines 179-185    Link Here 
179
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
179
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
180
  wifiPhy.Set ("RxGain", DoubleValue (-10));
180
  wifiPhy.Set ("RxGain", DoubleValue (-10));
181
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
181
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
182
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
182
  wifiPhy.Set ("CcaEdThreshold", DoubleValue (0.0));
183
  /***************************************************************************/
183
  /***************************************************************************/
184
184
185
  /** wifi channel **/
185
  /** wifi channel **/
(-)a/examples/energy/energy-model-with-harvesting-example.cc (-1 / +1 lines)
 Lines 220-226    Link Here 
220
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
220
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
221
  wifiPhy.Set ("RxGain", DoubleValue (-10));
221
  wifiPhy.Set ("RxGain", DoubleValue (-10));
222
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
222
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
223
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
223
  wifiPhy.Set ("CcaEdThreshold", DoubleValue (0.0));
224
  /***************************************************************************/
224
  /***************************************************************************/
225
225
226
  /** wifi channel **/
226
  /** wifi channel **/
(-)a/examples/wireless/wifi-clear-channel-cmu.cc (-2 / +1 lines)
 Lines 208-215    Link Here 
208
208
209
          NS_LOG_DEBUG (modes[i]);
209
          NS_LOG_DEBUG (modes[i]);
210
          experiment = Experiment (modes[i]);
210
          experiment = Experiment (modes[i]);
211
          wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) );
211
          wifiPhy.Set ("CcaEdThreshold", DoubleValue (-110.0) );
212
          wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) );
213
          wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
212
          wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
214
          wifiPhy.Set ("TxPowerEnd", DoubleValue (15.0) );
213
          wifiPhy.Set ("TxPowerEnd", DoubleValue (15.0) );
215
          wifiPhy.Set ("RxGain", DoubleValue (0) );
214
          wifiPhy.Set ("RxGain", DoubleValue (0) );
(-)a/examples/wireless/wifi-simple-interference.cc (-2 / +1 lines)
 Lines 180-186    Link Here 
180
  YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
180
  YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
181
  // set it to zero; otherwise, gain will be added
181
  // set it to zero; otherwise, gain will be added
182
  wifiPhy.Set ("RxGain", DoubleValue (0) );
182
  wifiPhy.Set ("RxGain", DoubleValue (0) );
183
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
183
  wifiPhy.Set ("CcaEdThreshold", DoubleValue (0.0) );
184
184
185
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
185
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
186
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
186
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
 Lines 200-206    Link Here 
200
  NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
200
  NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
201
  // This will disable these sending devices from detecting a signal
201
  // This will disable these sending devices from detecting a signal
202
  // so that they do not backoff
202
  // so that they do not backoff
203
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
204
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) );
203
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) );
205
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
204
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
206
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) );
205
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) );
(-)a/examples/wireless/wifi-spectrum-per-example.cc (-3 lines)
 Lines 183-191    Link Here 
183
        }
183
        }
184
      else if (wifiType == "ns3::SpectrumWifiPhy")
184
      else if (wifiType == "ns3::SpectrumWifiPhy")
185
        {
185
        {
186
          //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
187
          Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
188
189
          Ptr<MultiModelSpectrumChannel> spectrumChannel
186
          Ptr<MultiModelSpectrumChannel> spectrumChannel
190
            = CreateObject<MultiModelSpectrumChannel> ();
187
            = CreateObject<MultiModelSpectrumChannel> ();
191
          Ptr<FriisPropagationLossModel> lossModel
188
          Ptr<FriisPropagationLossModel> lossModel
(-)a/examples/wireless/wifi-spectrum-per-interference.cc (-3 lines)
 Lines 212-220    Link Here 
212
        }
212
        }
213
      else if (wifiType == "ns3::SpectrumWifiPhy")
213
      else if (wifiType == "ns3::SpectrumWifiPhy")
214
        {
214
        {
215
          //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
216
          Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
217
218
          spectrumChannel
215
          spectrumChannel
219
            = CreateObject<MultiModelSpectrumChannel> ();
216
            = CreateObject<MultiModelSpectrumChannel> ();
220
          Ptr<FriisPropagationLossModel> lossModel
217
          Ptr<FriisPropagationLossModel> lossModel
(-)a/examples/wireless/wifi-spectrum-saturation-example.cc (-3 lines)
 Lines 178-186    Link Here 
178
        }
178
        }
179
      else if (wifiType == "ns3::SpectrumWifiPhy")
179
      else if (wifiType == "ns3::SpectrumWifiPhy")
180
        {
180
        {
181
          //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
182
          Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
183
184
          Ptr<MultiModelSpectrumChannel> spectrumChannel
181
          Ptr<MultiModelSpectrumChannel> spectrumChannel
185
            = CreateObject<MultiModelSpectrumChannel> ();
182
            = CreateObject<MultiModelSpectrumChannel> ();
186
          Ptr<FriisPropagationLossModel> lossModel
183
          Ptr<FriisPropagationLossModel> lossModel
(-)a/examples/wireless/wifi-tcp.cc (-2 / +1 lines)
 Lines 125-132    Link Here 
125
  wifiPhy.Set ("TxGain", DoubleValue (0));
125
  wifiPhy.Set ("TxGain", DoubleValue (0));
126
  wifiPhy.Set ("RxGain", DoubleValue (0));
126
  wifiPhy.Set ("RxGain", DoubleValue (0));
127
  wifiPhy.Set ("RxNoiseFigure", DoubleValue (10));
127
  wifiPhy.Set ("RxNoiseFigure", DoubleValue (10));
128
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-79));
128
  wifiPhy.Set ("CcaEdThreshold", DoubleValue (-79));
129
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-79 + 3));
130
  wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
129
  wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
131
  wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
130
  wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
132
                                      "DataMode", StringValue (phyRate),
131
                                      "DataMode", StringValue (phyRate),
(-)a/src/aodv/test/aodv-regression.cc (-2 / +1 lines)
 Lines 168-175    Link Here 
168
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
168
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
169
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
169
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
170
  wifiPhy.SetChannel (chan);
170
  wifiPhy.SetChannel (chan);
171
  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
171
172
  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
173
  // This test suite output was originally based on YansErrorRateModel
172
  // This test suite output was originally based on YansErrorRateModel
174
  wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
173
  wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
175
  WifiHelper wifi;
174
  WifiHelper wifi;
(-)a/src/mesh/test/dot11s/hwmp-proactive-regression.cc (-2 / +1 lines)
 Lines 113-120    Link Here 
113
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
113
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
114
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
114
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
115
  wifiPhy.SetChannel (chan);
115
  wifiPhy.SetChannel (chan);
116
  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
116
117
  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
118
  // 2. setup mesh
117
  // 2. setup mesh
119
  MeshHelper mesh = MeshHelper::Default ();
118
  MeshHelper mesh = MeshHelper::Default ();
120
  mesh.SetStackInstaller ("ns3::Dot11sStack", "Root", Mac48AddressValue (Mac48Address ("00:00:00:00:00:0d")));
119
  mesh.SetStackInstaller ("ns3::Dot11sStack", "Root", Mac48AddressValue (Mac48Address ("00:00:00:00:00:0d")));
(-)a/src/mesh/test/dot11s/hwmp-reactive-regression.cc (-2 lines)
 Lines 114-121    Link Here 
114
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
114
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
115
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
115
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
116
  wifiPhy.SetChannel (chan);
116
  wifiPhy.SetChannel (chan);
117
  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
118
  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
119
117
120
  // 2. setup mesh
118
  // 2. setup mesh
121
  MeshHelper mesh = MeshHelper::Default ();
119
  MeshHelper mesh = MeshHelper::Default ();
(-)a/src/mesh/test/dot11s/hwmp-simplest-regression.cc (-2 / +1 lines)
 Lines 122-129    Link Here 
122
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
122
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
123
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
123
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
124
  wifiPhy.SetChannel (chan);
124
  wifiPhy.SetChannel (chan);
125
  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
125
126
  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
127
  // 2. setup mesh
126
  // 2. setup mesh
128
  MeshHelper mesh = MeshHelper::Default ();
127
  MeshHelper mesh = MeshHelper::Default ();
129
  mesh.SetStackInstaller ("ns3::Dot11sStack");
128
  mesh.SetStackInstaller ("ns3::Dot11sStack");
(-)a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc (-2 / +1 lines)
 Lines 140-147    Link Here 
140
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
140
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
141
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
141
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
142
  wifiPhy.SetChannel (chan);
142
  wifiPhy.SetChannel (chan);
143
  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
143
144
  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
145
  // 2. setup mesh
144
  // 2. setup mesh
146
  MeshHelper mesh = MeshHelper::Default ();
145
  MeshHelper mesh = MeshHelper::Default ();
147
  mesh.SetStackInstaller ("ns3::Dot11sStack");
146
  mesh.SetStackInstaller ("ns3::Dot11sStack");
(-)a/src/mesh/test/flame/flame-regression.cc (-2 / +1 lines)
 Lines 99-106    Link Here 
99
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
99
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
100
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
100
  Ptr<YansWifiChannel> chan = wifiChannel.Create ();
101
  wifiPhy.SetChannel (chan);
101
  wifiPhy.SetChannel (chan);
102
  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
102
103
  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
104
  // 2. setup mesh
103
  // 2. setup mesh
105
  MeshHelper mesh = MeshHelper::Default ();
104
  MeshHelper mesh = MeshHelper::Default ();
106
  mesh.SetStackInstaller ("ns3::FlameStack");
105
  mesh.SetStackInstaller ("ns3::FlameStack");
(-)a/src/test/ns3wifi/wifi-interference-test-suite.cc (-2 / +1 lines)
 Lines 140-146    Link Here 
140
  // This is one parameter that matters when using FixedRssLossModel
140
  // This is one parameter that matters when using FixedRssLossModel
141
  // set it to zero; otherwise, gain will be added
141
  // set it to zero; otherwise, gain will be added
142
  wifiPhy.Set ("RxGain", DoubleValue (0) ); 
142
  wifiPhy.Set ("RxGain", DoubleValue (0) ); 
143
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
143
  wifiPhy.Set ("CcaEdThreshold", DoubleValue (0.0) );
144
144
145
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
145
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
146
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO); 
146
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO); 
 Lines 172-178    Link Here 
172
172
173
  // This will disable these sending devices from detecting a signal 
173
  // This will disable these sending devices from detecting a signal 
174
  // so that they do not backoff
174
  // so that they do not backoff
175
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
176
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) ); 
175
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) ); 
177
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
176
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
178
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) ); 
177
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) ); 
(-)a/src/wifi/examples/wifi-manager-example.cc (-2 / +1 lines)
 Lines 337-344    Link Here 
337
  wifi.SetStandard (serverSelectedStandard.m_standard);
337
  wifi.SetStandard (serverSelectedStandard.m_standard);
338
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
338
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
339
  wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0));
339
  wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0));
340
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0));
340
  wifiPhy.Set ("CcaEdThreshold", DoubleValue (-110.0));
341
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0));
342
341
343
  Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> ();
342
  Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> ();
344
  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
343
  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
(-)a/src/wifi/model/spectrum-wifi-phy.cc (-8 / +10 lines)
 Lines 243-255    Link Here 
243
  // Log the signal arrival to the trace source
243
  // Log the signal arrival to the trace source
244
  m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDuration);
244
  m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDuration);
245
245
246
  // Do no further processing if signal is too weak
247
  // Current implementation assumes constant rx power over the packet duration
248
  if (rxPowerW < GetRxSensitivity ())
249
    {
250
      NS_LOG_INFO ("Received signal too weak to process: " << WToDbm (rxPowerW) << " dBm");
251
      return;
252
    }
253
  if (wifiRxParams == 0)
246
  if (wifiRxParams == 0)
254
    {
247
    {
255
      NS_LOG_INFO ("Received non Wi-Fi signal");
248
      NS_LOG_INFO ("Received non Wi-Fi signal");
 Lines 265-272    Link Here 
265
      return;
258
      return;
266
    }
259
    }
267
260
261
  Ptr<Packet> packet = wifiRxParams->packet->Copy ();
262
  // Do no further processing if signal is too weak
263
  // Current implementation assumes constant rx power over the packet duration
264
  if (rxPowerW < GetRxSensitivity ())
265
    {
266
      NS_LOG_INFO ("Dropped packet because received signal is too weak to process: " << WToDbm (rxPowerW) << " dBm");
267
      NotifyRxDrop (packet);
268
      return;
269
    }
270
268
  NS_LOG_INFO ("Received Wi-Fi signal");
271
  NS_LOG_INFO ("Received Wi-Fi signal");
269
  Ptr<Packet> packet = wifiRxParams->packet->Copy ();
270
  StartReceivePreambleAndHeader (packet, rxPowerW, rxDuration);
272
  StartReceivePreambleAndHeader (packet, rxPowerW, rxDuration);
271
}
273
}
272
274
(-)a/src/wifi/model/wifi-phy.cc (-31 / +11 lines)
 Lines 178-190    Link Here 
178
                   MakeUintegerAccessor (&WifiPhy::SetChannelNumber,
178
                   MakeUintegerAccessor (&WifiPhy::SetChannelNumber,
179
                                         &WifiPhy::GetChannelNumber),
179
                                         &WifiPhy::GetChannelNumber),
180
                   MakeUintegerChecker<uint8_t> (0, 196))
180
                   MakeUintegerChecker<uint8_t> (0, 196))
181
    .AddAttribute ("EnergyDetectionThreshold",
182
                   "The energy of a received signal should be higher than "
183
                   "this threshold (dbm) to allow the PHY layer to detect the signal.",
184
                   DoubleValue (-96.0),
185
                   MakeDoubleAccessor (&WifiPhy::SetEdThreshold),
186
                   MakeDoubleChecker<double> (),
187
                   TypeId::DEPRECATED, "Replaced by RxSensitivity")
188
    .AddAttribute ("RxSensitivity",
181
    .AddAttribute ("RxSensitivity",
189
                   "The energy of a received signal should be higher than "
182
                   "The energy of a received signal should be higher than "
190
                   "this threshold (dBm) for the PHY to detect the signal.",
183
                   "this threshold (dBm) for the PHY to detect the signal.",
 Lines 192-203    Link Here 
192
                   MakeDoubleAccessor (&WifiPhy::SetRxSensitivity,
185
                   MakeDoubleAccessor (&WifiPhy::SetRxSensitivity,
193
                                       &WifiPhy::GetRxSensitivity),
186
                                       &WifiPhy::GetRxSensitivity),
194
                   MakeDoubleChecker<double> ())
187
                   MakeDoubleChecker<double> ())
195
    .AddAttribute ("CcaMode1Threshold",
188
    .AddAttribute ("CcaEdThreshold",
196
                   "The energy of a received signal should be higher than "
189
                   "The energy of a received signal should be higher than "
197
                   "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state.",
190
                   "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state.",
198
                   DoubleValue (-62.0),
191
                   DoubleValue (-62.0),
199
                   MakeDoubleAccessor (&WifiPhy::SetCcaMode1Threshold,
192
                   MakeDoubleAccessor (&WifiPhy::SetCcaEdThreshold,
200
                                       &WifiPhy::GetCcaMode1Threshold),
193
                                       &WifiPhy::GetCcaEdThreshold),
201
                   MakeDoubleChecker<double> ())
194
                   MakeDoubleChecker<double> ())
202
    .AddAttribute ("TxGain",
195
    .AddAttribute ("TxGain",
203
                   "Transmission gain (dB).",
196
                   "Transmission gain (dB).",
 Lines 471-489    Link Here 
471
}
464
}
472
465
473
void
466
void
474
WifiPhy::SetEdThreshold (double threshold)
475
{
476
  NS_LOG_FUNCTION (this << threshold);
477
  m_edThresholdW = DbmToW (threshold);
478
}
479
480
double
481
WifiPhy::GetEdThreshold (void) const
482
{
483
  return WToDbm (m_edThresholdW);
484
}
485
486
void
487
WifiPhy::SetRxSensitivity (double threshold)
467
WifiPhy::SetRxSensitivity (double threshold)
488
{
468
{
489
  NS_LOG_FUNCTION (this << threshold);
469
  NS_LOG_FUNCTION (this << threshold);
 Lines 497-512    Link Here 
497
}
477
}
498
478
499
void
479
void
500
WifiPhy::SetCcaMode1Threshold (double threshold)
480
WifiPhy::SetCcaEdThreshold (double threshold)
501
{
481
{
502
  NS_LOG_FUNCTION (this << threshold);
482
  NS_LOG_FUNCTION (this << threshold);
503
  m_ccaMode1ThresholdW = DbmToW (threshold);
483
  m_ccaEdThresholdW = DbmToW (threshold);
504
}
484
}
505
485
506
double
486
double
507
WifiPhy::GetCcaMode1Threshold (void) const
487
WifiPhy::GetCcaEdThreshold (void) const
508
{
488
{
509
  return WToDbm (m_ccaMode1ThresholdW);
489
  return WToDbm (m_ccaEdThresholdW);
510
}
490
}
511
491
512
void
492
void
 Lines 1648-1654    Link Here 
1648
    case WifiPhyState::SLEEP:
1628
    case WifiPhyState::SLEEP:
1649
      {
1629
      {
1650
        NS_LOG_DEBUG ("resuming from sleep mode");
1630
        NS_LOG_DEBUG ("resuming from sleep mode");
1651
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW);
1631
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW);
1652
        m_state->SwitchFromSleep (delayUntilCcaEnd);
1632
        m_state->SwitchFromSleep (delayUntilCcaEnd);
1653
        break;
1633
        break;
1654
      }
1634
      }
 Lines 1679-1685    Link Here 
1679
    case WifiPhyState::OFF:
1659
    case WifiPhyState::OFF:
1680
      {
1660
      {
1681
        NS_LOG_DEBUG ("resuming from off mode");
1661
        NS_LOG_DEBUG ("resuming from off mode");
1682
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
1662
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
1683
        m_state->SwitchFromOff (delayUntilCcaEnd);
1663
        m_state->SwitchFromOff (delayUntilCcaEnd);
1684
        break;
1664
        break;
1685
      }
1665
      }
 Lines 2547-2553    Link Here 
2547
  //In this model, CCA becomes busy when the aggregation of all signals as
2527
  //In this model, CCA becomes busy when the aggregation of all signals as
2548
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
2528
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
2549
2529
2550
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
2530
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
2551
  if (!delayUntilCcaEnd.IsZero ())
2531
  if (!delayUntilCcaEnd.IsZero ())
2552
    {
2532
    {
2553
      m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
2533
      m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
 Lines 3643-3649    Link Here 
3643
  //In this model, CCA becomes busy when the aggregation of all signals as
3623
  //In this model, CCA becomes busy when the aggregation of all signals as
3644
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
3624
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
3645
3625
3646
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
3626
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
3647
  if (!delayUntilCcaEnd.IsZero ())
3627
  if (!delayUntilCcaEnd.IsZero ())
3648
    {
3628
    {
3649
      NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
3629
      NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
(-)a/src/wifi/model/wifi-phy.h (-24 / +4 lines)
 Lines 1185-1209    Link Here 
1185
  virtual int64_t AssignStreams (int64_t stream);
1185
  virtual int64_t AssignStreams (int64_t stream);
1186
1186
1187
  /**
1187
  /**
1188
   * Sets the energy detection threshold (dBm).
1189
   * The energy of a received signal should be higher than
1190
   * this threshold (dbm) to allow the PHY layer to detect the signal.
1191
   *
1192
   * This parameter is being deprecated (renamed to RxSensitivity)
1193
   *
1194
   * \param threshold the energy detection threshold in dBm
1195
   */
1196
  void SetEdThreshold (double threshold);
1197
  /**
1198
   * Return the energy detection threshold (dBm).
1199
   *
1200
   * This parameter is being deprecated (renamed to RxSensitivity)
1201
   *
1202
   * \return the energy detection threshold in dBm
1203
   */
1204
  NS_DEPRECATED
1205
  double GetEdThreshold (void) const;
1206
  /**
1207
   * Sets the receive sensitivity threshold (dBm).
1188
   * Sets the receive sensitivity threshold (dBm).
1208
   * The energy of a received signal should be higher than
1189
   * The energy of a received signal should be higher than
1209
   * this threshold to allow the PHY layer to detect the signal.
1190
   * this threshold to allow the PHY layer to detect the signal.
 Lines 1224-1236    Link Here 
1224
   *
1205
   *
1225
   * \param threshold the CCA threshold in dBm
1206
   * \param threshold the CCA threshold in dBm
1226
   */
1207
   */
1227
  void SetCcaMode1Threshold (double threshold);
1208
  void SetCcaEdThreshold (double threshold);
1228
  /**
1209
  /**
1229
   * Return the CCA threshold (dBm).
1210
   * Return the CCA threshold (dBm).
1230
   *
1211
   *
1231
   * \return the CCA threshold in dBm
1212
   * \return the CCA threshold in dBm
1232
   */
1213
   */
1233
  double GetCcaMode1Threshold (void) const;
1214
  double GetCcaEdThreshold (void) const;
1234
  /**
1215
  /**
1235
   * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
1216
   * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
1236
   *
1217
   *
 Lines 1500-1506    Link Here 
1500
   * Check if Phy state should move to CCA busy state based on current
1481
   * Check if Phy state should move to CCA busy state based on current
1501
   * state of interference tracker.  In this model, CCA becomes busy when
1482
   * state of interference tracker.  In this model, CCA becomes busy when
1502
   * the aggregation of all signals as tracked by the InterferenceHelper
1483
   * the aggregation of all signals as tracked by the InterferenceHelper
1503
   * class is higher than the CcaMode1Threshold
1484
   * class is higher than the CcaEdThreshold
1504
   */
1485
   */
1505
  void SwitchMaybeToCcaBusy (void);
1486
  void SwitchMaybeToCcaBusy (void);
1506
1487
 Lines 1762-1770    Link Here 
1762
  bool m_frequencyChannelNumberInitialized; //!< Store initialization state
1743
  bool m_frequencyChannelNumberInitialized; //!< Store initialization state
1763
  uint16_t m_channelWidth;                  //!< Channel width
1744
  uint16_t m_channelWidth;                  //!< Channel width
1764
1745
1765
  double   m_edThresholdW;        //!< Energy detection threshold in watts
1766
  double   m_rxSensitivityW;      //!< Receive sensitivity threshold in watts
1746
  double   m_rxSensitivityW;      //!< Receive sensitivity threshold in watts
1767
  double   m_ccaMode1ThresholdW;  //!< Clear channel assessment (CCA) threshold in watts
1747
  double   m_ccaEdThresholdW;     //!< Clear channel assessment (CCA) threshold in watts
1768
  double   m_txGainDb;            //!< Transmission gain (dB)
1748
  double   m_txGainDb;            //!< Transmission gain (dB)
1769
  double   m_rxGainDb;            //!< Reception gain (dB)
1749
  double   m_rxGainDb;            //!< Reception gain (dB)
1770
  double   m_txPowerBaseDbm;      //!< Minimum transmission power (dBm)
1750
  double   m_txPowerBaseDbm;      //!< Minimum transmission power (dBm)
(-)a/src/wifi/model/yans-wifi-channel.cc (-1 / +2 lines)
 Lines 129-135    Link Here 
129
  // Current implementation assumes constant rx power over the packet duration
129
  // Current implementation assumes constant rx power over the packet duration
130
  if ((rxPowerDbm + phy->GetRxGain ()) < phy->GetRxSensitivity ())
130
  if ((rxPowerDbm + phy->GetRxGain ()) < phy->GetRxSensitivity ())
131
    {
131
    {
132
      NS_LOG_INFO ("Received signal too weak to process: " << rxPowerDbm << " dBm");
132
      NS_LOG_INFO ("Dropped packet because received signal is too weak to process: " << rxPowerDbm << " dBm");
133
      phy->NotifyRxDrop (packet);
133
      return;
134
      return;
134
    }
135
    }
135
  phy->StartReceivePreambleAndHeader (packet, DbmToW (rxPowerDbm + phy->GetRxGain ()), duration);
136
  phy->StartReceivePreambleAndHeader (packet, DbmToW (rxPowerDbm + phy->GetRxGain ()), duration);
(-)a/src/wifi/test/spectrum-wifi-phy-test.cc (-2 lines)
 Lines 167-174    Link Here 
167
  m_phy->SetFrequency (FREQUENCY);
167
  m_phy->SetFrequency (FREQUENCY);
168
  m_phy->SetReceiveOkCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess, this));
168
  m_phy->SetReceiveOkCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess, this));
169
  m_phy->SetReceiveErrorCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure, this));
169
  m_phy->SetReceiveErrorCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure, this));
170
  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
171
  m_phy->SetCcaMode1Threshold (-62.0);
172
}
170
}
173
171
174
// Test that the expected number of packet receptions occur.
172
// Test that the expected number of packet receptions occur.
(-)a/src/wifi/test/wifi-test.cc (-1 lines)
 Lines 1269-1275    Link Here 
1269
Bug2483TestCase::DoRun (void)
1269
Bug2483TestCase::DoRun (void)
1270
{
1270
{
1271
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("500")); // so as to force RTS/CTS for data frames
1271
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("500")); // so as to force RTS/CTS for data frames
1272
  Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
1273
1272
1274
  uint16_t channelWidth = 40; // at least 40 MHz expected here
1273
  uint16_t channelWidth = 40; // at least 40 MHz expected here
1275
1274

Return to bug 2460