25#include "ns3/command-line.h"
26#include "ns3/gnuplot.h"
27#include "ns3/nist-error-rate-model.h"
28#include "ns3/table-based-error-rate-model.h"
29#include "ns3/wifi-tx-vector.h"
30#include "ns3/yans-error-rate-model.h"
38main(
int argc,
char* argv[])
41 std::ofstream yansfile(
"yans-frame-success-rate-be.plt");
42 std::ofstream nistfile(
"nist-frame-success-rate-be.plt");
43 std::ofstream tablefile(
"table-frame-success-rate-be.plt");
45 const std::vector<std::string> modes{
63 cmd.AddValue(
"FrameSize",
"The frame size", FrameSize);
64 cmd.Parse(argc, argv);
75 for (
uint32_t i = 0; i < modes.size(); i++)
77 std::cout << modes[i] << std::endl;
83 for (
double snr = -5.0; snr <= 55.0; snr += 0.1)
85 double ps = yans->GetChunkSuccessRate(
WifiMode(modes[i]),
87 std::pow(10.0, snr / 10.0),
89 if (ps < 0.0 || ps > 1.0)
94 yansdataset.Add(snr, ps);
96 ps = nist->GetChunkSuccessRate(
WifiMode(modes[i]),
98 std::pow(10.0, snr / 10.0),
100 if (ps < 0.0 || ps > 1.0)
105 nistdataset.Add(snr, ps);
107 ps = table->GetChunkSuccessRate(
WifiMode(modes[i]),
109 std::pow(10.0, snr / 10.0),
111 if (ps < 0.0 || ps > 1.0)
116 tabledataset.Add(snr, ps);
124 std::stringstream plotExtra;
125 plotExtra <<
"set xrange [-5:55]\n\
127 uint8_t lineNumber = 1;
128 const std::string
colors[14] = {
"green",
142 for (
uint32_t i = 0; i < modes.size(); i++)
144 plotExtra <<
"set style line " << +lineNumber++ <<
" linewidth 5 linecolor rgb \""
147 plotExtra <<
"set style increment user";
149 yansplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
150 yansplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
155 nistplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
156 nistplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
161 tableplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
162 tableplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
163 tableplot.
SetExtra(plotExtra.str());
Parse command-line arguments.
Class to represent a 2D points plot.
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
void AddDataset(const GnuplotDataset &dataset)
void SetLegend(const std::string &xLegend, const std::string &yLegend)
void SetTerminal(const std::string &terminal)
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
void SetExtra(const std::string &extra)
Smart pointer class similar to boost::intrusive_ptr.
represent a single transmission mode
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
Every class exported by the ns3 library is enclosed in the ns3 namespace.