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

(-)a/examples/energy/energy-model-example.cc (-9 / +1 lines)
 Lines 131-141   main (int argc, char *argv[]) Link Here 
131
  double interval = 1;          // seconds
131
  double interval = 1;          // seconds
132
  double startTime = 0.0;       // seconds
132
  double startTime = 0.0;       // seconds
133
  double distanceToRx = 100.0;  // meters
133
  double distanceToRx = 100.0;  // meters
134
  /*
135
   * This is a magic number used to set the transmit power, based on other
136
   * configuration.
137
   */
138
  double offset = 81;
139
134
140
  CommandLine cmd;
135
  CommandLine cmd;
141
  cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode);
136
  cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode);
 Lines 177-191   main (int argc, char *argv[]) Link Here 
177
  /** Wifi PHY **/
172
  /** Wifi PHY **/
178
  /***************************************************************************/
173
  /***************************************************************************/
179
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
174
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
180
  wifiPhy.Set ("RxGain", DoubleValue (-10));
181
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
182
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
183
  /***************************************************************************/
184
175
185
  /** wifi channel **/
176
  /** wifi channel **/
186
  YansWifiChannelHelper wifiChannel;
177
  YansWifiChannelHelper wifiChannel;
187
  wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
178
  wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
188
  wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
179
  wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
180
  
189
  // create wifi channel
181
  // create wifi channel
190
  Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
182
  Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
191
  wifiPhy.SetChannel (wifiChannelPtr);
183
  wifiPhy.SetChannel (wifiChannelPtr);
(-)a/examples/energy/energy-model-with-harvesting-example.cc (-9 / +1 lines)
 Lines 169-179   main (int argc, char *argv[]) Link Here 
169
  double interval = 1;          // seconds
169
  double interval = 1;          // seconds
170
  double startTime = 0.0;       // seconds
170
  double startTime = 0.0;       // seconds
171
  double distanceToRx = 100.0;  // meters
171
  double distanceToRx = 100.0;  // meters
172
  /*
173
   * This is a magic number used to set the transmit power, based on other
174
   * configuration.
175
   */
176
  double offset = 81;
177
  
172
  
178
  // Energy Harvester variables
173
  // Energy Harvester variables
179
  double harvestingUpdateInterval = 1;  // seconds
174
  double harvestingUpdateInterval = 1;  // seconds
 Lines 218-232   main (int argc, char *argv[]) Link Here 
218
  /** Wifi PHY **/
213
  /** Wifi PHY **/
219
  /***************************************************************************/
214
  /***************************************************************************/
220
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
215
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
221
  wifiPhy.Set ("RxGain", DoubleValue (-10));
222
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
223
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
224
  /***************************************************************************/
225
216
226
  /** wifi channel **/
217
  /** wifi channel **/
227
  YansWifiChannelHelper wifiChannel;
218
  YansWifiChannelHelper wifiChannel;
228
  wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
219
  wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
229
  wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
220
  wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
221
230
  // create wifi channel
222
  // create wifi channel
231
  Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
223
  Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
232
  wifiPhy.SetChannel (wifiChannelPtr);
224
  wifiPhy.SetChannel (wifiChannelPtr);
(-)a/examples/wireless/wifi-clear-channel-cmu.cc (-2 lines)
 Lines 208-215   int main (int argc, char *argv[]) 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) );
212
          wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) );
213
          wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
211
          wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
214
          wifiPhy.Set ("TxPowerEnd", DoubleValue (15.0) );
212
          wifiPhy.Set ("TxPowerEnd", DoubleValue (15.0) );
215
          wifiPhy.Set ("RxGain", DoubleValue (0) );
213
          wifiPhy.Set ("RxGain", DoubleValue (0) );
(-)a/examples/wireless/wifi-simple-interference.cc (-4 lines)
 Lines 178-186   int main (int argc, char *argv[]) Link Here 
178
  wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
178
  wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
179
179
180
  YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
180
  YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
181
  // set it to zero; otherwise, gain will be added
182
  wifiPhy.Set ("RxGain", DoubleValue (0) );
183
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
184
181
185
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
182
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
186
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
183
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
 Lines 200-206   int main (int argc, char *argv[]) Link Here 
200
  NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
197
  NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
201
  // This will disable these sending devices from detecting a signal
198
  // This will disable these sending devices from detecting a signal
202
  // so that they do not backoff
199
  // so that they do not backoff
203
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
204
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) );
200
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) );
205
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
201
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
206
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) );
202
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) );
(-)a/examples/wireless/wifi-spectrum-per-example.cc (-3 lines)
 Lines 183-191   int main (int argc, char *argv[]) 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   int main (int argc, char *argv[]) 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   int main (int argc, char *argv[]) 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 (-8 lines)
 Lines 119-132   main (int argc, char *argv[]) Link Here 
119
  /* Setup Physical Layer */
119
  /* Setup Physical Layer */
120
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
120
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
121
  wifiPhy.SetChannel (wifiChannel.Create ());
121
  wifiPhy.SetChannel (wifiChannel.Create ());
122
  wifiPhy.Set ("TxPowerStart", DoubleValue (10.0));
123
  wifiPhy.Set ("TxPowerEnd", DoubleValue (10.0));
124
  wifiPhy.Set ("TxPowerLevels", UintegerValue (1));
125
  wifiPhy.Set ("TxGain", DoubleValue (0));
126
  wifiPhy.Set ("RxGain", DoubleValue (0));
127
  wifiPhy.Set ("RxNoiseFigure", DoubleValue (10));
128
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-79));
129
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-79 + 3));
130
  wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
122
  wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
131
  wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
123
  wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
132
                                      "DataMode", StringValue (phyRate),
124
                                      "DataMode", StringValue (phyRate),
(-)a/src/aodv/test/aodv-regression.cc (-2 / +1 lines)
 Lines 168-175   ChainRegressionTest::CreateDevices () 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   HwmpProactiveRegressionTest::CreateDevices () 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   HwmpReactiveRegressionTest::CreateDevices () 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   HwmpSimplestRegressionTest::CreateDevices () 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   HwmpDoRfRegressionTest::CreateDevices () 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   FlameRegressionTest::CreateDevices () 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 (-5 lines)
 Lines 137-146   WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs Link Here 
137
  wifi.SetStandard (wifiStandard);
137
  wifi.SetStandard (wifiStandard);
138
138
139
  YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
139
  YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
140
  // This is one parameter that matters when using FixedRssLossModel
141
  // set it to zero; otherwise, gain will be added
142
  wifiPhy.Set ("RxGain", DoubleValue (0) ); 
143
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
144
140
145
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
141
  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
146
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO); 
142
  wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO); 
 Lines 172-178   WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs Link Here 
172
168
173
  // This will disable these sending devices from detecting a signal 
169
  // This will disable these sending devices from detecting a signal 
174
  // so that they do not backoff
170
  // so that they do not backoff
175
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
176
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) ); 
171
  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) ); 
177
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
172
  devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
178
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) ); 
173
  wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) ); 
(-)a/src/wifi/examples/wifi-manager-example.cc (-3 lines)
 Lines 336-344   int main (int argc, char *argv[]) Link Here 
336
  WifiHelper wifi;
336
  WifiHelper wifi;
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));
340
  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0));
341
  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0));
342
339
343
  Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> ();
340
  Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> ();
344
  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
341
  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
(-)a/src/wifi/model/spectrum-wifi-phy.cc (+8 lines)
 Lines 242-247   SpectrumWifiPhy::StartRx (Ptr<SpectrumSignalParameters> rxParams) Link Here 
242
242
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
246
  // Do no further processing if signal is too weak
247
  // Current implementation assumes constant rx power over the packet duration
248
  if (WToDbm (rxPowerW) < GetRxSensitivity ())
249
    {
250
      NS_LOG_INFO ("Received signal too weak to process: " << WToDbm (rxPowerW) << " dBm");
251
      return;
252
    }
245
  if (wifiRxParams == 0)
253
  if (wifiRxParams == 0)
246
    {
254
    {
247
      NS_LOG_INFO ("Received non Wi-Fi signal");
255
      NS_LOG_INFO ("Received non Wi-Fi signal");
(-)a/src/wifi/model/wifi-phy.cc (-80 / +71 lines)
 Lines 178-195   WifiPhy::GetTypeId (void) 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",
181
    .AddAttribute ("RxSensitivity",
182
                   "The energy of a received signal should be higher than "
182
                   "The energy of a received signal should be higher than "
183
                   "this threshold (dbm) to allow the PHY layer to detect the signal.",
183
                   "this threshold (dBm) for the PHY to detect the signal.",
184
                   DoubleValue (-96.0),
184
                   DoubleValue (-101.0),
185
                   MakeDoubleAccessor (&WifiPhy::SetEdThreshold),
185
                   MakeDoubleAccessor (&WifiPhy::SetRxSensitivity,
186
                                       &WifiPhy::GetRxSensitivity),
186
                   MakeDoubleChecker<double> ())
187
                   MakeDoubleChecker<double> ())
187
    .AddAttribute ("CcaMode1Threshold",
188
    .AddAttribute ("CcaEdThreshold",
188
                   "The energy of a received signal should be higher than "
189
                   "The energy of a received signal should be higher than "
189
                   "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.",
190
                   DoubleValue (-99.0),
191
                   DoubleValue (-62.0),
191
                   MakeDoubleAccessor (&WifiPhy::SetCcaMode1Threshold,
192
                   MakeDoubleAccessor (&WifiPhy::SetCcaEdThreshold,
192
                                       &WifiPhy::GetCcaMode1Threshold),
193
                                       &WifiPhy::GetCcaEdThreshold),
193
                   MakeDoubleChecker<double> ())
194
                   MakeDoubleChecker<double> ())
194
    .AddAttribute ("TxGain",
195
    .AddAttribute ("TxGain",
195
                   "Transmission gain (dB).",
196
                   "Transmission gain (dB).",
 Lines 463-491   WifiPhy::InitializeFrequencyChannelNumber (void) Link Here 
463
}
464
}
464
465
465
void
466
void
466
WifiPhy::SetEdThreshold (double threshold)
467
WifiPhy::SetRxSensitivity (double threshold)
467
{
468
{
468
  NS_LOG_FUNCTION (this << threshold);
469
  NS_LOG_FUNCTION (this << threshold);
469
  m_edThresholdW = DbmToW (threshold);
470
  m_rxSensitivityW = DbmToW (threshold);
470
}
471
}
471
472
472
double
473
double
473
WifiPhy::GetEdThreshold (void) const
474
WifiPhy::GetRxSensitivity (void) const
474
{
475
{
475
  return WToDbm (m_edThresholdW);
476
  return WToDbm (m_rxSensitivityW);
476
}
477
}
477
478
478
void
479
void
479
WifiPhy::SetCcaMode1Threshold (double threshold)
480
WifiPhy::SetCcaEdThreshold (double threshold)
480
{
481
{
481
  NS_LOG_FUNCTION (this << threshold);
482
  NS_LOG_FUNCTION (this << threshold);
482
  m_ccaMode1ThresholdW = DbmToW (threshold);
483
  m_ccaEdThresholdW = DbmToW (threshold);
483
}
484
}
484
485
485
double
486
double
486
WifiPhy::GetCcaMode1Threshold (void) const
487
WifiPhy::GetCcaEdThreshold (void) const
487
{
488
{
488
  return WToDbm (m_ccaMode1ThresholdW);
489
  return WToDbm (m_ccaEdThresholdW);
489
}
490
}
490
491
491
void
492
void
 Lines 1627-1633   WifiPhy::ResumeFromSleep (void) Link Here 
1627
    case WifiPhyState::SLEEP:
1628
    case WifiPhyState::SLEEP:
1628
      {
1629
      {
1629
        NS_LOG_DEBUG ("resuming from sleep mode");
1630
        NS_LOG_DEBUG ("resuming from sleep mode");
1630
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW);
1631
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW);
1631
        m_state->SwitchFromSleep (delayUntilCcaEnd);
1632
        m_state->SwitchFromSleep (delayUntilCcaEnd);
1632
        break;
1633
        break;
1633
      }
1634
      }
 Lines 1658-1664   WifiPhy::ResumeFromOff (void) Link Here 
1658
    case WifiPhyState::OFF:
1659
    case WifiPhyState::OFF:
1659
      {
1660
      {
1660
        NS_LOG_DEBUG ("resuming from off mode");
1661
        NS_LOG_DEBUG ("resuming from off mode");
1661
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
1662
        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
1662
        m_state->SwitchFromOff (delayUntilCcaEnd);
1663
        m_state->SwitchFromOff (delayUntilCcaEnd);
1663
        break;
1664
        break;
1664
      }
1665
      }
 Lines 2526-2532   WifiPhy::MaybeCcaBusyDuration () Link Here 
2526
  //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
2527
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
2528
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
2528
2529
2529
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
2530
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
2530
  if (!delayUntilCcaEnd.IsZero ())
2531
  if (!delayUntilCcaEnd.IsZero ())
2531
    {
2532
    {
2532
      m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
2533
      m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
 Lines 3622-3628   WifiPhy::SwitchMaybeToCcaBusy (void) Link Here 
3622
  //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
3623
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
3624
  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
3624
3625
3625
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
3626
  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
3626
  if (!delayUntilCcaEnd.IsZero ())
3627
  if (!delayUntilCcaEnd.IsZero ())
3627
    {
3628
    {
3628
      NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
3629
      NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
 Lines 3652-3727   void Link Here 
3652
WifiPhy::StartRx (Ptr<Packet> packet, WifiTxVector txVector, MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr<Event> event)
3653
WifiPhy::StartRx (Ptr<Packet> packet, WifiTxVector txVector, MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr<Event> event)
3653
{
3654
{
3654
  NS_LOG_FUNCTION (this << packet << txVector << +mpdutype << rxPowerW << rxDuration);
3655
  NS_LOG_FUNCTION (this << packet << txVector << +mpdutype << rxPowerW << rxDuration);
3655
  if (rxPowerW > m_edThresholdW) //checked here, no need to check in the payload reception (current implementation assumes constant rx power over the packet duration)
3656
3657
  AmpduTag ampduTag;
3658
  WifiPreamble preamble = txVector.GetPreambleType ();
3659
  if (preamble == WIFI_PREAMBLE_NONE && (m_mpdusNum == 0 || m_plcpSuccess == false))
3656
    {
3660
    {
3657
      AmpduTag ampduTag;
3661
      m_plcpSuccess = false;
3658
      WifiPreamble preamble = txVector.GetPreambleType ();
3662
      m_mpdusNum = 0;
3659
      if (preamble == WIFI_PREAMBLE_NONE && (m_mpdusNum == 0 || m_plcpSuccess == false))
3663
      NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received");
3660
        {
3664
      NotifyRxDrop (packet);
3661
          m_plcpSuccess = false;
3665
      MaybeCcaBusyDuration ();
3662
          m_mpdusNum = 0;
3666
      return;
3663
          NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received");
3667
    }
3664
          NotifyRxDrop (packet);
3668
  else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
3665
          MaybeCcaBusyDuration ();
3669
    {
3666
          return;
3670
      //received the first MPDU in an MPDU
3667
        }
3671
      m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
3668
      else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
3672
      m_rxMpduReferenceNumber++;
3669
        {
3673
    }
3670
          //received the first MPDU in an MPDU
3674
  else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
3671
          m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
3675
    {
3672
          m_rxMpduReferenceNumber++;
3676
      //received the other MPDUs that are part of the A-MPDU
3673
        }
3677
      if (ampduTag.GetRemainingNbOfMpdus () < (m_mpdusNum - 1))
3674
      else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
3675
        {
3676
          //received the other MPDUs that are part of the A-MPDU
3677
          if (ampduTag.GetRemainingNbOfMpdus () < (m_mpdusNum - 1))
3678
            {
3679
              NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetRemainingNbOfMpdus ());
3680
              m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
3681
            }
3682
          else
3683
            {
3684
              m_mpdusNum--;
3685
            }
3686
        }
3687
      else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
3688
        {
3678
        {
3689
          NS_LOG_DEBUG ("New A-MPDU started while " << m_mpdusNum << " MPDUs from previous are lost");
3679
          NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetRemainingNbOfMpdus ());
3690
          m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
3680
          m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
3691
        }
3681
        }
3692
      else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
3682
      else
3693
        {
3683
        {
3694
          NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
3684
          m_mpdusNum--;
3695
          m_mpdusNum = 0;
3696
        }
3685
        }
3686
    }
3687
  else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
3688
    {
3689
      NS_LOG_DEBUG ("New A-MPDU started while " << m_mpdusNum << " MPDUs from previous are lost");
3690
      m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
3691
    }
3692
  else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
3693
    {
3694
      NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
3695
      m_mpdusNum = 0;
3696
    }
3697
3697
3698
      NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
3698
  NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
3699
      m_currentEvent = event;
3699
  m_currentEvent = event;
3700
      m_state->SwitchToRx (rxDuration);
3700
  m_state->SwitchToRx (rxDuration);
3701
      NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
3701
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
3702
      NotifyRxBegin (packet);
3702
  NotifyRxBegin (packet);
3703
      m_interference.NotifyRxStart ();
3703
  m_interference.NotifyRxStart ();
3704
3705
      if (preamble != WIFI_PREAMBLE_NONE)
3706
        {
3707
          NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
3708
          Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector);
3709
          m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &WifiPhy::StartReceivePacket, this,
3710
                                                  packet, txVector, mpdutype, event);
3711
        }
3712
3704
3713
      NS_ASSERT (m_endRxEvent.IsExpired ());
3705
  if (preamble != WIFI_PREAMBLE_NONE)
3714
      m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this,
3715
                                          packet, preamble, mpdutype, event);
3716
    }
3717
  else
3718
    {
3706
    {
3719
      NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
3707
      NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
3720
                    rxPowerW << "<" << m_edThresholdW << ")");
3708
      Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector);
3721
      NotifyRxDrop (packet);
3709
      m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &WifiPhy::StartReceivePacket, this,
3722
      m_plcpSuccess = false;
3710
                                              packet, txVector, mpdutype, event);
3723
      MaybeCcaBusyDuration ();
3724
    }
3711
    }
3712
3713
  NS_ASSERT (m_endRxEvent.IsExpired ());
3714
  m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this,
3715
                                      packet, preamble, mpdutype, event);
3725
}
3716
}
3726
3717
3727
int64_t
3718
int64_t
(-)a/src/wifi/model/wifi-phy.h (-12 / +13 lines)
 Lines 23-28    Link Here 
23
#define WIFI_PHY_H
23
#define WIFI_PHY_H
24
24
25
#include "ns3/event-id.h"
25
#include "ns3/event-id.h"
26
#include "ns3/deprecated.h"
26
#include "wifi-mpdu-type.h"
27
#include "wifi-mpdu-type.h"
27
#include "wifi-phy-standard.h"
28
#include "wifi-phy-standard.h"
28
#include "interference-helper.h"
29
#include "interference-helper.h"
 Lines 1184-1202   public: Link Here 
1184
  virtual int64_t AssignStreams (int64_t stream);
1185
  virtual int64_t AssignStreams (int64_t stream);
1185
1186
1186
  /**
1187
  /**
1187
   * Sets the energy detection threshold (dBm).
1188
   * Sets the receive sensitivity threshold (dBm).
1188
   * The energy of a received signal should be higher than
1189
   * The energy of a received signal should be higher than
1189
   * this threshold (dbm) to allow the PHY layer to detect the signal.
1190
   * this threshold to allow the PHY layer to detect the signal.
1190
   *
1191
   *
1191
   * \param threshold the energy detection threshold in dBm
1192
   * \param threshold the receive sensitivity threshold in dBm
1192
   */
1193
   */
1193
  void SetEdThreshold (double threshold);
1194
  void SetRxSensitivity (double threshold);
1194
  /**
1195
  /**
1195
   * Return the energy detection threshold (dBm).
1196
   * Return the receive sensitivity threshold (dBm).
1196
   *
1197
   *
1197
   * \return the energy detection threshold in dBm
1198
   * \return the receive sensitivity threshold in dBm
1198
   */
1199
   */
1199
  double GetEdThreshold (void) const;
1200
  double GetRxSensitivity (void) const;
1200
  /**
1201
  /**
1201
   * Sets the CCA threshold (dBm). The energy of a received signal
1202
   * Sets the CCA threshold (dBm). The energy of a received signal
1202
   * should be higher than this threshold to allow the PHY
1203
   * should be higher than this threshold to allow the PHY
 Lines 1204-1216   public: Link Here 
1204
   *
1205
   *
1205
   * \param threshold the CCA threshold in dBm
1206
   * \param threshold the CCA threshold in dBm
1206
   */
1207
   */
1207
  void SetCcaMode1Threshold (double threshold);
1208
  void SetCcaEdThreshold (double threshold);
1208
  /**
1209
  /**
1209
   * Return the CCA threshold (dBm).
1210
   * Return the CCA threshold (dBm).
1210
   *
1211
   *
1211
   * \return the CCA threshold in dBm
1212
   * \return the CCA threshold in dBm
1212
   */
1213
   */
1213
  double GetCcaMode1Threshold (void) const;
1214
  double GetCcaEdThreshold (void) const;
1214
  /**
1215
  /**
1215
   * 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.
1216
   *
1217
   *
 Lines 1480-1486   protected: Link Here 
1480
   * 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
1481
   * state of interference tracker.  In this model, CCA becomes busy when
1482
   * state of interference tracker.  In this model, CCA becomes busy when
1482
   * the aggregation of all signals as tracked by the InterferenceHelper
1483
   * the aggregation of all signals as tracked by the InterferenceHelper
1483
   * class is higher than the CcaMode1Threshold
1484
   * class is higher than the CcaEdThreshold
1484
   */
1485
   */
1485
  void SwitchMaybeToCcaBusy (void);
1486
  void SwitchMaybeToCcaBusy (void);
1486
1487
 Lines 1742-1749   private: Link Here 
1742
  bool m_frequencyChannelNumberInitialized; //!< Store initialization state
1743
  bool m_frequencyChannelNumberInitialized; //!< Store initialization state
1743
  uint16_t m_channelWidth;                  //!< Channel width
1744
  uint16_t m_channelWidth;                  //!< Channel width
1744
1745
1745
  double   m_edThresholdW;        //!< Energy detection threshold in watts
1746
  double   m_rxSensitivityW;      //!< Receive sensitivity threshold in watts
1746
  double   m_ccaMode1ThresholdW;  //!< Clear channel assessment (CCA) threshold in watts
1747
  double   m_ccaEdThresholdW;     //!< Clear channel assessment (CCA) threshold in watts
1747
  double   m_txGainDb;            //!< Transmission gain (dB)
1748
  double   m_txGainDb;            //!< Transmission gain (dB)
1748
  double   m_rxGainDb;            //!< Reception gain (dB)
1749
  double   m_rxGainDb;            //!< Reception gain (dB)
1749
  double   m_txPowerBaseDbm;      //!< Minimum transmission power (dBm)
1750
  double   m_txPowerBaseDbm;      //!< Minimum transmission power (dBm)
(-)a/src/wifi/model/yans-wifi-channel.cc (+7 lines)
 Lines 125-130   void Link Here 
125
YansWifiChannel::Receive (Ptr<YansWifiPhy> phy, Ptr<Packet> packet, double rxPowerDbm, Time duration)
125
YansWifiChannel::Receive (Ptr<YansWifiPhy> phy, Ptr<Packet> packet, double rxPowerDbm, Time duration)
126
{
126
{
127
  NS_LOG_FUNCTION (phy << packet << rxPowerDbm << duration.GetSeconds ());
127
  NS_LOG_FUNCTION (phy << packet << rxPowerDbm << duration.GetSeconds ());
128
  // Do no further processing if signal is too weak
129
  // Current implementation assumes constant rx power over the packet duration
130
  if ((rxPowerDbm + phy->GetRxGain ()) < phy->GetRxSensitivity ())
131
    {
132
      NS_LOG_INFO ("Received signal too weak to process: " << rxPowerDbm << " dBm");
133
      return;
134
    }
128
  phy->StartReceivePreambleAndHeader (packet, DbmToW (rxPowerDbm + phy->GetRxGain ()), duration);
135
  phy->StartReceivePreambleAndHeader (packet, DbmToW (rxPowerDbm + phy->GetRxGain ()), duration);
129
}
136
}
130
137
(-)a/src/wifi/test/spectrum-wifi-phy-test.cc (-2 lines)
 Lines 167-174   SpectrumWifiPhyBasicTest::DoSetup (void) 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   void 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