24 #include <ns3/boolean.h>
25 #include <ns3/data-collection-object.h>
26 #include <ns3/distribution-collector.h>
29 #include <ns3/magister-gnuplot-aggregator.h>
30 #include <ns3/multi-file-aggregator.h>
32 #include <ns3/object-map.h>
33 #include <ns3/object-vector.h>
34 #include <ns3/satellite-geo-net-device.h>
35 #include <ns3/satellite-helper.h>
36 #include <ns3/satellite-phy-rx-carrier.h>
37 #include <ns3/satellite-phy-rx.h>
38 #include <ns3/satellite-phy.h>
39 #include <ns3/scalar-collector.h>
40 #include <ns3/string.h>
41 #include <ns3/unit-conversion-collector.h>
45 NS_LOG_COMPONENT_DEFINE(
"SatStatsWindowLoadHelper");
50 NS_OBJECT_ENSURE_REGISTERED(SatStatsWindowLoadHelper);
56 NS_LOG_FUNCTION(
this << satHelper);
61 NS_LOG_FUNCTION(
this);
67 static TypeId tid = TypeId(
"ns3::SatStatsWindowLoadHelper").SetParent<
SatStatsHelper>();
74 NS_LOG_FUNCTION(
this << windowLoad);
80 Ptr<ScalarCollector> c =
m_collector->GetObject<ScalarCollector>();
81 NS_ASSERT(c !=
nullptr);
82 c->TraceSinkDouble(0.0, windowLoad);
88 Ptr<UnitConversionCollector> c =
m_collector->GetObject<UnitConversionCollector>();
89 NS_ASSERT(c !=
nullptr);
90 c->TraceSinkDouble(0.0, windowLoad);
100 Ptr<DistributionCollector> c =
m_collector->GetObject<DistributionCollector>();
101 NS_ASSERT(c !=
nullptr);
102 c->TraceSinkDouble(0.0, windowLoad);
108 <<
" is not a valid output type for this statistics.");
115 Callback<void, double>
124 NS_LOG_FUNCTION(
this);
130 <<
" is not a valid output type for this statistics.");
140 "EnableContextPrinting",
144 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
147 Ptr<ScalarCollector> collector = CreateObject<ScalarCollector>();
148 collector->SetName(
"0");
149 collector->SetInputDataType(ScalarCollector::INPUT_DATA_TYPE_DOUBLE);
150 collector->SetOutputType(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE);
151 collector->TraceConnect(
"Output",
153 MakeCallback(&MultiFileAggregator::Write1d, aggregator));
154 m_collector = collector->GetObject<DataCollectionObject>();
166 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
169 Ptr<UnitConversionCollector> collector = CreateObject<UnitConversionCollector>();
170 collector->SetName(
"0");
171 collector->SetConversionType(UnitConversionCollector::TRANSPARENT);
172 collector->TraceConnect(
"OutputTimeValue",
174 MakeCallback(&MultiFileAggregator::Write2d, aggregator));
175 m_collector = collector->GetObject<DataCollectionObject>();
189 Ptr<MultiFileAggregator> aggregator =
m_aggregator->GetObject<MultiFileAggregator>();
192 Ptr<DistributionCollector> collector = CreateObject<DistributionCollector>();
193 collector->SetName(
"0");
196 collector->SetOutputType(DistributionCollector::OUTPUT_TYPE_HISTOGRAM);
200 collector->SetOutputType(DistributionCollector::OUTPUT_TYPE_PROBABILITY);
204 collector->SetOutputType(DistributionCollector::OUTPUT_TYPE_CUMULATIVE);
206 collector->TraceConnect(
"Output",
208 MakeCallback(&MultiFileAggregator::Write2d, aggregator));
209 collector->TraceConnect(
"OutputString",
211 MakeCallback(&MultiFileAggregator::AddContextHeading, aggregator));
212 collector->TraceConnect(
215 MakeCallback(&MultiFileAggregator::EnableContextWarning, aggregator));
216 m_collector = collector->GetObject<DataCollectionObject>();
224 <<
" is not a valid output type for this statistics.");
234 Ptr<MagisterGnuplotAggregator> plotAggregator =
236 NS_ASSERT(plotAggregator !=
nullptr);
238 plotAggregator->SetLegend(
"Time (in seconds)",
"Window normalized load (in bps/Hz)");
239 plotAggregator->Add2dDataset(
"0",
"0");
240 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
243 Ptr<UnitConversionCollector> collector = CreateObject<UnitConversionCollector>();
244 collector->SetName(
"0");
245 collector->SetConversionType(UnitConversionCollector::TRANSPARENT);
246 collector->TraceConnect(
"OutputTimeValue",
248 MakeCallback(&MagisterGnuplotAggregator::Write2d, plotAggregator));
249 m_collector = collector->GetObject<DataCollectionObject>();
263 Ptr<MagisterGnuplotAggregator> plotAggregator =
265 NS_ASSERT(plotAggregator !=
nullptr);
267 plotAggregator->SetLegend(
"Window normalized load (in bps/Hz)",
"Frequency");
268 plotAggregator->Add2dDataset(
"0",
"0");
269 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
272 Ptr<DistributionCollector> collector = CreateObject<DistributionCollector>();
273 collector->SetName(
"0");
276 collector->SetOutputType(DistributionCollector::OUTPUT_TYPE_HISTOGRAM);
280 collector->SetOutputType(DistributionCollector::OUTPUT_TYPE_PROBABILITY);
284 collector->SetOutputType(DistributionCollector::OUTPUT_TYPE_CUMULATIVE);
286 collector->TraceConnect(
"Output",
288 MakeCallback(&MagisterGnuplotAggregator::Write2d, plotAggregator));
289 m_collector = collector->GetObject<DataCollectionObject>();
295 NS_FATAL_ERROR(
"SatStatsWindowLoadHelper - Invalid output type");
318 NS_LOG_FUNCTION(
this << satHelper);
323 NS_LOG_FUNCTION(
this);
337 NS_LOG_FUNCTION(
this);
339 NodeContainer gws =
GetSatHelper()->GetBeamHelper()->GetGwNodes();
340 for (NodeContainer::Iterator it = gws.Begin(); it != gws.End(); ++it)
344 for (NetDeviceContainer::Iterator itDev = devs.Begin(); itDev != devs.End(); ++itDev)
346 Ptr<SatNetDevice> satDev = (*itDev)->GetObject<
SatNetDevice>();
347 NS_ASSERT(satDev !=
nullptr);
348 Ptr<SatPhy> satPhy = satDev->GetPhy();
349 NS_ASSERT(satPhy !=
nullptr);
350 Ptr<SatPhyRx> satPhyRx = satPhy->GetPhyRx();
351 NS_ASSERT(satPhyRx !=
nullptr);
352 ObjectVectorValue carriers;
353 satPhyRx->GetAttribute(
"RxCarrierList", carriers);
354 NS_LOG_DEBUG(
this <<
" Node ID " << (*it)->GetId() <<
" device #"
355 << (*itDev)->GetIfIndex() <<
" has " << carriers.GetN()
358 for (ObjectVectorValue::Iterator itCarrier = carriers.Begin();
359 itCarrier != carriers.End();
362 if (DynamicCast<SatPhyRxCarrier>(itCarrier->second)->GetCarrierType() !=
363 SatPhyRxCarrier::CarrierType::RA_ESSA)
368 if (!itCarrier->second->TraceConnectWithoutContext(
"WindowLoad",
371 NS_FATAL_ERROR(
"Error connecting to WindowLoad trace source"
372 <<
" of SatPhyRxCarrier"
373 <<
" at node ID " << (*it)->GetId() <<
" device #"
374 << (*itDev)->GetIfIndex() <<
" RX carrier #"
375 << itCarrier->first);
SatNetDevice to be utilized in the UT and GW nodes.
Parent abstract class of all satellite statistics helpers.
Ptr< const SatHelper > GetSatHelper() const
static NetDeviceContainer GetGwSatNetDevice(Ptr< Node > gwNode)
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.
OutputType_t GetOutputType() const
std::string GetName() const
virtual std::string GetTimeHeading(std::string dataLabel) const
virtual std::string GetDistributionHeading(std::string dataLabel) const
Produce return feeder window load statistics from a satellite module simulation.
SatStatsRtnFeederWindowLoadHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual ~SatStatsRtnFeederWindowLoadHelper()
/ Destructor.
Abstract class inherited by SatStatsRtnFeederWindowLoadHelper.
void WindowLoadCallback(double windowLoad)
Receive inputs from trace sources and forward them to the collector.
Ptr< DataCollectionObject > m_aggregator
The aggregator created by this helper.
void InstallProbes()
Set up several probes or other means of listeners and connect them to the collectors.
void DoInstall()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
Callback< void, double > GetTraceSinkCallback() const
Callback< void, double > m_traceSinkCallback
virtual void DoInstallProbes()=0
SatStatsWindowLoadHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsWindowLoadHelper()
/ Destructor.
Ptr< DataCollectionObject > m_collector
The collector created by this helper.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.