wifi: Refactor detection thresholds in WifiPhy
authorSébastien Deronne <sebastien.deronne@gmail.com>
Mon, 26 Nov 2018 20:01:12 +0100
changeset 13866 cace17aa07da
parent 13865 89015e966829
child 13867 2fc553937aaf
wifi: Refactor detection thresholds in WifiPhy
CHANGES.html
examples/energy/energy-model-example.cc
examples/energy/energy-model-with-harvesting-example.cc
examples/wireless/wifi-clear-channel-cmu.cc
examples/wireless/wifi-simple-interference.cc
examples/wireless/wifi-spectrum-per-example.cc
examples/wireless/wifi-spectrum-per-interference.cc
examples/wireless/wifi-spectrum-saturation-example.cc
examples/wireless/wifi-tcp.cc
src/aodv/test/aodv-chain-regression-test-0-0.pcap
src/aodv/test/aodv-chain-regression-test-1-0.pcap
src/aodv/test/aodv-regression.cc
src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap
src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap
src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap
src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap
src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap
src/mesh/test/dot11s/hwmp-proactive-regression.cc
src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap
src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap
src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap
src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap
src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap
src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap
src/mesh/test/dot11s/hwmp-reactive-regression.cc
src/mesh/test/dot11s/hwmp-simplest-regression.cc
src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap
src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap
src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap
src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap
src/mesh/test/dot11s/hwmp-target-flags-regression.cc
src/mesh/test/flame/flame-regression-test-0-1.pcap
src/mesh/test/flame/flame-regression-test-1-1.pcap
src/mesh/test/flame/flame-regression-test-2-1.pcap
src/mesh/test/flame/flame-regression.cc
src/test/ns3wifi/wifi-interference-test-suite.cc
src/wifi/doc/source/wifi-design.rst
src/wifi/examples/wifi-manager-example.cc
src/wifi/model/spectrum-wifi-phy.cc
src/wifi/model/wifi-phy-state-helper.cc
src/wifi/model/wifi-phy.cc
src/wifi/model/wifi-phy.h
src/wifi/model/yans-wifi-channel.cc
src/wifi/test/spectrum-wifi-phy-test.cc
src/wifi/test/wifi-phy-thresholds-test.cc
src/wifi/test/wifi-test.cc
src/wifi/wscript
--- a/CHANGES.html	Sat Nov 24 15:05:20 2018 -0800
+++ b/CHANGES.html	Mon Nov 26 20:01:12 2018 +0100
@@ -70,6 +70,10 @@
     RandomRectanglePositionAllocator, RandomDiscPositionAllocator,
     UniformDiscPositionAllocator.
   </li>
+  <li>
+    The WifiPhy attribute "CcaMode1Threshold" has been renamed to "CcaEdThreshold", 
+    and the WifiPhy attribute "EnergyDetectionThreshold" has been replaced by a new attribute called "RxSensitivity"
+  </li>
 </ul>
 <h2>Changes to build system:</h2>
 <ul>
--- a/examples/energy/energy-model-example.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/energy/energy-model-example.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -131,11 +131,6 @@
   double interval = 1;          // seconds
   double startTime = 0.0;       // seconds
   double distanceToRx = 100.0;  // meters
-  /*
-   * This is a magic number used to set the transmit power, based on other
-   * configuration.
-   */
-  double offset = 81;
 
   CommandLine cmd;
   cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode);
@@ -177,15 +172,12 @@
   /** Wifi PHY **/
   /***************************************************************************/
   YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
-  wifiPhy.Set ("RxGain", DoubleValue (-10));
-  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
-  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
-  /***************************************************************************/
 
   /** wifi channel **/
   YansWifiChannelHelper wifiChannel;
   wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
   wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
+  
   // create wifi channel
   Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
   wifiPhy.SetChannel (wifiChannelPtr);
--- a/examples/energy/energy-model-with-harvesting-example.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/energy/energy-model-with-harvesting-example.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -169,11 +169,6 @@
   double interval = 1;          // seconds
   double startTime = 0.0;       // seconds
   double distanceToRx = 100.0;  // meters
-  /*
-   * This is a magic number used to set the transmit power, based on other
-   * configuration.
-   */
-  double offset = 81;
   
   // Energy Harvester variables
   double harvestingUpdateInterval = 1;  // seconds
@@ -218,15 +213,12 @@
   /** Wifi PHY **/
   /***************************************************************************/
   YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
-  wifiPhy.Set ("RxGain", DoubleValue (-10));
-  wifiPhy.Set ("TxGain", DoubleValue (offset + Prss));
-  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0));
-  /***************************************************************************/
 
   /** wifi channel **/
   YansWifiChannelHelper wifiChannel;
   wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
   wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
+
   // create wifi channel
   Ptr<YansWifiChannel> wifiChannelPtr = wifiChannel.Create ();
   wifiPhy.SetChannel (wifiChannelPtr);
--- a/examples/wireless/wifi-clear-channel-cmu.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/wireless/wifi-clear-channel-cmu.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -208,8 +208,6 @@
 
           NS_LOG_DEBUG (modes[i]);
           experiment = Experiment (modes[i]);
-          wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) );
-          wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) );
           wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
           wifiPhy.Set ("TxPowerEnd", DoubleValue (15.0) );
           wifiPhy.Set ("RxGain", DoubleValue (0) );
--- a/examples/wireless/wifi-simple-interference.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/wireless/wifi-simple-interference.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -178,9 +178,6 @@
   wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
 
   YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
-  // set it to zero; otherwise, gain will be added
-  wifiPhy.Set ("RxGain", DoubleValue (0) );
-  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
 
   // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
   wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
@@ -200,7 +197,6 @@
   NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
   // This will disable these sending devices from detecting a signal
   // so that they do not backoff
-  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
   wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) );
   devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
   wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) );
--- a/examples/wireless/wifi-spectrum-per-example.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/wireless/wifi-spectrum-per-example.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -183,9 +183,6 @@
         }
       else if (wifiType == "ns3::SpectrumWifiPhy")
         {
-          //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
-          Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
-
           Ptr<MultiModelSpectrumChannel> spectrumChannel
             = CreateObject<MultiModelSpectrumChannel> ();
           Ptr<FriisPropagationLossModel> lossModel
--- a/examples/wireless/wifi-spectrum-per-interference.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/wireless/wifi-spectrum-per-interference.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -212,9 +212,6 @@
         }
       else if (wifiType == "ns3::SpectrumWifiPhy")
         {
-          //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
-          Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
-
           spectrumChannel
             = CreateObject<MultiModelSpectrumChannel> ();
           Ptr<FriisPropagationLossModel> lossModel
--- a/examples/wireless/wifi-spectrum-saturation-example.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/wireless/wifi-spectrum-saturation-example.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -178,9 +178,6 @@
         }
       else if (wifiType == "ns3::SpectrumWifiPhy")
         {
-          //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
-          Config::SetDefault ("ns3::WifiPhy::CcaMode1Threshold", DoubleValue (-62.0));
-
           Ptr<MultiModelSpectrumChannel> spectrumChannel
             = CreateObject<MultiModelSpectrumChannel> ();
           Ptr<FriisPropagationLossModel> lossModel
--- a/examples/wireless/wifi-tcp.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/examples/wireless/wifi-tcp.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -119,14 +119,6 @@
   /* Setup Physical Layer */
   YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
   wifiPhy.SetChannel (wifiChannel.Create ());
-  wifiPhy.Set ("TxPowerStart", DoubleValue (10.0));
-  wifiPhy.Set ("TxPowerEnd", DoubleValue (10.0));
-  wifiPhy.Set ("TxPowerLevels", UintegerValue (1));
-  wifiPhy.Set ("TxGain", DoubleValue (0));
-  wifiPhy.Set ("RxGain", DoubleValue (0));
-  wifiPhy.Set ("RxNoiseFigure", DoubleValue (10));
-  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-79));
-  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-79 + 3));
   wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
   wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                       "DataMode", StringValue (phyRate),
Binary file src/aodv/test/aodv-chain-regression-test-0-0.pcap has changed
Binary file src/aodv/test/aodv-chain-regression-test-1-0.pcap has changed
--- a/src/aodv/test/aodv-regression.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/aodv/test/aodv-regression.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -168,8 +168,7 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   Ptr<YansWifiChannel> chan = wifiChannel.Create ();
   wifiPhy.SetChannel (chan);
-  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
-  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
+
   // This test suite output was originally based on YansErrorRateModel
   wifiPhy.SetErrorRateModel ("ns3::YansErrorRateModel");
   WifiHelper wifi;
Binary file src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap has changed
--- a/src/mesh/test/dot11s/hwmp-proactive-regression.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/mesh/test/dot11s/hwmp-proactive-regression.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -113,8 +113,7 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   Ptr<YansWifiChannel> chan = wifiChannel.Create ();
   wifiPhy.SetChannel (chan);
-  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
-  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
+
   // 2. setup mesh
   MeshHelper mesh = MeshHelper::Default ();
   mesh.SetStackInstaller ("ns3::Dot11sStack", "Root", Mac48AddressValue (Mac48Address ("00:00:00:00:00:0d")));
Binary file src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap has changed
--- a/src/mesh/test/dot11s/hwmp-reactive-regression.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/mesh/test/dot11s/hwmp-reactive-regression.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -114,8 +114,6 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   Ptr<YansWifiChannel> chan = wifiChannel.Create ();
   wifiPhy.SetChannel (chan);
-  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
-  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
 
   // 2. setup mesh
   MeshHelper mesh = MeshHelper::Default ();
--- a/src/mesh/test/dot11s/hwmp-simplest-regression.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/mesh/test/dot11s/hwmp-simplest-regression.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -122,8 +122,7 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   Ptr<YansWifiChannel> chan = wifiChannel.Create ();
   wifiPhy.SetChannel (chan);
-  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
-  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
+
   // 2. setup mesh
   MeshHelper mesh = MeshHelper::Default ();
   mesh.SetStackInstaller ("ns3::Dot11sStack");
Binary file src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap has changed
Binary file src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap has changed
--- a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -140,8 +140,7 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   Ptr<YansWifiChannel> chan = wifiChannel.Create ();
   wifiPhy.SetChannel (chan);
-  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
-  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
+
   // 2. setup mesh
   MeshHelper mesh = MeshHelper::Default ();
   mesh.SetStackInstaller ("ns3::Dot11sStack");
Binary file src/mesh/test/flame/flame-regression-test-0-1.pcap has changed
Binary file src/mesh/test/flame/flame-regression-test-1-1.pcap has changed
Binary file src/mesh/test/flame/flame-regression-test-2-1.pcap has changed
--- a/src/mesh/test/flame/flame-regression.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/mesh/test/flame/flame-regression.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -99,8 +99,7 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   Ptr<YansWifiChannel> chan = wifiChannel.Create ();
   wifiPhy.SetChannel (chan);
-  wifiPhy.Set ("TxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
-  wifiPhy.Set ("RxGain", DoubleValue (1.0)); //this configuration should go away in future revision to the test
+
   // 2. setup mesh
   MeshHelper mesh = MeshHelper::Default ();
   mesh.SetStackInstaller ("ns3::FlameStack");
--- a/src/test/ns3wifi/wifi-interference-test-suite.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/test/ns3wifi/wifi-interference-test-suite.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -137,10 +137,6 @@
   wifi.SetStandard (wifiStandard);
 
   YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
-  // This is one parameter that matters when using FixedRssLossModel
-  // set it to zero; otherwise, gain will be added
-  wifiPhy.Set ("RxGain", DoubleValue (0) ); 
-  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
 
   // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
   wifiPhy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO); 
@@ -172,7 +168,6 @@
 
   // This will disable these sending devices from detecting a signal 
   // so that they do not backoff
-  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
   wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) ); 
   devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
   wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) ); 
--- a/src/wifi/doc/source/wifi-design.rst	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/doc/source/wifi-design.rst	Mon Nov 26 20:01:12 2018 +0100
@@ -284,8 +284,7 @@
 #. SLEEP: the PHY is in a power save mode and cannot send nor receive frames.
 
 Packet reception works as follows.  The ``YansWifiPhy`` attribute 
-CcaMode1Threshold 
-corresponds to what the standard calls the "ED threshold" for CCA Mode 1.  
+CcaEdThreshold corresponds to what the standard calls the "ED threshold" for CCA Mode 1.
 In section 16.4.8.5:  "CCA Mode 1: Energy above threshold. CCA shall report 
 a busy medium upon detection of any energy above the ED threshold."  
 
@@ -295,23 +294,17 @@
 signals in the YansWifi model-- everything is a Wi-Fi signal.
 
 In the standard, there is also what is called the "minimum modulation
-and coding rate sensitivity" in section 18.3.10.6 CCA requirements. This is 
-the -82 dBm requirement for 20 MHz channels.  This is analogous to the 
-EnergyDetectionThreshold attribute in ``YansWifiPhy``.  CCA busy state is 
-not raised in this model when this threshold is exceeded but instead RX 
-state is immediately reached, since it is assumed that PLCP sync always 
-succeeds in this model.  Even if the PLCP header reception fails, the 
+and coding rate sensitivity" in section 18.3.10.6 CCA requirements. 
+This is analogous to the RxSensitivity attribute in ``YansWifiPhy``.
+CCA busy state is not raised in this model when this threshold is exceeded
+but instead RX state is immediately reached, since it is assumed that PLCP
+sync always succeeds in this model. Even if the PLCP header reception fails, the 
 channel state is still held in RX until YansWifiPhy::EndReceive().
 
-In ns-3, the values of these attributes are set to small default values 
-(-96 dBm for EnergyDetectionThreshold and -99 dBm for CcaMode1Threshold).  
-So, if a signal comes in at > -96 dBm and the state is IDLE or CCA BUSY, 
-this model will lock onto it for the signal duration and raise RX state.  
-If it comes in at <= -96 dBm but >= -99 dBm, it will definitely raise 
-CCA BUSY but not RX state.  If it comes in < -99 dBm, it gets added to 
-the interference tracker and, by itself, it will not raise CCA BUSY, but 
-maybe a later signal will contribute more power so that the threshold 
-of -99 dBm is reached at a later time.
+In ns-3, the values of these attributes are -101 dBm for RxSensitivity
+and -62 dBm for CcaEdThreshold.  
+So, if a signal comes in at > -101 dBm and the state is IDLE or CCA BUSY, 
+this model will lock onto it for the signal duration and raise RX state.
 
 The energy of the signal intended to be received is 
 calculated from the transmission power and adjusted based on the Tx gain
@@ -443,12 +436,9 @@
 unintended Wi-Fi signals (perhaps from a different SSID or arriving
 late from a hidden node) are added to the noise.
 
-Third, the default value for CcaMode1Threshold attribute is -62 dBm
-rather than the value of -99 dBm used for YansWifiPhy.  This is because,
-unlike YansWifiPhy, where there are no foreign signals, CCA BUSY state
-will be raised for foreign signals that are higher than this 'energy
-detection' threshold (see section 16.4.8.5 in the 802.11-2012 standard
-for definition of CCA Mode 1).  
+Unlike YansWifiPhy, where there are no foreign signals, CCA BUSY state
+will be raised for foreign signals that are higher than CcaEdThreshold
+(see section 16.4.8.5 in the 802.11-2012 standard for definition of CCA Mode 1).  
 
 To support the Spectrum channel, the ``YansWifiPhy`` transmit and receive methods
 were adapted to use the Spectrum channel API.  This required developing
--- a/src/wifi/examples/wifi-manager-example.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/examples/wifi-manager-example.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -336,9 +336,6 @@
   WifiHelper wifi;
   wifi.SetStandard (serverSelectedStandard.m_standard);
   YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
-  wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0));
-  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0));
-  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0));
 
   Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> ();
   Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
--- a/src/wifi/model/spectrum-wifi-phy.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/model/spectrum-wifi-phy.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -242,6 +242,14 @@
 
   // Log the signal arrival to the trace source
   m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (rxPowerW), rxDuration);
+
+  // Do no further processing if signal is too weak
+  // Current implementation assumes constant rx power over the packet duration
+  if (WToDbm (rxPowerW) < GetRxSensitivity ())
+    {
+      NS_LOG_INFO ("Received signal too weak to process: " << WToDbm (rxPowerW) << " dBm");
+      return;
+    }
   if (wifiRxParams == 0)
     {
       NS_LOG_INFO ("Received non Wi-Fi signal");
--- a/src/wifi/model/wifi-phy-state-helper.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/model/wifi-phy-state-helper.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -517,6 +517,7 @@
     {
       m_startCcaBusy = now;
     }
+  m_stateLogger (now, duration, WifiPhyState::CCA_BUSY);
   m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
 }
 
--- a/src/wifi/model/wifi-phy.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/model/wifi-phy.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -182,15 +182,24 @@
     .AddAttribute ("EnergyDetectionThreshold",
                    "The energy of a received signal should be higher than "
                    "this threshold (dbm) to allow the PHY layer to detect the signal.",
-                   DoubleValue (-96.0),
+                   DoubleValue (-101.0),
                    MakeDoubleAccessor (&WifiPhy::SetEdThreshold),
-                   MakeDoubleChecker<double> ())
-    .AddAttribute ("CcaMode1Threshold",
+                   MakeDoubleChecker<double> (),
+                   TypeId::DEPRECATED, "Replaced by RxSensitivity, this attribute has no effect.")
+    .AddAttribute ("RxSensitivity",
                    "The energy of a received signal should be higher than "
-                   "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state.",
-                   DoubleValue (-99.0),
-                   MakeDoubleAccessor (&WifiPhy::SetCcaMode1Threshold,
-                                       &WifiPhy::GetCcaMode1Threshold),
+                   "this threshold (dBm) for the PHY to detect the signal.",
+                   DoubleValue (-101.0),
+                   MakeDoubleAccessor (&WifiPhy::SetRxSensitivity,
+                                       &WifiPhy::GetRxSensitivity),
+                   MakeDoubleChecker<double> ())
+    .AddAttribute ("CcaEdThreshold",
+                   "The energy of a non Wi-Fi received signal should be higher than "
+                   "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state. "
+                   "This check is performed on the 20 MHz primary channel only.",
+                   DoubleValue (-62.0),
+                   MakeDoubleAccessor (&WifiPhy::SetCcaEdThreshold,
+                                       &WifiPhy::GetCcaEdThreshold),
                    MakeDoubleChecker<double> ())
     .AddAttribute ("TxGain",
                    "Transmission gain (dB).",
@@ -414,6 +423,12 @@
   InitializeFrequencyChannelNumber ();
 }
 
+Ptr<WifiPhyStateHelper>
+WifiPhy::GetState (void) const
+{
+  return m_state;
+}
+
 void
 WifiPhy::SetReceiveOkCallback (RxOkCallback callback)
 {
@@ -475,27 +490,33 @@
 void
 WifiPhy::SetEdThreshold (double threshold)
 {
-  NS_LOG_FUNCTION (this << threshold);
-  m_edThresholdW = DbmToW (threshold);
-}
-
-double
-WifiPhy::GetEdThreshold (void) const
-{
-  return WToDbm (m_edThresholdW);
+  SetRxSensitivity (threshold);
 }
 
 void
-WifiPhy::SetCcaMode1Threshold (double threshold)
+WifiPhy::SetRxSensitivity (double threshold)
 {
   NS_LOG_FUNCTION (this << threshold);
-  m_ccaMode1ThresholdW = DbmToW (threshold);
+  m_rxSensitivityW = DbmToW (threshold);
 }
 
 double
-WifiPhy::GetCcaMode1Threshold (void) const
+WifiPhy::GetRxSensitivity (void) const
+{
+  return WToDbm (m_rxSensitivityW);
+}
+
+void
+WifiPhy::SetCcaEdThreshold (double threshold)
 {
-  return WToDbm (m_ccaMode1ThresholdW);
+  NS_LOG_FUNCTION (this << threshold);
+  m_ccaEdThresholdW = DbmToW (threshold);
+}
+
+double
+WifiPhy::GetCcaEdThreshold (void) const
+{
+  return WToDbm (m_ccaEdThresholdW);
 }
 
 void
@@ -1644,7 +1665,7 @@
     case WifiPhyState::SLEEP:
       {
         NS_LOG_DEBUG ("resuming from sleep mode");
-        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW);
+        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW);
         m_state->SwitchFromSleep (delayUntilCcaEnd);
         break;
       }
@@ -1675,7 +1696,7 @@
     case WifiPhyState::OFF:
       {
         NS_LOG_DEBUG ("resuming from off mode");
-        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
+        Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
         m_state->SwitchFromOff (delayUntilCcaEnd);
         break;
       }
@@ -2543,7 +2564,7 @@
   //In this model, CCA becomes busy when the aggregation of all signals as
   //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
 
-  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
+  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
   if (!delayUntilCcaEnd.IsZero ())
     {
       m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
@@ -3646,7 +3667,7 @@
   //In this model, CCA becomes busy when the aggregation of all signals as
   //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
 
-  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ()));
+  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ()));
   if (!delayUntilCcaEnd.IsZero ())
     {
       NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
@@ -3676,76 +3697,66 @@
 WifiPhy::StartRx (Ptr<Packet> packet, WifiTxVector txVector, MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr<Event> event)
 {
   NS_LOG_FUNCTION (this << packet << txVector << +mpdutype << rxPowerW << rxDuration);
-  if (rxPowerW > m_edThresholdW) //checked here, no need to check in the payload reception (current implementation assumes constant rx power over the packet duration)
+
+  AmpduTag ampduTag;
+  WifiPreamble preamble = txVector.GetPreambleType ();
+  if (preamble == WIFI_PREAMBLE_NONE && (m_mpdusNum == 0 || m_plcpSuccess == false))
     {
-      AmpduTag ampduTag;
-      WifiPreamble preamble = txVector.GetPreambleType ();
-      if (preamble == WIFI_PREAMBLE_NONE && (m_mpdusNum == 0 || m_plcpSuccess == false))
-        {
-          m_plcpSuccess = false;
-          m_mpdusNum = 0;
-          NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received");
-          NotifyRxDrop (packet);
-          MaybeCcaBusyDuration ();
-          return;
-        }
-      else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
+      m_plcpSuccess = false;
+      m_mpdusNum = 0;
+      NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received");
+      NotifyRxDrop (packet);
+      MaybeCcaBusyDuration ();
+      return;
+    }
+  else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
+    {
+      //received the first MPDU in an MPDU
+      m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
+      m_rxMpduReferenceNumber++;
+    }
+  else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
+    {
+      //received the other MPDUs that are part of the A-MPDU
+      if (ampduTag.GetRemainingNbOfMpdus () < (m_mpdusNum - 1))
         {
-          //received the first MPDU in an MPDU
-          m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
-          m_rxMpduReferenceNumber++;
-        }
-      else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
-        {
-          //received the other MPDUs that are part of the A-MPDU
-          if (ampduTag.GetRemainingNbOfMpdus () < (m_mpdusNum - 1))
-            {
-              NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetRemainingNbOfMpdus ());
-              m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
-            }
-          else
-            {
-              m_mpdusNum--;
-            }
-        }
-      else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
-        {
-          NS_LOG_DEBUG ("New A-MPDU started while " << m_mpdusNum << " MPDUs from previous are lost");
+          NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetRemainingNbOfMpdus ());
           m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
         }
-      else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
-        {
-          NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
-          m_mpdusNum = 0;
-        }
-
-      NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
-      m_currentEvent = event;
-      m_state->SwitchToRx (rxDuration);
-      NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
-      NotifyRxBegin (packet);
-      m_interference.NotifyRxStart ();
-
-      if (preamble != WIFI_PREAMBLE_NONE)
+      else
         {
-          NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
-          Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector);
-          m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &WifiPhy::StartReceivePacket, this,
-                                                  packet, txVector, mpdutype, event);
+          m_mpdusNum--;
         }
-
-      NS_ASSERT (m_endRxEvent.IsExpired ());
-      m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this,
-                                          packet, preamble, mpdutype, event);
     }
-  else
+  else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
+    {
+      NS_LOG_DEBUG ("New A-MPDU started while " << m_mpdusNum << " MPDUs from previous are lost");
+      m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
+    }
+  else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
     {
-      NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
-                    rxPowerW << "<" << m_edThresholdW << ")");
-      NotifyRxDrop (packet);
-      m_plcpSuccess = false;
-      MaybeCcaBusyDuration ();
+      NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
+      m_mpdusNum = 0;
     }
+
+  NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
+  m_currentEvent = event;
+  m_state->SwitchToRx (rxDuration);
+  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
+  NotifyRxBegin (packet);
+  m_interference.NotifyRxStart ();
+
+  if (preamble != WIFI_PREAMBLE_NONE)
+    {
+      NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
+      Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector);
+      m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &WifiPhy::StartReceivePacket, this,
+                                              packet, txVector, mpdutype, event);
+    }
+
+  NS_ASSERT (m_endRxEvent.IsExpired ());
+  m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this,
+                                      packet, preamble, mpdutype, event);
 }
 
 int64_t
--- a/src/wifi/model/wifi-phy.h	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/model/wifi-phy.h	Mon Nov 26 20:01:12 2018 +0100
@@ -23,6 +23,7 @@
 #define WIFI_PHY_H
 
 #include "ns3/event-id.h"
+#include "ns3/deprecated.h"
 #include "ns3/error-model.h"
 #include "wifi-mpdu-type.h"
 #include "wifi-phy-standard.h"
@@ -73,6 +74,13 @@
 
   WifiPhy ();
   virtual ~WifiPhy ();
+  
+  /**
+   * Return the WifiPhyStateHelper of this PHY
+   *
+   * \return the WifiPhyStateHelper of this PHY
+   */
+  Ptr<WifiPhyStateHelper> GetState (void) const;
 
   /**
    * \param callback the callback to invoke
@@ -1190,14 +1198,24 @@
    * this threshold (dbm) to allow the PHY layer to detect the signal.
    *
    * \param threshold the energy detection threshold in dBm
+   *
+   * \deprecated
    */
   void SetEdThreshold (double threshold);
   /**
-   * Return the energy detection threshold (dBm).
+   * Sets the receive sensitivity threshold (dBm).
+   * The energy of a received signal should be higher than
+   * this threshold to allow the PHY layer to detect the signal.
    *
-   * \return the energy detection threshold in dBm
+   * \param threshold the receive sensitivity threshold in dBm
    */
-  double GetEdThreshold (void) const;
+  void SetRxSensitivity (double threshold);
+  /**
+   * Return the receive sensitivity threshold (dBm).
+   *
+   * \return the receive sensitivity threshold in dBm
+   */
+  double GetRxSensitivity (void) const;
   /**
    * Sets the CCA threshold (dBm). The energy of a received signal
    * should be higher than this threshold to allow the PHY
@@ -1205,13 +1223,13 @@
    *
    * \param threshold the CCA threshold in dBm
    */
-  void SetCcaMode1Threshold (double threshold);
+  void SetCcaEdThreshold (double threshold);
   /**
    * Return the CCA threshold (dBm).
    *
    * \return the CCA threshold in dBm
    */
-  double GetCcaMode1Threshold (void) const;
+  double GetCcaEdThreshold (void) const;
   /**
    * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
    *
@@ -1493,7 +1511,7 @@
    * Check if Phy state should move to CCA busy state based on current
    * state of interference tracker.  In this model, CCA becomes busy when
    * the aggregation of all signals as tracked by the InterferenceHelper
-   * class is higher than the CcaMode1Threshold
+   * class is higher than the CcaEdThreshold
    */
   void SwitchMaybeToCcaBusy (void);
 
@@ -1755,8 +1773,8 @@
   bool m_frequencyChannelNumberInitialized; //!< Store initialization state
   uint16_t m_channelWidth;                  //!< Channel width
 
-  double   m_edThresholdW;        //!< Energy detection threshold in watts
-  double   m_ccaMode1ThresholdW;  //!< Clear channel assessment (CCA) threshold in watts
+  double   m_rxSensitivityW;      //!< Receive sensitivity threshold in watts
+  double   m_ccaEdThresholdW;     //!< Clear channel assessment (CCA) threshold in watts
   double   m_txGainDb;            //!< Transmission gain (dB)
   double   m_rxGainDb;            //!< Reception gain (dB)
   double   m_txPowerBaseDbm;      //!< Minimum transmission power (dBm)
--- a/src/wifi/model/yans-wifi-channel.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/model/yans-wifi-channel.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -125,6 +125,13 @@
 YansWifiChannel::Receive (Ptr<YansWifiPhy> phy, Ptr<Packet> packet, double rxPowerDbm, Time duration)
 {
   NS_LOG_FUNCTION (phy << packet << rxPowerDbm << duration.GetSeconds ());
+  // Do no further processing if signal is too weak
+  // Current implementation assumes constant rx power over the packet duration
+  if ((rxPowerDbm + phy->GetRxGain ()) < phy->GetRxSensitivity ())
+    {
+      NS_LOG_INFO ("Received signal too weak to process: " << rxPowerDbm << " dBm");
+      return;
+    }
   phy->StartReceivePreambleAndHeader (packet, DbmToW (rxPowerDbm + phy->GetRxGain ()), duration);
 }
 
--- a/src/wifi/test/spectrum-wifi-phy-test.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/test/spectrum-wifi-phy-test.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -167,8 +167,6 @@
   m_phy->SetFrequency (FREQUENCY);
   m_phy->SetReceiveOkCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess, this));
   m_phy->SetReceiveErrorCallback (MakeCallback (&SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure, this));
-  //Bug 2460: CcaMode1Threshold default should be set to -62 dBm when using Spectrum
-  m_phy->SetCcaMode1Threshold (-62.0);
 }
 
 // Test that the expected number of packet receptions occur.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/test/wifi-phy-thresholds-test.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -0,0 +1,425 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2018
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
+ */
+
+#include "ns3/log.h"
+#include "ns3/test.h"
+#include "ns3/spectrum-wifi-helper.h"
+#include "ns3/wifi-spectrum-value-helper.h"
+#include "ns3/spectrum-wifi-phy.h"
+#include "ns3/nist-error-rate-model.h"
+#include "ns3/wifi-mac-header.h"
+#include "ns3/wifi-mac-trailer.h"
+#include "ns3/wifi-phy-tag.h"
+#include "ns3/wifi-spectrum-signal-parameters.h"
+#include "ns3/wifi-utils.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("WifiPhyThresholdsTest");
+
+static const uint8_t CHANNEL_NUMBER = 36;
+static const uint32_t FREQUENCY = 5180; //MHz
+static const uint16_t CHANNEL_WIDTH = 20; //MHz
+
+/**
+ * \ingroup wifi-test
+ * \ingroup tests
+ *
+ * \brief Wifi Phy Threshold Test base class
+ */
+class WifiPhyThresholdsTest : public TestCase
+{
+public:
+  WifiPhyThresholdsTest (std::string test_name);
+  virtual ~WifiPhyThresholdsTest ();
+
+protected:
+  /**
+   * Make wifi signal function
+   * \param txPowerWatts the transmit power in watts
+   * \returns Ptr<SpectrumSignalParameters>
+   */
+  virtual Ptr<SpectrumSignalParameters> MakeWifiSignal (double txPowerWatts);
+  /**
+   * Make foreign signal function
+   * \param txPowerWatts the transmit power in watts
+   * \returns Ptr<SpectrumSignalParameters>
+   */
+  virtual Ptr<SpectrumSignalParameters> MakeForeignSignal (double txPowerWatts);
+  /**
+   * Send signal function
+   * \param txPowerWatts the transmit power in watts
+   * \param wifiSignal whether the signal is a wifi signal or not
+   */
+  virtual void SendSignal (double txPowerWatts, bool wifiSignal);
+  /**
+   * PHY receive success callback function
+   * \param p the packet
+   * \param snr the SNR
+   * \param txVector the transmit vector
+   */
+  virtual void RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
+  /**
+   * PHY receive failure callback function
+   */
+  virtual void RxFailure (void);
+  /**
+   * PHY dropped packet callback function
+   * \param p the packet
+   */
+  virtual void RxDropped (Ptr<const Packet> p);
+  /**
+   * PHY state changed callback function
+   * \param start the start time of the new state
+   * \param duration the duration of the new state
+   * \param newState the new state
+   */
+  virtual void PhyStateChanged (Time start, Time duration, WifiPhyState newState);
+
+  Ptr<SpectrumWifiPhy> m_phy; ///< PHY object
+  uint32_t m_rxSuccess;       ///< count number of successfully received packets
+  uint32_t m_rxFailure;       ///< count number of unsuccessfully received packets
+  uint32_t m_rxDropped;       ///< count number of dropped packets
+  uint32_t m_stateChanged;    ///< count number of PHY state change
+  uint32_t m_rxStateCount;    ///< count number of PHY state change to RX state
+  uint32_t m_idleStateCount;    ///< count number of PHY state change to IDLE state
+  uint32_t m_ccabusyStateCount; ///< count number of PHY state change to CCA_BUSY state
+
+private:
+  virtual void DoSetup (void);
+};
+
+WifiPhyThresholdsTest::WifiPhyThresholdsTest (std::string test_name)
+  : TestCase (test_name),
+    m_rxSuccess (0),
+    m_rxFailure (0),
+    m_rxDropped (0),
+    m_stateChanged (0),
+    m_rxStateCount (0),
+    m_idleStateCount (0),
+    m_ccabusyStateCount (0)
+{
+}
+
+WifiPhyThresholdsTest::~WifiPhyThresholdsTest ()
+{
+}
+
+Ptr<SpectrumSignalParameters>
+WifiPhyThresholdsTest::MakeWifiSignal (double txPowerWatts)
+{
+  WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, WIFI_PREAMBLE_LONG, false, 1, 1, 0, 20, false, false);
+  MpduType mpdutype = NORMAL_MPDU;
+
+  Ptr<Packet> pkt = Create<Packet> (1000);
+  WifiMacHeader hdr;
+  WifiMacTrailer trailer;
+
+  hdr.SetType (WIFI_MAC_QOSDATA);
+  hdr.SetQosTid (0);
+  uint32_t size = pkt->GetSize () + hdr.GetSize () + trailer.GetSerializedSize ();
+  Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency (), mpdutype, 0);
+  hdr.SetDuration (txDuration);
+
+  pkt->AddHeader (hdr);
+  pkt->AddTrailer (trailer);
+  WifiPhyTag tag (txVector, mpdutype, 1);
+  pkt->AddPacketTag (tag);
+  Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH);
+  Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
+  txParams->psd = txPowerSpectrum;
+  txParams->txPhy = 0;
+  txParams->duration = txDuration;
+  txParams->packet = pkt;
+  return txParams;
+}
+
+Ptr<SpectrumSignalParameters>
+WifiPhyThresholdsTest::MakeForeignSignal (double txPowerWatts)
+{
+  Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH);
+  Ptr<SpectrumSignalParameters> txParams = Create<SpectrumSignalParameters> ();
+  txParams->psd = txPowerSpectrum;
+  txParams->txPhy = 0;
+  txParams->duration = Seconds (0.5);
+  return txParams;
+}
+
+void
+WifiPhyThresholdsTest::SendSignal (double txPowerWatts, bool wifiSignal)
+{
+  if (wifiSignal)
+    {
+      m_phy->StartRx (MakeWifiSignal (txPowerWatts));
+    }
+  else
+    {
+      m_phy->StartRx (MakeForeignSignal (txPowerWatts));
+    }
+}
+
+void
+WifiPhyThresholdsTest::RxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector)
+{
+  NS_LOG_FUNCTION (this << p << snr << txVector);
+  m_rxSuccess++;
+}
+
+void
+WifiPhyThresholdsTest::RxFailure (void)
+{
+  NS_LOG_FUNCTION (this);
+  m_rxFailure++;
+}
+
+void
+WifiPhyThresholdsTest::RxDropped (Ptr<const Packet> p)
+{
+  NS_LOG_FUNCTION (this << p);
+  m_rxDropped++;
+}
+
+void
+WifiPhyThresholdsTest::PhyStateChanged (Time start, Time duration, WifiPhyState newState)
+{
+  NS_LOG_FUNCTION (this << start << duration << newState);
+  m_stateChanged++;
+  if (newState == WifiPhyState::IDLE)
+    {
+      m_idleStateCount++;
+    }
+  else if (newState == WifiPhyState::RX)
+    {
+      m_rxStateCount++;
+    }
+  else if (newState == WifiPhyState::CCA_BUSY)
+    {
+      m_ccabusyStateCount++;
+    }
+}
+
+void
+WifiPhyThresholdsTest::DoSetup (void)
+{
+  m_phy = CreateObject<SpectrumWifiPhy> ();
+  m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);
+  Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
+  m_phy->SetErrorRateModel (error);
+  m_phy->SetChannelNumber (CHANNEL_NUMBER);
+  m_phy->SetFrequency (FREQUENCY);
+  m_phy->SetReceiveOkCallback (MakeCallback (&WifiPhyThresholdsTest::RxSuccess, this));
+  m_phy->SetReceiveErrorCallback (MakeCallback (&WifiPhyThresholdsTest::RxFailure, this));
+  m_phy->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&WifiPhyThresholdsTest::RxDropped, this));
+  m_phy->GetState ()->TraceConnectWithoutContext ("State", MakeCallback (&WifiPhyThresholdsTest::PhyStateChanged, this));
+}
+
+/**
+ * \ingroup wifi-test
+ * \ingroup tests
+ *
+ * \brief Wifi Phy Threshold Weak Wifi Signal Test
+ *
+ * This test makes sure PHY ignores a Wi-Fi signal
+ * if its received power lower than RxSensitivity.
+ */
+class WifiPhyThresholdsWeakWifiSignalTest : public WifiPhyThresholdsTest
+{
+public:
+  WifiPhyThresholdsWeakWifiSignalTest ();
+  virtual ~WifiPhyThresholdsWeakWifiSignalTest ();
+  virtual void DoRun (void);
+};
+
+WifiPhyThresholdsWeakWifiSignalTest::WifiPhyThresholdsWeakWifiSignalTest ()
+  : WifiPhyThresholdsTest ("WifiPhy reception thresholds: test weak wifi signal reception")
+{
+}
+
+WifiPhyThresholdsWeakWifiSignalTest::~WifiPhyThresholdsWeakWifiSignalTest ()
+{
+}
+
+void
+WifiPhyThresholdsWeakWifiSignalTest::DoRun (void)
+{
+  WifiHelper::EnableLogComponents ();
+
+  double txPowerWatts = DbmToW (-110);
+
+  Simulator::Schedule (Seconds (1), &WifiPhyThresholdsWeakWifiSignalTest::SendSignal, this, txPowerWatts, true);
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+
+  NS_TEST_ASSERT_MSG_EQ (m_rxDropped + m_rxSuccess + m_rxFailure, 0, "Reception should not have been triggered if packet is weaker than RxSensitivity threshold");
+  NS_TEST_ASSERT_MSG_EQ (m_stateChanged, 0, "State should stay idle if reception involves a signal weaker than RxSensitivity threshold");
+}
+
+/**
+ * \ingroup wifi-test
+ * \ingroup tests
+ *
+ * \brief Wifi Phy Threshold Weak Foreign Signal Test
+ *
+ * This test makes sure PHY keeps the state as IDLE if reception involves
+ * a foreign signal with a received power lower than CcaEdThreshold.
+ */
+class WifiPhyThresholdsWeakForeignSignalTest : public WifiPhyThresholdsTest
+{
+public:
+  WifiPhyThresholdsWeakForeignSignalTest ();
+  virtual ~WifiPhyThresholdsWeakForeignSignalTest ();
+  virtual void DoRun (void);
+};
+
+WifiPhyThresholdsWeakForeignSignalTest::WifiPhyThresholdsWeakForeignSignalTest ()
+  : WifiPhyThresholdsTest ("WifiPhy reception thresholds: test weak foreign signal reception")
+{
+}
+
+WifiPhyThresholdsWeakForeignSignalTest::~WifiPhyThresholdsWeakForeignSignalTest ()
+{
+}
+
+void
+WifiPhyThresholdsWeakForeignSignalTest::DoRun (void)
+{
+  WifiHelper::EnableLogComponents ();
+
+  double txPowerWatts = DbmToW (-90);
+
+  Simulator::Schedule (Seconds (1), &WifiPhyThresholdsWeakForeignSignalTest::SendSignal, this, txPowerWatts, false);
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+
+  NS_TEST_ASSERT_MSG_EQ (m_rxDropped + m_rxSuccess + m_rxFailure, 0, "Reception of non-wifi packet should not be triggered");
+  NS_TEST_ASSERT_MSG_EQ (m_stateChanged, 0, "State should stay idle if reception involves a signal weaker than RxSensitivity threshold");
+}
+
+/**
+ * \ingroup wifi-test
+ * \ingroup tests
+ *
+ * \brief Wifi Phy Threshold Strong Wifi Signal Test
+ *
+ * This test makes sure PHY processes a Wi-Fi signal
+ * with a received power higher than RxSensitivity.
+ */
+class WifiPhyThresholdsStrongWifiSignalTest : public WifiPhyThresholdsTest
+{
+public:
+  WifiPhyThresholdsStrongWifiSignalTest ();
+  virtual ~WifiPhyThresholdsStrongWifiSignalTest ();
+  virtual void DoRun (void);
+};
+
+WifiPhyThresholdsStrongWifiSignalTest::WifiPhyThresholdsStrongWifiSignalTest ()
+  : WifiPhyThresholdsTest ("WifiPhy reception thresholds: test strong wifi signal reception")
+{
+}
+
+WifiPhyThresholdsStrongWifiSignalTest::~WifiPhyThresholdsStrongWifiSignalTest ()
+{
+}
+
+void
+WifiPhyThresholdsStrongWifiSignalTest::DoRun (void)
+{
+  WifiHelper::EnableLogComponents ();
+
+  double txPowerWatts = DbmToW (-60);
+
+  Simulator::Schedule (Seconds (1), &WifiPhyThresholdsStrongWifiSignalTest::SendSignal, this, txPowerWatts, true);
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+
+  NS_TEST_ASSERT_MSG_EQ (m_rxDropped + m_rxFailure, 0, "Packet reception should have been successfull");
+  NS_TEST_ASSERT_MSG_EQ (m_rxSuccess, 1, "Packet should have been successfully received");
+  NS_TEST_ASSERT_MSG_EQ (m_stateChanged, 2, "State should have moved to RX then back to IDLE");
+  NS_TEST_ASSERT_MSG_EQ (m_rxStateCount, 1, "State should have moved to RX once");
+  NS_TEST_ASSERT_MSG_EQ (m_idleStateCount, 1, "State should have moved to IDLE once");
+}
+
+/**
+ * \ingroup wifi-test
+ * \ingroup tests
+ *
+ * \brief Wifi Phy Threshold Strong Foreign Signal Test
+ *
+ * This test makes sure PHY declare the state as CCA_BUSY if reception involves
+ * a foreign signal with a received power higher than CcaEdThreshold.
+ */
+class WifiPhyThresholdsStrongForeignSignalTest : public WifiPhyThresholdsTest
+{
+public:
+  WifiPhyThresholdsStrongForeignSignalTest ();
+  virtual ~WifiPhyThresholdsStrongForeignSignalTest ();
+  virtual void DoRun (void);
+};
+
+WifiPhyThresholdsStrongForeignSignalTest::WifiPhyThresholdsStrongForeignSignalTest ()
+  : WifiPhyThresholdsTest ("WifiPhy reception thresholds: test weak foreign signal reception")
+{
+}
+
+WifiPhyThresholdsStrongForeignSignalTest::~WifiPhyThresholdsStrongForeignSignalTest ()
+{
+}
+
+void
+WifiPhyThresholdsStrongForeignSignalTest::DoRun (void)
+{
+  WifiHelper::EnableLogComponents ();
+
+  double txPowerWatts = DbmToW (-60);
+
+  Simulator::Schedule (Seconds (1), &WifiPhyThresholdsStrongForeignSignalTest::SendSignal, this, txPowerWatts, false);
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+
+  NS_TEST_ASSERT_MSG_EQ (m_rxDropped + m_rxSuccess + m_rxFailure, 0, "Reception of non-wifi packet should not be triggered");
+  NS_TEST_ASSERT_MSG_EQ (m_ccabusyStateCount, 1, "State should have moved to CCA-BUSY");
+}
+
+/**
+ * \ingroup wifi-test
+ * \ingroup tests
+ *
+ * \brief Wifi Phy Thresholds Test Suite
+ */
+class WifiPhyThresholdsTestSuite : public TestSuite
+{
+public:
+  WifiPhyThresholdsTestSuite ();
+};
+
+WifiPhyThresholdsTestSuite::WifiPhyThresholdsTestSuite ()
+  : TestSuite ("wifi-phy-thresholds", UNIT)
+{
+  AddTestCase (new WifiPhyThresholdsWeakWifiSignalTest, TestCase::QUICK);
+  AddTestCase (new WifiPhyThresholdsWeakForeignSignalTest, TestCase::QUICK);
+  AddTestCase (new WifiPhyThresholdsStrongWifiSignalTest, TestCase::QUICK);
+  AddTestCase (new WifiPhyThresholdsStrongForeignSignalTest, TestCase::QUICK);
+}
+
+static WifiPhyThresholdsTestSuite wifiPhyThresholdsTestSuite; ///< the test suite
--- a/src/wifi/test/wifi-test.cc	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/test/wifi-test.cc	Mon Nov 26 20:01:12 2018 +0100
@@ -1290,7 +1290,6 @@
   spectrumPhy.Set ("ChannelWidth", UintegerValue (channelWidth));
   spectrumPhy.Set ("TxPowerStart", DoubleValue (10));
   spectrumPhy.Set ("TxPowerEnd", DoubleValue (10));
-  spectrumPhy.Set ("CcaMode1Threshold", DoubleValue (-62.0));
 
   WifiHelper wifi;
   wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
--- a/src/wifi/wscript	Sat Nov 24 15:05:20 2018 -0800
+++ b/src/wifi/wscript	Mon Nov 26 20:01:12 2018 +0100
@@ -111,6 +111,7 @@
         'test/wifi-aggregation-test.cc',
         'test/wifi-error-rate-models-test.cc',
         'test/wifi-transmit-mask-test.cc',
+        'test/wifi-phy-thresholds-test.cc',
         ]
 
     headers = bld(features='ns3header')