Add helper to convert mcs values into datarate values
This commit is contained in:
@@ -87,19 +87,12 @@ int main (int argc, char *argv[])
|
||||
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 @@ int main (int argc, char *argv[])
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -90,20 +90,13 @@ int main (int argc, char *argv[])
|
||||
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 @@ int main (int argc, char *argv[])
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -47,4 +47,17 @@ HtWifiMacHelper::Default (void)
|
||||
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
|
||||
|
||||
@@ -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 @@ public:
|
||||
*/
|
||||
static HtWifiMacHelper Default (void);
|
||||
|
||||
/**
|
||||
* Converts a HT MCS value into a DataRate value
|
||||
*/
|
||||
static StringValue DataRateForMcs (int mcs);
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -54,4 +54,17 @@ VhtWifiMacHelper::Default (void)
|
||||
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
|
||||
|
||||
@@ -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 @@ public:
|
||||
*/
|
||||
static VhtWifiMacHelper Default (void);
|
||||
|
||||
/**
|
||||
* Converts a VHT MCS value into a DataRate value
|
||||
*/
|
||||
static StringValue DataRateForMcs (int mcs);
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user