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"
38 NS_LOG_COMPONENT_DEFINE(
"SatLinkResultsPlot");
80 Gnuplot
GetGnuplot(std::string outputName, std::string title);
95 Singleton<SatEnvVariables>::Get()->GetDataPath() +
"/additional-input/linkresults/";
113 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat2.txt");
114 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat3.txt");
115 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat4.txt");
116 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat5.txt");
117 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat6.txt");
118 Ptr<SatLookUpTable> table6 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat7.txt");
119 Ptr<SatLookUpTable> table7 =
120 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat13.txt");
121 Ptr<SatLookUpTable> table8 =
122 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat14.txt");
123 Ptr<SatLookUpTable> table9 =
124 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat15.txt");
125 Ptr<SatLookUpTable> table10 =
126 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat16.txt");
127 Ptr<SatLookUpTable> table11 =
128 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat17.txt");
130 Gnuplot2dDataset dataset1 =
GetGnuplotDataset(table1,
"Waveform 2: 112 bits, QPSK 1/3");
131 Gnuplot2dDataset dataset2 =
GetGnuplotDataset(table2,
"Waveform 3: 304 bits, QPSK 1/3");
132 Gnuplot2dDataset dataset3 =
GetGnuplotDataset(table3,
"Waveform 4: 472 bits, QPSK 1/2");
133 Gnuplot2dDataset dataset4 =
GetGnuplotDataset(table4,
"Waveform 5: 680 bits, QPSK 2/3");
134 Gnuplot2dDataset dataset5 =
GetGnuplotDataset(table5,
"Waveform 6: 768 bits, QPSK 3/4");
135 Gnuplot2dDataset dataset6 =
GetGnuplotDataset(table6,
"Waveform 7: 864 bits, QPSK 5/6");
136 Gnuplot2dDataset dataset7 =
GetGnuplotDataset(table7,
"Waveform 13: 984 bits, QPSK 1/3");
137 Gnuplot2dDataset dataset8 =
GetGnuplotDataset(table8,
"Waveform 14: 1504 bits, QPSK 1/2");
138 Gnuplot2dDataset dataset9 =
GetGnuplotDataset(table9,
"Waveform 15: 2112 bits, QPSK 2/3");
139 Gnuplot2dDataset dataset10 =
GetGnuplotDataset(table10,
"Waveform 16: 2384 bits, QPSK 3/4");
140 Gnuplot2dDataset dataset11 =
GetGnuplotDataset(table11,
"Waveform 17: 2664 bits, QPSK 5/6");
142 Gnuplot plot =
GetGnuplot(
"rcs2_qpsk",
"Link Results for DVB-RCS2 with QPSK");
143 plot.AddDataset(dataset1);
144 plot.AddDataset(dataset2);
145 plot.AddDataset(dataset3);
146 plot.AddDataset(dataset4);
147 plot.AddDataset(dataset5);
148 plot.AddDataset(dataset6);
149 plot.AddDataset(dataset7);
150 plot.AddDataset(dataset8);
151 plot.AddDataset(dataset9);
152 plot.AddDataset(dataset10);
153 plot.AddDataset(dataset11);
155 std::string plotFileName =
"rcs2_qpsk.plt";
156 std::ofstream plotFile(plotFileName.c_str());
157 plot.GenerateOutput(plotFile);
160 std::cout <<
"Output file written: " << plotFileName << std::endl;
167 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat8.txt");
168 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat9.txt");
169 Ptr<SatLookUpTable> table3 =
170 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat10.txt");
171 Ptr<SatLookUpTable> table4 =
172 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat18.txt");
173 Ptr<SatLookUpTable> table5 =
174 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat19.txt");
175 Ptr<SatLookUpTable> table6 =
176 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat20.txt");
178 Gnuplot2dDataset dataset1 =
GetGnuplotDataset(table1,
"Waveform 8: 920 bits, 8PSK 2/3");
179 Gnuplot2dDataset dataset2 =
GetGnuplotDataset(table2,
"Waveform 9: 1040 bits, 8PSK 3/4");
180 Gnuplot2dDataset dataset3 =
GetGnuplotDataset(table3,
"Waveform 10: 1152 bits, 8PSK 5/6");
181 Gnuplot2dDataset dataset4 =
GetGnuplotDataset(table4,
"Waveform 18: 2840 bits, 8PSK 2/3");
182 Gnuplot2dDataset dataset5 =
GetGnuplotDataset(table5,
"Waveform 19: 3200 bits, 8PSK 3/4");
183 Gnuplot2dDataset dataset6 =
GetGnuplotDataset(table6,
"Waveform 20: 3552 bits, 8PSK 5/6");
185 Gnuplot plot =
GetGnuplot(
"rcs2_8psk",
"Link Results for DVB-RCS2 with 8PSK");
186 plot.AddDataset(dataset1);
187 plot.AddDataset(dataset2);
188 plot.AddDataset(dataset3);
189 plot.AddDataset(dataset4);
190 plot.AddDataset(dataset5);
191 plot.AddDataset(dataset6);
193 std::string plotFileName =
"rcs2_8psk.plt";
194 std::ofstream plotFile(plotFileName.c_str());
195 plot.GenerateOutput(plotFile);
198 std::cout <<
"Output file written: " << plotFileName << std::endl;
205 Ptr<SatLookUpTable> table1 =
206 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat11.txt");
207 Ptr<SatLookUpTable> table2 =
208 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat12.txt");
209 Ptr<SatLookUpTable> table3 =
210 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat21.txt");
211 Ptr<SatLookUpTable> table4 =
212 CreateObject<SatLookUpTable>(
m_inputPath +
"rcs2_waveformat22.txt");
214 Gnuplot2dDataset dataset1 =
GetGnuplotDataset(table1,
"Waveform 11: 1400 bits, 16QAM 3/4");
215 Gnuplot2dDataset dataset2 =
GetGnuplotDataset(table2,
"Waveform 12: 1552 bits, 16QAM 5/6");
216 Gnuplot2dDataset dataset3 =
GetGnuplotDataset(table3,
"Waveform 21: 4312 bits, 16QAM 3/4");
217 Gnuplot2dDataset dataset4 =
GetGnuplotDataset(table4,
"Waveform 22: 4792 bits, 16QAM 5/6");
219 Gnuplot plot =
GetGnuplot(
"rcs2_16qam",
"Link Results for DVB-RCS2 with 16QAM");
220 plot.AddDataset(dataset1);
221 plot.AddDataset(dataset2);
222 plot.AddDataset(dataset3);
223 plot.AddDataset(dataset4);
225 std::string plotFileName =
"rcs2_16qam.plt";
226 std::ofstream plotFile(plotFileName.c_str());
227 plot.GenerateOutput(plotFile);
230 std::cout <<
"Output file written: " << plotFileName << std::endl;
237 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_1_to_2.txt");
238 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_2_to_3.txt");
239 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_3_to_4.txt");
240 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_3_to_5.txt");
241 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_4_to_5.txt");
242 Ptr<SatLookUpTable> table6 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_5_to_6.txt");
243 Ptr<SatLookUpTable> table7 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_8_to_9.txt");
244 Ptr<SatLookUpTable> table8 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_qpsk_9_to_10.txt");
255 Gnuplot plot =
GetGnuplot(
"s2_qpsk",
"Link Results for DVB-S2 with QPSK");
256 plot.AddDataset(dataset1);
257 plot.AddDataset(dataset2);
258 plot.AddDataset(dataset3);
259 plot.AddDataset(dataset4);
260 plot.AddDataset(dataset5);
261 plot.AddDataset(dataset6);
262 plot.AddDataset(dataset7);
263 plot.AddDataset(dataset8);
265 std::string plotFileName =
"s2_qpsk.plt";
266 std::ofstream plotFile(plotFileName.c_str());
267 plot.GenerateOutput(plotFile);
270 std::cout <<
"Output file written: " << plotFileName << std::endl;
277 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_2_to_3.txt");
278 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_3_to_4.txt");
279 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_3_to_5.txt");
280 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_5_to_6.txt");
281 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_8_to_9.txt");
282 Ptr<SatLookUpTable> table6 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_8psk_9_to_10.txt");
291 Gnuplot plot =
GetGnuplot(
"s2_8psk",
"Link Results for DVB-S2 with 8PSK");
292 plot.AddDataset(dataset1);
293 plot.AddDataset(dataset2);
294 plot.AddDataset(dataset3);
295 plot.AddDataset(dataset4);
296 plot.AddDataset(dataset5);
297 plot.AddDataset(dataset6);
299 std::string plotFileName =
"s2_8psk.plt";
300 std::ofstream plotFile(plotFileName.c_str());
301 plot.GenerateOutput(plotFile);
304 std::cout <<
"Output file written: " << plotFileName << std::endl;
311 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_2_to_3.txt");
312 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_3_to_4.txt");
313 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_4_to_5.txt");
314 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_5_to_6.txt");
315 Ptr<SatLookUpTable> table5 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_8_to_9.txt");
316 Ptr<SatLookUpTable> table6 =
317 CreateObject<SatLookUpTable>(
m_inputPath +
"s2_16apsk_9_to_10.txt");
326 Gnuplot plot =
GetGnuplot(
"s2_16apsk",
"Link Results for DVB-S2 with 16APSK");
327 plot.AddDataset(dataset1);
328 plot.AddDataset(dataset2);
329 plot.AddDataset(dataset3);
330 plot.AddDataset(dataset4);
331 plot.AddDataset(dataset5);
332 plot.AddDataset(dataset6);
334 std::string plotFileName =
"s2_16apsk.plt";
335 std::ofstream plotFile(plotFileName.c_str());
336 plot.GenerateOutput(plotFile);
339 std::cout <<
"Output file written: " << plotFileName << std::endl;
346 Ptr<SatLookUpTable> table1 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_3_to_4.txt");
347 Ptr<SatLookUpTable> table2 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_4_to_5.txt");
348 Ptr<SatLookUpTable> table3 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_5_to_6.txt");
349 Ptr<SatLookUpTable> table4 = CreateObject<SatLookUpTable>(
m_inputPath +
"s2_32apsk_8_to_9.txt");
356 Gnuplot plot =
GetGnuplot(
"s2_32apsk",
"Link Results for DVB-S2 with 32APSK");
357 plot.AddDataset(dataset1);
358 plot.AddDataset(dataset2);
359 plot.AddDataset(dataset3);
360 plot.AddDataset(dataset4);
362 std::string plotFileName =
"s2_32apsk.plt";
363 std::ofstream plotFile(plotFileName.c_str());
364 plot.GenerateOutput(plotFile);
367 std::cout <<
"Output file written: " << plotFileName << std::endl;
374 Gnuplot2dDataset ret;
376 ret.SetStyle(Gnuplot2dDataset::LINES);
378 bool writeFlag =
false;
383 bler = table->GetBler(sinr);
418 Gnuplot ret(outputName +
".png");
420 ret.SetTerminal(
"png");
421 ret.SetLegend(
"SINR (in dB)",
"BLER");
422 ret.AppendExtra(
"set key bottom left");
423 ret.AppendExtra(
"set logscale y 10");
424 ret.AppendExtra(
"set ytics 10");
425 ret.AppendExtra(
"set mxtics 5");
426 ret.AppendExtra(
"set grid xtics mxtics ytics");
435 main(
int argc,
char* argv[])
437 ns3::Ptr<ns3::SatLinkResultsPlot> stub;
438 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.