satellite-stats-link-jitter-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Magister Solutions
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Bastien Tauran <bastien.tauran@viveris.fr>
19  *
20  */
21 
23 
24 #include <ns3/application-delay-probe.h>
25 #include <ns3/application.h>
26 #include <ns3/boolean.h>
27 #include <ns3/callback.h>
28 #include <ns3/data-collection-object.h>
29 #include <ns3/distribution-collector.h>
30 #include <ns3/enum.h>
31 #include <ns3/inet-socket-address.h>
32 #include <ns3/ipv4.h>
33 #include <ns3/log.h>
34 #include <ns3/mac48-address.h>
35 #include <ns3/magister-gnuplot-aggregator.h>
36 #include <ns3/multi-file-aggregator.h>
37 #include <ns3/net-device.h>
38 #include <ns3/node-container.h>
39 #include <ns3/nstime.h>
40 #include <ns3/probe.h>
41 #include <ns3/satellite-helper.h>
42 #include <ns3/satellite-id-mapper.h>
43 #include <ns3/satellite-mac.h>
44 #include <ns3/satellite-net-device.h>
45 #include <ns3/satellite-orbiter-net-device.h>
46 #include <ns3/satellite-phy.h>
47 #include <ns3/satellite-time-tag.h>
48 #include <ns3/satellite-topology.h>
49 #include <ns3/scalar-collector.h>
50 #include <ns3/singleton.h>
51 #include <ns3/string.h>
52 #include <ns3/traffic-time-tag.h>
53 #include <ns3/unit-conversion-collector.h>
54 
55 #include <map>
56 #include <sstream>
57 #include <string>
58 #include <utility>
59 
60 NS_LOG_COMPONENT_DEFINE("SatStatsLinkJitterHelper");
61 
62 namespace ns3
63 {
64 
65 NS_OBJECT_ENSURE_REGISTERED(SatStatsLinkJitterHelper);
66 
68  : SatStatsHelper(satHelper),
69  m_averagingMode(false)
70 {
71  NS_LOG_FUNCTION(this << satHelper);
72 }
73 
75 {
76  NS_LOG_FUNCTION(this);
77 }
78 
79 TypeId // static
81 {
82  static TypeId tid =
83  TypeId("ns3::SatStatsLinkJitterHelper")
84  .SetParent<SatStatsHelper>()
85  .AddAttribute("AveragingMode",
86  "If true, all samples will be averaged before passed to aggregator. "
87  "Only affects histogram, PDF, and CDF output types.",
88  BooleanValue(false),
89  MakeBooleanAccessor(&SatStatsLinkJitterHelper::SetAveragingMode,
91  MakeBooleanChecker());
92  return tid;
93 }
94 
95 void
97 {
98  NS_LOG_FUNCTION(this << averagingMode);
99  m_averagingMode = averagingMode;
100 }
101 
102 bool
104 {
105  return m_averagingMode;
106 }
107 
108 void
110 {
111  NS_LOG_FUNCTION(this);
112 
113  switch (GetOutputType())
114  {
116  NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
117  << " is not a valid output type for this statistics.");
118  break;
119 
121  // Setup aggregator.
122  m_aggregator = CreateAggregator("ns3::MultiFileAggregator",
123  "OutputFileName",
124  StringValue(GetOutputFileName()),
125  "MultiFileMode",
126  BooleanValue(false),
127  "EnableContextPrinting",
128  BooleanValue(true),
129  "GeneralHeading",
130  StringValue(GetIdentifierHeading("jitter_sec")));
131 
132  // Setup collectors.
133  m_terminalCollectors.SetType("ns3::ScalarCollector");
134  m_terminalCollectors.SetAttribute("InputDataType",
135  EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
136  m_terminalCollectors.SetAttribute(
137  "OutputType",
138  EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
140  m_terminalCollectors.ConnectToAggregator("Output",
141  m_aggregator,
142  &MultiFileAggregator::Write1d);
143  break;
144  }
145 
147  // Setup aggregator.
148  m_aggregator = CreateAggregator("ns3::MultiFileAggregator",
149  "OutputFileName",
150  StringValue(GetOutputFileName()),
151  "GeneralHeading",
152  StringValue(GetTimeHeading("jitter_sec")));
153 
154  // Setup collectors.
155  m_terminalCollectors.SetType("ns3::UnitConversionCollector");
156  m_terminalCollectors.SetAttribute("ConversionType",
157  EnumValue(UnitConversionCollector::TRANSPARENT));
159  m_terminalCollectors.ConnectToAggregator("OutputTimeValue",
160  m_aggregator,
161  &MultiFileAggregator::Write2d);
162  break;
163  }
164 
168  if (m_averagingMode)
169  {
170  // Setup aggregator.
171  m_aggregator = CreateAggregator("ns3::MultiFileAggregator",
172  "OutputFileName",
173  StringValue(GetOutputFileName()),
174  "MultiFileMode",
175  BooleanValue(false),
176  "EnableContextPrinting",
177  BooleanValue(false),
178  "GeneralHeading",
179  StringValue(GetDistributionHeading("jitter_sec")));
180  Ptr<MultiFileAggregator> fileAggregator =
181  m_aggregator->GetObject<MultiFileAggregator>();
182  NS_ASSERT(fileAggregator != nullptr);
183 
184  // Setup the final-level collector.
185  m_averagingCollector = CreateObject<DistributionCollector>();
186  DistributionCollector::OutputType_t outputType =
187  DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
189  {
190  outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
191  }
193  {
194  outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
195  }
196  m_averagingCollector->SetOutputType(outputType);
197  m_averagingCollector->SetName("0");
198  m_averagingCollector->TraceConnect(
199  "Output",
200  "0",
201  MakeCallback(&MultiFileAggregator::Write2d, fileAggregator));
202  m_averagingCollector->TraceConnect(
203  "OutputString",
204  "0",
205  MakeCallback(&MultiFileAggregator::AddContextHeading, fileAggregator));
206  m_averagingCollector->TraceConnect(
207  "Warning",
208  "0",
209  MakeCallback(&MultiFileAggregator::EnableContextWarning, fileAggregator));
210 
211  // Setup collectors.
212  m_terminalCollectors.SetType("ns3::ScalarCollector");
213  m_terminalCollectors.SetAttribute("InputDataType",
214  EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
215  m_terminalCollectors.SetAttribute(
216  "OutputType",
217  EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
219  Callback<void, double> callback =
220  MakeCallback(&DistributionCollector::TraceSinkDouble1, m_averagingCollector);
221  for (CollectorMap::Iterator it = m_terminalCollectors.Begin();
222  it != m_terminalCollectors.End();
223  ++it)
224  {
225  it->second->TraceConnectWithoutContext("Output", callback);
226  }
227  }
228  else
229  {
230  // Setup aggregator.
231  m_aggregator = CreateAggregator("ns3::MultiFileAggregator",
232  "OutputFileName",
233  StringValue(GetOutputFileName()),
234  "GeneralHeading",
235  StringValue(GetDistributionHeading("jitter_sec")));
236 
237  // Setup collectors.
238  m_terminalCollectors.SetType("ns3::DistributionCollector");
239  DistributionCollector::OutputType_t outputType =
240  DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
242  {
243  outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
244  }
246  {
247  outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
248  }
249  m_terminalCollectors.SetAttribute("OutputType", EnumValue(outputType));
251  m_terminalCollectors.ConnectToAggregator("Output",
252  m_aggregator,
253  &MultiFileAggregator::Write2d);
254  m_terminalCollectors.ConnectToAggregator("OutputString",
255  m_aggregator,
256  &MultiFileAggregator::AddContextHeading);
257  m_terminalCollectors.ConnectToAggregator("Warning",
258  m_aggregator,
259  &MultiFileAggregator::EnableContextWarning);
260  }
261 
262  break;
263  }
264 
267  NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
268  << " is not a valid output type for this statistics.");
269  break;
270 
272  // Setup aggregator.
273  m_aggregator = CreateAggregator("ns3::MagisterGnuplotAggregator",
274  "OutputPath",
275  StringValue(GetOutputPath()),
276  "OutputFileName",
277  StringValue(GetName()));
278  Ptr<MagisterGnuplotAggregator> plotAggregator =
279  m_aggregator->GetObject<MagisterGnuplotAggregator>();
280  NS_ASSERT(plotAggregator != nullptr);
281  // plot->SetTitle ("");
282  plotAggregator->SetLegend("Time (in seconds)", "Packet jitter (in seconds)");
283  plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
284 
285  // Setup collectors.
286  m_terminalCollectors.SetType("ns3::UnitConversionCollector");
287  m_terminalCollectors.SetAttribute("ConversionType",
288  EnumValue(UnitConversionCollector::TRANSPARENT));
290  for (CollectorMap::Iterator it = m_terminalCollectors.Begin();
291  it != m_terminalCollectors.End();
292  ++it)
293  {
294  const std::string context = it->second->GetName();
295  plotAggregator->Add2dDataset(context, context);
296  }
297  m_terminalCollectors.ConnectToAggregator("OutputTimeValue",
298  m_aggregator,
299  &MagisterGnuplotAggregator::Write2d);
300  break;
301  }
302 
306  if (m_averagingMode)
307  {
308  // Setup aggregator.
309  m_aggregator = CreateAggregator("ns3::MagisterGnuplotAggregator",
310  "OutputPath",
311  StringValue(GetOutputPath()),
312  "OutputFileName",
313  StringValue(GetName()));
314  Ptr<MagisterGnuplotAggregator> plotAggregator =
315  m_aggregator->GetObject<MagisterGnuplotAggregator>();
316  NS_ASSERT(plotAggregator != nullptr);
317  // plot->SetTitle ("");
318  plotAggregator->SetLegend("Packet jitter (in seconds)", "Frequency");
319  plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
320  plotAggregator->Add2dDataset(GetName(), GetName());
322 
323  // Setup the final-level collector.
324  m_averagingCollector = CreateObject<DistributionCollector>();
325  DistributionCollector::OutputType_t outputType =
326  DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
328  {
329  outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
330  }
332  {
333  outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
334  }
335  m_averagingCollector->SetOutputType(outputType);
336  m_averagingCollector->SetName("0");
337  m_averagingCollector->TraceConnect(
338  "Output",
339  GetName(),
340  MakeCallback(&MagisterGnuplotAggregator::Write2d, plotAggregator));
342 
343  // Setup collectors.
344  m_terminalCollectors.SetType("ns3::ScalarCollector");
345  m_terminalCollectors.SetAttribute("InputDataType",
346  EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
347  m_terminalCollectors.SetAttribute(
348  "OutputType",
349  EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
351  Callback<void, double> callback =
352  MakeCallback(&DistributionCollector::TraceSinkDouble1, m_averagingCollector);
353  for (CollectorMap::Iterator it = m_terminalCollectors.Begin();
354  it != m_terminalCollectors.End();
355  ++it)
356  {
357  it->second->TraceConnectWithoutContext("Output", callback);
358  }
359  }
360  else
361  {
362  // Setup aggregator.
363  m_aggregator = CreateAggregator("ns3::MagisterGnuplotAggregator",
364  "OutputPath",
365  StringValue(GetOutputPath()),
366  "OutputFileName",
367  StringValue(GetName()));
368  Ptr<MagisterGnuplotAggregator> plotAggregator =
369  m_aggregator->GetObject<MagisterGnuplotAggregator>();
370  NS_ASSERT(plotAggregator != nullptr);
371  // plot->SetTitle ("");
372  plotAggregator->SetLegend("Packet jitter (in seconds)", "Frequency");
373  plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
374 
375  // Setup collectors.
376  m_terminalCollectors.SetType("ns3::DistributionCollector");
377  DistributionCollector::OutputType_t outputType =
378  DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
380  {
381  outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
382  }
384  {
385  outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
386  }
387  m_terminalCollectors.SetAttribute("OutputType", EnumValue(outputType));
389  for (CollectorMap::Iterator it = m_terminalCollectors.Begin();
390  it != m_terminalCollectors.End();
391  ++it)
392  {
393  const std::string context = it->second->GetName();
394  plotAggregator->Add2dDataset(context, context);
395  }
396  m_terminalCollectors.ConnectToAggregator("Output",
397  m_aggregator,
398  &MagisterGnuplotAggregator::Write2d);
399  }
400 
401  break;
402  }
403 
404  default:
405  NS_FATAL_ERROR("SatStatsLinkJitterHelper - Invalid output type");
406  break;
407  }
408 
409  // Setup probes and connect them to the collectors.
410  InstallProbes();
411 
412 } // end of `void DoInstall ();`
413 
414 void
416 {
417  // The method below is supposed to be implemented by the child class.
418  DoInstallProbes();
419 }
420 
421 void
422 SatStatsLinkJitterHelper::RxLinkJitterCallback(const Time& jitter, const Address& from)
423 {
424  // NS_LOG_FUNCTION (this << jitter.GetSeconds () << from);
425 
426  if (from.IsInvalid())
427  {
428  NS_LOG_WARN(this << " discarding a packet jitter of " << jitter.GetSeconds()
429  << " from statistics collection because of"
430  << " invalid sender address");
431  }
432  else if (Mac48Address::ConvertFrom(from).IsBroadcast())
433  {
434  for (std::pair<const Address, uint32_t> item : m_identifierMap)
435  {
436  PassSampleToCollector(jitter, item.second);
437  }
438  }
439  else
440  {
441  // Determine the identifier associated with the sender address.
442  std::map<const Address, uint32_t>::const_iterator it = m_identifierMap.find(from);
443 
444  if (it != m_identifierMap.end())
445  {
446  PassSampleToCollector(jitter, it->second);
447  }
448  else
449  {
450  NS_LOG_WARN(this << " discarding a packet jitter of " << jitter.GetSeconds()
451  << " from statistics collection because of"
452  << " unknown sender address " << from);
453  }
454  }
455 }
456 
457 bool
458 SatStatsLinkJitterHelper::ConnectProbeToCollector(Ptr<Probe> probe, uint32_t identifier)
459 {
460  NS_LOG_FUNCTION(this << probe << probe->GetName() << identifier);
461 
462  bool ret = false;
463  switch (GetOutputType())
464  {
467  ret = m_terminalCollectors.ConnectWithProbe(probe,
468  "OutputSeconds",
469  identifier,
470  &ScalarCollector::TraceSinkDouble);
471  break;
472 
475  ret = m_terminalCollectors.ConnectWithProbe(probe,
476  "OutputSeconds",
477  identifier,
478  &UnitConversionCollector::TraceSinkDouble);
479  break;
480 
487  if (m_averagingMode)
488  {
489  ret = m_terminalCollectors.ConnectWithProbe(probe,
490  "OutputSeconds",
491  identifier,
492  &ScalarCollector::TraceSinkDouble);
493  }
494  else
495  {
496  ret = m_terminalCollectors.ConnectWithProbe(probe,
497  "OutputSeconds",
498  identifier,
499  &DistributionCollector::TraceSinkDouble);
500  }
501  break;
502 
503  default:
504  NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
505  << " is not a valid output type for this statistics.");
506  break;
507  }
508 
509  if (ret)
510  {
511  NS_LOG_INFO(this << " created probe " << probe->GetName() << ", connected to collector "
512  << identifier);
513  }
514  else
515  {
516  NS_LOG_WARN(this << " unable to connect probe " << probe->GetName() << " to collector "
517  << identifier);
518  }
519 
520  return ret;
521 }
522 
523 bool
524 SatStatsLinkJitterHelper::DisconnectProbeFromCollector(Ptr<Probe> probe, uint32_t identifier)
525 {
526  NS_LOG_FUNCTION(this << probe << probe->GetName() << identifier);
527 
528  bool ret = false;
529  switch (GetOutputType())
530  {
533  ret = m_terminalCollectors.DisconnectWithProbe(probe,
534  "OutputSeconds",
535  identifier,
536  &ScalarCollector::TraceSinkDouble);
537  break;
538 
541  ret = m_terminalCollectors.DisconnectWithProbe(probe,
542  "OutputSeconds",
543  identifier,
544  &UnitConversionCollector::TraceSinkDouble);
545  break;
546 
553  if (m_averagingMode)
554  {
555  ret = m_terminalCollectors.DisconnectWithProbe(probe,
556  "OutputSeconds",
557  identifier,
558  &ScalarCollector::TraceSinkDouble);
559  }
560  else
561  {
562  ret = m_terminalCollectors.DisconnectWithProbe(probe,
563  "OutputSeconds",
564  identifier,
565  &DistributionCollector::TraceSinkDouble);
566  }
567  break;
568 
569  default:
570  NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
571  << " is not a valid output type for this statistics.");
572  break;
573  }
574 
575  if (ret)
576  {
577  NS_LOG_INFO(this << " probe " << probe->GetName() << ", disconnected from collector "
578  << identifier);
579  }
580  else
581  {
582  NS_LOG_WARN(this << " unable to disconnect probe " << probe->GetName() << " from collector "
583  << identifier);
584  }
585 
586  return ret;
587 }
588 
589 void
590 SatStatsLinkJitterHelper::PassSampleToCollector(const Time& jitter, uint32_t identifier)
591 {
592  // NS_LOG_FUNCTION (this << jitter.GetSeconds () << identifier);
593 
594  Ptr<DataCollectionObject> collector = m_terminalCollectors.Get(identifier);
595  NS_ASSERT_MSG(collector != nullptr, "Unable to find collector with identifier " << identifier);
596 
597  switch (GetOutputType())
598  {
601  Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
602  NS_ASSERT(c != nullptr);
603  c->TraceSinkDouble(0.0, jitter.GetSeconds());
604  break;
605  }
606 
609  Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
610  NS_ASSERT(c != nullptr);
611  c->TraceSinkDouble(0.0, jitter.GetSeconds());
612  break;
613  }
614 
621  if (m_averagingMode)
622  {
623  Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
624  NS_ASSERT(c != nullptr);
625  c->TraceSinkDouble(0.0, jitter.GetSeconds());
626  }
627  else
628  {
629  Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
630  NS_ASSERT(c != nullptr);
631  c->TraceSinkDouble(0.0, jitter.GetSeconds());
632  }
633  break;
634 
635  default:
636  NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
637  << " is not a valid output type for this statistics.");
638  break;
639 
640  } // end of `switch (GetOutputType ())`
641 
642 } // end of `void PassSampleToCollector (Time, uint32_t)`
643 
644 void
646 {
647  m_channelLink = channelLink;
648 }
649 
650 // FORWARD FEEDER LINK DEV-LEVEL /////////////////////////////////////////////////////
651 
652 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederDevLinkJitterHelper);
653 
655  Ptr<const SatHelper> satHelper)
656  : SatStatsLinkJitterHelper(satHelper)
657 {
658  NS_LOG_FUNCTION(this << satHelper);
659 }
660 
662 {
663  NS_LOG_FUNCTION(this);
664 }
665 
666 TypeId // static
668 {
669  static TypeId tid =
670  TypeId("ns3::SatStatsFwdFeederDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
671  return tid;
672 }
673 
674 void
676 {
677  NS_LOG_FUNCTION(this);
678 
679  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
680  Callback<void, const Time&, const Address&> callback =
682 
683  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
684  {
685  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
686  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
687  NS_ASSERT(satOrbiterDev != nullptr);
688  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
689  if (satOrbiterDev->TraceConnectWithoutContext("RxFeederLinkJitter", callback))
690  {
691  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
692  << " device #" << satOrbiterDev->GetIfIndex());
693  }
694  else
695  {
696  NS_FATAL_ERROR("Error connecting to RxFeederLinkJitter trace source of SatNetDevice"
697  << " at node ID " << (*it)->GetId() << " device #"
698  << satOrbiterDev->GetIfIndex());
699  }
700  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
701 
702  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
703 
704  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
705  {
706  // Create a map of UT addresses and identifiers.
708 
709  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
710  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
711  NS_ASSERT(satDev != nullptr);
712 
713  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
714 
715  } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
716 
717  // Enable statistics-related tags on the transmitting device.
718  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
719  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
720  {
721  NetDeviceContainer devs = GetGwSatNetDevice(*it);
722 
723  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
724  {
725  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
726  NS_ASSERT(satDev != nullptr);
727 
728  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
729  }
730  }
731 
732 } // end of `void DoInstallProbes ();`
733 
734 // FORWARD USER LINK DEV-LEVEL /////////////////////////////////////////////////////
735 
736 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserDevLinkJitterHelper);
737 
739  Ptr<const SatHelper> satHelper)
740  : SatStatsLinkJitterHelper(satHelper)
741 {
742  NS_LOG_FUNCTION(this << satHelper);
743 }
744 
746 {
747  NS_LOG_FUNCTION(this);
748 }
749 
750 TypeId // static
752 {
753  static TypeId tid =
754  TypeId("ns3::SatStatsFwdUserDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
755  return tid;
756 }
757 
758 void
760 {
761  NS_LOG_FUNCTION(this);
762 
763  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
764 
765  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
766  {
767  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
768  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
769  NS_ASSERT(satOrbiterDev != nullptr);
770  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
771  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
772 
773  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
774 
775  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
776  {
777  const int32_t utId = GetUtId(*it);
778  NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
779  const uint32_t identifier = GetIdentifierForUt(*it);
780 
781  // Create the probe.
782  std::ostringstream probeName;
783  probeName << utId;
784  Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
785  probe->SetName(probeName.str());
786 
787  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
788  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
789  NS_ASSERT(satDev != nullptr);
790 
791  // Connect the object to the probe.
792  if (probe->ConnectByObject("RxLinkJitter", satDev) &&
793  ConnectProbeToCollector(probe, identifier))
794  {
795  m_probes.insert(
796  std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
797 
798  // Enable statistics-related tags and trace sources on the device.
799  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
800  }
801  else
802  {
803  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatMac"
804  << " at node ID " << (*it)->GetId() << " device #2");
805  }
806 
807  } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
808 
809  // Enable statistics-related tags on the transmitting device.
810  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
811  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
812  {
813  NetDeviceContainer devs = GetGwSatNetDevice(*it);
814 
815  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
816  {
817  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
818  NS_ASSERT(satDev != nullptr);
819 
820  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
821  }
822  }
823 
824 } // end of `void DoInstallProbes ();`
825 
826 void
828 {
829  NS_LOG_FUNCTION(this);
830 
831  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
832 
833  for (it = m_probes.begin(); it != m_probes.end(); it++)
834  {
835  Ptr<Probe> probe = it->first;
836  Ptr<Node> node = it->second.first;
837  uint32_t identifier = it->second.second;
838 
839  if (!DisconnectProbeFromCollector(probe, identifier))
840  {
841  NS_FATAL_ERROR("Error disconnecting trace file on handover");
842  }
843 
844  identifier = GetIdentifierForUtUser(node);
845 
846  if (!ConnectProbeToCollector(probe, identifier))
847  {
848  NS_FATAL_ERROR("Error connecting trace file on handover");
849  }
850 
851  it->second.second = identifier;
852  }
853 } // end of `void UpdateIdentifierOnProbes ();`
854 
855 // FORWARD FEEDER LINK MAC-LEVEL /////////////////////////////////////////////////////
856 
857 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederMacLinkJitterHelper);
858 
860  Ptr<const SatHelper> satHelper)
861  : SatStatsLinkJitterHelper(satHelper)
862 {
863  NS_LOG_FUNCTION(this << satHelper);
864 }
865 
867 {
868  NS_LOG_FUNCTION(this);
869 }
870 
871 TypeId // static
873 {
874  static TypeId tid =
875  TypeId("ns3::SatStatsFwdFeederMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
876  return tid;
877 }
878 
879 void
881 {
882  NS_LOG_FUNCTION(this);
883 
884  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
885  Callback<void, const Time&, const Address&> callback =
887 
888  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
889  {
890  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
891  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
892  NS_ASSERT(satOrbiterDev != nullptr);
893  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
894  std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
895  Ptr<SatMac> satMac;
896  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
897  it2 != satOrbiterFeederMacs.end();
898  ++it2)
899  {
900  satMac = it2->second;
901  NS_ASSERT(satMac != nullptr);
902  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
903 
904  // Connect the object to the probe.
905  if (satMac->TraceConnectWithoutContext("RxLinkJitter", callback))
906  {
907  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
908  << " device #" << satOrbiterDev->GetIfIndex());
909 
910  // Enable statistics-related tags and trace sources on the device.
911  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
912  }
913  else
914  {
915  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
916  << " at node ID " << (*it)->GetId() << " device #"
917  << satOrbiterDev->GetIfIndex());
918  }
919  }
920  std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
921  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
922  it2 != satOrbiterUserMacs.end();
923  ++it2)
924  {
925  satMac = it2->second;
926  NS_ASSERT(satMac != nullptr);
927  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
928  }
929  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
930 
931  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
932 
933  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
934  {
935  // Create a map of UT addresses and identifiers.
937 
938  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
939  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
940  NS_ASSERT(satDev != nullptr);
941  Ptr<SatMac> satMac = satDev->GetMac();
942  NS_ASSERT(satMac != nullptr);
943 
944  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
945  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
946 
947  } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
948 
949  // Enable statistics-related tags on the transmitting device.
950  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
951  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
952  {
953  NetDeviceContainer devs = GetGwSatNetDevice(*it);
954 
955  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
956  {
957  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
958  NS_ASSERT(satDev != nullptr);
959  Ptr<SatMac> satMac = satDev->GetMac();
960  NS_ASSERT(satMac != nullptr);
961 
962  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
963  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
964  }
965  }
966 
967 } // end of `void DoInstallProbes ();`
968 
969 // FORWARD USER LINK MAC-LEVEL /////////////////////////////////////////////////////
970 
971 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserMacLinkJitterHelper);
972 
974  Ptr<const SatHelper> satHelper)
975  : SatStatsLinkJitterHelper(satHelper)
976 {
977  NS_LOG_FUNCTION(this << satHelper);
978 }
979 
981 {
982  NS_LOG_FUNCTION(this);
983 }
984 
985 TypeId // static
987 {
988  static TypeId tid =
989  TypeId("ns3::SatStatsFwdUserMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
990  return tid;
991 }
992 
993 void
995 {
996  NS_LOG_FUNCTION(this);
997 
998  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
999 
1000  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1001  {
1002  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1003  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1004  NS_ASSERT(satOrbiterDev != nullptr);
1005  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1006  std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1007  Ptr<SatMac> satMac;
1008  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1009  it2 != satOrbiterFeederMacs.end();
1010  ++it2)
1011  {
1012  satMac = it2->second;
1013  NS_ASSERT(satMac != nullptr);
1014  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1015  }
1016  std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1017  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1018  it2 != satOrbiterUserMacs.end();
1019  ++it2)
1020  {
1021  satMac = it2->second;
1022  NS_ASSERT(satMac != nullptr);
1023  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1024  }
1025  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1026 
1027  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1028 
1029  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1030  {
1031  const int32_t utId = GetUtId(*it);
1032  NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
1033  const uint32_t identifier = GetIdentifierForUt(*it);
1034 
1035  // Create the probe.
1036  std::ostringstream probeName;
1037  probeName << utId;
1038  Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
1039  probe->SetName(probeName.str());
1040 
1041  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1042  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1043  NS_ASSERT(satDev != nullptr);
1044  Ptr<SatMac> satMac = satDev->GetMac();
1045  NS_ASSERT(satMac != nullptr);
1046 
1047  // Connect the object to the probe.
1048  if (probe->ConnectByObject("RxLinkJitter", satMac) &&
1049  ConnectProbeToCollector(probe, identifier))
1050  {
1051  m_probes.insert(
1052  std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
1053 
1054  // Enable statistics-related tags and trace sources on the device.
1055  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1056  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1057  }
1058  else
1059  {
1060  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatMac"
1061  << " at node ID " << (*it)->GetId() << " device #2");
1062  }
1063 
1064  } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1065 
1066  // Enable statistics-related tags on the transmitting device.
1067  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1068  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1069  {
1070  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1071 
1072  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1073  {
1074  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1075  NS_ASSERT(satDev != nullptr);
1076  Ptr<SatMac> satMac = satDev->GetMac();
1077  NS_ASSERT(satMac != nullptr);
1078 
1079  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1080  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1081  }
1082  }
1083 
1084 } // end of `void DoInstallProbes ();`
1085 
1086 void
1088 {
1089  NS_LOG_FUNCTION(this);
1090 
1091  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
1092 
1093  for (it = m_probes.begin(); it != m_probes.end(); it++)
1094  {
1095  Ptr<Probe> probe = it->first;
1096  Ptr<Node> node = it->second.first;
1097  uint32_t identifier = it->second.second;
1098 
1099  if (!DisconnectProbeFromCollector(probe, identifier))
1100  {
1101  NS_FATAL_ERROR("Error disconnecting trace file on handover");
1102  }
1103 
1104  identifier = GetIdentifierForUtUser(node);
1105 
1106  if (!ConnectProbeToCollector(probe, identifier))
1107  {
1108  NS_FATAL_ERROR("Error connecting trace file on handover");
1109  }
1110 
1111  it->second.second = identifier;
1112  }
1113 } // end of `void UpdateIdentifierOnProbes ();`
1114 
1115 // FORWARD FEEDER LINK PHY-LEVEL /////////////////////////////////////////////////////
1116 
1117 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederPhyLinkJitterHelper);
1118 
1120  Ptr<const SatHelper> satHelper)
1121  : SatStatsLinkJitterHelper(satHelper)
1122 {
1123  NS_LOG_FUNCTION(this << satHelper);
1124 
1126 }
1127 
1129 {
1130  NS_LOG_FUNCTION(this);
1131 }
1132 
1133 TypeId // static
1135 {
1136  static TypeId tid =
1137  TypeId("ns3::SatStatsFwdFeederPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1138  return tid;
1139 }
1140 
1141 void
1143 {
1144  NS_LOG_FUNCTION(this);
1145 
1146  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1147  Callback<void, const Time&, const Address&> callback =
1149 
1150  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1151  {
1152  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1153  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1154  NS_ASSERT(satOrbiterDev != nullptr);
1155  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1156  std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1157  Ptr<SatPhy> satPhy;
1158  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1159  it2 != satOrbiterFeederPhys.end();
1160  ++it2)
1161  {
1162  satPhy = it2->second;
1163  NS_ASSERT(satPhy != nullptr);
1164  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1165 
1166  // Connect the object to the probe.
1167  if (satPhy->TraceConnectWithoutContext("RxLinkJitter", callback))
1168  {
1169  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1170  << " device #" << satOrbiterDev->GetIfIndex());
1171 
1172  // Enable statistics-related tags and trace sources on the device.
1173  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1174  }
1175  else
1176  {
1177  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1178  << " at node ID " << (*it)->GetId() << " device #"
1179  << satOrbiterDev->GetIfIndex());
1180  }
1181  }
1182  std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1183  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1184  it2 != satOrbiterUserPhys.end();
1185  ++it2)
1186  {
1187  satPhy = it2->second;
1188  NS_ASSERT(satPhy != nullptr);
1189  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1190  }
1191  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1192 
1193  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1194 
1195  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1196  {
1197  // Create a map of UT addresses and identifiers.
1199 
1200  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1201  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1202  NS_ASSERT(satDev != nullptr);
1203  Ptr<SatPhy> satPhy = satDev->GetPhy();
1204  NS_ASSERT(satPhy != nullptr);
1205 
1206  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1207  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1208 
1209  } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1210 
1211  // Enable statistics-related tags on the transmitting device.
1212  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1213  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1214  {
1215  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1216 
1217  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1218  {
1219  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1220  NS_ASSERT(satDev != nullptr);
1221  Ptr<SatPhy> satPhy = satDev->GetPhy();
1222  NS_ASSERT(satPhy != nullptr);
1223 
1224  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1225  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1226  }
1227  }
1228 
1229 } // end of `void DoInstallProbes ();`
1230 
1231 // FORWARD USER LINK PHY-LEVEL /////////////////////////////////////////////////////
1232 
1233 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserPhyLinkJitterHelper);
1234 
1236  Ptr<const SatHelper> satHelper)
1237  : SatStatsLinkJitterHelper(satHelper)
1238 {
1239  NS_LOG_FUNCTION(this << satHelper);
1240 
1242 }
1243 
1245 {
1246  NS_LOG_FUNCTION(this);
1247 }
1248 
1249 TypeId // static
1251 {
1252  static TypeId tid =
1253  TypeId("ns3::SatStatsFwdUserPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1254  return tid;
1255 }
1256 
1257 void
1259 {
1260  NS_LOG_FUNCTION(this);
1261 
1262  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1263 
1264  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1265  {
1266  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1267  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1268  NS_ASSERT(satOrbiterDev != nullptr);
1269  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1270  std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1271  Ptr<SatPhy> satPhy;
1272  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1273  it2 != satOrbiterFeederPhys.end();
1274  ++it2)
1275  {
1276  satPhy = it2->second;
1277  NS_ASSERT(satPhy != nullptr);
1278  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1279  }
1280  std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1281  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1282  it2 != satOrbiterUserPhys.end();
1283  ++it2)
1284  {
1285  satPhy = it2->second;
1286  NS_ASSERT(satPhy != nullptr);
1287  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1288  }
1289  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1290 
1291  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1292 
1293  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1294  {
1295  const int32_t utId = GetUtId(*it);
1296  NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
1297  const uint32_t identifier = GetIdentifierForUt(*it);
1298 
1299  // Create the probe.
1300  std::ostringstream probeName;
1301  probeName << utId;
1302  Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
1303  probe->SetName(probeName.str());
1304 
1305  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1306  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1307  NS_ASSERT(satDev != nullptr);
1308  Ptr<SatPhy> satPhy = satDev->GetPhy();
1309  NS_ASSERT(satPhy != nullptr);
1310 
1311  // Connect the object to the probe.
1312  if (probe->ConnectByObject("RxLinkJitter", satPhy) &&
1313  ConnectProbeToCollector(probe, identifier))
1314  {
1315  m_probes.insert(
1316  std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
1317 
1318  // Enable statistics-related tags and trace sources on the device.
1319  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1320  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1321  }
1322  else
1323  {
1324  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatPhy"
1325  << " at node ID " << (*it)->GetId() << " device #2");
1326  }
1327 
1328  } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1329 
1330  // Enable statistics-related tags on the transmitting device.
1331  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1332  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1333  {
1334  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1335 
1336  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1337  {
1338  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1339  NS_ASSERT(satDev != nullptr);
1340  Ptr<SatPhy> satPhy = satDev->GetPhy();
1341  NS_ASSERT(satPhy != nullptr);
1342 
1343  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1344  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1345  }
1346  }
1347 
1348 } // end of `void DoInstallProbes ();`
1349 
1350 void
1352 {
1353  NS_LOG_FUNCTION(this);
1354 
1355  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
1356 
1357  for (it = m_probes.begin(); it != m_probes.end(); it++)
1358  {
1359  Ptr<Probe> probe = it->first;
1360  Ptr<Node> node = it->second.first;
1361  uint32_t identifier = it->second.second;
1362 
1363  if (!DisconnectProbeFromCollector(probe, identifier))
1364  {
1365  NS_FATAL_ERROR("Error disconnecting trace file on handover");
1366  }
1367 
1368  identifier = GetIdentifierForUtUser(node);
1369 
1370  if (!ConnectProbeToCollector(probe, identifier))
1371  {
1372  NS_FATAL_ERROR("Error connecting trace file on handover");
1373  }
1374 
1375  it->second.second = identifier;
1376  }
1377 } // end of `void UpdateIdentifierOnProbes ();`
1378 
1379 // RETURN FEEDER LINK DEV-LEVEL //////////////////////////////////////////////////////
1380 
1381 NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederDevLinkJitterHelper);
1382 
1384  Ptr<const SatHelper> satHelper)
1385  : SatStatsLinkJitterHelper(satHelper)
1386 {
1387  NS_LOG_FUNCTION(this << satHelper);
1388 }
1389 
1391 {
1392  NS_LOG_FUNCTION(this);
1393 }
1394 
1395 TypeId // static
1397 {
1398  static TypeId tid =
1399  TypeId("ns3::SatStatsRtnFeederDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1400  return tid;
1401 }
1402 
1403 void
1405 {
1406  NS_LOG_FUNCTION(this);
1407 
1408  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1409 
1410  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1411  {
1412  Ptr<SatMac> satMac;
1413  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1414  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1415  NS_ASSERT(satOrbiterDev != nullptr);
1416  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1417  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1418 
1419  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1420  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1421  {
1422  // Create a map of UT addresses and identifiers.
1424 
1425  // Enable statistics-related tags and trace sources on the device.
1426  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1427  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1428  NS_ASSERT(satDev != nullptr);
1429  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1430  }
1431 
1432  // Connect to trace sources at GW nodes.
1433 
1434  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1435  Callback<void, const Time&, const Address&> callback =
1437 
1438  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1439  {
1440  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1441 
1442  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1443  {
1444  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1445  NS_ASSERT(satDev != nullptr);
1446 
1447  // Connect the object to the probe.
1448  if (satDev->TraceConnectWithoutContext("RxLinkJitter", callback))
1449  {
1450  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1451  << " device #" << satDev->GetIfIndex());
1452 
1453  // Enable statistics-related tags and trace sources on the device.
1454  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1455  }
1456  else
1457  {
1458  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1459  << " at node ID " << (*it)->GetId() << " device #"
1460  << satDev->GetIfIndex());
1461  }
1462 
1463  } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1464 
1465  } // end of `for (NodeContainer::Iterator it = gws)`
1466 
1467 } // end of `void DoInstallProbes ();`
1468 
1469 // RETURN USER LINK DEV-LEVEL //////////////////////////////////////////////////////
1470 
1471 NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserDevLinkJitterHelper);
1472 
1474  Ptr<const SatHelper> satHelper)
1475  : SatStatsLinkJitterHelper(satHelper)
1476 {
1477  NS_LOG_FUNCTION(this << satHelper);
1478 }
1479 
1481 {
1482  NS_LOG_FUNCTION(this);
1483 }
1484 
1485 TypeId // static
1487 {
1488  static TypeId tid =
1489  TypeId("ns3::SatStatsRtnUserDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1490  return tid;
1491 }
1492 
1493 void
1495 {
1496  NS_LOG_FUNCTION(this);
1497 
1498  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1499  Callback<void, const Time&, const Address&> callback =
1501 
1502  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1503  {
1504  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1505  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1506  NS_ASSERT(satOrbiterDev != nullptr);
1507  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1508 
1509  // Connect the object to the probe.
1510  if (satOrbiterDev->TraceConnectWithoutContext("RxUserLinkJitter", callback))
1511  {
1512  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1513  << " device #" << satOrbiterDev->GetIfIndex());
1514  }
1515  else
1516  {
1517  NS_FATAL_ERROR("Error connecting to RxUserLinkJitter trace source of SatNetDevice"
1518  << " at node ID " << (*it)->GetId() << " device #"
1519  << satOrbiterDev->GetIfIndex());
1520  }
1521  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1522 
1523  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1524  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1525  {
1526  // Create a map of UT addresses and identifiers.
1528 
1529  // Enable statistics-related tags and trace sources on the device.
1530  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1531  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1532  NS_ASSERT(satDev != nullptr);
1533  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1534  }
1535 
1536  // Connect to trace sources at GW nodes.
1537 
1538  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1539 
1540  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1541  {
1542  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1543 
1544  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1545  {
1546  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1547  NS_ASSERT(satDev != nullptr);
1548 
1549  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1550  } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1551 
1552  } // end of `for (NodeContainer::Iterator it = gws)`
1553 
1554 } // end of `void DoInstallProbes ();`
1555 
1556 // RETURN FEEDER LINK MAC-LEVEL //////////////////////////////////////////////////////
1557 
1558 NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederMacLinkJitterHelper);
1559 
1561  Ptr<const SatHelper> satHelper)
1562  : SatStatsLinkJitterHelper(satHelper)
1563 {
1564  NS_LOG_FUNCTION(this << satHelper);
1565 }
1566 
1568 {
1569  NS_LOG_FUNCTION(this);
1570 }
1571 
1572 TypeId // static
1574 {
1575  static TypeId tid =
1576  TypeId("ns3::SatStatsRtnFeederMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1577  return tid;
1578 }
1579 
1580 void
1582 {
1583  NS_LOG_FUNCTION(this);
1584 
1585  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1586 
1587  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1588  {
1589  Ptr<SatMac> satMac;
1590  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1591  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1592  NS_ASSERT(satOrbiterDev != nullptr);
1593  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1594  std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1595  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1596  it2 != satOrbiterFeederMacs.end();
1597  ++it2)
1598  {
1599  satMac = it2->second;
1600  NS_ASSERT(satMac != nullptr);
1601  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1602  }
1603  std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1604  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1605  it2 != satOrbiterUserMacs.end();
1606  ++it2)
1607  {
1608  satMac = it2->second;
1609  NS_ASSERT(satMac != nullptr);
1610  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1611  }
1612  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1613 
1614  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1615  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1616  {
1617  // Create a map of UT addresses and identifiers.
1619 
1620  // Enable statistics-related tags and trace sources on the device.
1621  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1622  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1623  NS_ASSERT(satDev != nullptr);
1624  Ptr<SatMac> satMac = satDev->GetMac();
1625  NS_ASSERT(satMac != nullptr);
1626  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1627  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1628  }
1629 
1630  // Connect to trace sources at GW nodes.
1631 
1632  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1633  Callback<void, const Time&, const Address&> callback =
1635 
1636  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1637  {
1638  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1639 
1640  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1641  {
1642  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1643  NS_ASSERT(satDev != nullptr);
1644  Ptr<SatMac> satMac = satDev->GetMac();
1645  NS_ASSERT(satMac != nullptr);
1646 
1647  // Connect the object to the probe.
1648  if (satMac->TraceConnectWithoutContext("RxLinkJitter", callback))
1649  {
1650  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1651  << " device #" << satDev->GetIfIndex());
1652 
1653  // Enable statistics-related tags and trace sources on the device.
1654  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1655  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1656  }
1657  else
1658  {
1659  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1660  << " at node ID " << (*it)->GetId() << " device #"
1661  << satDev->GetIfIndex());
1662  }
1663 
1664  } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1665 
1666  } // end of `for (NodeContainer::Iterator it = gws)`
1667 
1668 } // end of `void DoInstallProbes ();`
1669 
1670 // RETURN USER LINK MAC-LEVEL //////////////////////////////////////////////////////
1671 
1672 NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserMacLinkJitterHelper);
1673 
1675  Ptr<const SatHelper> satHelper)
1676  : SatStatsLinkJitterHelper(satHelper)
1677 {
1678  NS_LOG_FUNCTION(this << satHelper);
1679 }
1680 
1682 {
1683  NS_LOG_FUNCTION(this);
1684 }
1685 
1686 TypeId // static
1688 {
1689  static TypeId tid =
1690  TypeId("ns3::SatStatsRtnUserMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1691  return tid;
1692 }
1693 
1694 void
1696 {
1697  NS_LOG_FUNCTION(this);
1698 
1699  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1700  Callback<void, const Time&, const Address&> callback =
1702 
1703  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1704  {
1705  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1706  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1707  NS_ASSERT(satOrbiterDev != nullptr);
1708  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1709  std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1710  Ptr<SatMac> satMac;
1711  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1712  it2 != satOrbiterFeederMacs.end();
1713  ++it2)
1714  {
1715  satMac = it2->second;
1716  NS_ASSERT(satMac != nullptr);
1717  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1718  }
1719  std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1720  for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1721  it2 != satOrbiterUserMacs.end();
1722  ++it2)
1723  {
1724  satMac = it2->second;
1725  NS_ASSERT(satMac != nullptr);
1726  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1727 
1728  // Connect the object to the probe.
1729  if (satMac->TraceConnectWithoutContext("RxLinkJitter", callback))
1730  {
1731  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1732  << " device #" << satOrbiterDev->GetIfIndex());
1733  }
1734  else
1735  {
1736  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1737  << " at node ID " << (*it)->GetId() << " device #"
1738  << satOrbiterDev->GetIfIndex());
1739  }
1740  }
1741  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1742 
1743  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1744  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1745  {
1746  // Create a map of UT addresses and identifiers.
1748 
1749  // Enable statistics-related tags and trace sources on the device.
1750  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1751  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1752  NS_ASSERT(satDev != nullptr);
1753  Ptr<SatMac> satMac = satDev->GetMac();
1754  NS_ASSERT(satMac != nullptr);
1755  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1756  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1757  }
1758 
1759  // Connect to trace sources at GW nodes.
1760 
1761  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1762 
1763  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1764  {
1765  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1766 
1767  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1768  {
1769  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1770  NS_ASSERT(satDev != nullptr);
1771  Ptr<SatMac> satMac = satDev->GetMac();
1772  NS_ASSERT(satMac != nullptr);
1773 
1774  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1775  satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1776  } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1777 
1778  } // end of `for (NodeContainer::Iterator it = gws)`
1779 
1780 } // end of `void DoInstallProbes ();`
1781 
1782 // RETURN FEEDER LINK PHY-LEVEL //////////////////////////////////////////////////////
1783 
1784 NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederPhyLinkJitterHelper);
1785 
1787  Ptr<const SatHelper> satHelper)
1788  : SatStatsLinkJitterHelper(satHelper)
1789 {
1790  NS_LOG_FUNCTION(this << satHelper);
1791 
1793 }
1794 
1796 {
1797  NS_LOG_FUNCTION(this);
1798 }
1799 
1800 TypeId // static
1802 {
1803  static TypeId tid =
1804  TypeId("ns3::SatStatsRtnFeederPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1805  return tid;
1806 }
1807 
1808 void
1810 {
1811  NS_LOG_FUNCTION(this);
1812 
1813  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1814 
1815  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1816  {
1817  Ptr<SatPhy> satPhy;
1818  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1819  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1820  NS_ASSERT(satOrbiterDev != nullptr);
1821  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1822  std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1823  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1824  it2 != satOrbiterFeederPhys.end();
1825  ++it2)
1826  {
1827  satPhy = it2->second;
1828  NS_ASSERT(satPhy != nullptr);
1829  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1830  }
1831  std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1832  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1833  it2 != satOrbiterUserPhys.end();
1834  ++it2)
1835  {
1836  satPhy = it2->second;
1837  NS_ASSERT(satPhy != nullptr);
1838  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1839  }
1840  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1841 
1842  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1843  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1844  {
1845  // Create a map of UT addresses and identifiers.
1847 
1848  // Enable statistics-related tags and trace sources on the device.
1849  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1850  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1851  NS_ASSERT(satDev != nullptr);
1852  Ptr<SatPhy> satPhy = satDev->GetPhy();
1853  NS_ASSERT(satPhy != nullptr);
1854  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1855  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1856  }
1857 
1858  // Connect to trace sources at GW nodes.
1859 
1860  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1861  Callback<void, const Time&, const Address&> callback =
1863 
1864  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1865  {
1866  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1867 
1868  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1869  {
1870  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1871  NS_ASSERT(satDev != nullptr);
1872  Ptr<SatPhy> satPhy = satDev->GetPhy();
1873  NS_ASSERT(satPhy != nullptr);
1874 
1875  // Connect the object to the probe.
1876  if (satPhy->TraceConnectWithoutContext("RxLinkJitter", callback))
1877  {
1878  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1879  << " device #" << satDev->GetIfIndex());
1880 
1881  // Enable statistics-related tags and trace sources on the device.
1882  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1883  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1884  }
1885  else
1886  {
1887  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1888  << " at node ID " << (*it)->GetId() << " device #"
1889  << satDev->GetIfIndex());
1890  }
1891 
1892  } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1893 
1894  } // end of `for (NodeContainer::Iterator it = gws)`
1895 
1896 } // end of `void DoInstallProbes ();`
1897 
1898 // RETURN USER LINK PHY-LEVEL //////////////////////////////////////////////////////
1899 
1900 NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserPhyLinkJitterHelper);
1901 
1903  Ptr<const SatHelper> satHelper)
1904  : SatStatsLinkJitterHelper(satHelper)
1905 {
1906  NS_LOG_FUNCTION(this << satHelper);
1907 
1909 }
1910 
1912 {
1913  NS_LOG_FUNCTION(this);
1914 }
1915 
1916 TypeId // static
1918 {
1919  static TypeId tid =
1920  TypeId("ns3::SatStatsRtnUserPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1921  return tid;
1922 }
1923 
1924 void
1926 {
1927  NS_LOG_FUNCTION(this);
1928 
1929  NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1930  Callback<void, const Time&, const Address&> callback =
1932 
1933  for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1934  {
1935  Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1936  Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1937  NS_ASSERT(satOrbiterDev != nullptr);
1938  satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1939  std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1940  Ptr<SatPhy> satPhy;
1941  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1942  it2 != satOrbiterFeederPhys.end();
1943  ++it2)
1944  {
1945  satPhy = it2->second;
1946  NS_ASSERT(satPhy != nullptr);
1947  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1948  }
1949  std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1950  for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1951  it2 != satOrbiterUserPhys.end();
1952  ++it2)
1953  {
1954  satPhy = it2->second;
1955  NS_ASSERT(satPhy != nullptr);
1956  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1957 
1958  // Connect the object to the probe.
1959  if (satPhy->TraceConnectWithoutContext("RxLinkJitter", callback))
1960  {
1961  NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1962  << " device #" << satOrbiterDev->GetIfIndex());
1963  }
1964  else
1965  {
1966  NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1967  << " at node ID " << (*it)->GetId() << " device #"
1968  << satOrbiterDev->GetIfIndex());
1969  }
1970  }
1971  } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1972 
1973  NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1974  for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1975  {
1976  // Create a map of UT addresses and identifiers.
1978 
1979  // Enable statistics-related tags and trace sources on the device.
1980  Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1981  Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1982  NS_ASSERT(satDev != nullptr);
1983  Ptr<SatPhy> satPhy = satDev->GetPhy();
1984  NS_ASSERT(satPhy != nullptr);
1985  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1986  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1987  }
1988 
1989  // Connect to trace sources at GW nodes.
1990 
1991  NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1992 
1993  for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1994  {
1995  NetDeviceContainer devs = GetGwSatNetDevice(*it);
1996 
1997  for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1998  {
1999  Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
2000  NS_ASSERT(satDev != nullptr);
2001  Ptr<SatPhy> satPhy = satDev->GetPhy();
2002  NS_ASSERT(satPhy != nullptr);
2003 
2004  satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
2005  satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
2006  } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
2007 
2008  } // end of `for (NodeContainer::Iterator it = gws)`
2009 
2010 } // end of `void DoInstallProbes ();`
2011 
2012 } // end of namespace ns3
ChannelType_t
Types of channel.
SatNetDevice to be utilized in the UT and GW nodes.
SatOrbiterNetDevice to be utilized in geostationary satellite.
Parent abstract class of all satellite statistics helpers.
static Ptr< NetDevice > GetSatSatOrbiterNetDevice(Ptr< Node > satNode)
uint32_t GetIdentifierForUtUser(Ptr< Node > utUserNode) const
static NetDeviceContainer GetGwSatNetDevice(Ptr< Node > gwNode)
virtual void SaveAddressAndIdentifier(Ptr< Node > utNode)
Save the address and the proper identifier from the given UT node.
static std::string GetOutputTypeName(OutputType_t outputType)
virtual std::string GetIdentifierHeading(std::string dataLabel) const
virtual std::string GetOutputPath() const
Ptr< DataCollectionObject > CreateAggregator(std::string aggregatorTypeId, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue())
Create the aggregator according to the output type.
virtual std::string GetOutputFileName() const
Compute the path and file name where statistics output should be written to.
uint32_t GetUtId(Ptr< Node > utNode) const
uint32_t CreateCollectorPerIdentifier(CollectorMap &collectorMap) const
Create one collector instance for each identifier in the simulation.
static Ptr< NetDevice > GetUtSatNetDevice(Ptr< Node > utNode)
OutputType_t GetOutputType() const
uint32_t GetIdentifierForUt(Ptr< Node > utNode) const
std::map< const Address, uint32_t > m_identifierMap
Map of address and the identifier associated with it.
std::string GetName() const
virtual std::string GetTimeHeading(std::string dataLabel) const
virtual std::string GetDistributionHeading(std::string dataLabel) const
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.