27#include "ns3/gnuplot.h"
28#include "ns3/command-line.h"
29#include "ns3/yans-error-rate-model.h"
30#include "ns3/nist-error-rate-model.h"
31#include "ns3/table-based-error-rate-model.h"
32#include "ns3/wifi-tx-vector.h"
36int main (
int argc,
char *argv[])
39 std::ofstream yansfile (
"yans-frame-success-rate-ac.plt");
40 std::ofstream nistfile (
"nist-frame-success-rate-ac.plt");
41 std::ofstream tablefile (
"table-frame-success-rate-ac.plt");
42 std::vector <std::string> modes;
44 modes.push_back (
"VhtMcs0");
45 modes.push_back (
"VhtMcs1");
46 modes.push_back (
"VhtMcs2");
47 modes.push_back (
"VhtMcs3");
48 modes.push_back (
"VhtMcs4");
49 modes.push_back (
"VhtMcs5");
50 modes.push_back (
"VhtMcs6");
51 modes.push_back (
"VhtMcs7");
52 modes.push_back (
"VhtMcs8");
55 cmd.AddValue (
"FrameSize",
"The frame size in bytes", FrameSize);
56 cmd.Parse (argc, argv);
67 for (
uint32_t i = 0; i < modes.size (); i++)
69 std::cout << modes[i] << std::endl;
75 for (
double snr = -5.0; snr <= 30.0; snr += 0.1)
77 double ps = yans->GetChunkSuccessRate (
WifiMode (modes[i]), txVector, std::pow (10.0, snr / 10.0), FrameSize * 8);
78 if (ps < 0.0 || ps > 1.0)
83 yansdataset.Add (snr, ps);
85 ps = nist->GetChunkSuccessRate (
WifiMode (modes[i]), txVector, std::pow (10.0, snr / 10.0), FrameSize * 8);
86 if (ps < 0.0 || ps > 1.0)
91 nistdataset.Add (snr, ps);
93 ps = table->GetChunkSuccessRate (
WifiMode (modes[i]), txVector, std::pow (10.0, snr / 10.0), FrameSize * 8);
94 if (ps < 0.0 || ps > 1.0)
99 tabledataset.Add (snr, ps);
107 yansplot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
108 yansplot.
SetLegend (
"SNR(dB)",
"Frame Success Rate");
109 yansplot.
SetExtra (
"set xrange [-5:55]\n\
111set style line 1 linewidth 5\n\
112set style line 2 linewidth 5\n\
113set style line 3 linewidth 5\n\
114set style line 4 linewidth 5\n\
115set style line 5 linewidth 5\n\
116set style line 6 linewidth 5\n\
117set style line 7 linewidth 5\n\
118set style line 8 linewidth 5\n\
119set style line 9 linewidth 5\n\
120set style increment user");
124 nistplot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
125 nistplot.
SetLegend (
"SNR(dB)",
"Frame Success Rate");
126 nistplot.
SetExtra (
"set xrange [-5:55]\n\
128set style line 1 linewidth 5\n\
129set style line 2 linewidth 5\n\
130set style line 3 linewidth 5\n\
131set style line 4 linewidth 5\n\
132set style line 5 linewidth 5\n\
133set style line 6 linewidth 5\n\
134set style line 7 linewidth 5\n\
135set style line 8 linewidth 5\n\
136set style line 9 linewidth 5\n\
137set style increment user");
142 tableplot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
143 tableplot.
SetLegend (
"SNR(dB)",
"Frame Success Rate");
144 tableplot.
SetExtra (
"set xrange [-5:55]\n\
146set style line 1 linewidth 5\n\
147set style line 2 linewidth 5\n\
148set style line 3 linewidth 5\n\
149set style line 4 linewidth 5\n\
150set style line 5 linewidth 5\n\
151set style line 6 linewidth 5\n\
152set style line 7 linewidth 5\n\
153set style line 8 linewidth 5\n\
154set style line 9 linewidth 5\n\
155set 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.