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/satellite-topology.h>
42 #include <ns3/scalar-collector.h>
43 #include <ns3/singleton.h>
44 #include <ns3/string.h>
45 #include <ns3/unit-conversion-collector.h>
50 NS_LOG_COMPONENT_DEFINE(
"SatStatsFwdLinkSchedulerSymbolRateHelper");
55 NS_OBJECT_ENSURE_REGISTERED(SatStatsFwdLinkSchedulerSymbolRateHelper);
58 Ptr<const SatHelper> satHelper)
63 NS_LOG_FUNCTION(
this << satHelper);
68 NS_LOG_FUNCTION(
this);
75 TypeId(
"ns3::SatStatsFwdLinkSchedulerSymbolRateHelper").SetParent<
SatStatsHelper>();
82 NS_LOG_FUNCTION(
this << sliceId <<
" " << symbolRate);
84 Ptr<DataCollectionObject> collector =
nullptr;
90 NS_ASSERT_MSG(collector !=
nullptr,
"Unable to find collector with identifier 0");
94 collector =
m_collectors.Get(
static_cast<uint32_t
>(sliceId));
95 NS_ASSERT_MSG(collector !=
nullptr,
"Unable to find collector with identifier " << sliceId);
99 NS_FATAL_ERROR(
"SatStatsFwdLinkSchedulerSymbolRateHelper - Invalid identifier type");
107 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
108 NS_ASSERT(c !=
nullptr);
109 c->TraceSinkDouble(0.0, symbolRate);
115 Ptr<IntervalRateCollector> c = collector->GetObject<IntervalRateCollector>();
116 NS_ASSERT(c !=
nullptr);
117 c->TraceSinkDouble(0.0, symbolRate);
127 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
128 NS_ASSERT(c !=
nullptr);
129 c->TraceSinkDouble(0.0, symbolRate);
135 <<
" is not a valid output type for this statistics.");
142 Callback<void, uint8_t, double>
151 NS_LOG_FUNCTION(
this);
157 <<
" is not a valid output type for this statistics.");
167 "EnableContextPrinting",
171 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
176 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
178 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SECOND));
192 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
197 EnumValue(IntervalRateCollector::INPUT_DATA_TYPE_DOUBLE));
201 &MultiFileAggregator::Write2d);
204 &MultiFileAggregator::AddContextHeading);
218 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
222 DistributionCollector::OutputType_t outputType =
223 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
226 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
230 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
232 m_collectors.SetAttribute(
"OutputType", EnumValue(outputType));
237 &MultiFileAggregator::AddContextHeading);
240 &MultiFileAggregator::EnableContextWarning);
248 <<
" is not a valid output type for this statistics.");
258 Ptr<MagisterGnuplotAggregator> plotAggregator =
260 NS_ASSERT(plotAggregator !=
nullptr);
262 plotAggregator->SetLegend(
"Time (in seconds)",
"Latency (in seconds)");
263 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
268 EnumValue(IntervalRateCollector::INPUT_DATA_TYPE_DOUBLE));
272 const std::string context = it->second->GetName();
273 plotAggregator->Add2dDataset(context, context);
277 &MagisterGnuplotAggregator::Write2d);
291 Ptr<MagisterGnuplotAggregator> plotAggregator =
293 NS_ASSERT(plotAggregator !=
nullptr);
295 plotAggregator->SetLegend(
"Latency (in seconds)",
"Frequency");
296 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
300 DistributionCollector::OutputType_t outputType =
301 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
304 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
308 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
310 m_collectors.SetAttribute(
"OutputType", EnumValue(outputType));
314 const std::string context = it->second->GetName();
315 plotAggregator->Add2dDataset(context, context);
319 &MagisterGnuplotAggregator::Write2d);
325 NS_FATAL_ERROR(
"SatStatsFwdLinkSchedulerSymbolRateHelper - Invalid output type");
337 NS_LOG_FUNCTION(
this);
340 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
342 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
346 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
348 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
349 NS_ASSERT(satDev !=
nullptr);
350 Ptr<SatMac> satMac = satDev->GetMac();
351 NS_ASSERT(satMac !=
nullptr);
352 Ptr<SatGwMac> satGwMac = satMac->GetObject<
SatGwMac>();
353 NS_ASSERT(satGwMac !=
nullptr);
354 PointerValue scheduler;
355 satGwMac->GetAttribute(
"Scheduler", scheduler);
357 NS_ASSERT(fwdLinkScheduler !=
nullptr);
361 NS_FATAL_ERROR(
"Error connecting to Symbol Rate trace source"
362 <<
" of SatFwdLinkScheduler"
363 <<
" at node ID " << (*it)->GetId() <<
" device #"
364 << (*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.
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.