diff --git a/CHANGES.html b/CHANGES.html
index 1570797ed..b99bbf114 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -70,6 +70,10 @@ us a note on ns-developers mailing list.
RandomRectanglePositionAllocator, RandomDiscPositionAllocator,
UniformDiscPositionAllocator.
+
+ The WifiPhy attribute "CcaMode1Threshold" has been renamed to "CcaEdThreshold",
+ and the WifiPhy attribute "EnergyDetectionThreshold" has been replaced by a new attribute called "RxSensitivity"
+
Changes to build system:
diff --git a/examples/energy/energy-model-example.cc b/examples/energy/energy-model-example.cc
index f8d48326f..9e6d54db6 100644
--- a/examples/energy/energy-model-example.cc
+++ b/examples/energy/energy-model-example.cc
@@ -131,11 +131,6 @@ main (int argc, char *argv[])
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 @@ main (int argc, char *argv[])
/** 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 wifiChannelPtr = wifiChannel.Create ();
wifiPhy.SetChannel (wifiChannelPtr);
diff --git a/examples/energy/energy-model-with-harvesting-example.cc b/examples/energy/energy-model-with-harvesting-example.cc
index f89eab5da..50c688fea 100644
--- a/examples/energy/energy-model-with-harvesting-example.cc
+++ b/examples/energy/energy-model-with-harvesting-example.cc
@@ -169,11 +169,6 @@ main (int argc, char *argv[])
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 @@ main (int argc, char *argv[])
/** 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 wifiChannelPtr = wifiChannel.Create ();
wifiPhy.SetChannel (wifiChannelPtr);
diff --git a/examples/wireless/wifi-clear-channel-cmu.cc b/examples/wireless/wifi-clear-channel-cmu.cc
index a44c24bfa..94c984700 100644
--- a/examples/wireless/wifi-clear-channel-cmu.cc
+++ b/examples/wireless/wifi-clear-channel-cmu.cc
@@ -208,8 +208,6 @@ int main (int argc, char *argv[])
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) );
diff --git a/examples/wireless/wifi-simple-interference.cc b/examples/wireless/wifi-simple-interference.cc
index 65a8decca..6501d8550 100644
--- a/examples/wireless/wifi-simple-interference.cc
+++ b/examples/wireless/wifi-simple-interference.cc
@@ -178,9 +178,6 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
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) );
diff --git a/examples/wireless/wifi-spectrum-per-example.cc b/examples/wireless/wifi-spectrum-per-example.cc
index 0287731bb..44d900ad1 100644
--- a/examples/wireless/wifi-spectrum-per-example.cc
+++ b/examples/wireless/wifi-spectrum-per-example.cc
@@ -183,9 +183,6 @@ int main (int argc, char *argv[])
}
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 spectrumChannel
= CreateObject ();
Ptr lossModel
diff --git a/examples/wireless/wifi-spectrum-per-interference.cc b/examples/wireless/wifi-spectrum-per-interference.cc
index d9f7ff3ab..b83f95cff 100644
--- a/examples/wireless/wifi-spectrum-per-interference.cc
+++ b/examples/wireless/wifi-spectrum-per-interference.cc
@@ -212,9 +212,6 @@ int main (int argc, char *argv[])
}
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 ();
Ptr lossModel
diff --git a/examples/wireless/wifi-spectrum-saturation-example.cc b/examples/wireless/wifi-spectrum-saturation-example.cc
index 569a95329..30c095980 100644
--- a/examples/wireless/wifi-spectrum-saturation-example.cc
+++ b/examples/wireless/wifi-spectrum-saturation-example.cc
@@ -178,9 +178,6 @@ int main (int argc, char *argv[])
}
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 spectrumChannel
= CreateObject ();
Ptr lossModel
diff --git a/examples/wireless/wifi-tcp.cc b/examples/wireless/wifi-tcp.cc
index d06783f17..5a736a39c 100644
--- a/examples/wireless/wifi-tcp.cc
+++ b/examples/wireless/wifi-tcp.cc
@@ -119,14 +119,6 @@ main (int argc, char *argv[])
/* 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),
diff --git a/src/aodv/test/aodv-chain-regression-test-0-0.pcap b/src/aodv/test/aodv-chain-regression-test-0-0.pcap
index 6fc38b7cf..0db6f08d5 100644
Binary files a/src/aodv/test/aodv-chain-regression-test-0-0.pcap and b/src/aodv/test/aodv-chain-regression-test-0-0.pcap differ
diff --git a/src/aodv/test/aodv-chain-regression-test-1-0.pcap b/src/aodv/test/aodv-chain-regression-test-1-0.pcap
index 01ca13b92..92766af29 100644
Binary files a/src/aodv/test/aodv-chain-regression-test-1-0.pcap and b/src/aodv/test/aodv-chain-regression-test-1-0.pcap differ
diff --git a/src/aodv/test/aodv-regression.cc b/src/aodv/test/aodv-regression.cc
index eeb0b582d..b39eaa094 100644
--- a/src/aodv/test/aodv-regression.cc
+++ b/src/aodv/test/aodv-regression.cc
@@ -168,8 +168,7 @@ ChainRegressionTest::CreateDevices ()
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ptr 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;
diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap
index a5a9df0b8..01a3809b5 100644
Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap
index aa3fc9f20..752e3175f 100644
Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap
index d97288b7d..e59c83ecc 100644
Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap
index 34128ecbf..182a460e9 100644
Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap
index faa19791e..9f3eb8abb 100644
Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression.cc b/src/mesh/test/dot11s/hwmp-proactive-regression.cc
index 0314e12b4..8d5675dbb 100644
--- a/src/mesh/test/dot11s/hwmp-proactive-regression.cc
+++ b/src/mesh/test/dot11s/hwmp-proactive-regression.cc
@@ -113,8 +113,7 @@ HwmpProactiveRegressionTest::CreateDevices ()
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ptr 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")));
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap
index f0e3cd08c..b07cceab6 100644
Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap
index 1fdc5efdc..943faa860 100644
Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap
index e7f4ed211..5f02ba69d 100644
Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap
index a7606da94..20f9e87a8 100644
Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap
index 6f5300a02..3ce66df2b 100644
Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap
index d322107d0..1e515a1ab 100644
Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression.cc b/src/mesh/test/dot11s/hwmp-reactive-regression.cc
index 53a6376a4..e5cd924cb 100644
--- a/src/mesh/test/dot11s/hwmp-reactive-regression.cc
+++ b/src/mesh/test/dot11s/hwmp-reactive-regression.cc
@@ -114,8 +114,6 @@ HwmpReactiveRegressionTest::CreateDevices ()
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ptr 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 ();
diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression.cc b/src/mesh/test/dot11s/hwmp-simplest-regression.cc
index a0041ed14..08de6efc5 100644
--- a/src/mesh/test/dot11s/hwmp-simplest-regression.cc
+++ b/src/mesh/test/dot11s/hwmp-simplest-regression.cc
@@ -122,8 +122,7 @@ HwmpSimplestRegressionTest::CreateDevices ()
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ptr 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");
diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap
index beb974346..df0a9d1a5 100644
Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap
index 6bfd75d1e..ab31e1b22 100644
Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap
index 99a6342d8..5b6ff501a 100644
Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap
index 1dcfd5dad..01686124c 100644
Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap differ
diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc
index 793de89b7..aaaee161b 100644
--- a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc
+++ b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc
@@ -140,8 +140,7 @@ HwmpDoRfRegressionTest::CreateDevices ()
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ptr 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");
diff --git a/src/mesh/test/flame/flame-regression-test-0-1.pcap b/src/mesh/test/flame/flame-regression-test-0-1.pcap
index 56dc61fed..4d23035c5 100644
Binary files a/src/mesh/test/flame/flame-regression-test-0-1.pcap and b/src/mesh/test/flame/flame-regression-test-0-1.pcap differ
diff --git a/src/mesh/test/flame/flame-regression-test-1-1.pcap b/src/mesh/test/flame/flame-regression-test-1-1.pcap
index e560e3a89..37169e367 100644
Binary files a/src/mesh/test/flame/flame-regression-test-1-1.pcap and b/src/mesh/test/flame/flame-regression-test-1-1.pcap differ
diff --git a/src/mesh/test/flame/flame-regression-test-2-1.pcap b/src/mesh/test/flame/flame-regression-test-2-1.pcap
index 0d2d0701f..7c09bb44c 100644
Binary files a/src/mesh/test/flame/flame-regression-test-2-1.pcap and b/src/mesh/test/flame/flame-regression-test-2-1.pcap differ
diff --git a/src/mesh/test/flame/flame-regression.cc b/src/mesh/test/flame/flame-regression.cc
index a77d41b77..921374739 100644
--- a/src/mesh/test/flame/flame-regression.cc
+++ b/src/mesh/test/flame/flame-regression.cc
@@ -99,8 +99,7 @@ FlameRegressionTest::CreateDevices ()
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Ptr 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");
diff --git a/src/test/ns3wifi/wifi-interference-test-suite.cc b/src/test/ns3wifi/wifi-interference-test-suite.cc
index c0f215f07..d29605557 100644
--- a/src/test/ns3wifi/wifi-interference-test-suite.cc
+++ b/src/test/ns3wifi/wifi-interference-test-suite.cc
@@ -137,10 +137,6 @@ WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs
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 @@ WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs
// 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) );
diff --git a/src/wifi/doc/source/wifi-design.rst b/src/wifi/doc/source/wifi-design.rst
index 0b95f451e..0171c2e49 100644
--- a/src/wifi/doc/source/wifi-design.rst
+++ b/src/wifi/doc/source/wifi-design.rst
@@ -284,8 +284,7 @@ The PHY layer can be in one of six states:
#. 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 @@ However, the model doesn't support this, because there are no 'foreign'
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 @@ add their received power to the noise, in the same way that
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
diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc
index 402609aa1..0899d25f2 100644
--- a/src/wifi/examples/wifi-manager-example.cc
+++ b/src/wifi/examples/wifi-manager-example.cc
@@ -336,9 +336,6 @@ int main (int argc, char *argv[])
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 wifiChannel = CreateObject ();
Ptr delayModel = CreateObject ();
diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc
index 70e94ba24..892a7ca32 100644
--- a/src/wifi/model/spectrum-wifi-phy.cc
+++ b/src/wifi/model/spectrum-wifi-phy.cc
@@ -242,6 +242,14 @@ SpectrumWifiPhy::StartRx (Ptr rxParams)
// 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");
diff --git a/src/wifi/model/wifi-phy-state-helper.cc b/src/wifi/model/wifi-phy-state-helper.cc
index cf4e93801..4186a04e0 100644
--- a/src/wifi/model/wifi-phy-state-helper.cc
+++ b/src/wifi/model/wifi-phy-state-helper.cc
@@ -517,6 +517,7 @@ WifiPhyStateHelper::SwitchMaybeToCcaBusy (Time duration)
{
m_startCcaBusy = now;
}
+ m_stateLogger (now, duration, WifiPhyState::CCA_BUSY);
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
}
diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc
index 79f9028f3..d88312e42 100644
--- a/src/wifi/model/wifi-phy.cc
+++ b/src/wifi/model/wifi-phy.cc
@@ -182,15 +182,24 @@ WifiPhy::GetTypeId (void)
.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 ())
- .AddAttribute ("CcaMode1Threshold",
+ MakeDoubleChecker (),
+ 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 ())
+ .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 ())
.AddAttribute ("TxGain",
"Transmission gain (dB).",
@@ -414,6 +423,12 @@ WifiPhy::DoInitialize (void)
InitializeFrequencyChannelNumber ();
}
+Ptr
+WifiPhy::GetState (void) const
+{
+ return m_state;
+}
+
void
WifiPhy::SetReceiveOkCallback (RxOkCallback callback)
{
@@ -475,27 +490,33 @@ WifiPhy::InitializeFrequencyChannelNumber (void)
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_ccaMode1ThresholdW);
+ return WToDbm (m_rxSensitivityW);
+}
+
+void
+WifiPhy::SetCcaEdThreshold (double threshold)
+{
+ NS_LOG_FUNCTION (this << threshold);
+ m_ccaEdThresholdW = DbmToW (threshold);
+}
+
+double
+WifiPhy::GetCcaEdThreshold (void) const
+{
+ return WToDbm (m_ccaEdThresholdW);
}
void
@@ -1644,7 +1665,7 @@ WifiPhy::ResumeFromSleep (void)
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 @@ WifiPhy::ResumeFromOff (void)
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 @@ WifiPhy::MaybeCcaBusyDuration ()
//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 @@ WifiPhy::SwitchMaybeToCcaBusy (void)
//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 @@ void
WifiPhy::StartRx (Ptr packet, WifiTxVector txVector, MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr 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)
- {
- //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");
- 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)
- {
- 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);
- }
- else
- {
- NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
- rxPowerW << "<" << m_edThresholdW << ")");
- NotifyRxDrop (packet);
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))
+ {
+ 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");
+ 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)
+ {
+ 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
diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h
index 05584b4df..3131e38fd 100644
--- a/src/wifi/model/wifi-phy.h
+++ b/src/wifi/model/wifi-phy.h
@@ -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 @@ public:
WifiPhy ();
virtual ~WifiPhy ();
+
+ /**
+ * Return the WifiPhyStateHelper of this PHY
+ *
+ * \return the WifiPhyStateHelper of this PHY
+ */
+ Ptr GetState (void) const;
/**
* \param callback the callback to invoke
@@ -1190,14 +1198,24 @@ public:
* 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 @@ public:
*
* \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 @@ protected:
* 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 @@ private:
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)
diff --git a/src/wifi/model/yans-wifi-channel.cc b/src/wifi/model/yans-wifi-channel.cc
index 95607e259..c967c22ae 100644
--- a/src/wifi/model/yans-wifi-channel.cc
+++ b/src/wifi/model/yans-wifi-channel.cc
@@ -125,6 +125,13 @@ void
YansWifiChannel::Receive (Ptr phy, Ptr 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);
}
diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc
index edb96d4ab..f0f0a3f64 100644
--- a/src/wifi/test/spectrum-wifi-phy-test.cc
+++ b/src/wifi/test/spectrum-wifi-phy-test.cc
@@ -167,8 +167,6 @@ SpectrumWifiPhyBasicTest::DoSetup (void)
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.
diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc
new file mode 100644
index 000000000..58f0484a2
--- /dev/null
+++ b/src/wifi/test/wifi-phy-thresholds-test.cc
@@ -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
+ */
+
+#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
+ */
+ virtual Ptr MakeWifiSignal (double txPowerWatts);
+ /**
+ * Make foreign signal function
+ * \param txPowerWatts the transmit power in watts
+ * \returns Ptr
+ */
+ virtual Ptr 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 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 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 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
+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 pkt = Create (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 txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH);
+ Ptr txParams = Create ();
+ txParams->psd = txPowerSpectrum;
+ txParams->txPhy = 0;
+ txParams->duration = txDuration;
+ txParams->packet = pkt;
+ return txParams;
+}
+
+Ptr
+WifiPhyThresholdsTest::MakeForeignSignal (double txPowerWatts)
+{
+ Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH);
+ Ptr txParams = Create ();
+ 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 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 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 ();
+ m_phy->ConfigureStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);
+ Ptr error = CreateObject ();
+ 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
diff --git a/src/wifi/test/wifi-test.cc b/src/wifi/test/wifi-test.cc
index 614fe9606..7b5428997 100644
--- a/src/wifi/test/wifi-test.cc
+++ b/src/wifi/test/wifi-test.cc
@@ -1290,7 +1290,6 @@ Bug2483TestCase::DoRun (void)
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);
diff --git a/src/wifi/wscript b/src/wifi/wscript
index d06c3cf94..d1b3e3767 100644
--- a/src/wifi/wscript
+++ b/src/wifi/wscript
@@ -111,6 +111,7 @@ def build(bld):
'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')