Loading...
Searching...
No Matches
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
60NS_LOG_COMPONENT_DEFINE("SatStatsLinkJitterHelper");
61
62namespace ns3
63{
64
65NS_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
79TypeId // 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),
91 MakeBooleanChecker());
92 return tid;
93}
94
95void
97{
98 NS_LOG_FUNCTION(this << averagingMode);
99 m_averagingMode = averagingMode;
100}
101
102bool
107
108void
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",
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",
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",
253 &MultiFileAggregator::Write2d);
254 m_terminalCollectors.ConnectToAggregator("OutputString",
256 &MultiFileAggregator::AddContextHeading);
257 m_terminalCollectors.ConnectToAggregator("Warning",
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",
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",
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.
411
412} // end of `void DoInstall ();`
413
414void
416{
417 // The method below is supposed to be implemented by the child class.
419}
420
421void
422SatStatsLinkJitterHelper::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" << " invalid sender address");
430 }
431 else if (Mac48Address::ConvertFrom(from).IsBroadcast())
432 {
433 for (std::pair<const Address, uint32_t> item : m_identifierMap)
434 {
435 PassSampleToCollector(jitter, item.second);
436 }
437 }
438 else
439 {
440 // Determine the identifier associated with the sender address.
441 std::map<const Address, uint32_t>::const_iterator it = m_identifierMap.find(from);
442
443 if (it != m_identifierMap.end())
444 {
445 PassSampleToCollector(jitter, it->second);
446 }
447 else
448 {
449 NS_LOG_WARN(this << " discarding a packet jitter of " << jitter.GetSeconds()
450 << " from statistics collection because of"
451 << " unknown sender address " << from);
452 }
453 }
454}
455
456bool
457SatStatsLinkJitterHelper::ConnectProbeToCollector(Ptr<Probe> probe, uint32_t identifier)
458{
459 NS_LOG_FUNCTION(this << probe << probe->GetName() << identifier);
460
461 bool ret = false;
462 switch (GetOutputType())
463 {
466 ret = m_terminalCollectors.ConnectWithProbe(probe,
467 "OutputSeconds",
468 identifier,
469 &ScalarCollector::TraceSinkDouble);
470 break;
471
474 ret = m_terminalCollectors.ConnectWithProbe(probe,
475 "OutputSeconds",
476 identifier,
477 &UnitConversionCollector::TraceSinkDouble);
478 break;
479
486 if (m_averagingMode)
487 {
488 ret = m_terminalCollectors.ConnectWithProbe(probe,
489 "OutputSeconds",
490 identifier,
491 &ScalarCollector::TraceSinkDouble);
492 }
493 else
494 {
495 ret = m_terminalCollectors.ConnectWithProbe(probe,
496 "OutputSeconds",
497 identifier,
498 &DistributionCollector::TraceSinkDouble);
499 }
500 break;
501
502 default:
503 NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
504 << " is not a valid output type for this statistics.");
505 break;
506 }
507
508 if (ret)
509 {
510 NS_LOG_INFO(this << " created probe " << probe->GetName() << ", connected to collector "
511 << identifier);
512 }
513 else
514 {
515 NS_LOG_WARN(this << " unable to connect probe " << probe->GetName() << " to collector "
516 << identifier);
517 }
518
519 return ret;
520}
521
522bool
523SatStatsLinkJitterHelper::DisconnectProbeFromCollector(Ptr<Probe> probe, uint32_t identifier)
524{
525 NS_LOG_FUNCTION(this << probe << probe->GetName() << identifier);
526
527 bool ret = false;
528 switch (GetOutputType())
529 {
532 ret = m_terminalCollectors.DisconnectWithProbe(probe,
533 "OutputSeconds",
534 identifier,
535 &ScalarCollector::TraceSinkDouble);
536 break;
537
540 ret = m_terminalCollectors.DisconnectWithProbe(probe,
541 "OutputSeconds",
542 identifier,
543 &UnitConversionCollector::TraceSinkDouble);
544 break;
545
552 if (m_averagingMode)
553 {
554 ret = m_terminalCollectors.DisconnectWithProbe(probe,
555 "OutputSeconds",
556 identifier,
557 &ScalarCollector::TraceSinkDouble);
558 }
559 else
560 {
561 ret = m_terminalCollectors.DisconnectWithProbe(probe,
562 "OutputSeconds",
563 identifier,
564 &DistributionCollector::TraceSinkDouble);
565 }
566 break;
567
568 default:
569 NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
570 << " is not a valid output type for this statistics.");
571 break;
572 }
573
574 if (ret)
575 {
576 NS_LOG_INFO(this << " probe " << probe->GetName() << ", disconnected from collector "
577 << identifier);
578 }
579 else
580 {
581 NS_LOG_WARN(this << " unable to disconnect probe " << probe->GetName() << " from collector "
582 << identifier);
583 }
584
585 return ret;
586}
587
588void
589SatStatsLinkJitterHelper::PassSampleToCollector(const Time& jitter, uint32_t identifier)
590{
591 // NS_LOG_FUNCTION (this << jitter.GetSeconds () << identifier);
592
593 Ptr<DataCollectionObject> collector = m_terminalCollectors.Get(identifier);
594 NS_ASSERT_MSG(collector != nullptr, "Unable to find collector with identifier " << identifier);
595
596 switch (GetOutputType())
597 {
600 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
601 NS_ASSERT(c != nullptr);
602 c->TraceSinkDouble(0.0, jitter.GetSeconds());
603 break;
604 }
605
608 Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
609 NS_ASSERT(c != nullptr);
610 c->TraceSinkDouble(0.0, jitter.GetSeconds());
611 break;
612 }
613
620 if (m_averagingMode)
621 {
622 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
623 NS_ASSERT(c != nullptr);
624 c->TraceSinkDouble(0.0, jitter.GetSeconds());
625 }
626 else
627 {
628 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
629 NS_ASSERT(c != nullptr);
630 c->TraceSinkDouble(0.0, jitter.GetSeconds());
631 }
632 break;
633
634 default:
635 NS_FATAL_ERROR(GetOutputTypeName(GetOutputType())
636 << " is not a valid output type for this statistics.");
637 break;
638
639 } // end of `switch (GetOutputType ())`
640
641} // end of `void PassSampleToCollector (Time, uint32_t)`
642
643void
648
649// FORWARD FEEDER LINK DEV-LEVEL /////////////////////////////////////////////////////
650
651NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederDevLinkJitterHelper);
652
654 Ptr<const SatHelper> satHelper)
655 : SatStatsLinkJitterHelper(satHelper)
656{
657 NS_LOG_FUNCTION(this << satHelper);
658}
659
664
665TypeId // static
667{
668 static TypeId tid =
669 TypeId("ns3::SatStatsFwdFeederDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
670 return tid;
671}
672
673void
675{
676 NS_LOG_FUNCTION(this);
677
678 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
679 Callback<void, const Time&, const Address&> callback =
681
682 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
683 {
684 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
685 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
686 NS_ASSERT(satOrbiterDev != nullptr);
687 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
688 if (satOrbiterDev->TraceConnectWithoutContext("RxFeederLinkJitter", callback))
689 {
690 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
691 << " device #" << satOrbiterDev->GetIfIndex());
692 }
693 else
694 {
695 NS_FATAL_ERROR("Error connecting to RxFeederLinkJitter trace source of SatNetDevice"
696 << " at node ID " << (*it)->GetId() << " device #"
697 << satOrbiterDev->GetIfIndex());
698 }
699 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
700
701 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
702
703 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
704 {
705 // Create a map of UT addresses and identifiers.
707
708 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
709 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
710 NS_ASSERT(satDev != nullptr);
711
712 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
713
714 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
715
716 // Enable statistics-related tags on the transmitting device.
717 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
718 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
719 {
720 NetDeviceContainer devs = GetGwSatNetDevice(*it);
721
722 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
723 {
724 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
725 NS_ASSERT(satDev != nullptr);
726
727 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
728 }
729 }
730
731} // end of `void DoInstallProbes ();`
732
733// FORWARD USER LINK DEV-LEVEL /////////////////////////////////////////////////////
734
735NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserDevLinkJitterHelper);
736
738 Ptr<const SatHelper> satHelper)
739 : SatStatsLinkJitterHelper(satHelper)
740{
741 NS_LOG_FUNCTION(this << satHelper);
742}
743
748
749TypeId // static
751{
752 static TypeId tid =
753 TypeId("ns3::SatStatsFwdUserDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
754 return tid;
755}
756
757void
759{
760 NS_LOG_FUNCTION(this);
761
762 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
763
764 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
765 {
766 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
767 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
768 NS_ASSERT(satOrbiterDev != nullptr);
769 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
770 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
771
772 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
773
774 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
775 {
776 const int32_t utId = GetUtId(*it);
777 NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
778 const uint32_t identifier = GetIdentifierForUt(*it);
779
780 // Create the probe.
781 std::ostringstream probeName;
782 probeName << utId;
783 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
784 probe->SetName(probeName.str());
785
786 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
787 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
788 NS_ASSERT(satDev != nullptr);
789
790 // Connect the object to the probe.
791 if (probe->ConnectByObject("RxLinkJitter", satDev) &&
792 ConnectProbeToCollector(probe, identifier))
793 {
794 m_probes.insert(
795 std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
796
797 // Enable statistics-related tags and trace sources on the device.
798 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
799 }
800 else
801 {
802 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatMac"
803 << " at node ID " << (*it)->GetId() << " device #2");
804 }
805
806 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
807
808 // Enable statistics-related tags on the transmitting device.
809 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
810 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
811 {
812 NetDeviceContainer devs = GetGwSatNetDevice(*it);
813
814 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
815 {
816 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
817 NS_ASSERT(satDev != nullptr);
818
819 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
820 }
821 }
822
823} // end of `void DoInstallProbes ();`
824
825void
827{
828 NS_LOG_FUNCTION(this);
829
830 std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
831
832 for (it = m_probes.begin(); it != m_probes.end(); it++)
833 {
834 Ptr<Probe> probe = it->first;
835 Ptr<Node> node = it->second.first;
836 uint32_t identifier = it->second.second;
837
838 if (!DisconnectProbeFromCollector(probe, identifier))
839 {
840 NS_FATAL_ERROR("Error disconnecting trace file on handover");
841 }
842
843 identifier = GetIdentifierForUt(node);
844
845 if (!ConnectProbeToCollector(probe, identifier))
846 {
847 NS_FATAL_ERROR("Error connecting trace file on handover");
848 }
849
850 it->second.second = identifier;
851 }
852} // end of `void UpdateIdentifierOnProbes ();`
853
854// FORWARD FEEDER LINK MAC-LEVEL /////////////////////////////////////////////////////
855
856NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederMacLinkJitterHelper);
857
859 Ptr<const SatHelper> satHelper)
860 : SatStatsLinkJitterHelper(satHelper)
861{
862 NS_LOG_FUNCTION(this << satHelper);
863}
864
869
870TypeId // static
872{
873 static TypeId tid =
874 TypeId("ns3::SatStatsFwdFeederMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
875 return tid;
876}
877
878void
880{
881 NS_LOG_FUNCTION(this);
882
883 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
884 Callback<void, const Time&, const Address&> callback =
886
887 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
888 {
889 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
890 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
891 NS_ASSERT(satOrbiterDev != nullptr);
892 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
893 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
894 Ptr<SatMac> satMac;
895 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
896 it2 != satOrbiterFeederMacs.end();
897 ++it2)
898 {
899 satMac = it2->second;
900 NS_ASSERT(satMac != nullptr);
901 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
902
903 // Connect the object to the probe.
904 if (satMac->TraceConnectWithoutContext("RxLinkJitter", callback))
905 {
906 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
907 << " device #" << satOrbiterDev->GetIfIndex());
908
909 // Enable statistics-related tags and trace sources on the device.
910 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
911 }
912 else
913 {
914 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
915 << " at node ID " << (*it)->GetId() << " device #"
916 << satOrbiterDev->GetIfIndex());
917 }
918 }
919 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
920 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
921 it2 != satOrbiterUserMacs.end();
922 ++it2)
923 {
924 satMac = it2->second;
925 NS_ASSERT(satMac != nullptr);
926 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
927 }
928 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
929
930 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
931
932 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
933 {
934 // Create a map of UT addresses and identifiers.
936
937 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
938 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
939 NS_ASSERT(satDev != nullptr);
940 Ptr<SatMac> satMac = satDev->GetMac();
941 NS_ASSERT(satMac != nullptr);
942
943 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
944 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
945
946 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
947
948 // Enable statistics-related tags on the transmitting device.
949 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
950 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
951 {
952 NetDeviceContainer devs = GetGwSatNetDevice(*it);
953
954 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
955 {
956 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
957 NS_ASSERT(satDev != nullptr);
958 Ptr<SatMac> satMac = satDev->GetMac();
959 NS_ASSERT(satMac != nullptr);
960
961 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
962 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
963 }
964 }
965
966} // end of `void DoInstallProbes ();`
967
968// FORWARD USER LINK MAC-LEVEL /////////////////////////////////////////////////////
969
970NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserMacLinkJitterHelper);
971
973 Ptr<const SatHelper> satHelper)
974 : SatStatsLinkJitterHelper(satHelper)
975{
976 NS_LOG_FUNCTION(this << satHelper);
977}
978
983
984TypeId // static
986{
987 static TypeId tid =
988 TypeId("ns3::SatStatsFwdUserMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
989 return tid;
990}
991
992void
994{
995 NS_LOG_FUNCTION(this);
996
997 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
998
999 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1000 {
1001 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1002 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1003 NS_ASSERT(satOrbiterDev != nullptr);
1004 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1005 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1006 Ptr<SatMac> satMac;
1007 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1008 it2 != satOrbiterFeederMacs.end();
1009 ++it2)
1010 {
1011 satMac = it2->second;
1012 NS_ASSERT(satMac != nullptr);
1013 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1014 }
1015 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1016 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1017 it2 != satOrbiterUserMacs.end();
1018 ++it2)
1019 {
1020 satMac = it2->second;
1021 NS_ASSERT(satMac != nullptr);
1022 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1023 }
1024 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1025
1026 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1027
1028 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1029 {
1030 const int32_t utId = GetUtId(*it);
1031 NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
1032 const uint32_t identifier = GetIdentifierForUt(*it);
1033
1034 // Create the probe.
1035 std::ostringstream probeName;
1036 probeName << utId;
1037 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
1038 probe->SetName(probeName.str());
1039
1040 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1041 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1042 NS_ASSERT(satDev != nullptr);
1043 Ptr<SatMac> satMac = satDev->GetMac();
1044 NS_ASSERT(satMac != nullptr);
1045
1046 // Connect the object to the probe.
1047 if (probe->ConnectByObject("RxLinkJitter", satMac) &&
1048 ConnectProbeToCollector(probe, identifier))
1049 {
1050 m_probes.insert(
1051 std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
1052
1053 // Enable statistics-related tags and trace sources on the device.
1054 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1055 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1056 }
1057 else
1058 {
1059 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatMac"
1060 << " at node ID " << (*it)->GetId() << " device #2");
1061 }
1062
1063 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1064
1065 // Enable statistics-related tags on the transmitting device.
1066 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1067 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1068 {
1069 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1070
1071 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1072 {
1073 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1074 NS_ASSERT(satDev != nullptr);
1075 Ptr<SatMac> satMac = satDev->GetMac();
1076 NS_ASSERT(satMac != nullptr);
1077
1078 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1079 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1080 }
1081 }
1082
1083} // end of `void DoInstallProbes ();`
1084
1085void
1087{
1088 NS_LOG_FUNCTION(this);
1089
1090 std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
1091
1092 for (it = m_probes.begin(); it != m_probes.end(); it++)
1093 {
1094 Ptr<Probe> probe = it->first;
1095 Ptr<Node> node = it->second.first;
1096 uint32_t identifier = it->second.second;
1097
1098 if (!DisconnectProbeFromCollector(probe, identifier))
1099 {
1100 NS_FATAL_ERROR("Error disconnecting trace file on handover");
1101 }
1102
1103 identifier = GetIdentifierForUt(node);
1104
1105 if (!ConnectProbeToCollector(probe, identifier))
1106 {
1107 NS_FATAL_ERROR("Error connecting trace file on handover");
1108 }
1109
1110 it->second.second = identifier;
1111 }
1112} // end of `void UpdateIdentifierOnProbes ();`
1113
1114// FORWARD FEEDER LINK PHY-LEVEL /////////////////////////////////////////////////////
1115
1116NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederPhyLinkJitterHelper);
1117
1119 Ptr<const SatHelper> satHelper)
1120 : SatStatsLinkJitterHelper(satHelper)
1121{
1122 NS_LOG_FUNCTION(this << satHelper);
1123
1125}
1126
1131
1132TypeId // static
1134{
1135 static TypeId tid =
1136 TypeId("ns3::SatStatsFwdFeederPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1137 return tid;
1138}
1139
1140void
1142{
1143 NS_LOG_FUNCTION(this);
1144
1145 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1146 Callback<void, const Time&, const Address&> callback =
1148
1149 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1150 {
1151 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1152 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1153 NS_ASSERT(satOrbiterDev != nullptr);
1154 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1155 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1156 Ptr<SatPhy> satPhy;
1157 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1158 it2 != satOrbiterFeederPhys.end();
1159 ++it2)
1160 {
1161 satPhy = it2->second;
1162 NS_ASSERT(satPhy != nullptr);
1163 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1164
1165 // Connect the object to the probe.
1166 if (satPhy->TraceConnectWithoutContext("RxLinkJitter", callback))
1167 {
1168 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1169 << " device #" << satOrbiterDev->GetIfIndex());
1170
1171 // Enable statistics-related tags and trace sources on the device.
1172 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1173 }
1174 else
1175 {
1176 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1177 << " at node ID " << (*it)->GetId() << " device #"
1178 << satOrbiterDev->GetIfIndex());
1179 }
1180 }
1181 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1182 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1183 it2 != satOrbiterUserPhys.end();
1184 ++it2)
1185 {
1186 satPhy = it2->second;
1187 NS_ASSERT(satPhy != nullptr);
1188 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1189 }
1190 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1191
1192 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1193
1194 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1195 {
1196 // Create a map of UT addresses and identifiers.
1198
1199 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1200 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1201 NS_ASSERT(satDev != nullptr);
1202 Ptr<SatPhy> satPhy = satDev->GetPhy();
1203 NS_ASSERT(satPhy != nullptr);
1204
1205 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1206 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1207
1208 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1209
1210 // Enable statistics-related tags on the transmitting device.
1211 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1212 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1213 {
1214 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1215
1216 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1217 {
1218 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1219 NS_ASSERT(satDev != nullptr);
1220 Ptr<SatPhy> satPhy = satDev->GetPhy();
1221 NS_ASSERT(satPhy != nullptr);
1222
1223 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1224 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1225 }
1226 }
1227
1228} // end of `void DoInstallProbes ();`
1229
1230// FORWARD USER LINK PHY-LEVEL /////////////////////////////////////////////////////
1231
1232NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserPhyLinkJitterHelper);
1233
1235 Ptr<const SatHelper> satHelper)
1236 : SatStatsLinkJitterHelper(satHelper)
1237{
1238 NS_LOG_FUNCTION(this << satHelper);
1239
1241}
1242
1247
1248TypeId // static
1250{
1251 static TypeId tid =
1252 TypeId("ns3::SatStatsFwdUserPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1253 return tid;
1254}
1255
1256void
1258{
1259 NS_LOG_FUNCTION(this);
1260
1261 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1262
1263 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1264 {
1265 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1266 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1267 NS_ASSERT(satOrbiterDev != nullptr);
1268 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1269 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1270 Ptr<SatPhy> satPhy;
1271 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1272 it2 != satOrbiterFeederPhys.end();
1273 ++it2)
1274 {
1275 satPhy = it2->second;
1276 NS_ASSERT(satPhy != nullptr);
1277 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1278 }
1279 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1280 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1281 it2 != satOrbiterUserPhys.end();
1282 ++it2)
1283 {
1284 satPhy = it2->second;
1285 NS_ASSERT(satPhy != nullptr);
1286 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1287 }
1288 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1289
1290 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1291
1292 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1293 {
1294 const int32_t utId = GetUtId(*it);
1295 NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
1296 const uint32_t identifier = GetIdentifierForUt(*it);
1297
1298 // Create the probe.
1299 std::ostringstream probeName;
1300 probeName << utId;
1301 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
1302 probe->SetName(probeName.str());
1303
1304 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1305 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1306 NS_ASSERT(satDev != nullptr);
1307 Ptr<SatPhy> satPhy = satDev->GetPhy();
1308 NS_ASSERT(satPhy != nullptr);
1309
1310 // Connect the object to the probe.
1311 if (probe->ConnectByObject("RxLinkJitter", satPhy) &&
1312 ConnectProbeToCollector(probe, identifier))
1313 {
1314 m_probes.insert(
1315 std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
1316
1317 // Enable statistics-related tags and trace sources on the device.
1318 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1319 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1320 }
1321 else
1322 {
1323 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatPhy"
1324 << " at node ID " << (*it)->GetId() << " device #2");
1325 }
1326
1327 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1328
1329 // Enable statistics-related tags on the transmitting device.
1330 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1331 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1332 {
1333 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1334
1335 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1336 {
1337 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1338 NS_ASSERT(satDev != nullptr);
1339 Ptr<SatPhy> satPhy = satDev->GetPhy();
1340 NS_ASSERT(satPhy != nullptr);
1341
1342 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1343 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1344 }
1345 }
1346
1347} // end of `void DoInstallProbes ();`
1348
1349void
1351{
1352 NS_LOG_FUNCTION(this);
1353
1354 std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
1355
1356 for (it = m_probes.begin(); it != m_probes.end(); it++)
1357 {
1358 Ptr<Probe> probe = it->first;
1359 Ptr<Node> node = it->second.first;
1360 uint32_t identifier = it->second.second;
1361
1362 if (!DisconnectProbeFromCollector(probe, identifier))
1363 {
1364 NS_FATAL_ERROR("Error disconnecting trace file on handover");
1365 }
1366
1367 identifier = GetIdentifierForUt(node);
1368
1369 if (!ConnectProbeToCollector(probe, identifier))
1370 {
1371 NS_FATAL_ERROR("Error connecting trace file on handover");
1372 }
1373
1374 it->second.second = identifier;
1375 }
1376} // end of `void UpdateIdentifierOnProbes ();`
1377
1378// RETURN FEEDER LINK DEV-LEVEL //////////////////////////////////////////////////////
1379
1380NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederDevLinkJitterHelper);
1381
1383 Ptr<const SatHelper> satHelper)
1384 : SatStatsLinkJitterHelper(satHelper)
1385{
1386 NS_LOG_FUNCTION(this << satHelper);
1387}
1388
1393
1394TypeId // static
1396{
1397 static TypeId tid =
1398 TypeId("ns3::SatStatsRtnFeederDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1399 return tid;
1400}
1401
1402void
1404{
1405 NS_LOG_FUNCTION(this);
1406
1407 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1408
1409 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1410 {
1411 Ptr<SatMac> satMac;
1412 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1413 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1414 NS_ASSERT(satOrbiterDev != nullptr);
1415 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1416 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1417
1418 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1419 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1420 {
1421 // Create a map of UT addresses and identifiers.
1423
1424 // Enable statistics-related tags and trace sources on the device.
1425 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1426 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1427 NS_ASSERT(satDev != nullptr);
1428 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1429 }
1430
1431 // Connect to trace sources at GW nodes.
1432
1433 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1434 Callback<void, const Time&, const Address&> callback =
1436
1437 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1438 {
1439 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1440
1441 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1442 {
1443 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1444 NS_ASSERT(satDev != nullptr);
1445
1446 // Connect the object to the probe.
1447 if (satDev->TraceConnectWithoutContext("RxLinkJitter", callback))
1448 {
1449 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1450 << " device #" << satDev->GetIfIndex());
1451
1452 // Enable statistics-related tags and trace sources on the device.
1453 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1454 }
1455 else
1456 {
1457 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1458 << " at node ID " << (*it)->GetId() << " device #"
1459 << satDev->GetIfIndex());
1460 }
1461
1462 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1463
1464 } // end of `for (NodeContainer::Iterator it = gws)`
1465
1466} // end of `void DoInstallProbes ();`
1467
1468// RETURN USER LINK DEV-LEVEL //////////////////////////////////////////////////////
1469
1470NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserDevLinkJitterHelper);
1471
1473 Ptr<const SatHelper> satHelper)
1474 : SatStatsLinkJitterHelper(satHelper)
1475{
1476 NS_LOG_FUNCTION(this << satHelper);
1477}
1478
1483
1484TypeId // static
1486{
1487 static TypeId tid =
1488 TypeId("ns3::SatStatsRtnUserDevLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1489 return tid;
1490}
1491
1492void
1494{
1495 NS_LOG_FUNCTION(this);
1496
1497 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1498 Callback<void, const Time&, const Address&> callback =
1500
1501 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1502 {
1503 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1504 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1505 NS_ASSERT(satOrbiterDev != nullptr);
1506 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1507
1508 // Connect the object to the probe.
1509 if (satOrbiterDev->TraceConnectWithoutContext("RxUserLinkJitter", callback))
1510 {
1511 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1512 << " device #" << satOrbiterDev->GetIfIndex());
1513 }
1514 else
1515 {
1516 NS_FATAL_ERROR("Error connecting to RxUserLinkJitter trace source of SatNetDevice"
1517 << " at node ID " << (*it)->GetId() << " device #"
1518 << satOrbiterDev->GetIfIndex());
1519 }
1520 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1521
1522 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1523 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1524 {
1525 // Create a map of UT addresses and identifiers.
1527
1528 // Enable statistics-related tags and trace sources on the device.
1529 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1530 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1531 NS_ASSERT(satDev != nullptr);
1532 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1533 }
1534
1535 // Connect to trace sources at GW nodes.
1536
1537 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1538
1539 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1540 {
1541 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1542
1543 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1544 {
1545 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1546 NS_ASSERT(satDev != nullptr);
1547
1548 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1549 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1550
1551 } // end of `for (NodeContainer::Iterator it = gws)`
1552
1553} // end of `void DoInstallProbes ();`
1554
1555// RETURN FEEDER LINK MAC-LEVEL //////////////////////////////////////////////////////
1556
1557NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederMacLinkJitterHelper);
1558
1560 Ptr<const SatHelper> satHelper)
1561 : SatStatsLinkJitterHelper(satHelper)
1562{
1563 NS_LOG_FUNCTION(this << satHelper);
1564}
1565
1570
1571TypeId // static
1573{
1574 static TypeId tid =
1575 TypeId("ns3::SatStatsRtnFeederMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1576 return tid;
1577}
1578
1579void
1581{
1582 NS_LOG_FUNCTION(this);
1583
1584 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1585
1586 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1587 {
1588 Ptr<SatMac> satMac;
1589 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1590 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1591 NS_ASSERT(satOrbiterDev != nullptr);
1592 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1593 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1594 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1595 it2 != satOrbiterFeederMacs.end();
1596 ++it2)
1597 {
1598 satMac = it2->second;
1599 NS_ASSERT(satMac != nullptr);
1600 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1601 }
1602 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1603 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1604 it2 != satOrbiterUserMacs.end();
1605 ++it2)
1606 {
1607 satMac = it2->second;
1608 NS_ASSERT(satMac != nullptr);
1609 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1610 }
1611 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1612
1613 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1614 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1615 {
1616 // Create a map of UT addresses and identifiers.
1618
1619 // Enable statistics-related tags and trace sources on the device.
1620 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1621 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1622 NS_ASSERT(satDev != nullptr);
1623 Ptr<SatMac> satMac = satDev->GetMac();
1624 NS_ASSERT(satMac != nullptr);
1625 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1626 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1627 }
1628
1629 // Connect to trace sources at GW nodes.
1630
1631 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1632 Callback<void, const Time&, const Address&> callback =
1634
1635 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1636 {
1637 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1638
1639 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1640 {
1641 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1642 NS_ASSERT(satDev != nullptr);
1643 Ptr<SatMac> satMac = satDev->GetMac();
1644 NS_ASSERT(satMac != nullptr);
1645
1646 // Connect the object to the probe.
1647 if (satMac->TraceConnectWithoutContext("RxLinkJitter", callback))
1648 {
1649 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1650 << " device #" << satDev->GetIfIndex());
1651
1652 // Enable statistics-related tags and trace sources on the device.
1653 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1654 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1655 }
1656 else
1657 {
1658 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1659 << " at node ID " << (*it)->GetId() << " device #"
1660 << satDev->GetIfIndex());
1661 }
1662
1663 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1664
1665 } // end of `for (NodeContainer::Iterator it = gws)`
1666
1667} // end of `void DoInstallProbes ();`
1668
1669// RETURN USER LINK MAC-LEVEL //////////////////////////////////////////////////////
1670
1671NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserMacLinkJitterHelper);
1672
1674 Ptr<const SatHelper> satHelper)
1675 : SatStatsLinkJitterHelper(satHelper)
1676{
1677 NS_LOG_FUNCTION(this << satHelper);
1678}
1679
1684
1685TypeId // static
1687{
1688 static TypeId tid =
1689 TypeId("ns3::SatStatsRtnUserMacLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1690 return tid;
1691}
1692
1693void
1695{
1696 NS_LOG_FUNCTION(this);
1697
1698 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1699 Callback<void, const Time&, const Address&> callback =
1701
1702 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1703 {
1704 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1705 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1706 NS_ASSERT(satOrbiterDev != nullptr);
1707 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1708 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1709 Ptr<SatMac> satMac;
1710 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1711 it2 != satOrbiterFeederMacs.end();
1712 ++it2)
1713 {
1714 satMac = it2->second;
1715 NS_ASSERT(satMac != nullptr);
1716 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1717 }
1718 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1719 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1720 it2 != satOrbiterUserMacs.end();
1721 ++it2)
1722 {
1723 satMac = it2->second;
1724 NS_ASSERT(satMac != nullptr);
1725 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1726
1727 // Connect the object to the probe.
1728 if (satMac->TraceConnectWithoutContext("RxLinkJitter", callback))
1729 {
1730 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1731 << " device #" << satOrbiterDev->GetIfIndex());
1732 }
1733 else
1734 {
1735 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1736 << " at node ID " << (*it)->GetId() << " device #"
1737 << satOrbiterDev->GetIfIndex());
1738 }
1739 }
1740 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1741
1742 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1743 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1744 {
1745 // Create a map of UT addresses and identifiers.
1747
1748 // Enable statistics-related tags and trace sources on the device.
1749 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1750 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1751 NS_ASSERT(satDev != nullptr);
1752 Ptr<SatMac> satMac = satDev->GetMac();
1753 NS_ASSERT(satMac != nullptr);
1754 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1755 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1756 }
1757
1758 // Connect to trace sources at GW nodes.
1759
1760 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1761
1762 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1763 {
1764 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1765
1766 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1767 {
1768 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1769 NS_ASSERT(satDev != nullptr);
1770 Ptr<SatMac> satMac = satDev->GetMac();
1771 NS_ASSERT(satMac != nullptr);
1772
1773 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1774 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1775 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1776
1777 } // end of `for (NodeContainer::Iterator it = gws)`
1778
1779} // end of `void DoInstallProbes ();`
1780
1781// RETURN FEEDER LINK PHY-LEVEL //////////////////////////////////////////////////////
1782
1783NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederPhyLinkJitterHelper);
1784
1786 Ptr<const SatHelper> satHelper)
1787 : SatStatsLinkJitterHelper(satHelper)
1788{
1789 NS_LOG_FUNCTION(this << satHelper);
1790
1792}
1793
1798
1799TypeId // static
1801{
1802 static TypeId tid =
1803 TypeId("ns3::SatStatsRtnFeederPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1804 return tid;
1805}
1806
1807void
1809{
1810 NS_LOG_FUNCTION(this);
1811
1812 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1813
1814 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1815 {
1816 Ptr<SatPhy> satPhy;
1817 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1818 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1819 NS_ASSERT(satOrbiterDev != nullptr);
1820 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1821 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1822 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1823 it2 != satOrbiterFeederPhys.end();
1824 ++it2)
1825 {
1826 satPhy = it2->second;
1827 NS_ASSERT(satPhy != nullptr);
1828 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1829 }
1830 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1831 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1832 it2 != satOrbiterUserPhys.end();
1833 ++it2)
1834 {
1835 satPhy = it2->second;
1836 NS_ASSERT(satPhy != nullptr);
1837 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1838 }
1839 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1840
1841 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1842 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1843 {
1844 // Create a map of UT addresses and identifiers.
1846
1847 // Enable statistics-related tags and trace sources on the device.
1848 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1849 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1850 NS_ASSERT(satDev != nullptr);
1851 Ptr<SatPhy> satPhy = satDev->GetPhy();
1852 NS_ASSERT(satPhy != nullptr);
1853 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1854 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1855 }
1856
1857 // Connect to trace sources at GW nodes.
1858
1859 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1860 Callback<void, const Time&, const Address&> callback =
1862
1863 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1864 {
1865 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1866
1867 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1868 {
1869 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1870 NS_ASSERT(satDev != nullptr);
1871 Ptr<SatPhy> satPhy = satDev->GetPhy();
1872 NS_ASSERT(satPhy != nullptr);
1873
1874 // Connect the object to the probe.
1875 if (satPhy->TraceConnectWithoutContext("RxLinkJitter", callback))
1876 {
1877 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1878 << " device #" << satDev->GetIfIndex());
1879
1880 // Enable statistics-related tags and trace sources on the device.
1881 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1882 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1883 }
1884 else
1885 {
1886 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1887 << " at node ID " << (*it)->GetId() << " device #"
1888 << satDev->GetIfIndex());
1889 }
1890
1891 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1892
1893 } // end of `for (NodeContainer::Iterator it = gws)`
1894
1895} // end of `void DoInstallProbes ();`
1896
1897// RETURN USER LINK PHY-LEVEL //////////////////////////////////////////////////////
1898
1899NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserPhyLinkJitterHelper);
1900
1902 Ptr<const SatHelper> satHelper)
1903 : SatStatsLinkJitterHelper(satHelper)
1904{
1905 NS_LOG_FUNCTION(this << satHelper);
1906
1908}
1909
1914
1915TypeId // static
1917{
1918 static TypeId tid =
1919 TypeId("ns3::SatStatsRtnUserPhyLinkJitterHelper").SetParent<SatStatsLinkJitterHelper>();
1920 return tid;
1921}
1922
1923void
1925{
1926 NS_LOG_FUNCTION(this);
1927
1928 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1929 Callback<void, const Time&, const Address&> callback =
1931
1932 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1933 {
1934 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1935 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1936 NS_ASSERT(satOrbiterDev != nullptr);
1937 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1938 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1939 Ptr<SatPhy> satPhy;
1940 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1941 it2 != satOrbiterFeederPhys.end();
1942 ++it2)
1943 {
1944 satPhy = it2->second;
1945 NS_ASSERT(satPhy != nullptr);
1946 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1947 }
1948 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1949 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1950 it2 != satOrbiterUserPhys.end();
1951 ++it2)
1952 {
1953 satPhy = it2->second;
1954 NS_ASSERT(satPhy != nullptr);
1955 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1956
1957 // Connect the object to the probe.
1958 if (satPhy->TraceConnectWithoutContext("RxLinkJitter", callback))
1959 {
1960 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1961 << " device #" << satOrbiterDev->GetIfIndex());
1962 }
1963 else
1964 {
1965 NS_FATAL_ERROR("Error connecting to RxLinkJitter trace source of SatNetDevice"
1966 << " at node ID " << (*it)->GetId() << " device #"
1967 << satOrbiterDev->GetIfIndex());
1968 }
1969 }
1970 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1971
1972 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1973 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1974 {
1975 // Create a map of UT addresses and identifiers.
1977
1978 // Enable statistics-related tags and trace sources on the device.
1979 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1980 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1981 NS_ASSERT(satDev != nullptr);
1982 Ptr<SatPhy> satPhy = satDev->GetPhy();
1983 NS_ASSERT(satPhy != nullptr);
1984 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1985 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1986 }
1987
1988 // Connect to trace sources at GW nodes.
1989
1990 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1991
1992 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1993 {
1994 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1995
1996 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1997 {
1998 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1999 NS_ASSERT(satDev != nullptr);
2000 Ptr<SatPhy> satPhy = satDev->GetPhy();
2001 NS_ASSERT(satPhy != nullptr);
2002
2003 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
2004 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
2005 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
2006
2007 } // end of `for (NodeContainer::Iterator it = gws)`
2008
2009} // end of `void DoInstallProbes ();`
2010
2011} // 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.
static Ptr< NetDevice > GetSatSatOrbiterNetDevice(Ptr< Node > satNode)
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)
SatStatsHelper(Ptr< const SatHelper > satHelper)
Creates a new helper instance.
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.