--- a/examples/wireless/ht-wifi-network.cc Fri Sep 04 22:18:05 2015 +0200
+++ b/examples/wireless/ht-wifi-network.cc Sat Sep 05 11:37:49 2015 +0200
@@ -87,19 +87,12 @@
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
HtWifiMacHelper mac = HtWifiMacHelper::Default ();
- Ssid ssid = Ssid ("ns380211n");
-
- std::stringstream sstmp;
- std::string strtmp, dataRate;
- StringValue DataRate;
-
- sstmp << i;
- sstmp >> strtmp;
- dataRate = "HtMcs" + strtmp;
- DataRate = StringValue (dataRate);
-
+ StringValue DataRate = HtWifiMacHelper::DataRateForMcs (i);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
"ControlMode", DataRate);
+
+ Ssid ssid = Ssid ("ns3-80211n");
+
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
@@ -206,7 +199,7 @@
uint32_t totalPacketsThrough = DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
throughput = totalPacketsThrough * 8 / (simulationTime * 1000000.0); //Mbit/s
}
- std::cout << dataRate << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
+ std::cout << i << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
}
j *= 2;
}
--- a/examples/wireless/vht-wifi-network.cc Fri Sep 04 22:18:05 2015 +0200
+++ b/examples/wireless/vht-wifi-network.cc Sat Sep 05 11:37:49 2015 +0200
@@ -90,20 +90,13 @@
WifiHelper wifi = WifiHelper::Default ();
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
VhtWifiMacHelper mac = VhtWifiMacHelper::Default ();
-
- Ssid ssid = Ssid ("ns380211ac");
-
- std::stringstream sstmp;
- std::string strtmp, dataRate;
- StringValue DataRate;
-
- sstmp << i;
- sstmp >> strtmp;
- dataRate = "VhtMcs" + strtmp;
- DataRate = StringValue (dataRate);
-
+
+ StringValue DataRate = VhtWifiMacHelper::DataRateForMcs (i);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
"ControlMode", DataRate);
+
+ Ssid ssid = Ssid ("ns3-80211ac");
+
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
@@ -210,7 +203,7 @@
uint32_t totalPacketsThrough = DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
throughput = totalPacketsThrough * 8 / (simulationTime * 1000000.0); //Mbit/s
}
- std::cout << dataRate << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
+ std::cout << i << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
}
j *= 2;
}
--- a/src/wifi/helper/ht-wifi-mac-helper.cc Fri Sep 04 22:18:05 2015 +0200
+++ b/src/wifi/helper/ht-wifi-mac-helper.cc Sat Sep 05 11:37:49 2015 +0200
@@ -47,4 +47,17 @@
return helper;
}
+StringValue
+HtWifiMacHelper::DataRateForMcs (int mcs)
+{
+ std::stringstream sstmp;
+ std::string strtmp, dataRate;
+
+ sstmp << mcs;
+ sstmp >> strtmp;
+ dataRate = "HtMcs" + strtmp;
+
+ return StringValue (dataRate);
+}
+
} //namespace ns3
--- a/src/wifi/helper/ht-wifi-mac-helper.h Fri Sep 04 22:18:05 2015 +0200
+++ b/src/wifi/helper/ht-wifi-mac-helper.h Sat Sep 05 11:37:49 2015 +0200
@@ -21,6 +21,7 @@
#ifndef HT_WIFI_MAC_HELPER_H
#define HT_WIFI_MAC_HELPER_H
+#include "ns3/string.h"
#include "wifi-helper.h"
#include "ns3/qos-utils.h"
#include "qos-wifi-mac-helper.h"
@@ -53,6 +54,10 @@
*/
static HtWifiMacHelper Default (void);
+ /**
+ * Converts a HT MCS value into a DataRate value
+ */
+ static StringValue DataRateForMcs (int mcs);
};
} //namespace ns3
--- a/src/wifi/helper/vht-wifi-mac-helper.cc Fri Sep 04 22:18:05 2015 +0200
+++ b/src/wifi/helper/vht-wifi-mac-helper.cc Sat Sep 05 11:37:49 2015 +0200
@@ -54,4 +54,17 @@
return helper;
}
+StringValue
+VhtWifiMacHelper::DataRateForMcs (int mcs)
+{
+ std::stringstream sstmp;
+ std::string strtmp, dataRate;
+
+ sstmp << mcs;
+ sstmp >> strtmp;
+ dataRate = "VhtMcs" + strtmp;
+
+ return StringValue (dataRate);
+}
+
} //namespace ns3
--- a/src/wifi/helper/vht-wifi-mac-helper.h Fri Sep 04 22:18:05 2015 +0200
+++ b/src/wifi/helper/vht-wifi-mac-helper.h Sat Sep 05 11:37:49 2015 +0200
@@ -21,6 +21,7 @@
#ifndef VHT_WIFI_MAC_HELPER_H
#define VHT_WIFI_MAC_HELPER_H
+#include "ns3/string.h"
#include "wifi-helper.h"
#include "ns3/qos-utils.h"
#include "qos-wifi-mac-helper.h"
@@ -54,6 +55,10 @@
*/
static VhtWifiMacHelper Default (void);
+ /**
+ * Converts a VHT MCS value into a DataRate value
+ */
+ static StringValue DataRateForMcs (int mcs);
};
} //namespace ns3