24#include "ns3/command-line.h"
25#include "ns3/gnuplot.h"
26#include "ns3/nist-error-rate-model.h"
27#include "ns3/table-based-error-rate-model.h"
28#include "ns3/wifi-tx-vector.h"
29#include "ns3/yans-error-rate-model.h"
37main(
int argc,
char* argv[])
40 std::ofstream yansfile(
"yans-frame-success-rate-ac.plt");
41 std::ofstream nistfile(
"nist-frame-success-rate-ac.plt");
42 std::ofstream tablefile(
"table-frame-success-rate-ac.plt");
44 const std::vector<std::string> modes{
57 cmd.AddValue(
"FrameSize",
"The frame size in bytes", FrameSize);
58 cmd.Parse(argc, argv);
69 for (
uint32_t i = 0; i < modes.size(); i++)
71 std::cout << modes[i] << std::endl;
77 for (
double snr = -5.0; snr <= 30.0; snr += 0.1)
79 double ps = yans->GetChunkSuccessRate(
WifiMode(modes[i]),
81 std::pow(10.0, snr / 10.0),
83 if (ps < 0.0 || ps > 1.0)
88 yansdataset.Add(snr, ps);
90 ps = nist->GetChunkSuccessRate(
WifiMode(modes[i]),
92 std::pow(10.0, snr / 10.0),
94 if (ps < 0.0 || ps > 1.0)
99 nistdataset.Add(snr, ps);
101 ps = table->GetChunkSuccessRate(
WifiMode(modes[i]),
103 std::pow(10.0, snr / 10.0),
105 if (ps < 0.0 || ps > 1.0)
110 tabledataset.Add(snr, ps);
118 yansplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
119 yansplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
120 yansplot.
SetExtra(
"set xrange [-5:55]\n\
122set style line 1 linewidth 5\n\
123set style line 2 linewidth 5\n\
124set style line 3 linewidth 5\n\
125set style line 4 linewidth 5\n\
126set style line 5 linewidth 5\n\
127set style line 6 linewidth 5\n\
128set style line 7 linewidth 5\n\
129set style line 8 linewidth 5\n\
130set style line 9 linewidth 5\n\
131set style increment user");
135 nistplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
136 nistplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
137 nistplot.
SetExtra(
"set xrange [-5:55]\n\
139set style line 1 linewidth 5\n\
140set style line 2 linewidth 5\n\
141set style line 3 linewidth 5\n\
142set style line 4 linewidth 5\n\
143set style line 5 linewidth 5\n\
144set style line 6 linewidth 5\n\
145set style line 7 linewidth 5\n\
146set style line 8 linewidth 5\n\
147set style line 9 linewidth 5\n\
148set style increment user");
153 tableplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
154 tableplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
155 tableplot.
SetExtra(
"set xrange [-5:55]\n\
157set style line 1 linewidth 5\n\
158set style line 2 linewidth 5\n\
159set style line 3 linewidth 5\n\
160set style line 4 linewidth 5\n\
161set style line 5 linewidth 5\n\
162set style line 6 linewidth 5\n\
163set style line 7 linewidth 5\n\
164set style line 8 linewidth 5\n\
165set style line 9 linewidth 5\n\
166set style increment user");
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.