24 #include <ns3/boolean.h>
25 #include <ns3/data-collection-object.h>
26 #include <ns3/distribution-collector.h>
28 #include <ns3/interval-rate-collector.h>
30 #include <ns3/magister-gnuplot-aggregator.h>
31 #include <ns3/multi-file-aggregator.h>
32 #include <ns3/node-container.h>
33 #include <ns3/object-map.h>
34 #include <ns3/object-vector.h>
35 #include <ns3/pointer.h>
36 #include <ns3/satellite-fwd-link-scheduler.h>
37 #include <ns3/satellite-gw-mac.h>
38 #include <ns3/satellite-helper.h>
39 #include <ns3/satellite-mac.h>
40 #include <ns3/satellite-net-device.h>
41 #include <ns3/scalar-collector.h>
42 #include <ns3/string.h>
43 #include <ns3/unit-conversion-collector.h>
47 NS_LOG_COMPONENT_DEFINE(
"SatStatsFwdLinkSchedulerSymbolRateHelper");
52 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdLinkSchedulerSymbolRateHelper);
55 Ptr<const SatHelper> satHelper)
60 NS_LOG_FUNCTION(
this << satHelper);
65 NS_LOG_FUNCTION(
this);
72 TypeId(
"ns3::SatStatsFwdLinkSchedulerSymbolRateHelper").SetParent<
SatStatsHelper>();
79 NS_LOG_FUNCTION(
this << sliceId <<
" " << symbolRate);
81 Ptr<DataCollectionObject> collector = NULL;
87 NS_ASSERT_MSG(collector !=
nullptr,
"Unable to find collector with identifier 0");
91 collector =
m_collectors.Get(
static_cast<uint32_t
>(sliceId));
92 NS_ASSERT_MSG(collector !=
nullptr,
"Unable to find collector with identifier " << sliceId);
96 NS_FATAL_ERROR(
"SatStatsFwdLinkSchedulerSymbolRateHelper - Invalid identifier type");
104 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
105 NS_ASSERT(c !=
nullptr);
106 c->TraceSinkDouble(0.0, symbolRate);
112 Ptr<IntervalRateCollector> c = collector->GetObject<IntervalRateCollector>();
113 NS_ASSERT(c !=
nullptr);
114 c->TraceSinkDouble(0.0, symbolRate);
124 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
125 NS_ASSERT(c !=
nullptr);
126 c->TraceSinkDouble(0.0, symbolRate);
132 <<
" is not a valid output type for this statistics.");
139 Callback<void, uint8_t, double>
148 NS_LOG_FUNCTION(
this);
154 <<
" is not a valid output type for this statistics.");
164 "EnableContextPrinting",
168 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
173 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
175 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SECOND));
189 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
194 EnumValue(IntervalRateCollector::INPUT_DATA_TYPE_DOUBLE));
198 &MultiFileAggregator::Write2d);
201 &MultiFileAggregator::AddContextHeading);
215 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
219 DistributionCollector::OutputType_t outputType =
220 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
223 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
227 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
229 m_collectors.SetAttribute(
"OutputType", EnumValue(outputType));
234 &MultiFileAggregator::AddContextHeading);
237 &MultiFileAggregator::EnableContextWarning);
245 <<
" is not a valid output type for this statistics.");
255 Ptr<MagisterGnuplotAggregator> plotAggregator =
257 NS_ASSERT(plotAggregator !=
nullptr);
259 plotAggregator->SetLegend(
"Time (in seconds)",
"Latency (in seconds)");
260 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
265 EnumValue(IntervalRateCollector::INPUT_DATA_TYPE_DOUBLE));
269 const std::string context = it->second->GetName();
270 plotAggregator->Add2dDataset(context, context);
274 &MagisterGnuplotAggregator::Write2d);
288 Ptr<MagisterGnuplotAggregator> plotAggregator =
290 NS_ASSERT(plotAggregator !=
nullptr);
292 plotAggregator->SetLegend(
"Latency (in seconds)",
"Frequency");
293 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
297 DistributionCollector::OutputType_t outputType =
298 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
301 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
305 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
307 m_collectors.SetAttribute(
"OutputType", EnumValue(outputType));
311 const std::string context = it->second->GetName();
312 plotAggregator->Add2dDataset(context, context);
316 &MagisterGnuplotAggregator::Write2d);
322 NS_FATAL_ERROR(
"SatStatsFwdLinkSchedulerSymbolRateHelper - Invalid output type");
334 NS_LOG_FUNCTION(
this);
337 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
339 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
343 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
345 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
346 NS_ASSERT(satDev !=
nullptr);
347 Ptr<SatMac> satMac = satDev->GetMac();
348 NS_ASSERT(satMac !=
nullptr);
349 Ptr<SatGwMac> satGwMac = satMac->GetObject<
SatGwMac>();
350 NS_ASSERT(satGwMac !=
nullptr);
351 PointerValue scheduler;
352 satGwMac->GetAttribute(
"Scheduler", scheduler);
354 NS_ASSERT(fwdLinkScheduler !=
nullptr);
358 NS_FATAL_ERROR(
"Error connecting to Symbol Rate trace source"
359 <<
" of SatFwdLinkScheduler"
360 <<
" at node ID " << (*it)->GetId() <<
" device #"
361 << (*itDev)->GetIfIndex());
SatFwdLinkScheduler schedules BB frames for forward link.
GW specific Mac class for Sat Net Devices.
SatNetDevice to be utilized in the UT and GW nodes.
Helper for forward link scheduler symbol rate statistic.
CollectorMap m_collectors
Maintains a list of collectors created by this helper.
void DoInstall()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
SatStatsFwdLinkSchedulerSymbolRateHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
void InstallProbes()
Set up several probes or other means of listeners and connect them to the collectors.
Ptr< DataCollectionObject > m_aggregator
The aggregator created by this helper.
Callback< void, uint8_t, double > m_traceSinkCallback
virtual ~SatStatsFwdLinkSchedulerSymbolRateHelper()
/ Destructor.
Callback< void, uint8_t, double > GetTraceSinkCallback() const
void SymbolRateCallback(uint8_t sliceId, double symbolRate)
Receive inputs from trace sources and forward them to the collector.
Parent abstract class of all satellite statistics helpers.
Ptr< const SatHelper > GetSatHelper() const
static NetDeviceContainer GetGwSatNetDevice(Ptr< Node > gwNode)
IdentifierType_t GetIdentifierType() const
static std::string GetOutputTypeName(OutputType_t outputType)
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 CreateCollectorPerIdentifier(CollectorMap &collectorMap) const
Create one collector instance for each identifier in the simulation.
OutputType_t GetOutputType() 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.