97 std::stringstream ss(identifier);
98 uint32_t identifierNum;
99 if (!(ss >> identifierNum))
101 NS_FATAL_ERROR(
"Cannot convert '" << identifier <<
"' to number");
104 NS_ASSERT_MSG(collector !=
nullptr,
105 "Unable to find collector with identifier " << identifierNum);
111 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
112 NS_ASSERT(c !=
nullptr);
113 c->TraceSinkDouble(0.0, gain);
119 Ptr<UnitConversionCollector> c = collector->GetObject<UnitConversionCollector>();
120 NS_ASSERT(c !=
nullptr);
121 c->TraceSinkDouble(0.0, gain);
133 Ptr<ScalarCollector> c = collector->GetObject<ScalarCollector>();
134 NS_ASSERT(c !=
nullptr);
135 c->TraceSinkDouble(0.0, gain);
139 Ptr<DistributionCollector> c = collector->GetObject<DistributionCollector>();
140 NS_ASSERT(c !=
nullptr);
141 c->TraceSinkDouble(0.0, gain);
147 <<
" is not a valid output type for this statistics.");
155 NS_LOG_FUNCTION(
this);
161 <<
" is not a valid output type for this statistics.");
171 "EnableContextPrinting",
179 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
182 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
186 &MultiFileAggregator::Write1d);
201 EnumValue(UnitConversionCollector::TRANSPARENT));
205 &MultiFileAggregator::Write2d);
220 "EnableContextPrinting",
224 Ptr<MultiFileAggregator> fileAggregator =
226 NS_ASSERT(fileAggregator !=
nullptr);
230 DistributionCollector::OutputType_t outputType =
231 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
234 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
238 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
245 MakeCallback(&MultiFileAggregator::Write2d, fileAggregator));
249 MakeCallback(&MultiFileAggregator::AddContextHeading, fileAggregator));
253 MakeCallback(&MultiFileAggregator::EnableContextWarning, fileAggregator));
258 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
261 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
263 Callback<void, double> callback =
269 it->second->TraceConnectWithoutContext(
"Output", callback);
283 DistributionCollector::OutputType_t outputType =
284 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
287 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
291 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
297 &MultiFileAggregator::Write2d);
300 &MultiFileAggregator::AddContextHeading);
303 &MultiFileAggregator::EnableContextWarning);
312 <<
" is not a valid output type for this statistics.");
322 Ptr<MagisterGnuplotAggregator> plotAggregator =
324 NS_ASSERT(plotAggregator !=
nullptr);
326 plotAggregator->SetLegend(
"Time (in seconds)",
"Antenna Gain (in dB)");
327 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
332 EnumValue(UnitConversionCollector::TRANSPARENT));
338 const std::string context = it->second->GetName();
339 plotAggregator->Add2dDataset(context, context);
343 &MagisterGnuplotAggregator::Write2d);
358 Ptr<MagisterGnuplotAggregator> plotAggregator =
360 NS_ASSERT(plotAggregator !=
nullptr);
362 plotAggregator->SetLegend(
"Antenna gain (in dB)",
"Frequency");
363 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
369 DistributionCollector::OutputType_t outputType =
370 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
373 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
377 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
384 MakeCallback(&MagisterGnuplotAggregator::Write2d, plotAggregator));
390 EnumValue(ScalarCollector::INPUT_DATA_TYPE_DOUBLE));
393 EnumValue(ScalarCollector::OUTPUT_TYPE_AVERAGE_PER_SAMPLE));
395 Callback<void, double> callback =
401 it->second->TraceConnectWithoutContext(
"Output", callback);
412 Ptr<MagisterGnuplotAggregator> plotAggregator =
414 NS_ASSERT(plotAggregator !=
nullptr);
416 plotAggregator->SetLegend(
"Antenna gain (in dB)",
"Frequency");
417 plotAggregator->Set2dDatasetDefaultStyle(Gnuplot2dDataset::LINES);
421 DistributionCollector::OutputType_t outputType =
422 DistributionCollector::OUTPUT_TYPE_HISTOGRAM;
425 outputType = DistributionCollector::OUTPUT_TYPE_PROBABILITY;
429 outputType = DistributionCollector::OUTPUT_TYPE_CUMULATIVE;
437 const std::string context = it->second->GetName();
438 plotAggregator->Add2dDataset(context, context);
442 &MagisterGnuplotAggregator::Write2d);
449 NS_FATAL_ERROR(
"SatStatsDelayHelper - Invalid output type");
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.