Loading...
Searching...
No Matches
satellite-stats-link-delay-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("SatStatsLinkDelayHelper");
61
62namespace ns3
63{
64
65NS_OBJECT_ENSURE_REGISTERED(SatStatsLinkDelayHelper);
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::SatStatsLinkDelayHelper")
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("delay_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("delay_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("delay_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("delay_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 delay (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 delay (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 delay (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("SatStatsLinkDelayHelper - 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
422SatStatsLinkDelayHelper::RxLinkDelayCallback(const Time& delay, const Address& from)
423{
424 // NS_LOG_FUNCTION (this << delay.GetSeconds () << from);
425
426 if (from.IsInvalid())
427 {
428 NS_LOG_WARN(this << " discarding a packet delay of " << delay.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(delay, 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(delay, it->second);
446 }
447 else
448 {
449 NS_LOG_WARN(this << " discarding a packet delay of " << delay.GetSeconds()
450 << " from statistics collection because of"
451 << " unknown sender address " << from);
452 }
453 }
454}
455
456bool
457SatStatsLinkDelayHelper::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
523SatStatsLinkDelayHelper::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
589SatStatsLinkDelayHelper::PassSampleToCollector(const Time& delay, uint32_t identifier)
590{
591 // NS_LOG_FUNCTION (this << delay.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, delay.GetSeconds());
603 break;
604 }
605
608 Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
609 NS_ASSERT(c != nullptr);
610 c->TraceSinkDouble(0.0, delay.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, delay.GetSeconds());
625 }
626 else
627 {
628 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
629 NS_ASSERT(c != nullptr);
630 c->TraceSinkDouble(0.0, delay.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
643// FORWARD FEEDER LINK DEV-LEVEL /////////////////////////////////////////////////////
644
645NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederDevLinkDelayHelper);
646
648 Ptr<const SatHelper> satHelper)
649 : SatStatsLinkDelayHelper(satHelper)
650{
651 NS_LOG_FUNCTION(this << satHelper);
652}
653
658
659TypeId // static
661{
662 static TypeId tid =
663 TypeId("ns3::SatStatsFwdFeederDevLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
664 return tid;
665}
666
667void
669{
670 NS_LOG_FUNCTION(this);
671
672 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
673 Callback<void, const Time&, const Address&> callback =
675
676 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
677 {
678 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
679 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
680 NS_ASSERT(satOrbiterDev != nullptr);
681 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
682
683 // Connect the object to the probe.
684 if (satOrbiterDev->TraceConnectWithoutContext("RxFeederLinkDelay", callback))
685 {
686 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
687 << " device #" << satOrbiterDev->GetIfIndex());
688 }
689 else
690 {
691 NS_FATAL_ERROR("Error connecting to RxFeederLinkDelay trace source of SatNetDevice"
692 << " at node ID " << (*it)->GetId() << " device #"
693 << satOrbiterDev->GetIfIndex());
694 }
695 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
696
697 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
698
699 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
700 {
701 // Create a map of UT addresses and identifiers.
703
704 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
705 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
706 NS_ASSERT(satDev != nullptr);
707
708 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
709
710 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
711
712 // Enable statistics-related tags on the transmitting device.
713 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
714 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
715 {
716 NetDeviceContainer devs = GetGwSatNetDevice(*it);
717
718 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
719 {
720 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
721 NS_ASSERT(satDev != nullptr);
722
723 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
724 }
725 }
726
727} // end of `void DoInstallProbes ();`
728
729// FORWARD USER LINK DEV-LEVEL /////////////////////////////////////////////////////
730
731NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserDevLinkDelayHelper);
732
734 : SatStatsLinkDelayHelper(satHelper)
735{
736 NS_LOG_FUNCTION(this << satHelper);
737}
738
743
744TypeId // static
746{
747 static TypeId tid =
748 TypeId("ns3::SatStatsFwdUserDevLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
749 return tid;
750}
751
752void
754{
755 NS_LOG_FUNCTION(this);
756
757 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
758
759 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
760 {
761 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
762 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
763 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
764 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
765
766 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
767
768 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
769 {
770 const int32_t utId = GetUtId(*it);
771 NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
772 const uint32_t identifier = GetIdentifierForUt(*it);
773
774 // Create the probe.
775 std::ostringstream probeName;
776 probeName << utId;
777 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
778 probe->SetName(probeName.str());
779
780 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
781 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
782 NS_ASSERT(satDev != nullptr);
783
784 // Connect the object to the probe.
785 if (probe->ConnectByObject("RxLinkDelay", satDev) &&
786 ConnectProbeToCollector(probe, identifier))
787 {
788 m_probes.insert(
789 std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
790
791 // Enable statistics-related tags and trace sources on the device.
792 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
793 }
794 else
795 {
796 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatMac"
797 << " at node ID " << (*it)->GetId() << " device #2");
798 }
799
800 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
801
802 // Enable statistics-related tags on the transmitting device.
803 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
804 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
805 {
806 NetDeviceContainer devs = GetGwSatNetDevice(*it);
807
808 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
809 {
810 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
811 NS_ASSERT(satDev != nullptr);
812
813 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
814 }
815 }
816
817} // end of `void DoInstallProbes ();`
818
819void
821{
822 NS_LOG_FUNCTION(this);
823
824 std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
825
826 for (it = m_probes.begin(); it != m_probes.end(); it++)
827 {
828 Ptr<Probe> probe = it->first;
829 Ptr<Node> node = it->second.first;
830 uint32_t identifier = it->second.second;
831
832 if (!DisconnectProbeFromCollector(probe, identifier))
833 {
834 NS_FATAL_ERROR("Error disconnecting trace file on handover");
835 }
836
837 identifier = GetIdentifierForUt(node);
838
839 if (!ConnectProbeToCollector(probe, identifier))
840 {
841 NS_FATAL_ERROR("Error connecting trace file on handover");
842 }
843
844 it->second.second = identifier;
845 }
846} // end of `void UpdateIdentifierOnProbes ();`
847
848// FORWARD FEEDER LINK MAC-LEVEL /////////////////////////////////////////////////////
849
850NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederMacLinkDelayHelper);
851
853 Ptr<const SatHelper> satHelper)
854 : SatStatsLinkDelayHelper(satHelper)
855{
856 NS_LOG_FUNCTION(this << satHelper);
857}
858
863
864TypeId // static
866{
867 static TypeId tid =
868 TypeId("ns3::SatStatsFwdFeederMacLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
869 return tid;
870}
871
872void
874{
875 NS_LOG_FUNCTION(this);
876
877 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
878 Callback<void, const Time&, const Address&> callback =
880
881 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
882 {
883 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
884 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
885 NS_ASSERT(satOrbiterDev != nullptr);
886 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
887 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
888 Ptr<SatMac> satMac;
889 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
890 it2 != satOrbiterFeederMacs.end();
891 ++it2)
892 {
893 satMac = it2->second;
894 NS_ASSERT(satMac != nullptr);
895 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
896
897 // Connect the object to the probe.
898 if (satMac->TraceConnectWithoutContext("RxLinkDelay", callback))
899 {
900 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
901 << " device #" << satOrbiterDev->GetIfIndex());
902
903 // Enable statistics-related tags and trace sources on the device.
904 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
905 }
906 else
907 {
908 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
909 << " at node ID " << (*it)->GetId() << " device #"
910 << satOrbiterDev->GetIfIndex());
911 }
912 }
913 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
914 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
915 it2 != satOrbiterUserMacs.end();
916 ++it2)
917 {
918 satMac = it2->second;
919 NS_ASSERT(satMac != nullptr);
920 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
921 }
922 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
923
924 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
925
926 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
927 {
928 // Create a map of UT addresses and identifiers.
930
931 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
932 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
933 NS_ASSERT(satDev != nullptr);
934 Ptr<SatMac> satMac = satDev->GetMac();
935 NS_ASSERT(satMac != nullptr);
936
937 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
938 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
939
940 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
941
942 // Enable statistics-related tags on the transmitting device.
943 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
944 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
945 {
946 NetDeviceContainer devs = GetGwSatNetDevice(*it);
947
948 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
949 {
950 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
951 NS_ASSERT(satDev != nullptr);
952 Ptr<SatMac> satMac = satDev->GetMac();
953 NS_ASSERT(satMac != nullptr);
954
955 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
956 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
957 }
958 }
959
960} // end of `void DoInstallProbes ();`
961
962// FORWARD USER LINK MAC-LEVEL /////////////////////////////////////////////////////
963
964NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserMacLinkDelayHelper);
965
967 : SatStatsLinkDelayHelper(satHelper)
968{
969 NS_LOG_FUNCTION(this << satHelper);
970}
971
976
977TypeId // static
979{
980 static TypeId tid =
981 TypeId("ns3::SatStatsFwdUserMacLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
982 return tid;
983}
984
985void
987{
988 NS_LOG_FUNCTION(this);
989
990 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
991
992 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
993 {
994 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
995 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
996 NS_ASSERT(satOrbiterDev != nullptr);
997 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
998 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
999 Ptr<SatMac> satMac;
1000 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1001 it2 != satOrbiterFeederMacs.end();
1002 ++it2)
1003 {
1004 satMac = it2->second;
1005 NS_ASSERT(satMac != nullptr);
1006 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1007 }
1008 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1009 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1010 it2 != satOrbiterUserMacs.end();
1011 ++it2)
1012 {
1013 satMac = it2->second;
1014 NS_ASSERT(satMac != nullptr);
1015 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1016 }
1017 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1018
1019 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1020
1021 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1022 {
1023 const int32_t utId = GetUtId(*it);
1024 NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
1025 const uint32_t identifier = GetIdentifierForUt(*it);
1026
1027 // Create the probe.
1028 std::ostringstream probeName;
1029 probeName << utId;
1030 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
1031 probe->SetName(probeName.str());
1032
1033 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1034 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1035 NS_ASSERT(satDev != nullptr);
1036 Ptr<SatMac> satMac = satDev->GetMac();
1037 NS_ASSERT(satMac != nullptr);
1038
1039 // Connect the object to the probe.
1040 if (probe->ConnectByObject("RxLinkDelay", satMac) &&
1041 ConnectProbeToCollector(probe, identifier))
1042 {
1043 m_probes.insert(
1044 std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
1045
1046 // Enable statistics-related tags and trace sources on the device.
1047 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1048 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1049 }
1050 else
1051 {
1052 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatMac"
1053 << " at node ID " << (*it)->GetId() << " device #2");
1054 }
1055
1056 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1057
1058 // Enable statistics-related tags on the transmitting device.
1059 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1060 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1061 {
1062 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1063
1064 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1065 {
1066 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1067 NS_ASSERT(satDev != nullptr);
1068 Ptr<SatMac> satMac = satDev->GetMac();
1069 NS_ASSERT(satMac != nullptr);
1070
1071 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1072 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1073 }
1074 }
1075
1076} // end of `void DoInstallProbes ();`
1077
1078void
1080{
1081 NS_LOG_FUNCTION(this);
1082
1083 std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
1084
1085 for (it = m_probes.begin(); it != m_probes.end(); it++)
1086 {
1087 Ptr<Probe> probe = it->first;
1088 Ptr<Node> node = it->second.first;
1089 uint32_t identifier = it->second.second;
1090
1091 if (!DisconnectProbeFromCollector(probe, identifier))
1092 {
1093 NS_FATAL_ERROR("Error disconnecting trace file on handover");
1094 }
1095
1096 identifier = GetIdentifierForUt(node);
1097
1098 if (!ConnectProbeToCollector(probe, identifier))
1099 {
1100 NS_FATAL_ERROR("Error connecting trace file on handover");
1101 }
1102
1103 it->second.second = identifier;
1104 }
1105} // end of `void UpdateIdentifierOnProbes ();`
1106
1107// FORWARD FEEDER LINK PHY-LEVEL /////////////////////////////////////////////////////
1108
1109NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdFeederPhyLinkDelayHelper);
1110
1112 Ptr<const SatHelper> satHelper)
1113 : SatStatsLinkDelayHelper(satHelper)
1114{
1115 NS_LOG_FUNCTION(this << satHelper);
1116}
1117
1122
1123TypeId // static
1125{
1126 static TypeId tid =
1127 TypeId("ns3::SatStatsFwdFeederPhyLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1128 return tid;
1129}
1130
1131void
1133{
1134 NS_LOG_FUNCTION(this);
1135
1136 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1137 Callback<void, const Time&, const Address&> callback =
1139
1140 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1141 {
1142 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1143 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1144 NS_ASSERT(satOrbiterDev != nullptr);
1145 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1146 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1147 Ptr<SatPhy> satPhy;
1148 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1149 it2 != satOrbiterFeederPhys.end();
1150 ++it2)
1151 {
1152 satPhy = it2->second;
1153 NS_ASSERT(satPhy != nullptr);
1154 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1155
1156 // Connect the object to the probe.
1157 if (satPhy->TraceConnectWithoutContext("RxLinkDelay", callback))
1158 {
1159 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1160 << " device #" << satOrbiterDev->GetIfIndex());
1161
1162 // Enable statistics-related tags and trace sources on the device.
1163 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1164 }
1165 else
1166 {
1167 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
1168 << " at node ID " << (*it)->GetId() << " device #"
1169 << satOrbiterDev->GetIfIndex());
1170 }
1171 }
1172 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1173 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1174 it2 != satOrbiterUserPhys.end();
1175 ++it2)
1176 {
1177 satPhy = it2->second;
1178 NS_ASSERT(satPhy != nullptr);
1179 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1180 }
1181 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1182
1183 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1184
1185 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1186 {
1187 // Create a map of UT addresses and identifiers.
1189
1190 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1191 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1192 NS_ASSERT(satDev != nullptr);
1193 Ptr<SatPhy> satPhy = satDev->GetPhy();
1194 NS_ASSERT(satPhy != nullptr);
1195
1196 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1197 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1198
1199 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1200
1201 // Enable statistics-related tags on the transmitting device.
1202 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1203 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1204 {
1205 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1206
1207 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1208 {
1209 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1210 NS_ASSERT(satDev != nullptr);
1211 Ptr<SatPhy> satPhy = satDev->GetPhy();
1212 NS_ASSERT(satPhy != nullptr);
1213
1214 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1215 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1216 }
1217 }
1218
1219} // end of `void DoInstallProbes ();`
1220
1221// FORWARD USER LINK PHY-LEVEL /////////////////////////////////////////////////////
1222
1223NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdUserPhyLinkDelayHelper);
1224
1226 : SatStatsLinkDelayHelper(satHelper)
1227{
1228 NS_LOG_FUNCTION(this << satHelper);
1229}
1230
1235
1236TypeId // static
1238{
1239 static TypeId tid =
1240 TypeId("ns3::SatStatsFwdUserPhyLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1241 return tid;
1242}
1243
1244void
1246{
1247 NS_LOG_FUNCTION(this);
1248
1249 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1250
1251 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1252 {
1253 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1254 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1255 NS_ASSERT(satOrbiterDev != nullptr);
1256 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1257 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1258 Ptr<SatPhy> satPhy;
1259 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1260 it2 != satOrbiterFeederPhys.end();
1261 ++it2)
1262 {
1263 satPhy = it2->second;
1264 NS_ASSERT(satPhy != nullptr);
1265 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1266 }
1267 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1268 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1269 it2 != satOrbiterUserPhys.end();
1270 ++it2)
1271 {
1272 satPhy = it2->second;
1273 NS_ASSERT(satPhy != nullptr);
1274 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1275 }
1276 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1277
1278 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1279
1280 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1281 {
1282 const int32_t utId = GetUtId(*it);
1283 NS_ASSERT_MSG(utId > 0, "Node " << (*it)->GetId() << " is not a valid UT");
1284 const uint32_t identifier = GetIdentifierForUt(*it);
1285
1286 // Create the probe.
1287 std::ostringstream probeName;
1288 probeName << utId;
1289 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
1290 probe->SetName(probeName.str());
1291
1292 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1293 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1294 NS_ASSERT(satDev != nullptr);
1295 Ptr<SatPhy> satPhy = satDev->GetPhy();
1296 NS_ASSERT(satPhy != nullptr);
1297
1298 // Connect the object to the probe.
1299 if (probe->ConnectByObject("RxLinkDelay", satPhy) &&
1300 ConnectProbeToCollector(probe, identifier))
1301 {
1302 m_probes.insert(
1303 std::make_pair(probe->GetObject<Probe>(), std::make_pair(*it, identifier)));
1304
1305 // Enable statistics-related tags and trace sources on the device.
1306 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1307 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1308 }
1309 else
1310 {
1311 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatPhy"
1312 << " at node ID " << (*it)->GetId() << " device #2");
1313 }
1314
1315 } // end of `for (it = uts.Begin(); it != uts.End (); ++it)`
1316
1317 // Enable statistics-related tags on the transmitting device.
1318 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1319 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1320 {
1321 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1322
1323 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1324 {
1325 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1326 NS_ASSERT(satDev != nullptr);
1327 Ptr<SatPhy> satPhy = satDev->GetPhy();
1328 NS_ASSERT(satPhy != nullptr);
1329
1330 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1331 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1332 }
1333 }
1334
1335} // end of `void DoInstallProbes ();`
1336
1337void
1339{
1340 NS_LOG_FUNCTION(this);
1341
1342 std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>>::iterator it;
1343
1344 for (it = m_probes.begin(); it != m_probes.end(); it++)
1345 {
1346 Ptr<Probe> probe = it->first;
1347 Ptr<Node> node = it->second.first;
1348 uint32_t identifier = it->second.second;
1349
1350 if (!DisconnectProbeFromCollector(probe, identifier))
1351 {
1352 NS_FATAL_ERROR("Error disconnecting trace file on handover");
1353 }
1354
1355 identifier = GetIdentifierForUt(node);
1356
1357 if (!ConnectProbeToCollector(probe, identifier))
1358 {
1359 NS_FATAL_ERROR("Error connecting trace file on handover");
1360 }
1361
1362 it->second.second = identifier;
1363 }
1364} // end of `void UpdateIdentifierOnProbes ();`
1365
1366// RETURN FEEDER LINK DEV-LEVEL //////////////////////////////////////////////////////
1367
1368NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederDevLinkDelayHelper);
1369
1371 Ptr<const SatHelper> satHelper)
1372 : SatStatsLinkDelayHelper(satHelper)
1373{
1374 NS_LOG_FUNCTION(this << satHelper);
1375}
1376
1381
1382TypeId // static
1384{
1385 static TypeId tid =
1386 TypeId("ns3::SatStatsRtnFeederDevLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1387 return tid;
1388}
1389
1390void
1392{
1393 NS_LOG_FUNCTION(this);
1394
1395 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1396
1397 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1398 {
1399 Ptr<SatMac> satMac;
1400 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1401 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1402 NS_ASSERT(satOrbiterDev != nullptr);
1403 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1404 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1405
1406 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1407 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1408 {
1409 // Create a map of UT addresses and identifiers.
1411
1412 // Enable statistics-related tags and trace sources on the device.
1413 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1414 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1415 NS_ASSERT(satDev != nullptr);
1416 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1417 }
1418
1419 // Connect to trace sources at GW nodes.
1420
1421 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1422 Callback<void, const Time&, const Address&> callback =
1424
1425 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1426 {
1427 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1428
1429 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1430 {
1431 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1432 NS_ASSERT(satDev != nullptr);
1433
1434 // Connect the object to the probe.
1435 if (satDev->TraceConnectWithoutContext("RxLinkDelay", callback))
1436 {
1437 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1438 << " device #" << satDev->GetIfIndex());
1439
1440 // Enable statistics-related tags and trace sources on the device.
1441 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1442 }
1443 else
1444 {
1445 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
1446 << " at node ID " << (*it)->GetId() << " device #"
1447 << satDev->GetIfIndex());
1448 }
1449
1450 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1451
1452 } // end of `for (NodeContainer::Iterator it = gws)`
1453
1454} // end of `void DoInstallProbes ();`
1455
1456// RETURN USER LINK DEV-LEVEL //////////////////////////////////////////////////////
1457
1458NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserDevLinkDelayHelper);
1459
1461 : SatStatsLinkDelayHelper(satHelper)
1462{
1463 NS_LOG_FUNCTION(this << satHelper);
1464}
1465
1470
1471TypeId // static
1473{
1474 static TypeId tid =
1475 TypeId("ns3::SatStatsRtnUserDevLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1476 return tid;
1477}
1478
1479void
1481{
1482 NS_LOG_FUNCTION(this);
1483
1484 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1485 Callback<void, const Time&, const Address&> callback =
1487
1488 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1489 {
1490 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1491 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1492 NS_ASSERT(satOrbiterDev != nullptr);
1493 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1494
1495 // Connect the object to the probe.
1496 if (satOrbiterDev->TraceConnectWithoutContext("RxUserLinkDelay", callback))
1497 {
1498 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1499 << " device #" << satOrbiterDev->GetIfIndex());
1500 }
1501 else
1502 {
1503 NS_FATAL_ERROR("Error connecting to RxUserLinkDelay trace source of SatNetDevice"
1504 << " at node ID " << (*it)->GetId() << " device #"
1505 << satOrbiterDev->GetIfIndex());
1506 }
1507 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1508
1509 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1510 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1511 {
1512 // Create a map of UT addresses and identifiers.
1514
1515 // Enable statistics-related tags and trace sources on the device.
1516 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1517 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1518 NS_ASSERT(satDev != nullptr);
1519 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1520 }
1521
1522 // Connect to trace sources at GW nodes.
1523
1524 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1525
1526 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1527 {
1528 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1529
1530 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1531 {
1532 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1533 NS_ASSERT(satDev != nullptr);
1534
1535 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1536 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1537
1538 } // end of `for (NodeContainer::Iterator it = gws)`
1539
1540} // end of `void DoInstallProbes ();`
1541
1542// RETURN FEEDER LINK MAC-LEVEL //////////////////////////////////////////////////////
1543
1544NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederMacLinkDelayHelper);
1545
1547 Ptr<const SatHelper> satHelper)
1548 : SatStatsLinkDelayHelper(satHelper)
1549{
1550 NS_LOG_FUNCTION(this << satHelper);
1551}
1552
1557
1558TypeId // static
1560{
1561 static TypeId tid =
1562 TypeId("ns3::SatStatsRtnFeederMacLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1563 return tid;
1564}
1565
1566void
1568{
1569 NS_LOG_FUNCTION(this);
1570
1571 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1572
1573 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1574 {
1575 Ptr<SatMac> satMac;
1576 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1577 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1578 NS_ASSERT(satOrbiterDev != nullptr);
1579 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1580 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1581 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1582 it2 != satOrbiterFeederMacs.end();
1583 ++it2)
1584 {
1585 satMac = it2->second;
1586 NS_ASSERT(satMac != nullptr);
1587 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1588 }
1589 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1590 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1591 it2 != satOrbiterUserMacs.end();
1592 ++it2)
1593 {
1594 satMac = it2->second;
1595 NS_ASSERT(satMac != nullptr);
1596 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1597 }
1598 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1599
1600 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1601 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1602 {
1603 // Create a map of UT addresses and identifiers.
1605
1606 // Enable statistics-related tags and trace sources on the device.
1607 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1608 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1609 NS_ASSERT(satDev != nullptr);
1610 Ptr<SatMac> satMac = satDev->GetMac();
1611 NS_ASSERT(satMac != nullptr);
1612 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1613 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1614 }
1615
1616 // Connect to trace sources at GW nodes.
1617
1618 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1619 Callback<void, const Time&, const Address&> callback =
1621
1622 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1623 {
1624 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1625
1626 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1627 {
1628 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1629 NS_ASSERT(satDev != nullptr);
1630 Ptr<SatMac> satMac = satDev->GetMac();
1631 NS_ASSERT(satMac != nullptr);
1632
1633 // Connect the object to the probe.
1634 if (satMac->TraceConnectWithoutContext("RxLinkDelay", callback))
1635 {
1636 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1637 << " device #" << satDev->GetIfIndex());
1638
1639 // Enable statistics-related tags and trace sources on the device.
1640 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1641 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1642 }
1643 else
1644 {
1645 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
1646 << " at node ID " << (*it)->GetId() << " device #"
1647 << satDev->GetIfIndex());
1648 }
1649
1650 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1651
1652 } // end of `for (NodeContainer::Iterator it = gws)`
1653
1654} // end of `void DoInstallProbes ();`
1655
1656// RETURN USER LINK MAC-LEVEL //////////////////////////////////////////////////////
1657
1658NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserMacLinkDelayHelper);
1659
1661 : SatStatsLinkDelayHelper(satHelper)
1662{
1663 NS_LOG_FUNCTION(this << satHelper);
1664}
1665
1670
1671TypeId // static
1673{
1674 static TypeId tid =
1675 TypeId("ns3::SatStatsRtnUserMacLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1676 return tid;
1677}
1678
1679void
1681{
1682 NS_LOG_FUNCTION(this);
1683
1684 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1685 Callback<void, const Time&, const Address&> callback =
1687
1688 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1689 {
1690 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1691 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1692 NS_ASSERT(satOrbiterDev != nullptr);
1693 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1694 std::map<uint32_t, Ptr<SatMac>> satOrbiterFeederMacs = satOrbiterDev->GetFeederMac();
1695 Ptr<SatMac> satMac;
1696 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterFeederMacs.begin();
1697 it2 != satOrbiterFeederMacs.end();
1698 ++it2)
1699 {
1700 satMac = it2->second;
1701 NS_ASSERT(satMac != nullptr);
1702 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1703 }
1704 std::map<uint32_t, Ptr<SatMac>> satOrbiterUserMacs = satOrbiterDev->GetUserMac();
1705 for (std::map<uint32_t, Ptr<SatMac>>::iterator it2 = satOrbiterUserMacs.begin();
1706 it2 != satOrbiterUserMacs.end();
1707 ++it2)
1708 {
1709 satMac = it2->second;
1710 NS_ASSERT(satMac != nullptr);
1711 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1712
1713 // Connect the object to the probe.
1714 if (satMac->TraceConnectWithoutContext("RxLinkDelay", callback))
1715 {
1716 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1717 << " device #" << satOrbiterDev->GetIfIndex());
1718 }
1719 else
1720 {
1721 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
1722 << " at node ID " << (*it)->GetId() << " device #"
1723 << satOrbiterDev->GetIfIndex());
1724 }
1725 }
1726 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1727
1728 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1729 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1730 {
1731 // Create a map of UT addresses and identifiers.
1733
1734 // Enable statistics-related tags and trace sources on the device.
1735 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1736 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1737 NS_ASSERT(satDev != nullptr);
1738 Ptr<SatMac> satMac = satDev->GetMac();
1739 NS_ASSERT(satMac != nullptr);
1740 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1741 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1742 }
1743
1744 // Connect to trace sources at GW nodes.
1745
1746 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1747
1748 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1749 {
1750 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1751
1752 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1753 {
1754 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1755 NS_ASSERT(satDev != nullptr);
1756 Ptr<SatMac> satMac = satDev->GetMac();
1757 NS_ASSERT(satMac != nullptr);
1758
1759 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1760 satMac->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1761 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1762
1763 } // end of `for (NodeContainer::Iterator it = gws)`
1764
1765} // end of `void DoInstallProbes ();`
1766
1767// RETURN FEEDER LINK PHY-LEVEL //////////////////////////////////////////////////////
1768
1769NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnFeederPhyLinkDelayHelper);
1770
1772 Ptr<const SatHelper> satHelper)
1773 : SatStatsLinkDelayHelper(satHelper)
1774{
1775 NS_LOG_FUNCTION(this << satHelper);
1776}
1777
1782
1783TypeId // static
1785{
1786 static TypeId tid =
1787 TypeId("ns3::SatStatsRtnFeederPhyLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1788 return tid;
1789}
1790
1791void
1793{
1794 NS_LOG_FUNCTION(this);
1795
1796 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1797
1798 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1799 {
1800 Ptr<SatPhy> satPhy;
1801 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1802 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1803 NS_ASSERT(satOrbiterDev != nullptr);
1804 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1805 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1806 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1807 it2 != satOrbiterFeederPhys.end();
1808 ++it2)
1809 {
1810 satPhy = it2->second;
1811 NS_ASSERT(satPhy != nullptr);
1812 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1813 }
1814 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1815 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1816 it2 != satOrbiterUserPhys.end();
1817 ++it2)
1818 {
1819 satPhy = it2->second;
1820 NS_ASSERT(satPhy != nullptr);
1821 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1822 }
1823 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1824
1825 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1826 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1827 {
1828 // Create a map of UT addresses and identifiers.
1830
1831 // Enable statistics-related tags and trace sources on the device.
1832 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1833 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1834 NS_ASSERT(satDev != nullptr);
1835 Ptr<SatPhy> satPhy = satDev->GetPhy();
1836 NS_ASSERT(satPhy != nullptr);
1837 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1838 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1839 }
1840
1841 // Connect to trace sources at GW nodes.
1842
1843 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1844 Callback<void, const Time&, const Address&> callback =
1846
1847 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1848 {
1849 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1850
1851 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1852 {
1853 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1854 NS_ASSERT(satDev != nullptr);
1855 Ptr<SatPhy> satPhy = satDev->GetPhy();
1856 NS_ASSERT(satPhy != nullptr);
1857
1858 // Connect the object to the probe.
1859 if (satPhy->TraceConnectWithoutContext("RxLinkDelay", callback))
1860 {
1861 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1862 << " device #" << satDev->GetIfIndex());
1863
1864 // Enable statistics-related tags and trace sources on the device.
1865 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1866 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1867 }
1868 else
1869 {
1870 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
1871 << " at node ID " << (*it)->GetId() << " device #"
1872 << satDev->GetIfIndex());
1873 }
1874
1875 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1876
1877 } // end of `for (NodeContainer::Iterator it = gws)`
1878
1879} // end of `void DoInstallProbes ();`
1880
1881// RETURN USER LINK PHY-LEVEL //////////////////////////////////////////////////////
1882
1883NS_OBJECT_ENSURE_REGISTERED(SatStatsRtnUserPhyLinkDelayHelper);
1884
1886 : SatStatsLinkDelayHelper(satHelper)
1887{
1888 NS_LOG_FUNCTION(this << satHelper);
1889}
1890
1895
1896TypeId // static
1898{
1899 static TypeId tid =
1900 TypeId("ns3::SatStatsRtnUserPhyLinkDelayHelper").SetParent<SatStatsLinkDelayHelper>();
1901 return tid;
1902}
1903
1904void
1906{
1907 NS_LOG_FUNCTION(this);
1908
1909 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
1910 Callback<void, const Time&, const Address&> callback =
1912
1913 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1914 {
1915 Ptr<NetDevice> dev = GetSatSatOrbiterNetDevice(*it);
1916 Ptr<SatOrbiterNetDevice> satOrbiterDev = dev->GetObject<SatOrbiterNetDevice>();
1917 NS_ASSERT(satOrbiterDev != nullptr);
1918 satOrbiterDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1919 std::map<uint32_t, Ptr<SatPhy>> satOrbiterFeederPhys = satOrbiterDev->GetFeederPhy();
1920 Ptr<SatPhy> satPhy;
1921 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterFeederPhys.begin();
1922 it2 != satOrbiterFeederPhys.end();
1923 ++it2)
1924 {
1925 satPhy = it2->second;
1926 NS_ASSERT(satPhy != nullptr);
1927 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1928 }
1929 std::map<uint32_t, Ptr<SatPhy>> satOrbiterUserPhys = satOrbiterDev->GetUserPhy();
1930 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satOrbiterUserPhys.begin();
1931 it2 != satOrbiterUserPhys.end();
1932 ++it2)
1933 {
1934 satPhy = it2->second;
1935 NS_ASSERT(satPhy != nullptr);
1936 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1937
1938 // Connect the object to the probe.
1939 if (satPhy->TraceConnectWithoutContext("RxLinkDelay", callback))
1940 {
1941 NS_LOG_INFO(this << " successfully connected with node ID " << (*it)->GetId()
1942 << " device #" << satOrbiterDev->GetIfIndex());
1943 }
1944 else
1945 {
1946 NS_FATAL_ERROR("Error connecting to RxLinkDelay trace source of SatNetDevice"
1947 << " at node ID " << (*it)->GetId() << " device #"
1948 << satOrbiterDev->GetIfIndex());
1949 }
1950 }
1951 } // end of `for (it = sats.Begin(); it != sats.End (); ++it)`
1952
1953 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
1954 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1955 {
1956 // Create a map of UT addresses and identifiers.
1958
1959 // Enable statistics-related tags and trace sources on the device.
1960 Ptr<NetDevice> dev = GetUtSatNetDevice(*it);
1961 Ptr<SatNetDevice> satDev = dev->GetObject<SatNetDevice>();
1962 NS_ASSERT(satDev != nullptr);
1963 Ptr<SatPhy> satPhy = satDev->GetPhy();
1964 NS_ASSERT(satPhy != nullptr);
1965 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1966 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1967 }
1968
1969 // Connect to trace sources at GW nodes.
1970
1971 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
1972
1973 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1974 {
1975 NetDeviceContainer devs = GetGwSatNetDevice(*it);
1976
1977 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1978 {
1979 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<SatNetDevice>();
1980 NS_ASSERT(satDev != nullptr);
1981 Ptr<SatPhy> satPhy = satDev->GetPhy();
1982 NS_ASSERT(satPhy != nullptr);
1983
1984 satDev->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1985 satPhy->SetAttribute("EnableStatisticsTags", BooleanValue(true));
1986 } // end of `for (NetDeviceContainer::Iterator itDev = devs)`
1987
1988 } // end of `for (NodeContainer::Iterator it = gws)`
1989
1990} // end of `void DoInstallProbes ();`
1991
1992} // end of namespace ns3
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::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.