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-ofdm.plt");
42 std::ofstream nistfile(
"nist-frame-success-rate-ofdm.plt");
43 std::ofstream tablefile(
"table-frame-success-rate-ofdm.plt");
45 const std::vector<std::string> modes{
57 cmd.AddValue(
"FrameSize",
"The frame size in bytes", frameSizeBytes);
58 cmd.Parse(argc, argv);
69 uint32_t frameSizeBits = frameSizeBytes * 8;
71 for (
const auto& mode : modes)
73 std::cout << mode << std::endl;
81 for (
double snrDb = -5.0; snrDb <= 30.0; snrDb += 0.1)
83 double snr = std::pow(10.0, snrDb / 10.0);
85 double ps = yans->GetChunkSuccessRate(wifiMode, txVector, snr, frameSizeBits);
86 if (ps < 0.0 || ps > 1.0)
91 yansdataset.Add(snrDb, ps);
93 ps = nist->GetChunkSuccessRate(wifiMode, txVector, snr, frameSizeBits);
94 if (ps < 0.0 || ps > 1.0)
99 nistdataset.Add(snrDb, ps);
101 ps = table->GetChunkSuccessRate(wifiMode, txVector, snr, frameSizeBits);
102 if (ps < 0.0 || ps > 1.0)
107 tabledataset.Add(snrDb, ps);
115 yansplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
116 yansplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
117 yansplot.
SetExtra(
"set xrange [-5:30]\n\
119set style line 1 linewidth 5\n\
120set style line 2 linewidth 5\n\
121set style line 3 linewidth 5\n\
122set style line 4 linewidth 5\n\
123set style line 5 linewidth 5\n\
124set style line 6 linewidth 5\n\
125set style line 7 linewidth 5\n\
126set style line 8 linewidth 5\n\
127set style increment user");
131 nistplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
132 nistplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
133 nistplot.
SetExtra(
"set xrange [-5:30]\n\
135set style line 1 linewidth 5\n\
136set style line 2 linewidth 5\n\
137set style line 3 linewidth 5\n\
138set style line 4 linewidth 5\n\
139set style line 5 linewidth 5\n\
140set style line 6 linewidth 5\n\
141set style line 7 linewidth 5\n\
142set style line 8 linewidth 5\n\
143set style increment user");
148 tableplot.
SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
149 tableplot.
SetLegend(
"SNR(dB)",
"Frame Success Rate");
150 tableplot.
SetExtra(
"set xrange [-5:30]\n\
152set style line 1 linewidth 5\n\
153set style line 2 linewidth 5\n\
154set style line 3 linewidth 5\n\
155set style line 4 linewidth 5\n\
156set style line 5 linewidth 5\n\
157set style line 6 linewidth 5\n\
158set style line 7 linewidth 5\n\
159set style line 8 linewidth 5\n\
160set 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.