diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 51adb23ce..9ddffe88d 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -32,6 +32,7 @@ Bugs fixed ---------- - Bug 1551 - NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace? - Bug 1726 - WiFi Minstrel rate control algorithm doesn't save state +- Bug 1758 - Yans and Nist error rate models for 5/6 code rate 802.11n HT - Bug 1791 - TCP Endpoint never deallocates when closing - Bug 1906 - 802.11n PHY configuration for 2.4GHz and 5GHz devices - Bug 1957 - UdpSocketImpl is stuck after a Close() diff --git a/examples/wireless/ofdm-ht-validation.cc b/examples/wireless/ofdm-ht-validation.cc new file mode 100644 index 000000000..f7f46befe --- /dev/null +++ b/examples/wireless/ofdm-ht-validation.cc @@ -0,0 +1,106 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: Sébastien Deronne + */ +#include "ns3/core-module.h" +#include "ns3/yans-error-rate-model.h" +#include "ns3/nist-error-rate-model.h" +#include "ns3/gnuplot.h" + +#include +#include +#include + +using namespace ns3; + +int main (int argc, char *argv[]) +{ + uint32_t FrameSize = 2000; + std::ofstream yansfile ("yans-frame-success-rate-n.plt"); + std::ofstream nistfile ("nist-frame-success-rate-n.plt"); + std::vector modes; + + modes.push_back ("OfdmRate6_5MbpsBW20MHz"); + modes.push_back ("OfdmRate13MbpsBW20MHz"); + modes.push_back ("OfdmRate19_5MbpsBW20MHz"); + modes.push_back ("OfdmRate26MbpsBW20MHz"); + modes.push_back ("OfdmRate39MbpsBW20MHz"); + modes.push_back ("OfdmRate52MbpsBW20MHz"); + modes.push_back ("OfdmRate58_5MbpsBW20MHz"); + modes.push_back ("OfdmRate65MbpsBW20MHz"); + + CommandLine cmd; + cmd.AddValue ("FrameSize", "The frame size", FrameSize); + cmd.Parse (argc, argv); + + Gnuplot yansplot = Gnuplot ("yans-frame-success-rate-n.eps"); + Gnuplot nistplot = Gnuplot ("nist-frame-success-rate-n.eps"); + + Ptr yans = CreateObject (); + Ptr nist = CreateObject (); + + for (uint32_t i = 0; i < modes.size (); i++) + { + std::cout << modes[i] << std::endl; + Gnuplot2dDataset yansdataset (modes[i]); + Gnuplot2dDataset nistdataset (modes[i]); + + for (double snr = -5.0; snr <= 30.0; snr += 0.1) + { + double ps = yans->GetChunkSuccessRate (WifiMode (modes[i]), std::pow (10.0,snr / 10.0), FrameSize * 8); + yansdataset.Add (snr, ps); + ps = nist->GetChunkSuccessRate (WifiMode (modes[i]), std::pow (10.0,snr / 10.0), FrameSize * 8); + nistdataset.Add (snr, ps); + } + + yansplot.AddDataset (yansdataset); + nistplot.AddDataset (nistdataset); + } + + yansplot.SetTerminal ("postscript eps color enh \"Times-BoldItalic\""); + yansplot.SetLegend ("SNR(dB)", "Frame Success Rate"); + yansplot.SetExtra ("set xrange [-5:30]\n\ +set yrange [0:1.2]\n\ +set style line 1 linewidth 5\n\ +set style line 2 linewidth 5\n\ +set style line 3 linewidth 5\n\ +set style line 4 linewidth 5\n\ +set style line 5 linewidth 5\n\ +set style line 6 linewidth 5\n\ +set style line 7 linewidth 5\n\ +set style line 8 linewidth 5\n\ +set style increment user" ); + yansplot.GenerateOutput (yansfile); + yansfile.close (); + + nistplot.SetTerminal ("postscript eps color enh \"Times-BoldItalic\""); + nistplot.SetLegend ("SNR(dB)", "Frame Success Rate"); + nistplot.SetExtra ("set xrange [-5:30]\n\ +set yrange [0:1.2]\n\ +set style line 1 linewidth 5\n\ +set style line 2 linewidth 5\n\ +set style line 3 linewidth 5\n\ +set style line 4 linewidth 5\n\ +set style line 5 linewidth 5\n\ +set style line 6 linewidth 5\n\ +set style line 7 linewidth 5\n\ +set style line 8 linewidth 5\n\ +set style increment user" ); + + nistplot.GenerateOutput (nistfile); + nistfile.close (); +} + diff --git a/examples/wireless/wscript b/examples/wireless/wscript index 2a2939368..9a517d733 100644 --- a/examples/wireless/wscript +++ b/examples/wireless/wscript @@ -46,6 +46,9 @@ def build(bld): obj = bld.create_ns3_program('ofdm-validation', ['core', 'mobility', 'wifi', 'config-store', 'stats']) obj.source = 'ofdm-validation.cc' + obj = bld.create_ns3_program('ofdm-ht-validation', ['core', 'mobility', 'wifi', 'config-store', 'stats']) + obj.source = 'ofdm-ht-validation.cc' + obj = bld.create_ns3_program('wifi-hidden-terminal', ['internet', 'mobility', 'wifi', 'applications', 'propagation', 'flow-monitor']) obj.source = 'wifi-hidden-terminal.cc' diff --git a/src/wifi/doc/wifi.rst b/src/wifi/doc/wifi.rst index 111b8d356..f278c1d40 100644 --- a/src/wifi/doc/wifi.rst +++ b/src/wifi/doc/wifi.rst @@ -521,9 +521,7 @@ SNIR function. *SNIR function over time.* From the SNIR function we can derive the Bit Error Rate (BER) and Packet Error Rate (PER) for -the modulation and coding scheme being used for the transmission. Please refer to [pei80211ofdm]_, [pei80211b]_ -and [lacage2006yans]_ for a detailed description of the available BER/PER models. - +the modulation and coding scheme being used for the transmission. Please refer to [pei80211ofdm]_, [pei80211b]_, [lacage2006yans]_, [Haccoun]_ and [Frenger]_ for a detailed description of the available BER/PER models. WifiChannel configuration ========================= @@ -721,6 +719,10 @@ References .. [lacage2006yans] \M. Lacage and T. Henderson, `Yet another Network Simulator `__ +.. [Haccoun] \D. Haccoun and G. Begin, *High-Rate Punctured Convolutional Codes for Viterbi Sequential Decoding*, IEEE Transactions on Communications, Vol. 32, Issue 3, pp.315-319. + +.. [Frenger] \Pâl Frenger et al., "Multi-rate Convolutional Codes". + .. [ji2004sslswn] \Z. Ji, J. Zhou, M. Takai and R. Bagrodia, *Scalable simulation of large-scale wireless networks with bounded inaccuracies*, in Proc. of the Seventh ACM Symposium on Modeling, Analysis and Simulation of Wireless and Mobile Systems, October 2004. .. [linuxminstrel] `minstrel linux wireless `_ diff --git a/src/wifi/model/nist-error-rate-model.cc b/src/wifi/model/nist-error-rate-model.cc index 31a796bc1..746864e97 100644 --- a/src/wifi/model/nist-error-rate-model.cc +++ b/src/wifi/model/nist-error-rate-model.cc @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Author: Gary Pei + * Authors: Gary Pei + * Sébastien Deronne */ #include @@ -154,6 +155,23 @@ NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const + 428005675.0 * std::pow (D, 14) ); } + else if (bValue == 5) + { + // code rate 5/6, use table V from D. Haccoun and G. Begin, "High-Rate Punctured Convolutional Codes + // for Viterbi Sequential Decoding", IEEE Transactions on Communications, Vol. 32, Issue 3, pp.315-319. + pe = 1.0 / (2.0 * bValue) * + ( 92.0 * std::pow (D, 4.0) + + 528.0 * std::pow (D, 5.0) + + 8694.0 * std::pow (D, 6.0) + + 79453.0 * std::pow (D, 7.0) + + 792114.0 * std::pow (D, 8.0) + + 7375573.0 * std::pow (D, 9.0) + + 67884974.0 * std::pow (D, 10.0) + + 610875423.0 * std::pow (D, 11.0) + + 5427275376.0 * std::pow (D, 12.0) + + 47664215639.0 * std::pow (D, 13.0) + ); + } else { NS_ASSERT (false); @@ -255,13 +273,20 @@ NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi 2 // b value ); } - else - { - return GetFec64QamBer (snr, - nbits, - 3 // b value - ); - } + else if (mode.GetCodeRate () == WIFI_CODE_RATE_5_6) + { + return GetFec64QamBer (snr, + nbits, + 5 // b value + ); + } + else + { + return GetFec64QamBer (snr, + nbits, + 3 // b value + ); + } } } else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS) diff --git a/src/wifi/model/yans-error-rate-model.cc b/src/wifi/model/yans-error-rate-model.cc index 333037cf5..bf1cb5b0d 100644 --- a/src/wifi/model/yans-error-rate-model.cc +++ b/src/wifi/model/yans-error-rate-model.cc @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Sébastien Deronne */ #include @@ -176,7 +177,8 @@ double YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const { if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM - || mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM) + || mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM + || mode.GetModulationClass () == WIFI_MOD_CLASS_HT) { if (mode.GetConstellationSize () == 2) { @@ -269,6 +271,19 @@ YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi 16 // adFreePlusOne ); } + if (mode.GetCodeRate () == WIFI_CODE_RATE_5_6) + { + //Table B.32 in Pâl Frenger et al., "Multi-rate Convolutional Codes". + return GetFecQamBer (snr, + nbits, + mode.GetBandwidth (), // signal spread + mode.GetPhyRate (), // phy rate + 64, // m + 4, // dFree + 14, // adFree + 69 // adFreePlusOne + ); + } else { return GetFecQamBer (snr,