26 #include "ns3/gnuplot.h" 27 #include "ns3/command-line.h" 28 #include "ns3/yans-error-rate-model.h" 29 #include "ns3/nist-error-rate-model.h" 30 #include "ns3/wifi-tx-vector.h" 34 int main (
int argc,
char *argv[])
36 uint32_t FrameSize = 1500;
37 std::ofstream yansfile (
"yans-frame-success-rate-ax.plt");
38 std::ofstream nistfile (
"nist-frame-success-rate-ax.plt");
39 std::vector <std::string> modes;
41 modes.push_back (
"HeMcs0");
42 modes.push_back (
"HeMcs1");
43 modes.push_back (
"HeMcs2");
44 modes.push_back (
"HeMcs3");
45 modes.push_back (
"HeMcs4");
46 modes.push_back (
"HeMcs5");
47 modes.push_back (
"HeMcs6");
48 modes.push_back (
"HeMcs7");
49 modes.push_back (
"HeMcs8");
50 modes.push_back (
"HeMcs9");
51 modes.push_back (
"HeMcs10");
52 modes.push_back (
"HeMcs11");
55 cmd.AddValue (
"FrameSize",
"The frame size", FrameSize);
56 cmd.Parse (argc, argv);
65 for (uint32_t i = 0; i < modes.size (); i++)
67 std::cout << modes[i] << std::endl;
70 txVector.SetMode (modes[i]);
72 for (
double snr = -5.0; snr <= 40.0; snr += 0.1)
75 if (ps < 0.0 || ps > 1.0)
80 yansdataset.Add (snr, ps);
82 ps = nist->GetChunkSuccessRate (
WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8);
83 if (ps < 0.0 || ps > 1.0)
88 nistdataset.Add (snr, ps);
95 yansplot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
96 yansplot.
SetLegend (
"SNR(dB)",
"Frame Success Rate");
97 yansplot.
SetExtra (
"set xrange [-5:55]\n\ 99 set style line 1 linewidth 5\n\ 100 set style line 2 linewidth 5\n\ 101 set style line 3 linewidth 5\n\ 102 set style line 4 linewidth 5\n\ 103 set style line 5 linewidth 5\n\ 104 set style line 6 linewidth 5\n\ 105 set style line 7 linewidth 5\n\ 106 set style line 8 linewidth 5\n\ 107 set style line 9 linewidth 5\n\ 108 set style line 10 linewidth 5\n\ 109 set style line 11 linewidth 5\n\ 110 set style increment user" );
114 nistplot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
115 nistplot.
SetLegend (
"SNR(dB)",
"Frame Success Rate");
116 nistplot.
SetExtra (
"set xrange [-5:55]\n\ 118 set style line 1 linewidth 5\n\ 119 set style line 2 linewidth 5\n\ 120 set style line 3 linewidth 5\n\ 121 set style line 4 linewidth 5\n\ 122 set style line 5 linewidth 5\n\ 123 set style line 6 linewidth 5\n\ 124 set style line 7 linewidth 5\n\ 125 set style line 8 linewidth 5\n\ 126 set style line 9 linewidth 5\n\ 127 set style line 10 linewidth 5\n\ 128 set style line 11 linewidth 5\n\ 129 set style increment user" );
Smart pointer class similar to boost::intrusive_ptr.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Class to represent a 2D points plot.
void AddDataset(const GnuplotDataset &dataset)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Parse command-line arguments.
void SetLegend(const std::string &xLegend, const std::string &yLegend)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual double GetChunkSuccessRate(WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
A pure virtual method that must be implemented in the subclass.
void SetExtra(const std::string &extra)
void SetTerminal(const std::string &terminal)