bug 1801: Setting Wi-Fi timing parameters through WifiMac attributes (documentation fix)
--- a/src/wifi/doc/wifi.rst Thu Jan 29 19:00:01 2015 -0800
+++ b/src/wifi/doc/wifi.rst Thu Jan 29 19:01:38 2015 -0800
@@ -331,6 +331,38 @@
This creates the WifiNetDevice which includes also a WifiRemoteStationManager, a
WifiMac, and a WifiPhy (connected to the matching WifiChannel).
+The ``WifiHelper::SetStandard`` method set various default timing parameters as defined in the selected standard version, overwriting values that may exist or have been previously configured.
+In order to change parameters that are overwritten by ``WifiHelper::SetStandard``, this should be done post-install using ``Config::Set``::
+
+ WifiHelper wifi = WifiHelper::Default ();
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue("OfdmRate65MbpsBW20MHz"), "ControlMode", StringValue("OfdmRate6_5MbpsBW20MHz"));
+ HtWifiMacHelper mac = HtWifiMacHelper::Default ();
+
+ //Install PHY and MAC
+ Ssid ssid = Ssid ("ns3-wifi");
+ mac.SetType ("ns3::StaWifiMac",
+ "Ssid", SsidValue (ssid),
+ "ActiveProbing", BooleanValue (false));
+
+ NetDeviceContainer staDevice;
+ staDevice = wifi.Install (phy, mac, wifiStaNode);
+
+ mac.SetType ("ns3::ApWifiMac",
+ "Ssid", SsidValue (ssid));
+
+ NetDeviceContainer apDevice;
+ apDevice = wifi.Install (phy, mac, wifiApNode);
+
+ //Once install is done, we overwrite the standard timing values
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/Slot", TimeValue (MicroSeconds (slot)));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/Sifs", TimeValue (MicroSeconds (sifs)));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/AckTimeout", TimeValue (MicroSeconds (ackTimeout)));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/CtsTimeout", TimeValue (MicroSeconds (ctsTimeout)));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/Rifs", TimeValue (MicroSeconds (rifs)));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BasicBlockAckTimeout", TimeValue (MicroSeconds (basicBlockAckTimeout)));
+ Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/CompressedBlockAckTimeout", TimeValue (MicroSeconds (compressedBlockAckTimeout)));
+
There are many |ns3| attributes that can be set on the above helpers to
deviate from the default behavior; the example scripts show how to do some of
this reconfiguration.
--- a/src/wifi/helper/wifi-helper.h Thu Jan 29 19:00:01 2015 -0800
+++ b/src/wifi/helper/wifi-helper.h Thu Jan 29 19:01:38 2015 -0800
@@ -164,11 +164,29 @@
*/
virtual NetDeviceContainer Install (const WifiPhyHelper &phy,
const WifiMacHelper &mac, std::string nodeName) const;
-
/**
* \param standard the phy standard to configure during installation
*
- * By default, all objects are configured for 802.11a
+ * This method sets standards-compliant defaults for WifiMac
+ * parameters such as sifs time, slot time, timeout values, etc.,
+ * based on the standard selected. It results in
+ * WifiMac::ConfigureStandard(standard) being called on each
+ * installed mac object.
+ *
+ * The default standard of 802.11a will be applied if SetStandard()
+ * is not called.
+ *
+ * Note that WifiMac::ConfigureStandard () will overwrite certain
+ * defaults in the attribute system, so if a user wants to manipulate
+ * any default values affected by ConfigureStandard() while using this
+ * helper, the user should use a post-install configuration such as
+ * Config::Set() on any objects that this helper creates, such as:
+ * \code
+ * Config::Set ("/NodeList/0/DeviceList/0/$ns3::WifiNetDevice/Mac/Slot", TimeValue (MicroSeconds (slot)));
+ * \endcode
+ *
+ * \sa WifiMac::ConfigureStandard
+ * \sa Config::Set
*/
virtual void SetStandard (enum WifiPhyStandard standard);
--- a/src/wifi/model/wifi-mac.h Thu Jan 29 19:00:01 2015 -0800
+++ b/src/wifi/model/wifi-mac.h Thu Jan 29 19:01:38 2015 -0800
@@ -286,6 +286,17 @@
void NotifyRxDrop (Ptr<const Packet> packet);
/**
* \param standard the wifi standard to be configured
+ *
+ * This method sets standards-compliant defaults for WifiMac
+ * parameters such as sifs time, slot time, timeout values, etc.,
+ * based on the standard selected.
+ * \sa WifiMac::Configure80211a
+ * \sa WifiMac::Configure80211b
+ * \sa WifiMac::Configure80211g
+ * \sa WifiMac::Configure80211_10Mhz
+ * \sa WifiMac::Configure80211_5Mhz
+ * \sa WifiMac::Configure80211n_2_4Ghz
+ * \sa WifiMac::Configure80211n_5Ghz
*/
void ConfigureStandard (enum WifiPhyStandard standard);
@@ -386,31 +397,40 @@
Time m_maxPropagationDelay;
/**
- * Configure appropriate timing parameters for 802.11a.
+ * This method sets 802.11a standards-compliant defaults for following attributes:
+ * Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
*/
void Configure80211a (void);
/**
- * Configure appropriate timing parameters for 802.11b.
+ * This method sets 802.11b standards-compliant defaults for following attributes:
+ * Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
*/
void Configure80211b (void);
/**
- * Configure appropriate timing parameters for 802.11g.
+ * This method sets 802.11g standards-compliant defaults for following attributes:
+ * Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
+ * There is no support for short slot time.
*/
void Configure80211g (void);
/**
- * Configure appropriate timing parameters for 802.11 with 10Mhz channel spacing.
+ * This method sets 802.11 with 10Mhz channel spacing standards-compliant defaults
+ * for following attributes: Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
*/
void Configure80211_10Mhz (void);
/**
- * Configure appropriate timing parameters for 802.11 with 5Mhz channel spacing.
+ * This method sets 802.11 with 5Mhz channel spacing standards-compliant defaults
+ * for following attributes: Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
*/
void Configure80211_5Mhz ();
/**
- * Configure appropriate timing parameters for 802.11n operating at 2.4Ghz.
+ * This method sets 802.11n 2.4 GHz standards-compliant defaults for following attributes:
+ * Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
+ * There is no support for short slot time.
*/
void Configure80211n_2_4Ghz (void);
/**
- * Configure appropriate timing parameters for 802.11n operating at 5Ghz.
+ * This method sets 802.11n 5 GHz standards-compliant defaults for following attributes:
+ * Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
*/
void Configure80211n_5Ghz (void);