Bug 871: Rework construction of Wi-Fi rates
This patch attempts to lay some groundwork for enhancements to the Wi-Fi module
by bringing the representation of transmit rates more in line with the
standard.
The key part of the patch is the introduction of a type that corresponds to the
notion of Modulation Class described in IEEE 802.11-2007, Section 9.6.1, Table
9-2.
It also adds coding rate information to the WifiModes and centralises their
construction into a single WifiModeFactory method. The rates are also renamed
with reference to their Modulation Class.
WifiModes no longer have a WifiStandard, but the latter type still exists and is
used to imply the set of WifiModes that a MAC/PHY pair will support.
--- a/CHANGES.html Tue Jun 15 11:27:51 2010 -0700
+++ b/CHANGES.html Wed Jun 16 10:55:13 2010 +0100
@@ -69,6 +69,28 @@
<h2>Changes to existing API:</h2>
+<ul>
+<li><b>Changes to construction and naming of Wi-Fi transmit rates:</b>
+A reorganisation of the construction of Wi-Fi transmit rates has been
+undertaken with the aim of simplifying the task of supporting further
+IEEE 802.11 PHYs. This work has been completed under the auspices of
+Bug 871.
+
+From the viewpoint of simulation scripts not part of the ns-3
+distribution, the key change is that WifiMode names of the form
+wifi<em>x</em>-<em>n</em>mbs are now invalid. Names now take the
+form <em>Cccc</em>Rate<em>n</em>Mbps[BW<em>b</em>MHz],
+where <em>n</em> is the root bitrate in megabits-per-second as before
+(with only significant figures included, and an underscore replacing
+any decimal point), and <em>Cccc</em> is a representation of the
+Modulation Class as defined in Table 9-2 of IEEE
+Std. 802.11-2007. Currently-supported options for <em>Cccc</em>
+are <em>Ofdm</em> and <em>Dsss</em>. For modulation classes where
+optional reduced-bandwidth transmission is possible, this is captured
+in the final part of the form above, with <em>b</em> specifying the
+nominal signal bandwidth in megahertz.
+</ul>
+
<h2>Changed behavior:</h2>
<ul>
<li><b>Queue trace behavior during Enqueue changed:</b> The behavior of the
--- a/RELEASE_NOTES Tue Jun 15 11:27:51 2010 -0700
+++ b/RELEASE_NOTES Wed Jun 16 10:55:13 2010 +0100
@@ -26,6 +26,17 @@
New user-visible features
-------------------------
+
+ - A reorganisation of the construction of Wi-Fi transmit rates has
+ been undertaken with the aim of simplifying the task of
+ supporting further IEEE 802.11 PHYs. This work has been completed
+ under the auspices of Bug 871. A consequence of this work is that
+ WifiModes have a new (hopefully future-proof) naming, and
+ simulations which specify rates by name will need updating. The
+ list of new rate names is given in the error message produced
+ when an attempt is made to use any invalid rate name (including
+ those that were previously valid).
+
- A new OFDM error rate model for WiFi (NistErrorRateModel); this model
has been validated in clear-channel testbed tests. For 802.11b, it
uses the same underlying model as the YansErrorRateModel, but it differs
@@ -50,6 +61,7 @@
- bug 900: RawTextConfigLoad::Default does not load configurations
- bug 858 - support MSG_PEEK in IPv4/IPv6 raw socket
- bug 932 - Support IP_HDRINCL option for Ipv4RawSocket
+ - bug 871 - naming for WifiPhyStandard
Known issues
------------
--- a/examples/routing/aodv.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/routing/aodv.cc Wed Jun 16 10:55:13 2010 +0100
@@ -174,7 +174,7 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi = WifiHelper::Default ();
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs"), "RtsCtsThreshold", UintegerValue (0));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", UintegerValue (0));
devices = wifi.Install (wifiPhy, wifiMac, nodes);
if (pcap)
--- a/examples/routing/olsr-hna.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/routing/olsr-hna.cc Wed Jun 16 10:55:13 2010 +0100
@@ -92,7 +92,7 @@
int main (int argc, char *argv[])
{
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
double rss = -80; // -dBm
uint32_t packetSize = 1000; // bytes
uint32_t numPackets = 1;
--- a/examples/tap/tap-wifi-virtual-machine.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/tap/tap-wifi-virtual-machine.cc Wed Jun 16 10:55:13 2010 +0100
@@ -106,7 +106,7 @@
//
WifiHelper wifi = WifiHelper::Default ();
wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-54mbs"));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate54Mbps"));
//
// No reason for pesky access points, so we'll use an ad-hoc network.
--- a/examples/tap/tap-wifi-virtual-machine.py Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/tap/tap-wifi-virtual-machine.py Wed Jun 16 10:55:13 2010 +0100
@@ -41,7 +41,7 @@
#
wifi = ns3.WifiHelper.Default()
wifi.SetStandard (ns3.WIFI_PHY_STANDARD_80211a);
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", ns3.StringValue ("wifia-54mbs"));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", ns3.StringValue ("OfdmRate54Mbps"));
#
# No reason for pesky access points, so we'll use an ad-hoc network.
--- a/examples/wireless/mixed-wireless.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/mixed-wireless.cc Wed Jun 16 10:55:13 2010 +0100
@@ -146,7 +146,7 @@
NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
mac.SetType ("ns3::AdhocWifiMac");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-54mbs"));
+ "DataMode", StringValue ("OfdmRate54Mbps"));
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
--- a/examples/wireless/mixed-wireless.py Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/mixed-wireless.py Wed Jun 16 10:55:13 2010 +0100
@@ -117,7 +117,7 @@
mac = ns3.NqosWifiMacHelper.Default()
mac.SetType("ns3::AdhocWifiMac")
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
- "DataMode", ns3.StringValue("wifia-54mbs"))
+ "DataMode", ns3.StringValue("OfdmRate54Mbps"))
wifiPhy = ns3.YansWifiPhyHelper.Default()
wifiChannel = ns3.YansWifiChannelHelper.Default()
wifiPhy.SetChannel(wifiChannel.Create())
--- a/examples/wireless/wifi-adhoc.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-adhoc.cc Wed Jun 16 10:55:13 2010 +0100
@@ -185,56 +185,56 @@
NS_LOG_DEBUG ("54");
experiment = Experiment ("54mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-54mbs"));
+ "DataMode", StringValue ("OfdmRate54Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("48");
experiment = Experiment ("48mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-48mbs"));
+ "DataMode", StringValue ("OfdmRate48Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("36");
experiment = Experiment ("36mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-36mbs"));
+ "DataMode", StringValue ("OfdmRate36Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("24");
experiment = Experiment ("24mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-24mbs"));
+ "DataMode", StringValue ("OfdmRate24Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("18");
experiment = Experiment ("18mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-18mbs"));
+ "DataMode", StringValue ("OfdmRate18Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("12");
experiment = Experiment ("12mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-12mbs"));
+ "DataMode", StringValue ("OfdmRate12Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("9");
experiment = Experiment ("9mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-9mbs"));
+ "DataMode", StringValue ("OfdmRate9Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("6");
experiment = Experiment ("6mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("wifia-6mbs"));
+ "DataMode", StringValue ("OfdmRate6Mbps"));
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
--- a/examples/wireless/wifi-clear-channel-cmu.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-clear-channel-cmu.cc Wed Jun 16 10:55:13 2010 +0100
@@ -167,10 +167,10 @@
std::ofstream outfile ("clear-channel.plt");
std::vector <std::string> modes;
- modes.push_back ("wifib-1mbs");
- modes.push_back ("wifib-2mbs");
- modes.push_back ("wifib-5.5mbs");
- modes.push_back ("wifib-11mbs");
+ modes.push_back ("DsssRate1Mbps");
+ modes.push_back ("DsssRate2Mbps");
+ modes.push_back ("DsssRate5_5Mbps");
+ modes.push_back ("DsssRate11Mbps");
// disable fragmentation
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
--- a/examples/wireless/wifi-hidden-terminal.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-hidden-terminal.cc Wed Jun 16 10:55:13 2010 +0100
@@ -69,8 +69,8 @@
// 5. Install wireless devices
WifiHelper wifi;
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode",StringValue ("wifib-2mbs"),
- "ControlMode",StringValue ("wifib-1mbs"));
+ "DataMode",StringValue ("DsssRate2Mbps"),
+ "ControlMode",StringValue ("DsssRate1Mbps"));
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
wifiPhy.SetChannel (wifiChannel);
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
--- a/examples/wireless/wifi-simple-adhoc-grid.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-simple-adhoc-grid.cc Wed Jun 16 10:55:13 2010 +0100
@@ -109,7 +109,7 @@
int main (int argc, char *argv[])
{
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
double distance = 500; // m
uint32_t packetSize = 1000; // bytes
uint32_t numPackets = 1;
--- a/examples/wireless/wifi-simple-adhoc.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-simple-adhoc.cc Wed Jun 16 10:55:13 2010 +0100
@@ -91,7 +91,7 @@
int main (int argc, char *argv[])
{
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
double rss = -80; // -dBm
uint32_t packetSize = 1000; // bytes
uint32_t numPackets = 1;
--- a/examples/wireless/wifi-simple-infra.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-simple-infra.cc Wed Jun 16 10:55:13 2010 +0100
@@ -92,7 +92,7 @@
int main (int argc, char *argv[])
{
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
double rss = -80; // -dBm
uint32_t packetSize = 1000; // bytes
uint32_t numPackets = 1;
--- a/examples/wireless/wifi-simple-interference.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/examples/wireless/wifi-simple-interference.cc Wed Jun 16 10:55:13 2010 +0100
@@ -125,7 +125,7 @@
{
// LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL);
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
double Prss = -80; // -dBm
double Irss = -95; // -dBm
double delta = 0; // microseconds
--- a/src/devices/wifi/constant-rate-wifi-manager.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/constant-rate-wifi-manager.cc Wed Jun 16 10:55:13 2010 +0100
@@ -34,11 +34,11 @@
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<ConstantRateWifiManager> ()
.AddAttribute ("DataMode", "The transmission mode to use for every data packet transmission",
- StringValue ("wifia-6mbs"),
+ StringValue ("OfdmRate6Mbps"),
MakeWifiModeAccessor (&ConstantRateWifiManager::m_dataMode),
MakeWifiModeChecker ())
.AddAttribute ("ControlMode", "The transmission mode to use for every control packet transmission.",
- StringValue ("wifia-6mbs"),
+ StringValue ("OfdmRate6Mbps"),
MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
MakeWifiModeChecker ())
;
--- a/src/devices/wifi/interference-helper-tx-duration-test.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/interference-helper-tx-duration-test.cc Wed Jun 16 10:55:13 2010 +0100
@@ -115,63 +115,63 @@
bool retval = true;
// IEEE Std 802.11-2007 Table 18-2 "Example of LENGTH calculations for CCK"
- retval = retval
- && CheckPayloadDuration (1023, WifiPhy::Get11mbb (), 744)
- && CheckPayloadDuration (1024, WifiPhy::Get11mbb (), 745)
- && CheckPayloadDuration (1025, WifiPhy::Get11mbb (), 746)
- && CheckPayloadDuration (1026, WifiPhy::Get11mbb (), 747);
+ retval = retval
+ && CheckPayloadDuration (1023, WifiPhy::GetDsssRate11Mbps (), 744)
+ && CheckPayloadDuration (1024, WifiPhy::GetDsssRate11Mbps (), 745)
+ && CheckPayloadDuration (1025, WifiPhy::GetDsssRate11Mbps (), 746)
+ && CheckPayloadDuration (1026, WifiPhy::GetDsssRate11Mbps (), 747);
// Similar, but we add PLCP preamble and header durations
// and we test different rates.
// The payload durations for modes other than 11mbb have been
// calculated by hand according to IEEE Std 802.11-2007 18.2.3.5
- retval = retval
- && CheckTxDuration (1023, WifiPhy::Get11mbb (), WIFI_PREAMBLE_SHORT, 744 + 96)
- && CheckTxDuration (1024, WifiPhy::Get11mbb (), WIFI_PREAMBLE_SHORT, 745 + 96)
- && CheckTxDuration (1025, WifiPhy::Get11mbb (), WIFI_PREAMBLE_SHORT, 746 + 96)
- && CheckTxDuration (1026, WifiPhy::Get11mbb (), WIFI_PREAMBLE_SHORT, 747 + 96)
- && CheckTxDuration (1023, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 744 + 192)
- && CheckTxDuration (1024, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 745 + 192)
- && CheckTxDuration (1025, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 746 + 192)
- && CheckTxDuration (1026, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 747 + 192)
- && CheckTxDuration (1023, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_SHORT, 1488 + 96)
- && CheckTxDuration (1024, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_SHORT, 1490 + 96)
- && CheckTxDuration (1025, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_SHORT, 1491 + 96)
- && CheckTxDuration (1026, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_SHORT, 1493 + 96)
- && CheckTxDuration (1023, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_LONG, 1488 + 192)
- && CheckTxDuration (1024, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_LONG, 1490 + 192)
- && CheckTxDuration (1025, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_LONG, 1491 + 192)
- && CheckTxDuration (1026, WifiPhy::Get5_5mbb (), WIFI_PREAMBLE_LONG, 1493 + 192)
- && CheckTxDuration (1023, WifiPhy::Get2mbb (), WIFI_PREAMBLE_SHORT, 4092 + 96)
- && CheckTxDuration (1024, WifiPhy::Get2mbb (), WIFI_PREAMBLE_SHORT, 4096 + 96)
- && CheckTxDuration (1025, WifiPhy::Get2mbb (), WIFI_PREAMBLE_SHORT, 4100 + 96)
- && CheckTxDuration (1026, WifiPhy::Get2mbb (), WIFI_PREAMBLE_SHORT, 4104 + 96)
- && CheckTxDuration (1023, WifiPhy::Get2mbb (), WIFI_PREAMBLE_LONG, 4092 + 192)
- && CheckTxDuration (1024, WifiPhy::Get2mbb (), WIFI_PREAMBLE_LONG, 4096 + 192)
- && CheckTxDuration (1025, WifiPhy::Get2mbb (), WIFI_PREAMBLE_LONG, 4100 + 192)
- && CheckTxDuration (1026, WifiPhy::Get2mbb (), WIFI_PREAMBLE_LONG, 4104 + 192)
- && CheckTxDuration (1023, WifiPhy::Get1mbb (), WIFI_PREAMBLE_SHORT, 8184 + 96)
- && CheckTxDuration (1024, WifiPhy::Get1mbb (), WIFI_PREAMBLE_SHORT, 8192 + 96)
- && CheckTxDuration (1025, WifiPhy::Get1mbb (), WIFI_PREAMBLE_SHORT, 8200 + 96)
- && CheckTxDuration (1026, WifiPhy::Get1mbb (), WIFI_PREAMBLE_SHORT, 8208 + 96)
- && CheckTxDuration (1023, WifiPhy::Get1mbb (), WIFI_PREAMBLE_LONG, 8184 + 192)
- && CheckTxDuration (1024, WifiPhy::Get1mbb (), WIFI_PREAMBLE_LONG, 8192 + 192)
- && CheckTxDuration (1025, WifiPhy::Get1mbb (), WIFI_PREAMBLE_LONG, 8200 + 192)
- && CheckTxDuration (1026, WifiPhy::Get1mbb (), WIFI_PREAMBLE_LONG, 8208 + 192);
+ retval = retval
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 744 + 96)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 745 + 96)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 746 + 96)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 747 + 96)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 744 + 192)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 745 + 192)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 746 + 192)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 747 + 192)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1488 + 96)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1490 + 96)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1491 + 96)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1493 + 96)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1488 + 192)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1490 + 192)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1491 + 192)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1493 + 192)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4092 + 96)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4096 + 96)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4100 + 96)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4104 + 96)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4092 + 192)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4096 + 192)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4100 + 192)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4104 + 192)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8184 + 96)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8192 + 96)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8200 + 96)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8208 + 96)
+ && CheckTxDuration (1023, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8184 + 192)
+ && CheckTxDuration (1024, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8192 + 192)
+ && CheckTxDuration (1025, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8200 + 192)
+ && CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8208 + 192);
// values from http://mailman.isi.edu/pipermail/ns-developers/2009-July/006226.html
- retval = retval && CheckTxDuration (14, WifiPhy::Get1mbb (), WIFI_PREAMBLE_LONG, 304);
+ retval = retval && CheckTxDuration (14, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 304);
// values from
// http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html
retval = retval
- && CheckTxDuration (1536, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 1310)
- && CheckTxDuration (76, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 248)
- && CheckTxDuration (14, WifiPhy::Get11mbb (), WIFI_PREAMBLE_LONG, 203)
- && CheckTxDuration (1536, WifiPhy::Get54mba (), WIFI_PREAMBLE_LONG, 248)
- && CheckTxDuration (76, WifiPhy::Get54mba (), WIFI_PREAMBLE_LONG, 32)
- && CheckTxDuration (14, WifiPhy::Get54mba (), WIFI_PREAMBLE_LONG, 24);
+ && CheckTxDuration (1536, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 1310)
+ && CheckTxDuration (76, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 248)
+ && CheckTxDuration (14, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 203)
+ && CheckTxDuration (1536, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 248)
+ && CheckTxDuration (76, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 32)
+ && CheckTxDuration (14, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 24);
return (!retval);
}
--- a/src/devices/wifi/interference-helper.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/interference-helper.cc Wed Jun 16 10:55:13 2010 +0100
@@ -229,65 +229,70 @@
WifiMode
InterferenceHelper::GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble)
{
- switch (payloadMode.GetStandard ())
- {
- case WIFI_PHY_STANDARD_holland:
- case WIFI_PHY_STANDARD_80211a:
- // IEEE Std 802.11-2007, 17.3.2
- // actually this is only the first part of the PlcpHeader,
- // because the last 16 bits of the PlcpHeader are using the
- // same mode of the payload
- return WifiPhy::Get6mba ();
-
- case WIFI_PHY_STANDARD_80211b:
- if (preamble == WIFI_PREAMBLE_LONG)
- {
- // IEEE Std 802.11-2007, sections 15.2.3 and 18.2.2.1
- return WifiPhy::Get1mbb ();
- }
- else // WIFI_PREAMBLE_SHORT
- {
- // IEEE Std 802.11-2007, section 18.2.2.2
- return WifiPhy::Get2mbb ();
- }
-
- case WIFI_PHY_STANDARD_80211_10Mhz:
- return WifiPhy::Get3mb10Mhz ();
-
- case WIFI_PHY_STANDARD_80211_5Mhz:
- return WifiPhy::Get1_5mb5Mhz ();
-
- default:
- NS_FATAL_ERROR("unknown standard");
- return WifiMode ();
- }
+ switch (payloadMode.GetModulationClass ())
+ {
+ case WIFI_MOD_CLASS_OFDM:
+ {
+ switch (payloadMode.GetBandwidth ()) {
+ case 5000000:
+ return WifiPhy::GetOfdmRate1_5MbpsBW5MHz ();
+ case 10000000:
+ return WifiPhy::GetOfdmRate3MbpsBW10MHz ();
+ default:
+ // IEEE Std 802.11-2007, 17.3.2
+ // actually this is only the first part of the PlcpHeader,
+ // because the last 16 bits of the PlcpHeader are using the
+ // same mode of the payload
+ return WifiPhy::GetOfdmRate6Mbps ();
+ }
+ }
+
+ case WIFI_MOD_CLASS_DSSS:
+ if (preamble == WIFI_PREAMBLE_LONG)
+ {
+ // IEEE Std 802.11-2007, sections 15.2.3 and 18.2.2.1
+ return WifiPhy::GetDsssRate1Mbps ();
+ }
+ else // WIFI_PREAMBLE_SHORT
+ {
+ // IEEE Std 802.11-2007, section 18.2.2.2
+ return WifiPhy::GetDsssRate2Mbps ();
+ }
+
+ default:
+ NS_FATAL_ERROR("unsupported modulation class");
+ return WifiMode ();
+ }
}
uint32_t
InterferenceHelper::GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble)
{
- switch (payloadMode.GetStandard ())
+ switch (payloadMode.GetModulationClass ())
{
- case WIFI_PHY_STANDARD_holland:
- case WIFI_PHY_STANDARD_80211a:
- // IEEE Std 802.11-2007, section 17.3.3 and figure 17-4
- // also section 17.3.2.3, table 17-4
- // We return the duration of the SIGNAL field only, since the
- // SERVICE field (which strictly speaking belongs to the PLCP
- // header, see section 17.3.2 and figure 17-1) is sent using the
- // payload mode.
- return 4;
-
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
- return 8;
-
- case WIFI_PHY_STANDARD_80211_5Mhz:
- // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
- return 16;
+ case WIFI_MOD_CLASS_OFDM:
+ {
+ switch (payloadMode.GetBandwidth ()) {
+ case 20000000:
+ default:
+ // IEEE Std 802.11-2007, section 17.3.3 and figure 17-4
+ // also section 17.3.2.3, table 17-4
+ // We return the duration of the SIGNAL field only, since the
+ // SERVICE field (which strictly speaking belongs to the PLCP
+ // header, see section 17.3.2 and figure 17-1) is sent using the
+ // payload mode.
+ return 4;
+ case 10000000:
+ // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
+ return 8;
+ case 5000000:
+ // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
+ return 16;
+ }
+ }
- case WIFI_PHY_STANDARD_80211b:
- if (preamble == WIFI_PREAMBLE_SHORT)
+ case WIFI_MOD_CLASS_DSSS:
+ if (preamble == WIFI_PREAMBLE_SHORT)
{
// IEEE Std 802.11-2007, section 18.2.2.2 and figure 18-2
return 24;
@@ -296,37 +301,39 @@
{
// IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
return 48;
- }
-
+ }
+
default:
- NS_FATAL_ERROR("unknown standard");
+ NS_FATAL_ERROR("unsupported modulation class");
return 0;
}
-
}
uint32_t
InterferenceHelper::GetPlcpPreambleDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble)
{
- switch (payloadMode.GetStandard ())
+ switch (payloadMode.GetModulationClass ())
{
- case WIFI_PHY_STANDARD_holland:
- case WIFI_PHY_STANDARD_80211a:
- // IEEE Std 802.11-2007, section 17.3.3, figure 17-4
- // also section 17.3.2.3, table 17-4
- return 16;
-
- case WIFI_PHY_STANDARD_80211_10Mhz:
- // IEEE Std 802.11-2007, section 17.3.3, table 17-4
- // also section 17.3.2.3, table 17-4
- return 32;
-
- case WIFI_PHY_STANDARD_80211_5Mhz:
- // IEEE Std 802.11-2007, section 17.3.3
- // also section 17.3.2.3, table 17-4
- return 64;
+ case WIFI_MOD_CLASS_OFDM:
+ {
+ switch (payloadMode.GetBandwidth ()) {
+ case 20000000:
+ default:
+ // IEEE Std 802.11-2007, section 17.3.3, figure 17-4
+ // also section 17.3.2.3, table 17-4
+ return 16;
+ case 10000000:
+ // IEEE Std 802.11-2007, section 17.3.3, table 17-4
+ // also section 17.3.2.3, table 17-4
+ return 32;
+ case 5000000:
+ // IEEE Std 802.11-2007, section 17.3.3
+ // also section 17.3.2.3, table 17-4
+ return 64;
+ }
+ }
- case WIFI_PHY_STANDARD_80211b:
+ case WIFI_MOD_CLASS_DSSS:
if (preamble == WIFI_PREAMBLE_SHORT)
{
// IEEE Std 802.11-2007, section 18.2.2.2 and figure 18-2
@@ -337,9 +344,9 @@
// IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
return 144;
}
-
+
default:
- NS_FATAL_ERROR("unknown standard");
+ NS_FATAL_ERROR("unsupported modulation class");
return 0;
}
}
@@ -348,48 +355,39 @@
InterferenceHelper::GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode)
{
NS_LOG_FUNCTION(size << payloadMode);
- switch (payloadMode.GetStandard ())
+
+ switch (payloadMode.GetModulationClass ())
{
- case WIFI_PHY_STANDARD_80211a:
- case WIFI_PHY_STANDARD_holland:
- case WIFI_PHY_STANDARD_80211_10Mhz:
- case WIFI_PHY_STANDARD_80211_5Mhz:
+ case WIFI_MOD_CLASS_OFDM:
{
// IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
// corresponds to T_{SYM} in the table
- uint32_t symbolDurationUs;
- switch (payloadMode.GetStandard ())
- {
- case WIFI_PHY_STANDARD_holland:
- case WIFI_PHY_STANDARD_80211a:
- symbolDurationUs = 4;
- break;
- case WIFI_PHY_STANDARD_80211_10Mhz:
- symbolDurationUs = 8;
- break;
- case WIFI_PHY_STANDARD_80211_5Mhz:
- symbolDurationUs = 16;
- break;
- case WIFI_PHY_STANDARD_80211b:
- NS_FATAL_ERROR("can't happen here");
- symbolDurationUs = 0; // quiet compiler
- break;
- default:
- NS_FATAL_ERROR("unknown standard");
- symbolDurationUs = 0; // quiet compiler
- break;
- }
-
+ uint32_t symbolDurationUs;
+
+ switch (payloadMode.GetBandwidth ()) {
+ case 20000000:
+ default:
+ symbolDurationUs = 4;
+ break;
+ case 10000000:
+ symbolDurationUs = 8;
+ break;
+ case 5000000:
+ symbolDurationUs = 16;
+ break;
+ }
+
// IEEE Std 802.11-2007, section 17.3.2.2, table 17-3
// corresponds to N_{DBPS} in the table
double numDataBitsPerSymbol = payloadMode.GetDataRate () * symbolDurationUs / 1e6;
// IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11)
uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0)/numDataBitsPerSymbol));
-
+
return numSymbols*symbolDurationUs;
}
- case WIFI_PHY_STANDARD_80211b:
+
+ case WIFI_MOD_CLASS_DSSS:
// IEEE Std 802.11-2007, section 18.2.3.5
NS_LOG_LOGIC(" size=" << size
<< " mode=" << payloadMode
@@ -397,7 +395,7 @@
return lrint(ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)));
default:
- NS_FATAL_ERROR("unknown standard");
+ NS_FATAL_ERROR("unsupported modulation class");
return 0;
}
}
--- a/src/devices/wifi/nist-error-rate-model.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/nist-error-rate-model.cc Wed Jun 16 10:55:13 2010 +0100
@@ -190,77 +190,90 @@
double
NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
{
- if (mode == WifiPhy::Get6mba () || mode == WifiPhy::Get3mb10Mhz () || mode == WifiPhy::Get1_5mb5Mhz ())
- {
- return GetFecBpskBer (snr,
- nbits,
- 1 // b value
- );
- }
- else if (mode == WifiPhy::Get9mba () || mode == WifiPhy::Get4_5mb10Mhz () || mode == WifiPhy::Get2_25mb5Mhz ())
- {
- return GetFecBpskBer (snr,
- nbits,
- 3 // b value
- );
- }
- else if (mode == WifiPhy::Get12mba () || mode == WifiPhy::Get6mb10Mhz () || mode == WifiPhy::Get3mb5Mhz ())
+ if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
{
- return GetFecQpskBer (snr,
- nbits,
- 1 // b value
- );
- }
- else if (mode == WifiPhy::Get18mba () || mode == WifiPhy::Get9mb10Mhz () || mode == WifiPhy::Get4_5mb5Mhz ())
- {
- return GetFecQpskBer (snr,
- nbits,
- 3 // b value
- );
- }
- else if (mode == WifiPhy::Get24mba () || mode == WifiPhy::Get12mb10Mhz () || mode == WifiPhy::Get6mb5Mhz ())
- {
- return GetFec16QamBer (snr,
- nbits,
- 1 // b value
- );
+ if (mode.GetConstellationSize () == 2)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+ {
+ return GetFecBpskBer (snr,
+ nbits,
+ 1 // b value
+ );
+ }
+ else
+ {
+ return GetFecBpskBer (snr,
+ nbits,
+ 3 // b value
+ );
+ }
+ }
+ else if (mode.GetConstellationSize () == 4)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+ {
+ return GetFecQpskBer (snr,
+ nbits,
+ 1 // b value
+ );
+ }
+ else
+ {
+ return GetFecQpskBer (snr,
+ nbits,
+ 3 // b value
+ );
+ }
+ }
+ else if (mode.GetConstellationSize () == 16)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+ {
+ return GetFec16QamBer (snr,
+ nbits,
+ 1 // b value
+ );
+ }
+ else
+ {
+ return GetFec16QamBer (snr,
+ nbits,
+ 3 // b value
+ );
+ }
+ }
+ else if (mode.GetConstellationSize () == 64)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_2_3)
+ {
+ return GetFec64QamBer (snr,
+ nbits,
+ 2 // b value
+ );
+ }
+ else
+ {
+ return GetFec64QamBer (snr,
+ nbits,
+ 3 // b value
+ );
+ }
+ }
}
- else if (mode == WifiPhy::Get36mba () || mode == WifiPhy::Get18mb10Mhz () || mode == WifiPhy::Get9mb5Mhz ())
- {
- return GetFec16QamBer (snr,
- nbits,
- 3 // b value
- );
- }
- else if (mode == WifiPhy::Get48mba () || mode == WifiPhy::Get24mb10Mhz () || mode == WifiPhy::Get12mb5Mhz ())
- {
- return GetFec64QamBer (snr,
- nbits,
- 2 // b value
- );
- }
- else if (mode == WifiPhy::Get54mba () || mode == WifiPhy::Get27mb10Mhz () || mode == WifiPhy::Get13_5mb5Mhz ())
+ else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS)
{
- return GetFec64QamBer (snr,
- nbits,
- 3 // b value
- );
- }
- else if (mode == WifiPhy::Get1mbb ())
- {
- return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr,nbits);
- }
- else if (mode == WifiPhy::Get2mbb ())
- {
- return DsssErrorRateModel::GetDsssDqpskSuccessRate (snr,nbits);
- }
- else if (mode == WifiPhy::Get5_5mbb ())
- {
- return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr,nbits);
- }
- else if (mode == WifiPhy::Get11mbb ())
- {
- return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr,nbits);
+ switch (mode.GetDataRate ())
+ {
+ case 1000000:
+ return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr, nbits);
+ case 2000000:
+ return DsssErrorRateModel::GetDsssDqpskSuccessRate (snr, nbits);
+ case 5500000:
+ return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr, nbits);
+ case 11000000:
+ return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr, nbits);
+ }
}
return 0;
}
--- a/src/devices/wifi/wifi-mode.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/wifi-mode.cc Wed Jun 16 10:55:13 2010 +0100
@@ -18,7 +18,9 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "wifi-mode.h"
+#include "ns3/simulator.h"
#include "ns3/assert.h"
+#include "ns3/log.h"
namespace ns3 {
@@ -35,10 +37,7 @@
{
std::string str;
is >> str;
- if (!WifiModeFactory::GetFactory ()->Search (str, &mode))
- {
- is.setstate (std::ios_base::badbit);
- }
+ mode = WifiModeFactory::GetFactory ()->Search (str);
return is;
}
@@ -60,23 +59,11 @@
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->dataRate;
}
-bool
-WifiMode::IsModulationBpsk (void) const
+enum WifiCodeRate
+WifiMode::GetCodeRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
- return item->modulation == WifiMode::BPSK;
-}
-bool
-WifiMode::IsModulationQam (void) const
-{
- struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
- return item->modulation == WifiMode::QAM;
-}
-enum WifiMode::ModulationType
-WifiMode::GetModulationType (void) const
-{
- struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
- return item->modulation;
+ return item->codingRate;
}
uint8_t
WifiMode::GetConstellationSize (void) const
@@ -102,11 +89,11 @@
{
return m_uid;
}
-enum WifiPhyStandard
-WifiMode::GetStandard () const
+enum WifiModulationClass
+WifiMode::GetModulationClass () const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
- return item->standard;
+ return item->modClass;
}
WifiMode::WifiMode ()
: m_uid (0)
@@ -116,10 +103,7 @@
{}
WifiMode::WifiMode (std::string name)
{
- if (!WifiModeFactory::GetFactory ()->Search (name, this))
- {
- NS_FATAL_ERROR ("Invalid requested wifi mode: " << name);
- }
+ *this = WifiModeFactory::GetFactory ()->Search (name);
}
ATTRIBUTE_HELPER_CPP (WifiMode);
@@ -127,130 +111,96 @@
WifiModeFactory::WifiModeFactory ()
{}
-WifiMode
-WifiModeFactory::CreateBpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard)
-{
- WifiModeFactory *factory = GetFactory ();
- uint32_t uid = factory->AllocateUid (uniqueName);
- WifiModeItem *item = factory->Get (uid);
- item->uniqueUid = uniqueName;
- item->bandwidth = bandwidth;
- item->dataRate = dataRate;
- item->phyRate = phyRate;
- item->modulation = WifiMode::BPSK;
- item->constellationSize = 2;
- item->isMandatory = isMandatory;
- item->standard = standard;
- return WifiMode (uid);
-}
WifiMode
-WifiModeFactory::CreateQpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard)
-{
- WifiModeFactory *factory = GetFactory ();
- uint32_t uid = factory->AllocateUid (uniqueName);
- WifiModeItem *item = factory->Get (uid);
- item->uniqueUid = uniqueName;
- item->bandwidth = bandwidth;
- item->dataRate = dataRate;
- item->phyRate = phyRate;
- item->modulation = WifiMode::QPSK;
- item->constellationSize = 4;
- item->isMandatory = isMandatory;
- item->standard = standard;
- return WifiMode (uid);
-}
-
-WifiMode
-WifiModeFactory::CreateQam (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- uint8_t constellationSize,
- enum WifiPhyStandard standard)
+WifiModeFactory::CreateWifiMode (std::string uniqueName,
+ enum WifiModulationClass modClass,
+ bool isMandatory,
+ uint32_t bandwidth,
+ uint32_t dataRate,
+ enum WifiCodeRate codingRate,
+ uint8_t constellationSize)
{
WifiModeFactory *factory = GetFactory ();
uint32_t uid = factory->AllocateUid (uniqueName);
WifiModeItem *item = factory->Get (uid);
item->uniqueUid = uniqueName;
- item->bandwidth = bandwidth;
- item->dataRate = dataRate;
- item->phyRate = phyRate;
- item->modulation = WifiMode::QAM;
- item->constellationSize = constellationSize;
- item->isMandatory = isMandatory;
- item->standard = standard;
- return WifiMode (uid);
-}
-WifiMode
-WifiModeFactory::CreateDbpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard)
-{
- WifiModeFactory *factory = GetFactory ();
- uint32_t uid = factory->AllocateUid (uniqueName);
- WifiModeItem *item = factory->Get (uid);
- item->uniqueUid = uniqueName;
+ item->modClass = modClass;
+ // The modulation class for this WifiMode must be valid.
+ NS_ASSERT (modClass != WIFI_MOD_CLASS_UNKNOWN);
+
item->bandwidth = bandwidth;
item->dataRate = dataRate;
- item->phyRate = phyRate;
- item->modulation = WifiMode::DBPSK;
- item->constellationSize = 2;
+
+ item->codingRate = codingRate;
+
+ switch (codingRate) {
+ case WIFI_CODE_RATE_3_4:
+ item->phyRate = dataRate * 4 / 3;
+ break;
+ case WIFI_CODE_RATE_2_3:
+ item->phyRate = dataRate * 3 / 2;
+ break;
+ case WIFI_CODE_RATE_1_2:
+ item->phyRate = dataRate * 2 / 1;
+ break;
+ case WIFI_CODE_RATE_UNDEFINED:
+ default:
+ item->phyRate = dataRate;
+ break;
+ }
+
+ // Check for compatibility between modulation class and coding
+ // rate. If modulation class is DSSS then coding rate must be
+ // undefined, and vice versa. I could have done this with an
+ // assertion, but it seems better to always give the error (i.e.,
+ // not only in non-optimised builds) and the cycles that extra test
+ // here costs are only suffered at simulation setup.
+ if ((codingRate == WIFI_CODE_RATE_UNDEFINED) != (modClass == WIFI_MOD_CLASS_DSSS))
+ {
+ NS_FATAL_ERROR ("Error in creation of WifiMode named " << uniqueName << std::endl
+ << "Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS");
+ }
+
+ item->constellationSize = constellationSize;
item->isMandatory = isMandatory;
- item->standard = standard;
+
return WifiMode (uid);
}
-WifiMode
-WifiModeFactory::CreateDqpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard)
+
+WifiMode
+WifiModeFactory::Search (std::string name)
{
- WifiModeFactory *factory = GetFactory ();
- uint32_t uid = factory->AllocateUid (uniqueName);
- WifiModeItem *item = factory->Get (uid);
- item->uniqueUid = uniqueName;
- item->bandwidth = bandwidth;
- item->dataRate = dataRate;
- item->phyRate = phyRate;
- item->modulation = WifiMode::DQPSK;
- item->constellationSize = 4;
- item->isMandatory = isMandatory;
- item->standard = standard;
- return WifiMode (uid);
-}
-bool
-WifiModeFactory::Search (std::string name, WifiMode *mode)
-{
+ WifiModeItemList::const_iterator i;
uint32_t j = 0;
- for (WifiModeItemList::const_iterator i = m_itemList.begin ();
- i != m_itemList.end (); i++)
+ for (i = m_itemList.begin (); i != m_itemList.end (); i++)
{
if (i->uniqueUid == name)
{
- *mode = WifiMode (j);
- return true;
+ return WifiMode (j);
}
j++;
}
- *mode = WifiMode (0);
- return false;
+
+ // If we get here then a matching WifiMode was not found above. This
+ // is a fatal problem, but we try to be helpful by displaying the
+ // list of WifiModes that are supported.
+ NS_LOG_UNCOND ("Could not find match for WifiMode named \""
+ << name << "\". Valid options are:");
+ for (i = m_itemList.begin (); i != m_itemList.end (); i++)
+ {
+ NS_LOG_UNCOND (" " << i->uniqueUid);
+ }
+ // Empty fatal error to die. We've already unconditionally logged
+ // the helpful information.
+ NS_FATAL_ERROR ("");
+
+ // This next line is unreachable because of the fatal error
+ // immediately above, and that is fortunate, because we have no idea
+ // what is in WifiMode (0), but we do know it is not what our caller
+ // has requested by name. It's here only because it's the safest
+ // thing that'll give valid code.
+ return WifiMode (0);
}
uint32_t
@@ -291,10 +241,10 @@
item->bandwidth = 0;
item->dataRate = 0;
item->phyRate = 0;
- item->modulation = WifiMode::UNKNOWN;
+ item->modClass = WIFI_MOD_CLASS_UNKNOWN;
item->constellationSize = 0;
+ item->codingRate = WIFI_CODE_RATE_UNDEFINED;
item->isMandatory = false;
- item->standard = WIFI_PHY_UNKNOWN;
isFirstTime = false;
}
return &factory;
--- a/src/devices/wifi/wifi-mode.h Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/wifi-mode.h Wed Jun 16 10:55:13 2010 +0100
@@ -30,6 +30,51 @@
namespace ns3 {
/**
+ * This enumeration defines the modulation classes per IEEE
+ * 802.11-2007, Section 9.6.1, Table 9-2.
+ */
+enum WifiModulationClass {
+ /** Modulation class unknown or unspecified. A WifiMode with this
+ WifiModulationClass has not been properly initialised. */
+ WIFI_MOD_CLASS_UNKNOWN = 0,
+ /** Infrared (IR) (Clause 16) */
+ WIFI_MOD_CLASS_IR,
+ /** Frequency-hopping spread spectrum (FHSS) PHY (Clause 14) */
+ WIFI_MOD_CLASS_FHSS,
+ /** DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18) */
+ WIFI_MOD_CLASS_DSSS,
+ /** ERP-PBCC PHY (19.6) */
+ WIFI_MOD_CLASS_ERP_PBCC,
+ /** DSSS-OFDM PHY (19.7) */
+ WIFI_MOD_CLASS_DSSS_OFDM,
+ /** ERP-OFDM PHY (19.5) */
+ WIFI_MOD_CLASS_ERP_OFDM,
+ /** OFDM PHY (Clause 17) */
+ WIFI_MOD_CLASS_OFDM,
+ /** HT PHY (Clause 20) */
+ WIFI_MOD_CLASS_HT
+};
+
+
+/**
+ * This enumeration defines the various convolutional coding rates
+ * used for the OFDM transmission modes in the IEEE 802.11
+ * standard. DSSS (for example) rates which do not have an explicit
+ * coding stage in their generation should have this parameter set to
+ * WIFI_CODE_RATE_UNDEFINED.
+ */
+enum WifiCodeRate {
+ /** No explicit coding (e.g., DSSS rates) */
+ WIFI_CODE_RATE_UNDEFINED,
+ /** Rate 3/4 */
+ WIFI_CODE_RATE_3_4,
+ /** Rate 2/3 */
+ WIFI_CODE_RATE_2_3,
+ /** Rate 1/2 */
+ WIFI_CODE_RATE_1_2
+};
+
+/**
* \brief represent a single transmission mode
*
* A WifiMode is implemented by a single integer which is used
@@ -40,15 +85,6 @@
class WifiMode
{
public:
- enum ModulationType {
- BPSK,
- QPSK,
- DBPSK,
- DQPSK,
- QAM,
- UNKNOWN
- };
-
/**
* \returns the number of Hz used by this signal
*/
@@ -65,19 +101,9 @@
*/
uint32_t GetDataRate (void) const;
/**
- * \returns true if this mode uses a bpsk modulation, false
- * otherwise.
+ * \returns the coding rate of this transmission mode
*/
- bool IsModulationBpsk (void) const;
- /**
- * \returns true if this mode uses a qam modulation, false
- * otherwise.
- */
- bool IsModulationQam (void) const;
- /**
- * \returns the type of modulation used by this mode.
- */
- enum ModulationType GetModulationType (void) const;
+ enum WifiCodeRate GetCodeRate (void) const;
/**
* \returns the size of the modulation constellation.
*/
@@ -104,11 +130,12 @@
*/
uint32_t GetUid (void) const;
- /**
- *
- * @return the WifiPhyStandard to which the WifiMode belongs
+ /**
+ *
+ * \returns the Modulation Class (see IEEE 802.11-2007 Section
+ * 9.6.1) to which this WifiMode belongs.
*/
- enum WifiPhyStandard GetStandard () const;
+ enum WifiModulationClass GetModulationClass () const;
/**
* Create an invalid WifiMode. Calling any method on the
@@ -146,102 +173,29 @@
public:
/**
* \param uniqueName the name of the associated WifiMode. This name
- * must be unique across _all_ instances.
- * \param isMandatory true if this WifiMode is mandatory, false otherwise.
- * \param bandwidth the bandwidth (Hz) of the signal generated when the
- * associated WifiMode is used.
- * \param dataRate the rate (bits/second) at which the user data is transmitted
- * \param phyRate the rate (bits/second) at which the encoded user data is transmitted
- * \param standard the Wifi Phy standard to apply
- * The phyRate includes FEC so, is typically higher than the dataRate.
- *
- * Create a BPSK WifiMode.
- */
- static WifiMode CreateBpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard);
- /**
- * \param uniqueName the name of the associated WifiMode. This name
- * must be unique across _all_ instances.
- * \param isMandatory true if this WifiMode is mandatory, false otherwise.
- * \param bandwidth the bandwidth (Hz) of the signal generated when the
- * associated WifiMode is used.
- * \param dataRate the rate (bits/second) at which the user data is transmitted
- * \param phyRate the rate (bits/second) at which the encoded user data is transmitted
- * \param standard the Wifi Phy standard to apply
- * The phyRate includes FEC so, is typically higher than the dataRate.
- *
- * Create a QPSK WifiMode.
- */
- static WifiMode CreateQpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard);
- /**
- * \param uniqueName the name of the associated WifiMode. This name
- * must be unique across _all_ instances.
+ * must be unique accross _all_ instances.
+ * \param modClass the class of modulation
* \param isMandatory true if this WifiMode is mandatory, false otherwise.
* \param bandwidth the bandwidth (Hz) of the signal generated when the
* associated WifiMode is used.
* \param dataRate the rate (bits/second) at which the user data is transmitted
- * \param phyRate the rate (bits/second) at which the encoded user data is transmitted
- * The phyRate includes FEC so, is typically higher than the dataRate.
- * \param constellationSize the number of elements included in the QAM constellation.
- * \param standard the Wifi Phy standard to apply
- *
- * Create a QAM WifiMode.
- */
- static WifiMode CreateQam (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- uint8_t constellationSize,
- enum WifiPhyStandard standard);
-
- /**
- * \param uniqueName the name of the associated WifiMode. This name
- * must be unique across _all_ instances.
- * \param isMandatory true if this WifiMode is mandatory, false otherwise.
- * \param bandwidth the bandwidth (Hz) of the signal generated when the
- * associated WifiMode is used.
- * \param dataRate the rate (bits/second) at which the user data is transmitted
- * \param phyRate the rate (bits/second) at which the encoded user data is transmitted
- * \param standard the Wifi Phy standard to apply
- * The phyRate includes FEC so, is typically higher than the dataRate.
+ * \param codingRate if convolutional coding is used for this rate
+ * then this parameter specifies the convolutional coding rate
+ * used. If there is no explicit convolutional coding step (e.g.,
+ * for DSSS rates) then the caller should set this parameter to
+ * WIFI_CODE_RATE_UNCODED.
+ * \param constellationSize the order of the constellation used.
*
- * Create a DBPSK WifiMode.
+ * Create a WifiMode.
*/
- static WifiMode CreateDbpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard);
- /**
- * \param uniqueName the name of the associated WifiMode. This name
- * must be unique across _all_ instances.
- * \param isMandatory true if this WifiMode is mandatory, false otherwise.
- * \param bandwidth the bandwidth (Hz) of the signal generated when the
- * associated WifiMode is used.
- * \param dataRate the rate (bits/second) at which the user data is transmitted
- * \param phyRate the rate (bits/second) at which the encoded user data is transmitted
- * \param standard the Wifi Phy standard to apply
- * The phyRate includes FEC so, is typically higher than the dataRate.
- *
- * Create a DQPSK WifiMode.
- */
- static WifiMode CreateDqpsk (std::string uniqueName,
- bool isMandatory,
- uint32_t bandwidth,
- uint32_t dataRate,
- uint32_t phyRate,
- enum WifiPhyStandard standard);
+ static WifiMode CreateWifiMode (std::string uniqueName,
+ enum WifiModulationClass modClass,
+ bool isMandatory,
+ uint32_t bandwidth,
+ uint32_t dataRate,
+ enum WifiCodeRate codingRate,
+ uint8_t constellationSize);
+
private:
friend class WifiMode;
friend std::istream & operator >> (std::istream &is, WifiMode &mode);
@@ -258,13 +212,13 @@
uint32_t bandwidth;
uint32_t dataRate;
uint32_t phyRate;
- enum WifiMode::ModulationType modulation;
+ enum WifiModulationClass modClass;
uint8_t constellationSize;
+ enum WifiCodeRate codingRate;
bool isMandatory;
- enum WifiPhyStandard standard;
};
- bool Search (std::string name, WifiMode *mode);
+ WifiMode Search (std::string name);
uint32_t AllocateUid (std::string uniqueName);
WifiModeItem *Get (uint32_t uid);
--- a/src/devices/wifi/wifi-phy-test.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/wifi-phy-test.cc Wed Jun 16 10:55:13 2010 +0100
@@ -82,7 +82,7 @@
{}
PsrExperiment::Input::Input ()
: distance (5.0),
- txMode ("wifia-6mbs"),
+ txMode ("OfdmRate6Mbps"),
txPowerLevel (0),
packetSize (2304),
nPackets (400)
@@ -202,8 +202,8 @@
: interval (MicroSeconds (0)),
xA (-5),
xB (5),
- txModeA ("wifia-6mbs"),
- txModeB ("wifia-6mbs"),
+ txModeA ("OfdmRate6Mbps"),
+ txModeB ("OfdmRate6Mbps"),
txPowerLevelA (0),
txPowerLevelB (0),
packetSizeA (2304),
@@ -310,35 +310,35 @@
PsrExperiment experiment;
struct PsrExperiment::Output output;
- input.txMode = "wifia-6mbs";
+ input.txMode = "OfdmRate6Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-9mbs";
+ input.txMode = "OfdmRate9Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-12mbs";
+ input.txMode = "OfdmRate12Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-18mbs";
+ input.txMode = "OfdmRate18Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-24mbs";
+ input.txMode = "OfdmRate24Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-36mbs";
+ input.txMode = "OfdmRate36Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-48mbs";
+ input.txMode = "OfdmRate48Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
- input.txMode = "wifia-54mbs";
+ input.txMode = "OfdmRate54Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
--- a/src/devices/wifi/wifi-phy.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/wifi-phy.cc Wed Jun 16 10:55:13 2010 +0100
@@ -93,85 +93,6 @@
NS_LOG_FUNCTION (this);
}
-WifiMode
-WifiPhy::Get6mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifia-6mbs",
- true,
- 20000000, 6000000, 12000000,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-WifiMode
-WifiPhy::Get9mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifia-9mbs",
- false,
- 20000000, 9000000, 12000000,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-WifiMode
-WifiPhy::Get12mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateQpsk ("wifia-12mbs",
- true,
- 20000000, 12000000, 24000000,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-WifiMode
-WifiPhy::Get18mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateQpsk ("wifia-18mbs",
- false,
- 20000000, 18000000, 24000000,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-WifiMode
-WifiPhy::Get24mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateQam ("wifia-24mbs",
- true,
- 20000000, 24000000, 48000000,
- 16,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-WifiMode
-WifiPhy::Get36mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateQam ("wifia-36mbs",
- false,
- 20000000, 36000000, 48000000,
- 16,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-
-WifiMode
-WifiPhy::Get48mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateQam ("wifia-48mbs",
- false,
- 20000000, 48000000, 72000000,
- 64,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-
-WifiMode
-WifiPhy::Get54mba (void)
-{
- static WifiMode mode = WifiModeFactory::CreateQam ("wifia-54mbs",
- false,
- 20000000, 54000000, 72000000,
- 64,
- WIFI_PHY_STANDARD_80211a);
- return mode;
-}
-
void
WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
{
@@ -220,203 +141,382 @@
m_phyPromiscSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble);
}
-WifiMode
-WifiPhy::Get1mbb (void)
+
+/**
+ * Clause 15 rates (DSSS)
+ */
+
+WifiMode
+WifiPhy::GetDsssRate1Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateDbpsk ("wifib-1mbs",
- true,
- 22000000, 1000000, 1000000,
- WIFI_PHY_STANDARD_80211b);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("DsssRate1Mbps",
+ WIFI_MOD_CLASS_DSSS,
+ true,
+ 22000000, 1000000,
+ WIFI_CODE_RATE_UNDEFINED,
+ 2);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetDsssRate2Mbps ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("DsssRate2Mbps",
+ WIFI_MOD_CLASS_DSSS,
+ true,
+ 22000000, 2000000,
+ WIFI_CODE_RATE_UNDEFINED,
+ 4);
return mode;
}
-WifiMode
-WifiPhy::Get2mbb (void)
+
+/**
+ * Clause 18 rates (HR/DSSS)
+ */
+WifiMode
+WifiPhy::GetDsssRate5_5Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateDqpsk ("wifib-2mbs",
- true,
- 22000000, 2000000, 2000000,
- WIFI_PHY_STANDARD_80211b);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("DsssRate5_5Mbps",
+ WIFI_MOD_CLASS_DSSS,
+ true,
+ 22000000, 5500000,
+ WIFI_CODE_RATE_UNDEFINED,
+ 4);
return mode;
}
-WifiMode
-WifiPhy::Get5_5mbb (void)
+WifiMode
+WifiPhy::GetDsssRate11Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateDqpsk ("wifib-5.5mbs",
- true,
- 22000000, 5500000, 5500000,
- WIFI_PHY_STANDARD_80211b);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("DsssRate11Mbps",
+ WIFI_MOD_CLASS_DSSS,
+ true,
+ 22000000, 11000000,
+ WIFI_CODE_RATE_UNDEFINED,
+ 4);
return mode;
}
-WifiMode
-WifiPhy::Get11mbb (void)
+
+/**
+ * Clause 17 rates (OFDM)
+ */
+WifiMode
+WifiPhy::GetOfdmRate6Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateDqpsk ("wifib-11mbs",
- true,
- 22000000, 11000000, 11000000,
- WIFI_PHY_STANDARD_80211b);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate6Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 20000000, 6000000,
+ WIFI_CODE_RATE_1_2,
+ 2);
return mode;
}
-WifiMode
-WifiPhy::Get3mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate9Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-3mbs-10Mhz",
- true,
- 10000000, 3000000, 6000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate9Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 20000000, 9000000,
+ WIFI_CODE_RATE_3_4,
+ 2);
return mode;
}
-WifiMode
-WifiPhy::Get4_5mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate12Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-4.5mbs-10Mhz",
- false,
- 10000000, 4500000, 6000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate12Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 20000000, 12000000,
+ WIFI_CODE_RATE_1_2,
+ 4);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetOfdmRate18Mbps ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate18Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 20000000, 18000000,
+ WIFI_CODE_RATE_3_4,
+ 4);
return mode;
}
-WifiMode
-WifiPhy::Get6mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate24Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-6mbs-10Mhz",
- true,
- 10000000, 6000000, 12000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate24Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 20000000, 24000000,
+ WIFI_CODE_RATE_1_2,
+ 16);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetOfdmRate36Mbps ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate36Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 20000000, 36000000,
+ WIFI_CODE_RATE_3_4,
+ 16);
return mode;
}
-WifiMode
-WifiPhy::Get9mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate48Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-9mbs-10Mhz",
- false,
- 10000000, 9000000, 12000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate48Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 20000000, 48000000,
+ WIFI_CODE_RATE_2_3,
+ 64);
return mode;
}
-WifiMode
-WifiPhy::Get12mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate54Mbps ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-12mbs-10Mhz",
- true,
- 10000000, 12000000, 24000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate54Mbps",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 20000000, 54000000,
+ WIFI_CODE_RATE_3_4,
+ 64);
+ return mode;
+}
+
+/* 10 MHz channel rates */
+WifiMode
+WifiPhy::GetOfdmRate3MbpsBW10MHz ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate3MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 10000000, 3000000,
+ WIFI_CODE_RATE_1_2,
+ 2);
return mode;
}
-WifiMode
-WifiPhy::Get18mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate4_5MbpsBW10MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-18mbs-10Mhz",
- false,
- 10000000, 18000000, 24000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate4_5MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 10000000, 4500000,
+ WIFI_CODE_RATE_3_4,
+ 2);
return mode;
}
-WifiMode
-WifiPhy::Get24mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate6MbpsBW10MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-24mbs-10Mhz",
- false,
- 10000000, 24000000, 36000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate6MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 10000000, 6000000,
+ WIFI_CODE_RATE_1_2,
+ 4);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetOfdmRate9MbpsBW10MHz ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate9MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 10000000, 9000000,
+ WIFI_CODE_RATE_3_4,
+ 4);
return mode;
}
-WifiMode
-WifiPhy::Get27mb10Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate12MbpsBW10MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-27mbs-10Mhz",
- false,
- 10000000, 27000000, 36000000,
- WIFI_PHY_STANDARD_80211_10Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate12MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 10000000, 12000000,
+ WIFI_CODE_RATE_1_2,
+ 16);
return mode;
}
-WifiMode
-WifiPhy::Get1_5mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate18MbpsBW10MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-1_5mbs-5Mhz",
- true,
- 5000000, 1500000, 3000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate18MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 10000000, 18000000,
+ WIFI_CODE_RATE_3_4,
+ 16);
return mode;
}
-WifiMode
-WifiPhy::Get2_25mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate24MbpsBW10MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-2.25mbs-5Mhz",
- false,
- 5000000, 2250000, 3000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate24MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 10000000, 24000000,
+ WIFI_CODE_RATE_2_3,
+ 64);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetOfdmRate27MbpsBW10MHz ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate27MbpsBW10MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 10000000, 27000000,
+ WIFI_CODE_RATE_3_4,
+ 64);
return mode;
}
-WifiMode
-WifiPhy::Get3mb5Mhz (void)
+/* 5 MHz channel rates */
+WifiMode
+WifiPhy::GetOfdmRate1_5MbpsBW5MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-3mbs-5Mhz",
- true,
- 5000000, 3000000, 6000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate1_5MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 5000000, 1500000,
+ WIFI_CODE_RATE_1_2,
+ 2);
return mode;
}
-WifiMode
-WifiPhy::Get4_5mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate2_25MbpsBW5MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-4.5mbs-5Mhz",
- false,
- 5000000, 4500000, 6000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate2_25MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 5000000, 2250000,
+ WIFI_CODE_RATE_3_4,
+ 2);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetOfdmRate3MbpsBW5MHz ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate3MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 5000000, 3000000,
+ WIFI_CODE_RATE_1_2,
+ 4);
return mode;
}
-WifiMode
-WifiPhy::Get6mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate4_5MbpsBW5MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-6mbs-5Mhz",
- true,
- 5000000, 6000000, 12000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate4_5MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 5000000, 4500000,
+ WIFI_CODE_RATE_3_4,
+ 4);
+ return mode;
+}
+
+WifiMode
+WifiPhy::GetOfdmRate6MbpsBW5MHz ()
+{
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate6MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ true,
+ 5000000, 6000000,
+ WIFI_CODE_RATE_1_2,
+ 16);
return mode;
}
-WifiMode
-WifiPhy::Get9mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate9MbpsBW5MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-9mbs-5Mhz",
- false,
- 5000000, 9000000, 12000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate9MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 5000000, 9000000,
+ WIFI_CODE_RATE_3_4,
+ 16);
return mode;
}
-WifiMode
-WifiPhy::Get12mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate12MbpsBW5MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-12mbs-5Mhz",
- false,
- 5000000, 12000000, 18000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate12MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 5000000, 12000000,
+ WIFI_CODE_RATE_2_3,
+ 64);
return mode;
}
-WifiMode
-WifiPhy::Get13_5mb5Mhz (void)
+WifiMode
+WifiPhy::GetOfdmRate13_5MbpsBW5MHz ()
{
- static WifiMode mode = WifiModeFactory::CreateBpsk ("wifi-13.5mbs-5Mhz",
- false,
- 5000000, 13500000, 18000000,
- WIFI_PHY_STANDARD_80211_5Mhz);
+ static WifiMode mode =
+ WifiModeFactory::CreateWifiMode ("OfdmRate13_5MbpsBW5MHz",
+ WIFI_MOD_CLASS_OFDM,
+ false,
+ 5000000, 13500000,
+ WIFI_CODE_RATE_3_4,
+ 64);
return mode;
}
@@ -447,34 +547,34 @@
{
public:
Constructor () {
- ns3::WifiPhy::Get6mba ();
- ns3::WifiPhy::Get9mba ();
- ns3::WifiPhy::Get12mba ();
- ns3::WifiPhy::Get18mba ();
- ns3::WifiPhy::Get24mba ();
- ns3::WifiPhy::Get36mba ();
- ns3::WifiPhy::Get48mba ();
- ns3::WifiPhy::Get54mba ();
- ns3::WifiPhy::Get1mbb ();
- ns3::WifiPhy::Get2mbb ();
- ns3::WifiPhy::Get5_5mbb ();
- ns3::WifiPhy::Get11mbb ();
- ns3::WifiPhy::Get3mb10Mhz ();
- ns3::WifiPhy::Get4_5mb10Mhz ();
- ns3::WifiPhy::Get6mb10Mhz ();
- ns3::WifiPhy::Get9mb10Mhz ();
- ns3::WifiPhy::Get12mb10Mhz ();
- ns3::WifiPhy::Get18mb10Mhz ();
- ns3::WifiPhy::Get24mb10Mhz ();
- ns3::WifiPhy::Get27mb10Mhz ();
- ns3::WifiPhy::Get1_5mb5Mhz ();
- ns3::WifiPhy::Get2_25mb5Mhz ();
- ns3::WifiPhy::Get3mb5Mhz ();
- ns3::WifiPhy::Get4_5mb5Mhz ();
- ns3::WifiPhy::Get6mb5Mhz ();
- ns3::WifiPhy::Get9mb5Mhz ();
- ns3::WifiPhy::Get12mb5Mhz ();
- ns3::WifiPhy::Get13_5mb5Mhz ();
+ ns3::WifiPhy::GetDsssRate1Mbps ();
+ ns3::WifiPhy::GetDsssRate2Mbps ();
+ ns3::WifiPhy::GetDsssRate5_5Mbps ();
+ ns3::WifiPhy::GetDsssRate11Mbps ();
+ ns3::WifiPhy::GetOfdmRate6Mbps ();
+ ns3::WifiPhy::GetOfdmRate9Mbps ();
+ ns3::WifiPhy::GetOfdmRate12Mbps ();
+ ns3::WifiPhy::GetOfdmRate18Mbps ();
+ ns3::WifiPhy::GetOfdmRate24Mbps ();
+ ns3::WifiPhy::GetOfdmRate36Mbps ();
+ ns3::WifiPhy::GetOfdmRate48Mbps ();
+ ns3::WifiPhy::GetOfdmRate54Mbps ();
+ ns3::WifiPhy::GetOfdmRate3MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate4_5MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate6MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate9MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate12MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate18MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate24MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate27MbpsBW10MHz ();
+ ns3::WifiPhy::GetOfdmRate1_5MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate2_25MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate3MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate4_5MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate6MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate9MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate12MbpsBW5MHz ();
+ ns3::WifiPhy::GetOfdmRate13_5MbpsBW5MHz ();
}
} g_constructor;
}
--- a/src/devices/wifi/wifi-phy.h Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/wifi-phy.h Wed Jun 16 10:55:13 2010 +0100
@@ -274,34 +274,34 @@
virtual Ptr<WifiChannel> GetChannel (void) const = 0;
- static WifiMode Get6mba (void);
- static WifiMode Get9mba (void);
- static WifiMode Get12mba (void);
- static WifiMode Get18mba (void);
- static WifiMode Get24mba (void);
- static WifiMode Get36mba (void);
- static WifiMode Get48mba (void);
- static WifiMode Get54mba (void);
- static WifiMode Get1mbb (void);
- static WifiMode Get2mbb (void);
- static WifiMode Get5_5mbb (void);
- static WifiMode Get11mbb (void);
- static WifiMode Get3mb10Mhz (void);
- static WifiMode Get4_5mb10Mhz (void);
- static WifiMode Get6mb10Mhz (void);
- static WifiMode Get9mb10Mhz (void);
- static WifiMode Get12mb10Mhz (void);
- static WifiMode Get18mb10Mhz (void);
- static WifiMode Get24mb10Mhz (void);
- static WifiMode Get27mb10Mhz (void);
- static WifiMode Get1_5mb5Mhz (void);
- static WifiMode Get2_25mb5Mhz (void);
- static WifiMode Get3mb5Mhz (void);
- static WifiMode Get4_5mb5Mhz (void);
- static WifiMode Get6mb5Mhz (void);
- static WifiMode Get9mb5Mhz (void);
- static WifiMode Get12mb5Mhz (void);
- static WifiMode Get13_5mb5Mhz (void);
+ static WifiMode GetDsssRate1Mbps ();
+ static WifiMode GetDsssRate2Mbps ();
+ static WifiMode GetDsssRate5_5Mbps ();
+ static WifiMode GetDsssRate11Mbps ();
+ static WifiMode GetOfdmRate6Mbps ();
+ static WifiMode GetOfdmRate9Mbps ();
+ static WifiMode GetOfdmRate12Mbps ();
+ static WifiMode GetOfdmRate18Mbps ();
+ static WifiMode GetOfdmRate24Mbps ();
+ static WifiMode GetOfdmRate36Mbps ();
+ static WifiMode GetOfdmRate48Mbps ();
+ static WifiMode GetOfdmRate54Mbps ();
+ static WifiMode GetOfdmRate3MbpsBW10MHz ();
+ static WifiMode GetOfdmRate4_5MbpsBW10MHz ();
+ static WifiMode GetOfdmRate6MbpsBW10MHz ();
+ static WifiMode GetOfdmRate9MbpsBW10MHz ();
+ static WifiMode GetOfdmRate12MbpsBW10MHz ();
+ static WifiMode GetOfdmRate18MbpsBW10MHz ();
+ static WifiMode GetOfdmRate24MbpsBW10MHz ();
+ static WifiMode GetOfdmRate27MbpsBW10MHz ();
+ static WifiMode GetOfdmRate1_5MbpsBW5MHz ();
+ static WifiMode GetOfdmRate2_25MbpsBW5MHz ();
+ static WifiMode GetOfdmRate3MbpsBW5MHz ();
+ static WifiMode GetOfdmRate4_5MbpsBW5MHz ();
+ static WifiMode GetOfdmRate6MbpsBW5MHz ();
+ static WifiMode GetOfdmRate9MbpsBW5MHz ();
+ static WifiMode GetOfdmRate12MbpsBW5MHz ();
+ static WifiMode GetOfdmRate13_5MbpsBW5MHz ();
/**
--- a/src/devices/wifi/wifi-remote-station-manager.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/wifi-remote-station-manager.cc Wed Jun 16 10:55:13 2010 +0100
@@ -559,7 +559,7 @@
{
if (i->GetPhyRate () > mode.GetPhyRate () &&
i->GetPhyRate () <= reqMode.GetPhyRate () &&
- i->GetModulationType () == reqMode.GetModulationType ())
+ i->GetModulationClass () == reqMode.GetModulationClass ())
{
mode = *i;
}
--- a/src/devices/wifi/yans-error-rate-model.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/yans-error-rate-model.cc Wed Jun 16 10:55:13 2010 +0100
@@ -171,113 +171,126 @@
double
YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
{
- if (mode == WifiPhy::Get6mba () || mode == WifiPhy::Get3mb10Mhz () || mode == WifiPhy::Get1_5mb5Mhz ())
- {
- return GetFecBpskBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 10, // dFree
- 11 // adFree
- );
- }
- else if (mode == WifiPhy::Get9mba () || mode == WifiPhy::Get4_5mb10Mhz () || mode == WifiPhy::Get2_25mb5Mhz ())
- {
- return GetFecBpskBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 5, // dFree
- 8 // adFree
- );
- }
- else if (mode == WifiPhy::Get12mba () || mode == WifiPhy::Get6mb10Mhz () || mode == WifiPhy::Get3mb5Mhz ())
- {
- return GetFecQamBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 4, // m
- 10, // dFree
- 11, // adFree
- 0 // adFreePlusOne
- );
- }
- else if (mode == WifiPhy::Get18mba () || mode == WifiPhy::Get9mb10Mhz () || mode == WifiPhy::Get4_5mb5Mhz ())
- {
- return GetFecQamBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 4, // m
- 5, // dFree
- 8, // adFree
- 31 // adFreePlusOne
- );
- }
- else if (mode == WifiPhy::Get24mba () || mode == WifiPhy::Get12mb10Mhz () || mode == WifiPhy::Get6mb5Mhz ())
+ if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
{
- return GetFecQamBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 16, // m
- 10, // dFree
- 11, // adFree
- 0 // adFreePlusOne
- );
+ if (mode.GetConstellationSize () == 2)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+ {
+ return GetFecBpskBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 10, // dFree
+ 11 // adFree
+ );
+ }
+ else
+ {
+ return GetFecBpskBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 5, // dFree
+ 8 // adFree
+ );
+ }
+ }
+ else if (mode.GetConstellationSize () == 4)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+ {
+ return GetFecQamBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 4, // m
+ 10, // dFree
+ 11, // adFree
+ 0 // adFreePlusOne
+ );
+ }
+ else
+ {
+ return GetFecQamBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 4, // m
+ 5, // dFree
+ 8, // adFree
+ 31 // adFreePlusOne
+ );
+ }
+ }
+ else if (mode.GetConstellationSize () == 16)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
+ {
+ return GetFecQamBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 16, // m
+ 10, // dFree
+ 11, // adFree
+ 0 // adFreePlusOne
+ );
+ }
+ else
+ {
+ return GetFecQamBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 16, // m
+ 5, // dFree
+ 8, // adFree
+ 31 // adFreePlusOne
+ );
+ }
+ }
+ else if (mode.GetConstellationSize () == 64)
+ {
+ if (mode.GetCodeRate () == WIFI_CODE_RATE_2_3)
+ {
+ return GetFecQamBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 64, // m
+ 6, // dFree
+ 1, // adFree
+ 16 // adFreePlusOne
+ );
+ }
+ else
+ {
+ return GetFecQamBer (snr,
+ nbits,
+ mode.GetBandwidth (), // signal spread
+ mode.GetPhyRate (), // phy rate
+ 64, // m
+ 5, // dFree
+ 8, // adFree
+ 31 // adFreePlusOne
+ );
+ }
+ }
}
- else if (mode == WifiPhy::Get36mba () || mode == WifiPhy::Get18mb10Mhz () || mode == WifiPhy::Get9mb5Mhz ())
- {
- return GetFecQamBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 16, // m
- 5, // dFree
- 8, // adFree
- 31 // adFreePlusOne
- );
- }
- else if (mode == WifiPhy::Get48mba () || mode == WifiPhy::Get24mb10Mhz () || mode == WifiPhy::Get12mb5Mhz ())
+ else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS)
{
- return GetFecQamBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 64, // m
- 6, // dFree
- 1, // adFree
- 16 // adFreePlusOne
- );
- }
- else if (mode == WifiPhy::Get54mba () || mode == WifiPhy::Get27mb10Mhz () || mode == WifiPhy::Get13_5mb5Mhz ())
- {
- return GetFecQamBer (snr,
- nbits,
- mode.GetBandwidth (), // signal spread
- mode.GetPhyRate (), // phy rate
- 64, // m
- 5, // dFree
- 8, // adFree
- 31 // adFreePlusOne
- );
- }
- else if (mode == WifiPhy::Get1mbb ())
- {
- return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr,nbits);
- }
- else if (mode == WifiPhy::Get2mbb ())
- {
- return DsssErrorRateModel::GetDsssDqpskSuccessRate (snr,nbits);
- }
- else if (mode == WifiPhy::Get5_5mbb ())
- {
- return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr,nbits);
- }
- else if (mode == WifiPhy::Get11mbb ())
- {
- return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr,nbits);
+ switch (mode.GetDataRate ())
+ {
+ case 1000000:
+ return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr, nbits);
+ case 2000000:
+ return DsssErrorRateModel::GetDsssDqpskSuccessRate (snr, nbits);
+ case 5500000:
+ return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr, nbits);
+ case 11000000:
+ return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr, nbits);
+ }
}
return 0;
}
--- a/src/devices/wifi/yans-wifi-phy.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/devices/wifi/yans-wifi-phy.cc Wed Jun 16 10:55:13 2010 +0100
@@ -534,14 +534,15 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 5.000 GHz
- m_modes.push_back (WifiPhy::Get6mba ());
- m_modes.push_back (WifiPhy::Get9mba ());
- m_modes.push_back (WifiPhy::Get12mba ());
- m_modes.push_back (WifiPhy::Get18mba ());
- m_modes.push_back (WifiPhy::Get24mba ());
- m_modes.push_back (WifiPhy::Get36mba ());
- m_modes.push_back (WifiPhy::Get48mba ());
- m_modes.push_back (WifiPhy::Get54mba ());
+
+ m_modes.push_back (WifiPhy::GetOfdmRate6Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate9Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate12Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate18Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate24Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate36Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate48Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate54Mbps ());
}
@@ -550,10 +551,11 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 2412; // 2.412 GHz
- m_modes.push_back (WifiPhy::Get1mbb ());
- m_modes.push_back (WifiPhy::Get2mbb ());
- m_modes.push_back (WifiPhy::Get5_5mbb ());
- m_modes.push_back (WifiPhy::Get11mbb ());
+
+ m_modes.push_back (WifiPhy::GetDsssRate1Mbps ());
+ m_modes.push_back (WifiPhy::GetDsssRate2Mbps ());
+ m_modes.push_back (WifiPhy::GetDsssRate5_5Mbps ());
+ m_modes.push_back (WifiPhy::GetDsssRate11Mbps ());
}
void
@@ -561,14 +563,15 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
- m_modes.push_back (WifiPhy::Get3mb10Mhz ());
- m_modes.push_back (WifiPhy::Get4_5mb10Mhz ());
- m_modes.push_back (WifiPhy::Get6mb10Mhz ());
- m_modes.push_back (WifiPhy::Get9mb10Mhz ());
- m_modes.push_back (WifiPhy::Get12mb10Mhz ());
- m_modes.push_back (WifiPhy::Get18mb10Mhz ());
- m_modes.push_back (WifiPhy::Get24mb10Mhz ());
- m_modes.push_back (WifiPhy::Get27mb10Mhz ());
+
+ m_modes.push_back (WifiPhy::GetOfdmRate3MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate4_5MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate6MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate9MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate12MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate18MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate24MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate27MbpsBW10MHz ());
}
void
@@ -576,14 +579,15 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
- m_modes.push_back (WifiPhy::Get1_5mb5Mhz ());
- m_modes.push_back (WifiPhy::Get2_25mb5Mhz ());
- m_modes.push_back (WifiPhy::Get3mb5Mhz ());
- m_modes.push_back (WifiPhy::Get4_5mb5Mhz ());
- m_modes.push_back (WifiPhy::Get6mb5Mhz ());
- m_modes.push_back (WifiPhy::Get9mb5Mhz ());
- m_modes.push_back (WifiPhy::Get12mb5Mhz ());
- m_modes.push_back (WifiPhy::Get13_5mb5Mhz ());
+
+ m_modes.push_back (WifiPhy::GetOfdmRate1_5MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate2_25MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate3MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate4_5MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate6MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate9MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate12MbpsBW5MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate13_5MbpsBW5MHz ());
}
void
@@ -591,11 +595,11 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 5.000 GHz
- m_modes.push_back (WifiPhy::Get6mba ());
- m_modes.push_back (WifiPhy::Get12mba ());
- m_modes.push_back (WifiPhy::Get18mba ());
- m_modes.push_back (WifiPhy::Get36mba ());
- m_modes.push_back (WifiPhy::Get54mba ());
+ m_modes.push_back (WifiPhy::GetOfdmRate6Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate12Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate18Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate36Mbps ());
+ m_modes.push_back (WifiPhy::GetOfdmRate54Mbps ());
}
void
@@ -603,14 +607,15 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 802.11p works over the 5Ghz freq range
- m_modes.push_back (WifiPhy::Get3mb10Mhz ());
- m_modes.push_back (WifiPhy::Get4_5mb10Mhz ());
- m_modes.push_back (WifiPhy::Get6mb10Mhz ());
- m_modes.push_back (WifiPhy::Get9mb10Mhz ());
- m_modes.push_back (WifiPhy::Get12mb10Mhz ());
- m_modes.push_back (WifiPhy::Get18mb10Mhz ());
- m_modes.push_back (WifiPhy::Get24mb10Mhz ());
- m_modes.push_back (WifiPhy::Get27mb10Mhz ());
+
+ m_modes.push_back (WifiPhy::GetOfdmRate3MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate4_5MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate6MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate9MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate12MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate18MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate24MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate27MbpsBW10MHz ());
}
void
@@ -618,14 +623,15 @@
{
NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 802.11p works over the 5Ghz freq range
- m_modes.push_back (WifiPhy::Get3mb10Mhz ());
- m_modes.push_back (WifiPhy::Get4_5mb10Mhz ());
- m_modes.push_back (WifiPhy::Get6mb10Mhz ());
- m_modes.push_back (WifiPhy::Get9mb10Mhz ());
- m_modes.push_back (WifiPhy::Get12mb10Mhz ());
- m_modes.push_back (WifiPhy::Get18mb10Mhz ());
- m_modes.push_back (WifiPhy::Get24mb10Mhz ());
- m_modes.push_back (WifiPhy::Get27mb10Mhz ());
+
+ m_modes.push_back (WifiPhy::GetOfdmRate3MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate4_5MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate6MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate9MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate12MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate18MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate24MbpsBW10MHz ());
+ m_modes.push_back (WifiPhy::GetOfdmRate27MbpsBW10MHz ());
}
void
--- a/src/routing/aodv/test/aodv-regression.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/routing/aodv/test/aodv-regression.cc Wed Jun 16 10:55:13 2010 +0100
@@ -140,7 +140,7 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi = WifiHelper::Default ();
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs"), "RtsCtsThreshold", StringValue ("2200"));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, *m_nodes);
// 2. Setup TCP/IP & AODV
--- a/src/routing/aodv/test/bug-772.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/routing/aodv/test/bug-772.cc Wed Jun 16 10:55:13 2010 +0100
@@ -115,7 +115,7 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi = WifiHelper::Default ();
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs"), "RtsCtsThreshold", StringValue ("2200"));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, *m_nodes);
// 2. Setup TCP/IP & AODV
--- a/src/routing/aodv/test/loopback.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/routing/aodv/test/loopback.cc Wed Jun 16 10:55:13 2010 +0100
@@ -69,7 +69,7 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi = WifiHelper::Default ();
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs"), "RtsCtsThreshold", StringValue ("2200"));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes);
// Setup TCP/IP & AODV
--- a/src/routing/olsr/test/bug780-test.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/routing/olsr/test/bug780-test.cc Wed Jun 16 10:55:13 2010 +0100
@@ -96,7 +96,7 @@
{
int nWifis = 3;
double SimTime = 200.0;
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
//sending one packets per sec
// Fix non-unicast data rate to be the same as that of unicast
--- a/src/routing/olsr/test/tc-regression-test.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/routing/olsr/test/tc-regression-test.cc Wed Jun 16 10:55:13 2010 +0100
@@ -101,7 +101,7 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi = WifiHelper::Default ();
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs"), "RtsCtsThreshold", StringValue ("2200"));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200"));
NetDeviceContainer nd = wifi.Install (wifiPhy, wifiMac, c);
// setup IP addresses
--- a/src/test/ns3wifi/wifi-interference-test-suite.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/test/ns3wifi/wifi-interference-test-suite.cc Wed Jun 16 10:55:13 2010 +0100
@@ -230,7 +230,7 @@
WifiInterferenceTestCase::DoRun (void)
{
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
double Prss = -90; // -dBm
double Irss = -90; // -dBm
double delta = 0; // microseconds
--- a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc Tue Jun 15 11:27:51 2010 -0700
+++ b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc Wed Jun 16 10:55:13 2010 +0100
@@ -70,7 +70,7 @@
// scenario with 802.11b rates (transmit rate fixed to 1 Mbps, no
// less), but this approach tests the bit we need to without unduly
// increasing the complexity of the simulation.
- std::string phyMode ("wifib-1mbs");
+ std::string phyMode ("DsssRate1Mbps");
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue (phyMode),