24 #include <ns3/data-collection-object.h>
25 #include <ns3/fatal-error.h>
27 #include <ns3/multi-file-aggregator.h>
28 #include <ns3/satellite-beam-helper.h>
29 #include <ns3/satellite-beam-scheduler.h>
30 #include <ns3/satellite-helper.h>
31 #include <ns3/satellite-ncc.h>
32 #include <ns3/string.h>
39 NS_LOG_COMPONENT_DEFINE(
"SatStatsBackloggedRequestHelper");
44 NS_OBJECT_ENSURE_REGISTERED(SatStatsBackloggedRequestHelper);
49 NS_LOG_FUNCTION(
this << satHelper);
54 NS_LOG_FUNCTION(
this);
60 static TypeId tid = TypeId(
"ns3::SatStatsBackloggedRequestHelper").SetParent<
SatStatsHelper>();
67 NS_LOG_FUNCTION(
this);
72 <<
" is not a valid output type for this statistics.");
79 <<
" is not a valid identifier type for this statistics.");
87 StringValue(
"% time_sec, beam_id, ut_id, type, requests"));
88 Ptr<MultiFileAggregator> multiFileAggregator =
m_aggregator->GetObject<MultiFileAggregator>();
89 NS_ASSERT(multiFileAggregator !=
nullptr);
90 Callback<void, std::string, std::string> aggregatorSink =
91 MakeCallback(&MultiFileAggregator::WriteString, multiFileAggregator);
94 Ptr<SatBeamHelper> beamHelper =
GetSatHelper()->GetBeamHelper();
95 NS_ASSERT(beamHelper !=
nullptr);
96 Ptr<SatNcc> ncc = beamHelper->GetNcc();
97 NS_ASSERT(ncc !=
nullptr);
98 std::list<std::pair<uint32_t, uint32_t>> beams = beamHelper->GetBeams();
100 for (std::list<std::pair<uint32_t, uint32_t>>::const_iterator it = beams.begin();
104 std::ostringstream context;
117 NS_FATAL_ERROR(
"SatStatsBackloggedRequestHelper - Invalid identifier type");
121 Ptr<SatBeamScheduler> s = ncc->GetBeamScheduler(it->first, it->second);
122 NS_ASSERT_MSG(s !=
nullptr,
"Error finding beam " << it->second);
123 const bool ret = s->TraceConnect(
"BacklogRequestsTrace", context.str(), aggregatorSink);
124 NS_ASSERT_MSG(ret,
"Error connecting to BacklogRequestsTrace of beam " << it->second);
125 NS_LOG_INFO(
this <<
" successfully connected"
126 <<
" with beam " << it->second);
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsBackloggedRequestHelper()
/ Destructor.
Ptr< DataCollectionObject > m_aggregator
The aggregator created by this helper.
SatStatsBackloggedRequestHelper(Ptr< const SatHelper > satHelper)
void DoInstall()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
Parent abstract class of all satellite statistics helpers.
uint32_t GetIdentifierForBeam(uint32_t satId, uint32_t beamId) const
Ptr< const SatHelper > GetSatHelper() const
IdentifierType_t GetIdentifierType() const
static std::string GetOutputTypeName(OutputType_t outputType)
static std::string GetIdentifierTypeName(IdentifierType_t identifierType)
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.
OutputType_t GetOutputType() const
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.