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
file (
"frame-success-rate-dsss.plt");
38 std::vector <std::string> modes;
40 modes.push_back (
"DsssRate1Mbps");
41 modes.push_back (
"DsssRate2Mbps");
42 modes.push_back (
"DsssRate5_5Mbps");
43 modes.push_back (
"DsssRate11Mbps");
46 cmd.AddValue (
"FrameSize",
"The frame size in bytes", FrameSize);
47 cmd.Parse (argc, argv);
55 for (uint32_t i = 0; i < modes.size (); i++)
57 std::cout << modes[i] << std::endl;
59 txVector.SetMode (modes[i]);
61 for (
double snr = -10.0; snr <= 20.0; snr += 0.1)
64 if (psYans < 0.0 || psYans > 1.0)
69 double psNist = nist->GetChunkSuccessRate (
WifiMode (modes[i]), txVector, std::pow (10.0,snr / 10.0), FrameSize * 8);
70 if (psNist < 0.0 || psNist > 1.0)
72 std::cout<<psNist<<std::endl;
80 dataset.Add (snr, psNist);
86 plot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
87 plot.
SetLegend (
"SNR(dB)",
"Frame Success Rate");
88 plot.
SetExtra (
"set xrange [-10:20]\n\ 90 set style line 1 linewidth 5\n\ 91 set style line 2 linewidth 5\n\ 92 set style line 3 linewidth 5\n\ 93 set style line 4 linewidth 5\n\ 94 set style line 5 linewidth 5\n\ 95 set style line 6 linewidth 5\n\ 96 set style line 7 linewidth 5\n\ 97 set style line 8 linewidth 5\n\ 98 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)