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(
"SatStatsDelayHelper");
61 NS_OBJECT_ENSURE_REGISTERED(SatStatsDelayHelper);
65 m_averagingMode(false)
67 NS_LOG_FUNCTION(
this << satHelper);
72 NS_LOG_FUNCTION(
this);
79 TypeId(
"ns3::SatStatsDelayHelper")
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 delay (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 delay (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 delay (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(
"SatStatsDelayHelper - Invalid output type");
422 if (from.IsInvalid())
424 NS_LOG_WARN(
this <<
" discarding a packet delay of " << delay.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 delay of " << delay.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, delay.GetSeconds());
552 Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
553 NS_ASSERT(c !=
nullptr);
554 c->TraceSinkDouble(0.0, delay.GetSeconds());
566 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
567 NS_ASSERT(c !=
nullptr);
568 c->TraceSinkDouble(0.0, delay.GetSeconds());
572 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
573 NS_ASSERT(c !=
nullptr);
574 c->TraceSinkDouble(0.0, delay.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::SatStatsFwdAppDelayHelper").SetParent<
SatStatsDelayHelper>();
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(
"RxDelay") !=
nullptr)
632 NS_LOG_INFO(
this <<
" attempt to connect using RxDelay");
635 std::ostringstream probeName;
636 probeName << utUserId <<
"-" << i;
637 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
638 probe->SetName(probeName.str());
641 if (probe->ConnectByObject(
"RxDelay", 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 delay statistics"
692 <<
" from this application");
704 Ptr<const Packet> packet,
707 NS_LOG_FUNCTION(helper << identifier << packet << packet->GetSize() << from);
736 TrafficTimeTag timeTag;
737 if (packet->PeekPacketTag(timeTag))
739 NS_LOG_DEBUG(
"Contains a TrafficTimeTag tag");
740 const Time delay = Simulator::Now() - timeTag.GetSenderTimestamp();
741 helper->PassSampleToCollector(delay, identifier);
745 NS_LOG_WARN(
"Discarding a packet of " << packet->GetSize() <<
" from statistics collection"
746 <<
" because it does not contain any TrafficTimeTag");
757 NS_LOG_FUNCTION(
this << satHelper);
762 NS_LOG_FUNCTION(
this);
768 static TypeId tid = TypeId(
"ns3::SatStatsFwdDevDelayHelper").SetParent<
SatStatsDelayHelper>();
775 NS_LOG_FUNCTION(
this);
776 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
778 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
780 const int32_t utId =
GetUtId(*it);
781 NS_ASSERT_MSG(utId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT");
785 std::ostringstream probeName;
787 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
788 probe->SetName(probeName.str());
795 m_probes.push_back(probe->GetObject<Probe>());
798 dev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
802 NS_FATAL_ERROR(
"Error connecting to RxDelay trace source of SatNetDevice"
803 <<
" at node ID " << (*it)->GetId() <<
" device #2");
809 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
810 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
814 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
816 NS_ASSERT((*itDev)->GetObject<
SatNetDevice>() !=
nullptr);
817 (*itDev)->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
830 NS_LOG_FUNCTION(
this << satHelper);
835 NS_LOG_FUNCTION(
this);
841 static TypeId tid = TypeId(
"ns3::SatStatsFwdMacDelayHelper").SetParent<
SatStatsDelayHelper>();
848 NS_LOG_FUNCTION(
this);
849 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
851 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
853 const int32_t utId =
GetUtId(*it);
854 NS_ASSERT_MSG(utId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT");
858 std::ostringstream probeName;
860 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
861 probe->SetName(probeName.str());
864 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
865 NS_ASSERT(satDev !=
nullptr);
866 Ptr<SatMac> satMac = satDev->GetMac();
867 NS_ASSERT(satMac !=
nullptr);
872 m_probes.push_back(probe->GetObject<Probe>());
875 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
876 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
880 NS_FATAL_ERROR(
"Error connecting to RxDelay trace source of satMac"
881 <<
" at node ID " << (*it)->GetId() <<
" device #2");
887 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
888 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
892 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
894 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
895 NS_ASSERT(satDev !=
nullptr);
896 Ptr<SatMac> satMac = satDev->GetMac();
897 NS_ASSERT(satMac !=
nullptr);
899 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
900 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
913 NS_LOG_FUNCTION(
this << satHelper);
918 NS_LOG_FUNCTION(
this);
924 static TypeId tid = TypeId(
"ns3::SatStatsFwdPhyDelayHelper").SetParent<
SatStatsDelayHelper>();
931 NS_LOG_FUNCTION(
this);
933 NodeContainer sats =
GetSatHelper()->GetBeamHelper()->GetGeoSatNodes();
935 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
939 NS_ASSERT(satGeoDev !=
nullptr);
940 std::map<uint32_t, Ptr<SatPhy>> satGeoFeederPhys = satGeoDev->GetFeederPhy();
942 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoFeederPhys.begin();
943 it2 != satGeoFeederPhys.end();
946 satPhy = it2->second;
947 NS_ASSERT(satPhy !=
nullptr);
948 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
950 std::map<uint32_t, Ptr<SatPhy>> satGeoUserPhys = satGeoDev->GetUserPhy();
951 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoUserPhys.begin();
952 it2 != satGeoUserPhys.end();
955 satPhy = it2->second;
956 NS_ASSERT(satPhy !=
nullptr);
957 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
961 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
963 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
965 const int32_t utId =
GetUtId(*it);
966 NS_ASSERT_MSG(utId > 0,
"Node " << (*it)->GetId() <<
" is not a valid UT");
970 std::ostringstream probeName;
972 Ptr<ApplicationDelayProbe> probe = CreateObject<ApplicationDelayProbe>();
973 probe->SetName(probeName.str());
976 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
977 NS_ASSERT(satDev !=
nullptr);
978 Ptr<SatPhy> satPhy = satDev->GetPhy();
979 NS_ASSERT(satPhy !=
nullptr);
984 m_probes.push_back(probe->GetObject<Probe>());
987 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
988 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
992 NS_FATAL_ERROR(
"Error connecting to RxDelay trace source of SatPhy"
993 <<
" at node ID " << (*it)->GetId() <<
" device #2");
999 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1000 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1004 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1006 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
1007 NS_ASSERT(satDev !=
nullptr);
1008 Ptr<SatPhy> satPhy = satDev->GetPhy();
1009 NS_ASSERT(satPhy !=
nullptr);
1011 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1012 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1025 NS_LOG_FUNCTION(
this << satHelper);
1030 NS_LOG_FUNCTION(
this);
1036 static TypeId tid = TypeId(
"ns3::SatStatsRtnAppDelayHelper").SetParent<
SatStatsDelayHelper>();
1043 NS_LOG_FUNCTION(
this);
1046 for (NodeContainer::Iterator it = utUsers.Begin(); it != utUsers.End(); ++it)
1055 for (uint32_t i = 0; i < (*it)->GetNApplications(); i++)
1057 Ptr<Application> app = (*it)->GetApplication(i);
1059 if (!app->SetAttributeFailSafe(
"EnableStatisticsTags", BooleanValue(
true)))
1061 NS_LOG_WARN(
this <<
" node ID " << (*it)->GetId() <<
" application #" << i
1062 <<
" might not produce the required tags"
1063 <<
" in the transmitted packets,"
1064 <<
" thus preventing delay statistics"
1065 <<
" from this sender application");
1075 Callback<void, const Time&, const Address&> rxDelayCallback =
1077 Callback<void, Ptr<const Packet>,
const Address&> rxCallback =
1080 for (NodeContainer::Iterator it = gwUsers.Begin(); it != gwUsers.End(); ++it)
1082 for (uint32_t i = 0; i < (*it)->GetNApplications(); i++)
1084 Ptr<Application> app = (*it)->GetApplication(i);
1085 bool isConnected =
false;
1091 if (app->GetInstanceTypeId().LookupTraceSourceByName(
"RxDelay") !=
nullptr)
1093 isConnected = app->TraceConnectWithoutContext(
"RxDelay", rxDelayCallback);
1095 else if (app->GetInstanceTypeId().LookupTraceSourceByName(
"Rx") !=
nullptr)
1097 isConnected = app->TraceConnectWithoutContext(
"Rx", rxCallback);
1102 NS_LOG_INFO(
this <<
" successfully connected"
1103 <<
" with node ID " << (*it)->GetId() <<
" application #" << i);
1112 NS_LOG_WARN(
this <<
" unable to connect"
1113 <<
" with node ID " << (*it)->GetId() <<
" application #" << i);
1154 TrafficTimeTag timeTag;
1155 if (packet->PeekPacketTag(timeTag))
1157 NS_LOG_DEBUG(
this <<
" contains a TrafficTimeTag tag");
1158 Ipv4Callback(Simulator::Now() - timeTag.GetSenderTimestamp(), from);
1162 NS_LOG_WARN(
this <<
" discarding a packet of " << packet->GetSize()
1163 <<
" from statistics collection"
1164 <<
" because it does not contain any TrafficTimeTag");
1174 if (InetSocketAddress::IsMatchingType(from))
1177 const Address ipv4Addr = InetSocketAddress::ConvertFrom(from).GetIpv4();
1178 std::map<const Address, uint32_t>::const_iterator it1 =
m_identifierMap.find(ipv4Addr);
1182 NS_LOG_WARN(
this <<
" discarding a packet delay of " << delay.GetSeconds()
1183 <<
" from statistics collection because of"
1184 <<
" unknown sender IPV4 address " << ipv4Addr);
1193 NS_LOG_WARN(
this <<
" discarding a packet delay of " << delay.GetSeconds()
1194 <<
" from statistics collection"
1195 <<
" because it comes from sender " << from
1196 <<
" without valid InetSocketAddress");
1203 NS_LOG_FUNCTION(
this << utUserNode->GetId());
1205 Ptr<Ipv4> ipv4 = utUserNode->GetObject<Ipv4>();
1207 if (ipv4 ==
nullptr)
1209 NS_LOG_INFO(
this <<
" Node " << utUserNode->GetId() <<
" does not support IPv4 protocol");
1211 else if (ipv4->GetNInterfaces() >= 2)
1219 for (uint32_t i = 0; i < ipv4->GetNAddresses(1); i++)
1221 const Address addr = ipv4->GetAddress(1, i).GetLocal();
1223 NS_LOG_INFO(
this <<
" associated address " << addr <<
" with identifier "
1229 NS_LOG_WARN(
this <<
" Node " << utUserNode->GetId() <<
" is not a valid UT user");
1240 NS_LOG_FUNCTION(
this << satHelper);
1245 NS_LOG_FUNCTION(
this);
1251 static TypeId tid = TypeId(
"ns3::SatStatsRtnDevDelayHelper").SetParent<
SatStatsDelayHelper>();
1258 NS_LOG_FUNCTION(
this);
1260 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
1261 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1268 dev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1273 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1274 Callback<void, const Time&, const Address&> callback =
1277 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1281 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1283 NS_ASSERT((*itDev)->GetObject<
SatNetDevice>() !=
nullptr);
1285 if ((*itDev)->TraceConnectWithoutContext(
"RxDelay", callback))
1287 NS_LOG_INFO(
this <<
" successfully connected with node ID " << (*it)->GetId()
1288 <<
" device #" << (*itDev)->GetIfIndex());
1291 (*itDev)->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1295 NS_FATAL_ERROR(
"Error connecting to RxDelay trace source of SatNetDevice"
1296 <<
" at node ID " << (*it)->GetId() <<
" device #"
1297 << (*itDev)->GetIfIndex());
1313 NS_LOG_FUNCTION(
this << satHelper);
1318 NS_LOG_FUNCTION(
this);
1324 static TypeId tid = TypeId(
"ns3::SatStatsRtnMacDelayHelper").SetParent<
SatStatsDelayHelper>();
1331 NS_LOG_FUNCTION(
this);
1333 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
1334 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1341 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
1342 NS_ASSERT(satDev !=
nullptr);
1343 Ptr<SatMac> satMac = satDev->GetMac();
1344 NS_ASSERT(satMac !=
nullptr);
1345 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1346 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1351 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1352 Callback<void, const Time&, const Address&> callback =
1355 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1359 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1361 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
1362 NS_ASSERT(satDev !=
nullptr);
1363 Ptr<SatMac> satMac = satDev->GetMac();
1364 NS_ASSERT(satMac !=
nullptr);
1367 if (satMac->TraceConnectWithoutContext(
"RxDelay", callback))
1369 NS_LOG_INFO(
this <<
" successfully connected with node ID " << (*it)->GetId()
1370 <<
" device #" << satDev->GetIfIndex());
1373 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1374 satMac->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1378 NS_FATAL_ERROR(
"Error connecting to RxDelay trace source of SatNetDevice"
1379 <<
" at node ID " << (*it)->GetId() <<
" device #"
1380 << satDev->GetIfIndex());
1396 NS_LOG_FUNCTION(
this << satHelper);
1401 NS_LOG_FUNCTION(
this);
1407 static TypeId tid = TypeId(
"ns3::SatStatsRtnPhyDelayHelper").SetParent<
SatStatsDelayHelper>();
1414 NS_LOG_FUNCTION(
this);
1416 NodeContainer sats =
GetSatHelper()->GetBeamHelper()->GetGeoSatNodes();
1418 for (NodeContainer::Iterator it = sats.Begin(); it != sats.End(); ++it)
1423 NS_ASSERT(satGeoDev !=
nullptr);
1424 std::map<uint32_t, Ptr<SatPhy>> satGeoFeederPhys = satGeoDev->GetFeederPhy();
1425 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoFeederPhys.begin();
1426 it2 != satGeoFeederPhys.end();
1429 satPhy = it2->second;
1430 NS_ASSERT(satPhy !=
nullptr);
1431 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1433 std::map<uint32_t, Ptr<SatPhy>> satGeoUserPhys = satGeoDev->GetUserPhy();
1434 for (std::map<uint32_t, Ptr<SatPhy>>::iterator it2 = satGeoUserPhys.begin();
1435 it2 != satGeoUserPhys.end();
1438 satPhy = it2->second;
1439 NS_ASSERT(satPhy !=
nullptr);
1440 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1444 NodeContainer uts =
GetSatHelper()->GetBeamHelper()->GetUtNodes();
1445 for (NodeContainer::Iterator it = uts.Begin(); it != uts.End(); ++it)
1452 Ptr<SatNetDevice> satDev = dev->GetObject<
SatNetDevice>();
1453 NS_ASSERT(satDev !=
nullptr);
1454 Ptr<SatPhy> satPhy = satDev->GetPhy();
1455 NS_ASSERT(satPhy !=
nullptr);
1456 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1457 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1462 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
1463 Callback<void, const Time&, const Address&> callback =
1466 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
1470 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
1472 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
1473 NS_ASSERT(satDev !=
nullptr);
1474 Ptr<SatPhy> satPhy = satDev->GetPhy();
1475 NS_ASSERT(satPhy !=
nullptr);
1478 if (satPhy->TraceConnectWithoutContext(
"RxDelay", callback))
1480 NS_LOG_INFO(
this <<
" successfully connected with node ID " << (*it)->GetId()
1481 <<
" device #" << satDev->GetIfIndex());
1484 satDev->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1485 satPhy->SetAttribute(
"EnableStatisticsTags", BooleanValue(
true));
1489 NS_FATAL_ERROR(
"Error connecting to RxDelay trace source of SatNetDevice"
1490 <<
" at node ID " << (*it)->GetId() <<
" device #"
1491 << 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.
Base class for delay statistics helpers.
CollectorMap m_terminalCollectors
Maintains a list of collectors created by this helper.
void InstallProbes()
Set up several probes or other means of listeners and connect them to the collectors.
void SetAveragingMode(bool averagingMode)
void DoInstall()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
void RxDelayCallback(const Time &delay, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
virtual void DoInstallProbes()=0
void PassSampleToCollector(const Time &delay, uint32_t identifier)
Find a collector with the right identifier and pass a sample data to it.
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).
static TypeId GetTypeId()
inherited from ObjectBase base class
void SaveAddressAndIdentifier(Ptr< Node > utNode)
Save the address and the proper identifier from the given UT node.
bool m_averagingMode
AveragingMode attribute.
Ptr< DistributionCollector > m_averagingCollector
The final collector utilized in averaged output (histogram, PDF, and CDF).
SatStatsDelayHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsDelayHelper()
/ Destructor.
bool GetAveragingMode() const
bool ConnectProbeToCollector(Ptr< Probe > probe, uint32_t identifier)
Connect the probe to the right collector.
Produce forward link application-level delay statistics from a satellite module simulation.
static TypeId GetTypeId()
inherited from ObjectBase base class
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
static void RxCallback(Ptr< SatStatsFwdAppDelayHelper > 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.
SatStatsFwdAppDelayHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsFwdAppDelayHelper()
Destructor for SatStatsFwdAppDelayHelper.
Produce forward link device-level delay statistics from a satellite module simulation.
SatStatsFwdDevDelayHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
virtual ~SatStatsFwdDevDelayHelper()
/ Destructor.
Produce forward link MAC-level delay statistics from a satellite module simulation.
SatStatsFwdMacDelayHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
virtual ~SatStatsFwdMacDelayHelper()
/ Destructor.
Produce forward link PHY-level delay statistics from a satellite module simulation.
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsFwdPhyDelayHelper()
/ Destructor.
SatStatsFwdPhyDelayHelper(Ptr< const SatHelper > satHelper)
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
Produce return link application-level delay statistics from a satellite module simulation.
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsRtnAppDelayHelper()
/ Destructor.
void Ipv4Callback(const Time &delay, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
void RxCallback(Ptr< const Packet > packet, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
SatStatsRtnAppDelayHelper(Ptr< const SatHelper > satHelper)
void SaveIpv4AddressAndIdentifier(Ptr< Node > utUserNode)
Save the IPv4 address and the proper identifier from the given UT user node.
Produce return link device-level delay statistics from a satellite module simulation.
SatStatsRtnDevDelayHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsRtnDevDelayHelper()
/ Destructor.
Produce return link MAC-level delay statistics from a satellite module simulation.
SatStatsRtnMacDelayHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsRtnMacDelayHelper()
/ Destructor.
Produce return link PHY-level delay statistics from a satellite module simulation.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsRtnPhyDelayHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsRtnPhyDelayHelper()
/ Destructor.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.