22 #include "ns3/core-module.h"
23 #include "ns3/gnuplot.h"
24 #include "ns3/satellite-env-variables.h"
25 #include "ns3/satellite-look-up-table.h"
26 #include "ns3/singleton.h"
37 NS_LOG_COMPONENT_DEFINE(
"SatLinkResultsPlot");
79 Gnuplot
GetGnuplot(std::string outputName, std::string title);
93 m_inputPath = Singleton<SatEnvVariables>::Get()->GetDataPath() +
"/linkresults/";
111 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat2.txt");
112 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat3.txt");
113 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat4.txt");
114 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat5.txt");
115 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat6.txt");
116 Ptr<SatLookUpTable> table6 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat7.txt");
117 Ptr<SatLookUpTable> table7 =
118 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat13.txt");
119 Ptr<SatLookUpTable> table8 =
120 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat14.txt");
121 Ptr<SatLookUpTable> table9 =
122 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat15.txt");
123 Ptr<SatLookUpTable> table10 =
124 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat16.txt");
125 Ptr<SatLookUpTable> table11 =
126 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat17.txt");
128 Gnuplot2dDataset dataset1 =
GetGnuplotDataset(table1,
"Waveform 2: 112 bits, QPSK 1/3");
129 Gnuplot2dDataset dataset2 =
GetGnuplotDataset(table2,
"Waveform 3: 304 bits, QPSK 1/3");
130 Gnuplot2dDataset dataset3 =
GetGnuplotDataset(table3,
"Waveform 4: 472 bits, QPSK 1/2");
131 Gnuplot2dDataset dataset4 =
GetGnuplotDataset(table4,
"Waveform 5: 680 bits, QPSK 2/3");
132 Gnuplot2dDataset dataset5 =
GetGnuplotDataset(table5,
"Waveform 6: 768 bits, QPSK 3/4");
133 Gnuplot2dDataset dataset6 =
GetGnuplotDataset(table6,
"Waveform 7: 864 bits, QPSK 5/6");
134 Gnuplot2dDataset dataset7 =
GetGnuplotDataset(table7,
"Waveform 13: 984 bits, QPSK 1/3");
135 Gnuplot2dDataset dataset8 =
GetGnuplotDataset(table8,
"Waveform 14: 1504 bits, QPSK 1/2");
136 Gnuplot2dDataset dataset9 =
GetGnuplotDataset(table9,
"Waveform 15: 2112 bits, QPSK 2/3");
137 Gnuplot2dDataset dataset10 =
GetGnuplotDataset(table10,
"Waveform 16: 2384 bits, QPSK 3/4");
138 Gnuplot2dDataset dataset11 =
GetGnuplotDataset(table11,
"Waveform 17: 2664 bits, QPSK 5/6");
140 Gnuplot plot =
GetGnuplot(
"rcs2_qpsk",
"Link Results for DVB-RCS2 with QPSK");
141 plot.AddDataset(dataset1);
142 plot.AddDataset(dataset2);
143 plot.AddDataset(dataset3);
144 plot.AddDataset(dataset4);
145 plot.AddDataset(dataset5);
146 plot.AddDataset(dataset6);
147 plot.AddDataset(dataset7);
148 plot.AddDataset(dataset8);
149 plot.AddDataset(dataset9);
150 plot.AddDataset(dataset10);
151 plot.AddDataset(dataset11);
153 std::string plotFileName =
"rcs2_qpsk.plt";
154 std::ofstream plotFile(plotFileName.c_str());
155 plot.GenerateOutput(plotFile);
158 std::cout <<
"Output file written: " << plotFileName << std::endl;
165 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat8.txt");
166 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat9.txt");
167 Ptr<SatLookUpTable> table3 =
168 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat10.txt");
169 Ptr<SatLookUpTable> table4 =
170 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat18.txt");
171 Ptr<SatLookUpTable> table5 =
172 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat19.txt");
173 Ptr<SatLookUpTable> table6 =
174 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat20.txt");
176 Gnuplot2dDataset dataset1 =
GetGnuplotDataset(table1,
"Waveform 8: 920 bits, 8PSK 2/3");
177 Gnuplot2dDataset dataset2 =
GetGnuplotDataset(table2,
"Waveform 9: 1040 bits, 8PSK 3/4");
178 Gnuplot2dDataset dataset3 =
GetGnuplotDataset(table3,
"Waveform 10: 1152 bits, 8PSK 5/6");
179 Gnuplot2dDataset dataset4 =
GetGnuplotDataset(table4,
"Waveform 18: 2840 bits, 8PSK 2/3");
180 Gnuplot2dDataset dataset5 =
GetGnuplotDataset(table5,
"Waveform 19: 3200 bits, 8PSK 3/4");
181 Gnuplot2dDataset dataset6 =
GetGnuplotDataset(table6,
"Waveform 20: 3552 bits, 8PSK 5/6");
183 Gnuplot plot =
GetGnuplot(
"rcs2_8psk",
"Link Results for DVB-RCS2 with 8PSK");
184 plot.AddDataset(dataset1);
185 plot.AddDataset(dataset2);
186 plot.AddDataset(dataset3);
187 plot.AddDataset(dataset4);
188 plot.AddDataset(dataset5);
189 plot.AddDataset(dataset6);
191 std::string plotFileName =
"rcs2_8psk.plt";
192 std::ofstream plotFile(plotFileName.c_str());
193 plot.GenerateOutput(plotFile);
196 std::cout <<
"Output file written: " << plotFileName << std::endl;
203 Ptr<SatLookUpTable> table1 =
204 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat11.txt");
205 Ptr<SatLookUpTable> table2 =
206 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat12.txt");
207 Ptr<SatLookUpTable> table3 =
208 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat21.txt");
209 Ptr<SatLookUpTable> table4 =
210 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat22.txt");
212 Gnuplot2dDataset dataset1 =
GetGnuplotDataset(table1,
"Waveform 11: 1400 bits, 16QAM 3/4");
213 Gnuplot2dDataset dataset2 =
GetGnuplotDataset(table2,
"Waveform 12: 1552 bits, 16QAM 5/6");
214 Gnuplot2dDataset dataset3 =
GetGnuplotDataset(table3,
"Waveform 21: 4312 bits, 16QAM 3/4");
215 Gnuplot2dDataset dataset4 =
GetGnuplotDataset(table4,
"Waveform 22: 4792 bits, 16QAM 5/6");
217 Gnuplot plot =
GetGnuplot(
"rcs2_16qam",
"Link Results for DVB-RCS2 with 16QAM");
218 plot.AddDataset(dataset1);
219 plot.AddDataset(dataset2);
220 plot.AddDataset(dataset3);
221 plot.AddDataset(dataset4);
223 std::string plotFileName =
"rcs2_16qam.plt";
224 std::ofstream plotFile(plotFileName.c_str());
225 plot.GenerateOutput(plotFile);
228 std::cout <<
"Output file written: " << plotFileName << std::endl;
235 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_1_to_2.txt");
236 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_2_to_3.txt");
237 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_3_to_4.txt");
238 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_3_to_5.txt");
239 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_4_to_5.txt");
240 Ptr<SatLookUpTable> table6 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_5_to_6.txt");
241 Ptr<SatLookUpTable> table7 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_8_to_9.txt");
242 Ptr<SatLookUpTable> table8 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_9_to_10.txt");
253 Gnuplot plot =
GetGnuplot(
"s2_qpsk",
"Link Results for DVB-S2 with QPSK");
254 plot.AddDataset(dataset1);
255 plot.AddDataset(dataset2);
256 plot.AddDataset(dataset3);
257 plot.AddDataset(dataset4);
258 plot.AddDataset(dataset5);
259 plot.AddDataset(dataset6);
260 plot.AddDataset(dataset7);
261 plot.AddDataset(dataset8);
263 std::string plotFileName =
"s2_qpsk.plt";
264 std::ofstream plotFile(plotFileName.c_str());
265 plot.GenerateOutput(plotFile);
268 std::cout <<
"Output file written: " << plotFileName << std::endl;
275 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_2_to_3.txt");
276 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_3_to_4.txt");
277 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_3_to_5.txt");
278 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_5_to_6.txt");
279 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_8_to_9.txt");
280 Ptr<SatLookUpTable> table6 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_9_to_10.txt");
289 Gnuplot plot =
GetGnuplot(
"s2_8psk",
"Link Results for DVB-S2 with 8PSK");
290 plot.AddDataset(dataset1);
291 plot.AddDataset(dataset2);
292 plot.AddDataset(dataset3);
293 plot.AddDataset(dataset4);
294 plot.AddDataset(dataset5);
295 plot.AddDataset(dataset6);
297 std::string plotFileName =
"s2_8psk.plt";
298 std::ofstream plotFile(plotFileName.c_str());
299 plot.GenerateOutput(plotFile);
302 std::cout <<
"Output file written: " << plotFileName << std::endl;
309 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_2_to_3.txt");
310 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_3_to_4.txt");
311 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_4_to_5.txt");
312 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_5_to_6.txt");
313 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_8_to_9.txt");
314 Ptr<SatLookUpTable> table6 =
315 CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_9_to_10.txt");
324 Gnuplot plot =
GetGnuplot(
"s2_16apsk",
"Link Results for DVB-S2 with 16APSK");
325 plot.AddDataset(dataset1);
326 plot.AddDataset(dataset2);
327 plot.AddDataset(dataset3);
328 plot.AddDataset(dataset4);
329 plot.AddDataset(dataset5);
330 plot.AddDataset(dataset6);
332 std::string plotFileName =
"s2_16apsk.plt";
333 std::ofstream plotFile(plotFileName.c_str());
334 plot.GenerateOutput(plotFile);
337 std::cout <<
"Output file written: " << plotFileName << std::endl;
344 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_3_to_4.txt");
345 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_4_to_5.txt");
346 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_5_to_6.txt");
347 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_8_to_9.txt");
354 Gnuplot plot =
GetGnuplot(
"s2_32apsk",
"Link Results for DVB-S2 with 32APSK");
355 plot.AddDataset(dataset1);
356 plot.AddDataset(dataset2);
357 plot.AddDataset(dataset3);
358 plot.AddDataset(dataset4);
360 std::string plotFileName =
"s2_32apsk.plt";
361 std::ofstream plotFile(plotFileName.c_str());
362 plot.GenerateOutput(plotFile);
365 std::cout <<
"Output file written: " << plotFileName << std::endl;
372 Gnuplot2dDataset ret;
374 ret.SetStyle(Gnuplot2dDataset::LINES);
376 bool writeFlag =
false;
381 bler = table->GetBler(sinr);
416 Gnuplot ret(outputName +
".png");
418 ret.SetTerminal(
"png");
419 ret.SetLegend(
"SINR (in dB)",
"BLER");
420 ret.AppendExtra(
"set key bottom left");
421 ret.AppendExtra(
"set logscale y 10");
422 ret.AppendExtra(
"set ytics 10");
423 ret.AppendExtra(
"set mxtics 5");
424 ret.AppendExtra(
"set grid xtics mxtics ytics");
433 main(
int argc,
char* argv[])
435 ns3::Ptr<ns3::SatLinkResultsPlot> stub;
436 stub = ns3::Create<ns3::SatLinkResultsPlot>();
Example for plotting satellite link results data.
Gnuplot2dDataset GetGnuplotDataset(Ptr< SatLookUpTable > table, std::string title)
void Run()
Load link results data files and generate plots from them.
Gnuplot GetGnuplot(std::string outputName, std::string title)
SatLinkResultsPlot()
Creates an empty instance.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.