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>
31 #include <ns3/inet-socket-address.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-geo-net-device.h>
42 #include <ns3/satellite-helper.h>
43 #include <ns3/satellite-id-mapper.h>
44 #include <ns3/satellite-mac.h>
45 #include <ns3/satellite-net-device.h>
46 #include <ns3/satellite-phy.h>
47 #include <ns3/satellite-time-tag.h>
48 #include <ns3/scalar-collector.h>
49 #include <ns3/singleton.h>
50 #include <ns3/string.h>
51 #include <ns3/traffic-time-tag.h>
52 #include <ns3/unit-conversion-collector.h>
56 NS_LOG_COMPONENT_DEFINE(
"SatStatsJitterHelper");
61 NS_OBJECT_ENSURE_REGISTERED(SatStatsJitterHelper);
65 m_averagingMode(false)
67 NS_LOG_FUNCTION(
this << satHelper);
72 NS_LOG_FUNCTION(
this);
79 TypeId(
"ns3::SatStatsJitterHelper")
81 .AddAttribute(
"AveragingMode",
82 "If true, all samples will be averaged before passed to aggregator. "
83 "Only affects histogram, PDF, and CDF output types.",
87 MakeBooleanChecker());
94 NS_LOG_FUNCTION(
this << averagingMode);
107 NS_LOG_FUNCTION(
this);
113 <<
" is not a valid output type for this statistics.");
123 "EnableContextPrinting",
131 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
134 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
138 &MultiFileAggregator::Write1d);
153 EnumValue(UnitConversionCollector::TRANSPARENT));
157 &MultiFileAggregator::Write2d);
172 "EnableContextPrinting",
176 Ptr<MultiFileAggregator> fileAggregator =
178 NS_ASSERT(fileAggregator !=
nullptr);
182 DistributionCollector::OutputType_t outputType =
183 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
186 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
190 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
197 MakeCallback(&MultiFileAggregator::Write2d, fileAggregator));
201 MakeCallback(&MultiFileAggregator::AddContextHeading, fileAggregator));
205 MakeCallback(&MultiFileAggregator::EnableContextWarning, fileAggregator));
210 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
213 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
215 Callback<void, double> callback =
221 it->second->TraceConnectWithoutContext(
"Output", callback);
235 DistributionCollector::OutputType_t outputType =
236 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
239 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
243 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
249 &MultiFileAggregator::Write2d);
252 &MultiFileAggregator::AddContextHeading);
255 &MultiFileAggregator::EnableContextWarning);
264 <<
" is not a valid output type for this statistics.");
274 Ptr<MagisterGnuplotAggregator> plotAggregator =
276 NS_ASSERT(plotAggregator !=
nullptr);
278 plotAggregator->SetLegend(
"Time (in seconds)",
"Packet jitter (in seconds)");
279 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
284 EnumValue(UnitConversionCollector::TRANSPARENT));
290 const std::string context = it->second->GetName();
291 plotAggregator->Add2dDataset(context, context);
295 &MagisterGnuplotAggregator::Write2d);
310 Ptr<MagisterGnuplotAggregator> plotAggregator =
312 NS_ASSERT(plotAggregator !=
nullptr);
314 plotAggregator->SetLegend(
"Packet jitter (in seconds)",
"Frequency");
315 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
321 DistributionCollector::OutputType_t outputType =
322 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
325 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
329 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
336 MakeCallback(&MagisterGnuplotAggregator::Write2d, plotAggregator));
342 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
345 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
347 Callback<void, double> callback =
353 it->second->TraceConnectWithoutContext(
"Output", callback);
364 Ptr<MagisterGnuplotAggregator> plotAggregator =
366 NS_ASSERT(plotAggregator !=
nullptr);
368 plotAggregator->SetLegend(
"Packet jitter (in seconds)",
"Frequency");
369 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
373 DistributionCollector::OutputType_t outputType =
374 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
377 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
381 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
389 const std::string context = it->second->GetName();
390 plotAggregator->Add2dDataset(context, context);
394 &MagisterGnuplotAggregator::Write2d);
401 NS_FATAL_ERROR(
"SatStatsJitterHelper - Invalid output type");
422 if (from.IsInvalid())
424 NS_LOG_WARN(
this <<
" discarding a packet jitter of " << jitter.GetSeconds()
425 <<
" from statistics collection because of"
426 <<
" invalid sender address");
431 std::map<const Address, uint32_t>::const_iterator it =
m_identifierMap.find(from);
439 NS_LOG_WARN(
this <<
" discarding a packet jitter of " << jitter.GetSeconds()
440 <<
" from statistics collection because of"
441 <<
" unknown sender address " << from);
449 NS_LOG_FUNCTION(
this << utNode->GetId());
451 const SatIdMapper* satIdMapper = Singleton<SatIdMapper>::Get();
454 if (addr.IsInvalid())
456 NS_LOG_WARN(
this <<
" Node " << utNode->GetId() <<
" is not a valid UT");
462 NS_LOG_INFO(
this <<
" associated address " << addr <<
" with identifier " << identifier);
469 NS_LOG_FUNCTION(
this << probe << probe->GetName() << identifier);
479 &ScalarCollector::TraceSinkDouble);
487 &UnitConversionCollector::TraceSinkDouble);
501 &ScalarCollector::TraceSinkDouble);
508 &DistributionCollector::TraceSinkDouble);
514 <<
" is not a valid output type for this statistics.");
520 NS_LOG_INFO(
this <<
" created probe " << probe->GetName() <<
", connected to collector "
525 NS_LOG_WARN(
this <<
" unable to connect probe " << probe->GetName() <<
" to collector "
538 NS_ASSERT_MSG(collector !=
nullptr,
"Unable to find collector with identifier " << identifier);
544 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
545 NS_ASSERT(c !=
nullptr);
546 c->TraceSinkDouble(0.0, jitter.GetSeconds());
552 Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
553 NS_ASSERT(c !=
nullptr);
554 c->TraceSinkDouble(0.0, jitter.GetSeconds());
566 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
567 NS_ASSERT(c !=
nullptr);
568 c->TraceSinkDouble(0.0, jitter.GetSeconds());
572 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
573 NS_ASSERT(c !=
nullptr);
574 c->TraceSinkDouble(0.0, jitter.GetSeconds());
580 <<
" is not a valid output type for this statistics.");
594 NS_LOG_FUNCTION(
this << satHelper);
599 NS_LOG_FUNCTION(
this);
605 static TypeId tid = TypeId(
"ns3::SatStatsFwdAppJitterHelper").SetParent<
SatStatsJitterHelper>();
612 NS_LOG_FUNCTION(
this);
615 for (NodeContainer::Iterator it = utUsers.Begin(); it != utUsers.End(); ++it)
618 NS_ASSERT_MSG(utUserId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT user");
621 for (uint32_t i = 0; i < (*it)->GetNApplications(); i++)
623 Ptr<Application> app = (*it)->GetApplication(i);
624 bool isConnected =
false;
630 if (app->GetInstanceTypeId().LookupTraceSourceByName(
"RxJitter") !=
nullptr)
632 NS_LOG_INFO(
this <<
" attempt to connect using RxJitter");
635 std::ostringstream probeName;
636 probeName << utUserId <<
"-" << i;
637 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
638 probe->SetName(probeName.str());
641 if (probe->ConnectByObject(
"RxJitter", app))
644 m_probes.push_back(probe->GetObject<Probe>());
647 else if (app->GetInstanceTypeId().LookupTraceSourceByName(
"Rx") !=
nullptr)
649 NS_LOG_INFO(
this <<
" attempt to connect using Rx");
650 Callback<void, Ptr<const Packet>,
const Address&> rxCallback =
652 isConnected = app->TraceConnectWithoutContext(
"Rx", rxCallback);
657 NS_LOG_INFO(
this <<
" successfully connected"
658 <<
" with node ID " << (*it)->GetId() <<
" application #" << i);
667 NS_LOG_WARN(
this <<
" unable to connect"
668 <<
" with node ID " << (*it)->GetId() <<
" application #" << i);
680 for (NodeContainer::Iterator it = gwUsers.Begin(); it != gwUsers.End(); ++it)
682 for (uint32_t i = 0; i < (*it)->GetNApplications(); i++)
684 Ptr<Application> app = (*it)->GetApplication(i);
686 if (!app->SetAttributeFailSafe(
"EnableStatisticsTags", BooleanValue(
true)))
688 NS_LOG_WARN(
this <<
" node ID " << (*it)->GetId() <<
" application #" << i
689 <<
" might not produce the required tags"
690 <<
" in the packets it transmits,"
691 <<
" thus preventing jitter statistics"
692 <<
" from this application");
704 NS_LOG_FUNCTION(identifier);
706 Time delay = Seconds(0);
719 Ptr<const Packet> packet,
722 NS_LOG_FUNCTION(helper << identifier << packet << packet->GetSize() << from);
724 TrafficTimeTag timeTag;
725 if (packet->PeekPacketTag(timeTag))
727 NS_LOG_DEBUG(
"Contains a TrafficTimeTag tag");
728 const Time delay = Simulator::Now() - timeTag.GetSenderTimestamp();
729 Time previousDelay = helper->GetAndUpdatePreviousDelay(identifier, delay);
730 if (previousDelay.IsZero() ==
false)
732 Time jitter = Abs(delay - previousDelay);
733 helper->PassSampleToCollector(jitter, identifier);
738 NS_LOG_WARN(
"Discarding a packet of " << packet->GetSize() <<
" from statistics collection"
739 <<
" because it does not contain any TrafficTimeTag");
750 NS_LOG_FUNCTION(
this << satHelper);
755 NS_LOG_FUNCTION(
this);
761 static TypeId tid = TypeId(
"ns3::SatStatsFwdDevJitterHelper").SetParent<
SatStatsJitterHelper>();
768 NS_LOG_FUNCTION(
this);
769 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
771 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
773 const int32_t utId =
GetUtId(*it);
774 NS_ASSERT_MSG(utId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT");
778 std::ostringstream probeName;
780 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
781 probe->SetName(probeName.str());
788 m_probes.push_back(probe->GetObject<Probe>());
791 dev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
795 NS_FATAL_ERROR(
"Error connecting to RxJitter trace source of SatNetDevice"
796 <<
" at node ID " << (*it)->GetId() <<
" device #2");
802 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
803 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
807 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
809 NS_ASSERT((*itDev)->GetObject<
SatNetDevice>() !=
nullptr);
810 (*itDev)->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
823 NS_LOG_FUNCTION(
this << satHelper);
828 NS_LOG_FUNCTION(
this);
834 static TypeId tid = TypeId(
"ns3::SatStatsFwdMacJitterHelper").SetParent<
SatStatsJitterHelper>();
841 NS_LOG_FUNCTION(
this);
842 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
844 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
846 const int32_t utId =
GetUtId(*it);
847 NS_ASSERT_MSG(utId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT");
851 std::ostringstream probeName;
853 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
854 probe->SetName(probeName.str());
857 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
858 NS_ASSERT(satDev !=
nullptr);
859 Ptr<SatMac> satMac = satDev->GetMac();
860 NS_ASSERT(satMac !=
nullptr);
863 if (probe->ConnectByObject(
"RxJitter", satMac) &&
866 m_probes.push_back(probe->GetObject<Probe>());
869 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
870 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
874 NS_FATAL_ERROR(
"Error connecting to RxJitter trace source of satMac"
875 <<
" at node ID " << (*it)->GetId() <<
" device #2");
881 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
882 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
886 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
888 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
889 NS_ASSERT(satDev !=
nullptr);
890 Ptr<SatMac> satMac = satDev->GetMac();
891 NS_ASSERT(satMac !=
nullptr);
893 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
894 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
907 NS_LOG_FUNCTION(
this << satHelper);
912 NS_LOG_FUNCTION(
this);
918 static TypeId tid = TypeId(
"ns3::SatStatsFwdPhyJitterHelper").SetParent<
SatStatsJitterHelper>();
925 NS_LOG_FUNCTION(
this);
927 NodeContainer sats =
GetSatHelper()->GetBeamHelper()->GetGeoSatNodes();
929 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
933 NS_ASSERT(satGeoDev !=
nullptr);
934 std::map<uint32_t, Ptr<SatPhy>> satGeoFeederPhys = satGeoDev->GetFeederPhy();
936 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoFeederPhys.begin();
937 it2 != satGeoFeederPhys.end();
940 satPhy = it2->second;
941 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
943 std::map<uint32_t, Ptr<SatPhy>> satGeoUserPhys = satGeoDev->GetUserPhy();
944 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoUserPhys.begin();
945 it2 != satGeoUserPhys.end();
948 satPhy = it2->second;
949 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
953 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
955 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
957 const int32_t utId =
GetUtId(*it);
958 NS_ASSERT_MSG(utId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT");
962 std::ostringstream probeName;
964 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
965 probe->SetName(probeName.str());
968 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
969 NS_ASSERT(satDev !=
nullptr);
970 Ptr<SatPhy> satPhy = satDev->GetPhy();
971 NS_ASSERT(satPhy !=
nullptr);
974 if (probe->ConnectByObject(
"RxJitter", satPhy) &&
977 m_probes.push_back(probe->GetObject<Probe>());
980 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
981 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
985 NS_FATAL_ERROR(
"Error connecting to RxJitter trace source of SatPhy"
986 <<
" at node ID " << (*it)->GetId() <<
" device #2");
992 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
993 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
997 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
999 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
1000 NS_ASSERT(satDev !=
nullptr);
1001 Ptr<SatPhy> satPhy = satDev->GetPhy();
1002 NS_ASSERT(satPhy !=
nullptr);
1004 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1005 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1018 NS_LOG_FUNCTION(
this << satHelper);
1023 NS_LOG_FUNCTION(
this);
1029 static TypeId tid = TypeId(
"ns3::SatStatsRtnAppJitterHelper").SetParent<
SatStatsJitterHelper>();
1036 NS_LOG_FUNCTION(
this);
1039 for (NodeContainer::Iterator it = utUsers.Begin(); it != utUsers.End(); ++it)
1048 for (uint32_t i = 0; i < (*it)->GetNApplications(); i++)
1050 Ptr<Application> app = (*it)->GetApplication(i);
1052 if (!app->SetAttributeFailSafe(
"EnableStatisticsTags", BooleanValue(
true)))
1054 NS_LOG_WARN(
this <<
" node ID " << (*it)->GetId() <<
" application #" << i
1055 <<
" might not produce the required tags"
1056 <<
" in the transmitted packets,"
1057 <<
" thus preventing jitter statistics"
1058 <<
" from this sender application");
1068 Callback<void, const Time&, const Address&> rxJitterCallback =
1070 Callback<void, Ptr<const Packet>,
const Address&> rxCallback =
1073 for (NodeContainer::Iterator it = gwUsers.Begin(); it != gwUsers.End(); ++it)
1075 for (uint32_t i = 0; i < (*it)->GetNApplications(); i++)
1077 Ptr<Application> app = (*it)->GetApplication(i);
1078 bool isConnected =
false;
1084 if (app->GetInstanceTypeId().LookupTraceSourceByName(
"RxJitter") !=
nullptr)
1086 isConnected = app->TraceConnectWithoutContext(
"RxJitter", rxJitterCallback);
1088 else if (app->GetInstanceTypeId().LookupTraceSourceByName(
"Rx") !=
nullptr)
1090 isConnected = app->TraceConnectWithoutContext(
"Rx", rxCallback);
1095 NS_LOG_INFO(
this <<
" successfully connected"
1096 <<
" with node ID " << (*it)->GetId() <<
" application #" << i);
1105 NS_LOG_WARN(
this <<
" unable to connect"
1106 <<
" with node ID " << (*it)->GetId() <<
" application #" << i);
1118 TrafficTimeTag timeTag;
1119 if (packet->PeekPacketTag(timeTag))
1121 NS_LOG_DEBUG(
this <<
" contains a TrafficTimeTag tag");
1122 const Time delay = Simulator::Now() - timeTag.GetSenderTimestamp();
1123 const Address identifier = InetSocketAddress::ConvertFrom(from).GetIpv4();
1127 Time previousDelay = it->second;
1128 Time jitter = Abs(delay - previousDelay);
1135 NS_LOG_WARN(
this <<
" discarding a packet of " << packet->GetSize()
1136 <<
" from statistics collection"
1137 <<
" because it does not contain any TrafficTimeTag");
1146 if (InetSocketAddress::IsMatchingType(from))
1149 const Address ipv4Addr = InetSocketAddress::ConvertFrom(from).GetIpv4();
1150 std::map<const Address, uint32_t>::const_iterator it1 =
m_identifierMap.find(ipv4Addr);
1154 NS_LOG_WARN(
this <<
" discarding a packet jitter of " << jitter.GetSeconds()
1155 <<
" from statistics collection because of"
1156 <<
" unknown sender IPV4 address " << ipv4Addr);
1165 NS_LOG_WARN(
this <<
" discarding a packet jitter of " << jitter.GetSeconds()
1166 <<
" from statistics collection"
1167 <<
" because it comes from sender " << from
1168 <<
" without valid InetSocketAddress");
1175 NS_LOG_FUNCTION(
this << utUserNode->GetId());
1177 Ptr<Ipv4> ipv4 = utUserNode->GetObject<Ipv4>();
1179 if (ipv4 ==
nullptr)
1181 NS_LOG_INFO(
this <<
" Node " << utUserNode->GetId() <<
" does not support IPv4 protocol");
1183 else if (ipv4->GetNInterfaces() >= 2)
1191 for (uint32_t i = 0; i < ipv4->GetNAddresses(1); i++)
1193 const Address addr = ipv4->GetAddress(1, i).GetLocal();
1195 NS_LOG_INFO(
this <<
" associated address " << addr <<
" with identifier "
1201 NS_LOG_WARN(
this <<
" Node " << utUserNode->GetId() <<
" is not a valid UT user");
1212 NS_LOG_FUNCTION(
this << satHelper);
1217 NS_LOG_FUNCTION(
this);
1223 static TypeId tid = TypeId(
"ns3::SatStatsRtnDevJitterHelper").SetParent<
SatStatsJitterHelper>();
1230 NS_LOG_FUNCTION(
this);
1232 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
1233 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1240 dev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1245 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1246 Callback<void, const Time&, const Address&> callback =
1249 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1253 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1255 NS_ASSERT((*itDev)->GetObject<
SatNetDevice>() !=
nullptr);
1257 if ((*itDev)->TraceConnectWithoutContext(
"RxJitter", callback))
1259 NS_LOG_INFO(
this <<
" successfully connected with node ID " << (*it)->GetId()
1260 <<
" device #" << (*itDev)->GetIfIndex());
1263 (*itDev)->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1267 NS_FATAL_ERROR(
"Error connecting to RxJitter trace source of SatNetDevice"
1268 <<
" at node ID " << (*it)->GetId() <<
" device #"
1269 << (*itDev)->GetIfIndex());
1285 NS_LOG_FUNCTION(
this << satHelper);
1290 NS_LOG_FUNCTION(
this);
1296 static TypeId tid = TypeId(
"ns3::SatStatsRtnMacJitterHelper").SetParent<
SatStatsJitterHelper>();
1303 NS_LOG_FUNCTION(
this);
1305 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
1306 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1313 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
1314 NS_ASSERT(satDev !=
nullptr);
1315 Ptr<SatMac> satMac = satDev->GetMac();
1316 NS_ASSERT(satMac !=
nullptr);
1317 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1318 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1323 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1324 Callback<void, const Time&, const Address&> callback =
1327 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1331 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1333 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
1334 NS_ASSERT(satDev !=
nullptr);
1335 Ptr<SatMac> satMac = satDev->GetMac();
1336 NS_ASSERT(satMac !=
nullptr);
1339 if (satMac->TraceConnectWithoutContext(
"RxJitter", callback))
1341 NS_LOG_INFO(
this <<
" successfully connected with node ID " << (*it)->GetId()
1342 <<
" device #" << satDev->GetIfIndex());
1345 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1346 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1350 NS_FATAL_ERROR(
"Error connecting to RxJitter trace source of SatNetDevice"
1351 <<
" at node ID " << (*it)->GetId() <<
" device #"
1352 << satDev->GetIfIndex());
1368 NS_LOG_FUNCTION(
this << satHelper);
1373 NS_LOG_FUNCTION(
this);
1379 static TypeId tid = TypeId(
"ns3::SatStatsRtnPhyJitterHelper").SetParent<
SatStatsJitterHelper>();
1386 NS_LOG_FUNCTION(
this);
1388 NodeContainer sats =
GetSatHelper()->GetBeamHelper()->GetGeoSatNodes();
1390 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1394 NS_ASSERT(satGeoDev !=
nullptr);
1395 std::map<uint32_t, Ptr<SatPhy>> satGeoFeederPhys = satGeoDev->GetFeederPhy();
1397 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoFeederPhys.begin();
1398 it2 != satGeoFeederPhys.end();
1401 satPhy = it2->second;
1402 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1404 std::map<uint32_t, Ptr<SatPhy>> satGeoUserPhys = satGeoDev->GetUserPhy();
1405 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoUserPhys.begin();
1406 it2 != satGeoUserPhys.end();
1409 satPhy = it2->second;
1410 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1414 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
1415 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1422 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
1423 NS_ASSERT(satDev !=
nullptr);
1424 Ptr<SatPhy> satPhy = satDev->GetPhy();
1425 NS_ASSERT(satPhy !=
nullptr);
1426 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1427 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1432 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1433 Callback<void, const Time&, const Address&> callback =
1436 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1440 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1442 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
1443 NS_ASSERT(satDev !=
nullptr);
1444 Ptr<SatPhy> satPhy = satDev->GetPhy();
1445 NS_ASSERT(satPhy !=
nullptr);
1448 if (satPhy->TraceConnectWithoutContext(
"RxJitter", callback))
1450 NS_LOG_INFO(
this <<
" successfully connected with node ID " << (*it)->GetId()
1451 <<
" device #" << satDev->GetIfIndex());
1454 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1455 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1459 NS_FATAL_ERROR(
"Error connecting to RxJitter trace source of SatNetDevice"
1460 <<
" at node ID " << (*it)->GetId() <<
" device #"
1461 << satDev->GetIfIndex());
SatGeoNetDevice to be utilized in geostationary satellite.
Address GetUtMacWithNode(Ptr< Node > utNode) const
SatNetDevice to be utilized in the UT and GW nodes.
Time GetAndUpdatePreviousDelay(uint32_t identifier, Time newDelay)
Returns the previous delay mesurment for given identifier, and update with new value measured.
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
std::map< uint32_t, Time > m_previousDelayMap
Stores the last delay to a UT to compute jitter.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsFwdAppJitterHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsFwdAppJitterHelper()
Destructor for SatStatsFwdAppJitterHelper.
static void RxCallback(Ptr< SatStatsFwdAppJitterHelper > helper, uint32_t identifier, Ptr< const Packet > packet, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsFwdDevJitterHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsFwdDevJitterHelper()
/ Destructor.
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
virtual ~SatStatsFwdMacJitterHelper()
/ Destructor.
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
SatStatsFwdMacJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsFwdPhyJitterHelper(Ptr< const SatHelper > satHelper)
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
virtual ~SatStatsFwdPhyJitterHelper()
/ Destructor.
Parent abstract class of all satellite statistics helpers.
Ptr< const SatHelper > GetSatHelper() const
uint32_t GetIdentifierForUtUser(Ptr< Node > utUserNode) const
static NetDeviceContainer GetGwSatNetDevice(Ptr< Node > gwNode)
static std::string GetOutputTypeName(OutputType_t outputType)
static Ptr< NetDevice > GetSatSatGeoNetDevice(Ptr< Node > satNode)
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
uint32_t GetUtUserId(Ptr< Node > utUserNode) const
std::string GetName() const
virtual std::string GetTimeHeading(std::string dataLabel) const
virtual std::string GetDistributionHeading(std::string dataLabel) const
Base class for jitter statistics helpers.
bool m_averagingMode
AveragingMode attribute.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsJitterHelper(Ptr< const SatHelper > satHelper)
void RxJitterCallback(const Time &jitter, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
void PassSampleToCollector(const Time &jitter, uint32_t identifier)
Find a collector with the right identifier and pass a sample data to it.
bool ConnectProbeToCollector(Ptr< Probe > probe, uint32_t identifier)
Connect the probe to the right collector.
Ptr< DataCollectionObject > m_aggregator
The aggregator created by this helper.
std::map< const Address, uint32_t > m_identifierMap
Map of address and the identifier associated with it (for return link).
void SaveAddressAndIdentifier(Ptr< Node > utNode)
Save the address and the proper identifier from the given UT node.
virtual void DoInstallProbes()=0
void SetAveragingMode(bool averagingMode)
CollectorMap m_terminalCollectors
Maintains a list of collectors created by this helper.
virtual ~SatStatsJitterHelper()
/ Destructor.
bool GetAveragingMode() const
void DoInstall()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
void InstallProbes()
Set up several probes or other means of listeners and connect them to the collectors.
Ptr< DistributionCollector > m_averagingCollector
The final collector utilized in averaged output (histogram, PDF, and CDF).
void SaveIpv4AddressAndIdentifier(Ptr< Node > utUserNode)
Save the IPv4 address and the proper identifier from the given UT user node.
static TypeId GetTypeId()
inherited from ObjectBase base class
std::map< const Address, Time > m_previousDelayMap
Stores the last delay to a UT to compute jitter.
virtual ~SatStatsRtnAppJitterHelper()
/ Destructor.
void RxCallback(Ptr< const Packet > packet, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
SatStatsRtnAppJitterHelper(Ptr< const SatHelper > satHelper)
void Ipv4Callback(const Time &jitter, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
SatStatsRtnDevJitterHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsRtnDevJitterHelper()
/ Destructor.
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsRtnMacJitterHelper()
/ Destructor.
SatStatsRtnMacJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsRtnPhyJitterHelper()
/ Destructor.
SatStatsRtnPhyJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.