27 #include <ns3/address.h>
28 #include <ns3/cbr-helper.h>
29 #include <ns3/config-store.h>
30 #include <ns3/config.h>
33 #include <ns3/lora-periodic-sender.h>
34 #include <ns3/nrtv-helper.h>
35 #include <ns3/packet-sink-helper.h>
36 #include <ns3/packet-sink.h>
37 #include <ns3/pointer.h>
38 #include <ns3/random-variable-stream.h>
39 #include <ns3/satellite-env-variables.h>
40 #include <ns3/satellite-on-off-helper.h>
41 #include <ns3/singleton.h>
42 #include <ns3/string.h>
43 #include <ns3/three-gpp-http-satellite-helper.h>
44 #include <ns3/uinteger.h>
46 NS_LOG_COMPONENT_DEFINE(
"SimulationHelper");
51 NS_OBJECT_ENSURE_REGISTERED(SimulationHelperConf);
67 #define SIM_ADD_TRAFFIC_MODEL_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6) \
68 AddAttribute("Traffic" TOSTRING(index) "Percentage", \
69 "Percentage of final users that will use this traffic model", \
71 MakeDoubleAccessor(&SimulationHelperConf::SetTraffic##index##Percentage, \
72 &SimulationHelperConf::GetTraffic##index##Percentage), \
73 MakeDoubleChecker<double>(0, 1)) \
74 .AddAttribute("Traffic" TOSTRING(index) "Protocol", \
75 "Network protocol that this traffic model will use", \
77 MakeEnumAccessor(&SimulationHelperConf::SetTraffic##index##Protocol, \
78 &SimulationHelperConf::GetTraffic##index##Protocol), \
79 MakeEnumChecker(SimulationHelperConf::PROTOCOL_UDP, \
81 SimulationHelperConf::PROTOCOL_TCP, \
83 SimulationHelperConf::PROTOCOL_BOTH, \
85 .AddAttribute("Traffic" TOSTRING(index) "Direction", \
86 "Satellite link direction that this traffic model will use", \
88 MakeEnumAccessor(&SimulationHelperConf::SetTraffic##index##Direction, \
89 &SimulationHelperConf::GetTraffic##index##Direction), \
90 MakeEnumChecker(SimulationHelperConf::RTN_LINK, \
92 SimulationHelperConf::FWD_LINK, \
94 SimulationHelperConf::BOTH_LINK, \
97 "Traffic" TOSTRING(index) "StartTime", \
98 "Time into the simulation when this traffic model will be started on each user", \
100 MakeTimeAccessor(&SimulationHelperConf::SetTraffic##index##StartTime, \
101 &SimulationHelperConf::GetTraffic##index##StartTime), \
102 MakeTimeChecker(Seconds(0))) \
103 .AddAttribute("Traffic" TOSTRING(index) "StopTime", \
104 "Time into the simulation when this traffic model will be stopped " \
105 "on each user. 0 means endless traffic generation.", \
107 MakeTimeAccessor(&SimulationHelperConf::SetTraffic##index##StopTime, \
108 &SimulationHelperConf::GetTraffic##index##StopTime), \
109 MakeTimeChecker(Seconds(0))) \
110 .AddAttribute("Traffic" TOSTRING(index) "StartDelay", \
111 "Cummulative delay for each user before starting this traffic model", \
113 MakeTimeAccessor(&SimulationHelperConf::SetTraffic##index##StartDelay, \
114 &SimulationHelperConf::GetTraffic##index##StartDelay), \
115 MakeTimeChecker(Seconds(0)))
121 TypeId(
"ns3::SimulationHelperConf")
123 .AddConstructor<SimulationHelperConf>()
124 .AddAttribute(
"SimTime",
126 TimeValue(Seconds(100)),
128 MakeTimeChecker(Seconds(1)))
129 .AddAttribute(
"BeamsIDs",
131 StringValue(
"10 11 12 23 24 25"),
134 .AddAttribute(
"UserCountPerUt",
135 "Amount of user per User Terminal",
136 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"),
138 MakePointerChecker<RandomVariableStream>())
139 .AddAttribute(
"UserCountPerMobileUt",
140 "Amount of user per mobile User Terminal",
141 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"),
143 MakePointerChecker<RandomVariableStream>())
144 .AddAttribute(
"UtCountPerBeam",
145 "Amount of User Terminal associated to each Beam",
146 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"),
148 MakePointerChecker<RandomVariableStream>())
149 .AddAttribute(
"ActivateStatistics",
150 "Enable outputing values from stats helpers",
153 MakeBooleanChecker())
154 .AddAttribute(
"ActivateProgressLogs",
155 "Enable outputing progress of the simulation",
158 MakeBooleanChecker())
159 .AddAttribute(
"MobileUtsFolder",
160 "Select the folder where mobile UTs traces should be found",
161 StringValue(Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
162 "/utpositions/mobiles/"),
199 NS_LOG_FUNCTION(
this);
209 m_utMobileUserCount(0),
210 m_activateStatistics(false),
211 m_activateProgressLogging(false)
213 NS_LOG_FUNCTION(
this);
218 NS_LOG_FUNCTION(
this);
227 TypeId(
"ns3::SimulationHelper").SetParent<Object>().AddConstructor<SimulationHelper>();
234 NS_LOG_FUNCTION(
this);
241 m_statContainer(NULL),
242 m_commonUtPositions(),
243 m_utPositionsByBeam(),
244 m_simulationName(
""),
245 m_enabledBeamsStr(
""),
250 m_utMobileUserCount(0),
252 m_numberOfConfiguredFrames(0),
253 m_randomAccessConfigured(false),
254 m_enableInputFileUtListPositions(false),
255 m_inputFileUtPositionsCheckBeams(true),
257 m_progressLoggingEnabled(false),
258 m_progressUpdateInterval(Seconds(0.5))
261 "SimulationHelper: Default constructor not in use. Please create with simulation name. ");
266 m_statContainer(NULL),
267 m_commonUtPositions(),
268 m_utPositionsByBeam(),
269 m_simulationName(
""),
270 m_enabledBeamsStr(
""),
275 m_utMobileUserCount(0),
277 m_numberOfConfiguredFrames(0),
278 m_randomAccessConfigured(false),
279 m_enableInputFileUtListPositions(false),
280 m_inputFileUtPositionsCheckBeams(true),
282 m_progressLoggingEnabled(false),
283 m_progressUpdateInterval(Seconds(0.5))
285 NS_LOG_FUNCTION(
this);
287 ObjectBase::ConstructSelf(AttributeConstructionList());
290 Config::SetDefault(
"ns3::SatEnvVariables::SimulationCampaignName",
292 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
295 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType", StringValue(
"ConfigType_2"));
296 Config::SetDefault(
"ns3::SatWaveformConf::AcmEnabled", BooleanValue(
true));
299 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
300 BooleanValue(
false));
301 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed", BooleanValue(
true));
302 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_MinimumServiceRate",
304 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
305 BooleanValue(
false));
310 NS_LOG_FUNCTION(
this);
316 NS_LOG_FUNCTION(
this);
325 NS_LOG_FUNCTION(
this << count);
327 Ptr<RandomVariableStream> utCount = CreateObject<ConstantRandomVariable>();
328 utCount->SetAttribute(
"Constant", DoubleValue(count));
330 m_utCount.insert(std::make_pair(0, utCount));
336 NS_LOG_FUNCTION(
this << &rs);
344 NS_LOG_FUNCTION(
this << beamId << count);
346 Ptr<RandomVariableStream> utCount = CreateObject<ConstantRandomVariable>();
347 utCount->SetAttribute(
"Constant", DoubleValue(count));
349 m_utCount.insert(std::make_pair(beamId, utCount));
355 NS_LOG_FUNCTION(
this << &rs);
357 m_utCount.insert(std::make_pair(beamId, rs));
363 NS_LOG_FUNCTION(
this << count);
372 NS_LOG_FUNCTION(
this << &rs);
380 NS_LOG_FUNCTION(
this << count);
389 NS_LOG_FUNCTION(
this << &rs);
397 NS_LOG_FUNCTION(
this << gwUserCount);
399 Config::SetDefault(
"ns3::SatHelper::GwUsers", UintegerValue(gwUserCount));
405 NS_LOG_FUNCTION(
this << seconds);
413 NS_LOG_FUNCTION(
this << tag);
422 NS_LOG_FUNCTION(
this << path);
431 NS_LOG_FUNCTION(
this);
434 cmd.AddValue(
"InputXml",
"Input attributes in XML file", xmlInputFile);
440 NS_LOG_FUNCTION(
this);
443 cmd.AddValue(
"OutputPath",
"Output path for storing the simulation statistics",
m_outputPath);
449 NS_LOG_FUNCTION(
this);
454 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0", StringValue(
"Configuration_0"));
455 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType", StringValue(
"ConfigType_2"));
456 Config::SetDefault(
"ns3::SatSuperframeSeq::TargetDuration", TimeValue(MilliSeconds(100)));
458 Config::SetDefault(
"ns3::SatRequestManager::EvaluationInterval", TimeValue(MilliSeconds(100)));
459 Config::SetDefault(
"ns3::SatRequestManager::EnableOnDemandEvaluation", BooleanValue(
false));
461 Config::SetDefault(
"ns3::SatBbFrameConf::BBFrameUsageMode", StringValue(
"NormalFrames"));
478 Config::SetDefault(
"ns3::SatUtHelper::EnableChannelEstimationError", BooleanValue(
true));
479 Config::SetDefault(
"ns3::SatGwHelper::EnableChannelEstimationError", BooleanValue(
true));
481 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled", BooleanValue(
false));
483 Config::SetDefault(
"ns3::SatQueue::MaxPackets", UintegerValue(10000));
489 NS_LOG_FUNCTION(
this);
491 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaServiceCount", UintegerValue(4));
492 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
493 BooleanValue(
false));
494 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
495 BooleanValue(
false));
496 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
497 BooleanValue(
false));
498 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
499 BooleanValue(
false));
500 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
501 BooleanValue(
false));
502 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
503 BooleanValue(
false));
504 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
505 BooleanValue(
false));
506 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
507 BooleanValue(
false));
508 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
509 BooleanValue(
false));
510 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
511 BooleanValue(
false));
512 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
513 BooleanValue(
false));
514 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
515 BooleanValue(
false));
521 NS_LOG_FUNCTION(
this << rcIndex << rateKbps);
523 std::stringstream ss;
525 std::string attributeDefault(
"ns3::SatLowerLayerServiceConf::DaService" + ss.str());
527 Config::SetDefault(attributeDefault +
"_ConstantAssignmentProvided", BooleanValue(
true));
528 Config::SetDefault(attributeDefault +
"_RbdcAllowed", BooleanValue(
false));
529 Config::SetDefault(attributeDefault +
"_VolumeAllowed", BooleanValue(
false));
535 NS_LOG_FUNCTION(
this << rcIndex);
537 std::stringstream ss;
539 std::string attributeDefault(
"ns3::SatLowerLayerServiceConf::DaService" + ss.str());
541 Config::SetDefault(attributeDefault +
"_ConstantAssignmentProvided", BooleanValue(
false));
542 Config::SetDefault(attributeDefault +
"_RbdcAllowed", BooleanValue(
true));
543 Config::SetDefault(attributeDefault +
"_VolumeAllowed", BooleanValue(
false));
545 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DynamicRatePersistence", UintegerValue(10));
551 NS_LOG_FUNCTION(
this << rcIndex);
553 std::stringstream ss;
555 std::string attributeDefault(
"ns3::SatLowerLayerServiceConf::DaService" + ss.str());
557 Config::SetDefault(attributeDefault +
"_ConstantAssignmentProvided", BooleanValue(
false));
558 Config::SetDefault(attributeDefault +
"_RbdcAllowed", BooleanValue(
false));
559 Config::SetDefault(attributeDefault +
"_VolumeAllowed", BooleanValue(
true));
561 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::VolumeBacklogPersistence",
568 NS_LOG_FUNCTION(
this);
570 Config::SetDefault(
"ns3::SatSuperframeAllocator::FcaEnabled", BooleanValue(
true));
576 NS_LOG_FUNCTION(
this);
578 Config::SetDefault(
"ns3::SatSuperframeAllocator::FcaEnabled", BooleanValue(
false));
584 NS_LOG_FUNCTION(
this << periodicity.GetSeconds());
587 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
true));
588 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotInterval", TimeValue(periodicity));
594 NS_LOG_FUNCTION(
this << dir);
599 Config::SetDefault(
"ns3::SatLlc::FwdLinkArqEnabled", BooleanValue(
true));
601 Config::SetDefault(
"ns3::SatGenericStreamEncapsulatorArq::MaxNoOfRetransmissions",
603 Config::SetDefault(
"ns3::SatGenericStreamEncapsulatorArq::RetransmissionTimer",
604 TimeValue(MilliSeconds(600)));
605 Config::SetDefault(
"ns3::SatGenericStreamEncapsulatorArq::WindowSize", UintegerValue(10));
606 Config::SetDefault(
"ns3::SatGenericStreamEncapsulatorArq::ArqHeaderSize", UintegerValue(1));
607 Config::SetDefault(
"ns3::SatGenericStreamEncapsulatorArq::RxWaitingTime",
608 TimeValue(Seconds(1.8)));
612 Config::SetDefault(
"ns3::SatLlc::RtnLinkArqEnabled", BooleanValue(
true));
614 Config::SetDefault(
"ns3::SatReturnLinkEncapsulatorArq::MaxRtnArqSegmentSize",
616 Config::SetDefault(
"ns3::SatReturnLinkEncapsulatorArq::MaxNoOfRetransmissions",
618 Config::SetDefault(
"ns3::SatReturnLinkEncapsulatorArq::RetransmissionTimer",
619 TimeValue(MilliSeconds(600)));
620 Config::SetDefault(
"ns3::SatReturnLinkEncapsulatorArq::WindowSize", UintegerValue(10));
621 Config::SetDefault(
"ns3::SatReturnLinkEncapsulatorArq::ArqHeaderSize", UintegerValue(1));
622 Config::SetDefault(
"ns3::SatReturnLinkEncapsulatorArq::RxWaitingTime",
623 TimeValue(Seconds(1.8)));
627 NS_FATAL_ERROR(
"Unsupported SatLinkDir_t!");
637 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
639 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
641 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
643 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
644 BooleanValue(
false));
650 NS_LOG_FUNCTION(
this);
654 NS_FATAL_ERROR(
"Random access already configured!");
657 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
665 NS_LOG_FUNCTION(
this);
669 NS_FATAL_ERROR(
"Random access already configured!");
672 Config::SetDefault(
"ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(
false));
673 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
681 NS_LOG_FUNCTION(
this);
683 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
685 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DefaultControlRandomizationInterval",
686 TimeValue(MilliSeconds(100)));
687 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaServiceCount", UintegerValue(1));
688 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
690 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
692 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
694 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
696 Config::SetDefault(
"ns3::SatBeamHelper::RaConstantErrorRate", DoubleValue(0.0));
698 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
699 BooleanValue(
false));
701 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
704 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
706 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
708 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
710 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
712 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
714 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
717 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
728 NS_LOG_FUNCTION(
this);
730 Config::SetDefault(
"ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(
false));
731 Config::SetDefault(
"ns3::SatChannel::ForwardingMode", StringValue(
"OnlyDestNode"));
732 Config::SetDefault(
"ns3::SatChannel::RxPowerCalculationMode",
733 StringValue(
"RxPowerCalculation"));
734 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", StringValue(
"FadingOff"));
735 Config::SetDefault(
"ns3::SatUtHelper::EnableChannelEstimationError", BooleanValue(
false));
736 Config::SetDefault(
"ns3::SatGwHelper::EnableChannelEstimationError", BooleanValue(
false));
737 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel", StringValue(
"Constant"));
738 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
739 StringValue(
"Perfect"));
740 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
741 StringValue(
"RaCollisionNotDefined"));
750 NS_LOG_FUNCTION(
this << dir);
755 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
true));
756 Config::SetDefault(
"ns3::SatBbFrameConf::DefaultModCod", StringValue(
"QPSK_1_TO_2"));
757 Config::SetDefault(
"ns3::SatRequestManager::CnoReportInterval", TimeValue(Seconds(0.1)));
758 Config::SetDefault(
"ns3::SatFwdLinkScheduler::CnoEstimationMode",
759 StringValue(
"AverageValueInWindow"));
760 Config::SetDefault(
"ns3::SatFwdLinkScheduler::CnoEstimationWindow", TimeValue(Seconds(2)));
764 Config::SetDefault(
"ns3::SatBeamScheduler::CnoEstimationMode",
765 StringValue(
"MinimumValueInWindow"));
766 Config::SetDefault(
"ns3::SatBeamScheduler::CnoEstimationWindow", TimeValue(Seconds(2)));
767 Config::SetDefault(
"ns3::SatWaveformConf::AcmEnabled", BooleanValue(
true));
768 Config::SetDefault(
"ns3::SatWaveformConf::DefaultWfId", UintegerValue(3));
772 NS_FATAL_ERROR(
"Unsupported SatLinkDir_t!");
781 NS_LOG_FUNCTION(
this << dir);
786 Config::SetDefault(
"ns3::SatBbFrameConf::AcmEnabled", BooleanValue(
false));
787 Config::SetDefault(
"ns3::SatBbFrameConf::DefaultModCod", StringValue(
"QPSK_1_TO_2"));
788 Config::SetDefault(
"ns3::SatRequestManager::CnoReportInterval", TimeValue(Seconds(100)));
792 Config::SetDefault(
"ns3::SatWaveformConf::AcmEnabled", BooleanValue(
false));
793 Config::SetDefault(
"ns3::SatWaveformConf::DefaultWfId", UintegerValue(3));
797 NS_FATAL_ERROR(
"Unsupported SatLinkDir_t!");
806 std::cout <<
"Progress: " << Simulator::Now().GetSeconds() <<
"/" <<
GetSimTime().GetSeconds()
815 NS_ASSERT_MSG(
m_satHelper !=
nullptr,
"Satellite scenario not created yet!");
819 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
831 NS_LOG_FUNCTION(
this);
835 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
861 Config::SetDefault(
"ns3::SatStatsThroughputHelper::AveragingMode", BooleanValue(
true));
891 Config::SetDefault(
"ns3::SatStatsFrameTypeUsageHelper::Percentage", BooleanValue(
true));
903 NS_LOG_FUNCTION(
this);
907 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
993 NS_LOG_FUNCTION(
this << em << errorRate);
995 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
996 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
1000 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkConstantErrorRate", DoubleValue(errorRate));
1001 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkConstantErrorRate", DoubleValue(errorRate));
1009 NS_LOG_FUNCTION(
this << ifModel << constantIf);
1011 Config::SetDefault(
"ns3::SatUtHelper::DaFwdLinkInterferenceModel", EnumValue(ifModel));
1012 Config::SetDefault(
"ns3::SatGwHelper::DaRtnLinkInterferenceModel", EnumValue(ifModel));
1016 Config::SetDefault(
"ns3::SatConstantInterference::ConstantInterferencePower",
1017 DoubleValue(constantIf));
1026 double carrierSpacing,
1027 bool isRandomAccess)
1029 NS_LOG_FUNCTION(
this << bw << carrierBw << rollOff << carrierSpacing << isRandomAccess);
1031 std::stringstream sfId, fId;
1032 sfId << superFrameId;
1034 std::string attributeDefault(
"ns3::SatSuperframeConf" + sfId.str() +
"::Frame" + fId.str());
1036 Config::SetDefault(attributeDefault +
"_AllocatedBandwidthHz", DoubleValue(bw));
1037 Config::SetDefault(attributeDefault +
"_CarrierAllocatedBandwidthHz", DoubleValue(carrierBw));
1038 Config::SetDefault(attributeDefault +
"_CarrierRollOff", DoubleValue(rollOff));
1039 Config::SetDefault(attributeDefault +
"_CarrierSpacing", DoubleValue(carrierSpacing));
1040 Config::SetDefault(attributeDefault +
"_RandomAccessFrame", BooleanValue(isRandomAccess));
1044 Config::SetDefault(
"ns3::SatSuperframeConf" + sfId.str() +
"::FrameCount",
1051 NS_LOG_FUNCTION(
this);
1053 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(2e+09));
1054 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkBaseFrequency", DoubleValue(2.75e+10));
1055 Config::SetDefault(
"ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(5e+08));
1056 Config::SetDefault(
"ns3::SatConf::FwdUserLinkBaseFrequency", DoubleValue(1.97e+10));
1058 Config::SetDefault(
"ns3::SatConf::RtnFeederLinkBandwidth", DoubleValue(2e+09));
1059 Config::SetDefault(
"ns3::SatConf::RtnFeederLinkBaseFrequency", DoubleValue(1.77e+10));
1060 Config::SetDefault(
"ns3::SatConf::RtnUserLinkBandwidth", DoubleValue(5e+08));
1061 Config::SetDefault(
"ns3::SatConf::RtnUserLinkBaseFrequency", DoubleValue(2.95e+10));
1063 Config::SetDefault(
"ns3::SatConf::FwdUserLinkChannels", UintegerValue(4));
1064 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkChannels", UintegerValue(16));
1065 Config::SetDefault(
"ns3::SatConf::RtnUserLinkChannels", UintegerValue(4));
1066 Config::SetDefault(
"ns3::SatConf::RtnFeederLinkChannels", UintegerValue(16));
1068 Config::SetDefault(
"ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1.25e+08));
1069 Config::SetDefault(
"ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.2));
1070 Config::SetDefault(
"ns3::SatConf::FwdCarrierSpacing", DoubleValue(0.0));
1076 NS_LOG_FUNCTION(
this);
1079 Config::SetDefault(
"ns3::SatBeamHelper::EnableFwdLinkBeamHopping", BooleanValue(
true));
1082 Config::SetDefault(
"ns3::SatHelper::SatFwdConfFileName",
1083 StringValue(
"beamhopping/Scenario72FwdConf_BH.txt"));
1085 Config::SetDefault(
"ns3::SatBstpController::BeamHoppingMode",
1087 Config::SetDefault(
"ns3::SatBstpController::StaticBeamHoppingConfigFileName",
1088 StringValue(
"beamhopping/SatBstpConf_GW1.txt"));
1089 Config::SetDefault(
"ns3::SatBstpController::SuperframeDuration", TimeValue(MilliSeconds(1)));
1092 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(2e+09));
1093 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkBaseFrequency", DoubleValue(2.75e+10));
1094 Config::SetDefault(
"ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(5e+08));
1095 Config::SetDefault(
"ns3::SatConf::FwdUserLinkBaseFrequency", DoubleValue(1.97e+10));
1097 Config::SetDefault(
"ns3::SatConf::FwdUserLinkChannels", UintegerValue(1));
1098 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkChannels", UintegerValue(4));
1100 Config::SetDefault(
"ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(5e+08));
1101 Config::SetDefault(
"ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.2));
1102 Config::SetDefault(
"ns3::SatConf::FwdCarrierSpacing", DoubleValue(0.0));
1108 NS_LOG_FUNCTION(
this);
1110 Config::SetDefault(
"ns3::SatPhyRxCarrier::EnableCompositeSinrOutputTrace", BooleanValue(
true));
1111 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
1112 Config::SetDefault(
"ns3::SatChannel::EnableRxPowerOutputTrace", BooleanValue(
true));
1113 Config::SetDefault(
"ns3::SatChannel::EnableFadingOutputTrace", BooleanValue(
true));
1119 NS_LOG_FUNCTION(
this);
1121 Config::SetDefault(
"ns3::SatGeoFeederPhy::RxTemperatureDbk", DoubleValue(28.4));
1122 Config::SetDefault(
"ns3::SatGeoFeederPhy::RxMaxAntennaGainDb", DoubleValue(54));
1123 Config::SetDefault(
"ns3::SatGeoFeederPhy::TxMaxAntennaGainDb", DoubleValue(54));
1124 Config::SetDefault(
"ns3::SatGeoFeederPhy::TxMaxPowerDbw", DoubleValue(-4.38));
1125 Config::SetDefault(
"ns3::SatGeoFeederPhy::TxOutputLossDb", DoubleValue(1.75));
1126 Config::SetDefault(
"ns3::SatGeoFeederPhy::TxPointingLossDb", DoubleValue(0));
1127 Config::SetDefault(
"ns3::SatGeoFeederPhy::TxOboLossDb", DoubleValue(4));
1128 Config::SetDefault(
"ns3::SatGeoFeederPhy::TxAntennaLossDb", DoubleValue(1));
1129 Config::SetDefault(
"ns3::SatGeoFeederPhy::RxAntennaLossDb", DoubleValue(1));
1130 Config::SetDefault(
"ns3::SatGeoFeederPhy::DefaultFadingValue", DoubleValue(1));
1131 Config::SetDefault(
"ns3::SatGeoFeederPhy::ExtNoisePowerDensityDbwhz", DoubleValue(-207));
1132 Config::SetDefault(
"ns3::SatGeoFeederPhy::ImIfCOverIDb", DoubleValue(27));
1133 Config::SetDefault(
"ns3::SatGeoFeederPhy::FixedAmplificationGainDb", DoubleValue(82));
1134 Config::SetDefault(
"ns3::SatGeoUserPhy::RxTemperatureDbk", DoubleValue(28.4));
1135 Config::SetDefault(
"ns3::SatGeoUserPhy::RxMaxAntennaGainDb", DoubleValue(54));
1136 Config::SetDefault(
"ns3::SatGeoUserPhy::TxMaxAntennaGainDb", DoubleValue(54));
1137 Config::SetDefault(
"ns3::SatGeoUserPhy::TxMaxPowerDbw", DoubleValue(15));
1138 Config::SetDefault(
"ns3::SatGeoUserPhy::TxOutputLossDb", DoubleValue(2.85));
1139 Config::SetDefault(
"ns3::SatGeoUserPhy::TxPointingLossDb", DoubleValue(0));
1140 Config::SetDefault(
"ns3::SatGeoUserPhy::TxOboLossDb", DoubleValue(0));
1141 Config::SetDefault(
"ns3::SatGeoUserPhy::TxAntennaLossDb", DoubleValue(1));
1142 Config::SetDefault(
"ns3::SatGeoUserPhy::RxAntennaLossDb", DoubleValue(1));
1143 Config::SetDefault(
"ns3::SatGeoUserPhy::DefaultFadingValue", DoubleValue(1));
1144 Config::SetDefault(
"ns3::SatGeoUserPhy::OtherSysIfCOverIDb", DoubleValue(27.5));
1145 Config::SetDefault(
"ns3::SatGeoUserPhy::AciIfCOverIDb", DoubleValue(17));
1146 Config::SetDefault(
"ns3::SatGwPhy::RxTemperatureDbk", DoubleValue(24.62));
1147 Config::SetDefault(
"ns3::SatGwPhy::RxMaxAntennaGainDb", DoubleValue(61.5));
1148 Config::SetDefault(
"ns3::SatGwPhy::TxMaxAntennaGainDb", DoubleValue(65.2));
1149 Config::SetDefault(
"ns3::SatGwPhy::TxMaxPowerDbw", DoubleValue(8.97));
1150 Config::SetDefault(
"ns3::SatGwPhy::TxOutputLossDb", DoubleValue(2));
1151 Config::SetDefault(
"ns3::SatGwPhy::TxPointingLossDb", DoubleValue(1.1));
1152 Config::SetDefault(
"ns3::SatGwPhy::TxOboLossDb", DoubleValue(6));
1153 Config::SetDefault(
"ns3::SatGwPhy::TxAntennaLossDb", DoubleValue(0));
1154 Config::SetDefault(
"ns3::SatGwPhy::RxAntennaLossDb", DoubleValue(0));
1155 Config::SetDefault(
"ns3::SatGwPhy::DefaultFadingValue", DoubleValue(1));
1156 Config::SetDefault(
"ns3::SatGwPhy::ImIfCOverIDb", DoubleValue(22));
1157 Config::SetDefault(
"ns3::SatGwPhy::AciIfWrtNoisePercent", DoubleValue(10));
1158 Config::SetDefault(
"ns3::SatUtPhy::RxTemperatureDbk", DoubleValue(24.6));
1159 Config::SetDefault(
"ns3::SatUtPhy::RxMaxAntennaGainDb", DoubleValue(44.6));
1160 Config::SetDefault(
"ns3::SatUtPhy::TxMaxAntennaGainDb", DoubleValue(45.2));
1161 Config::SetDefault(
"ns3::SatUtPhy::TxMaxPowerDbw", DoubleValue(4));
1162 Config::SetDefault(
"ns3::SatUtPhy::TxOutputLossDb", DoubleValue(0.5));
1163 Config::SetDefault(
"ns3::SatUtPhy::TxPointingLossDb", DoubleValue(1));
1164 Config::SetDefault(
"ns3::SatUtPhy::TxOboLossDb", DoubleValue(0.5));
1165 Config::SetDefault(
"ns3::SatUtPhy::TxAntennaLossDb", DoubleValue(1));
1166 Config::SetDefault(
"ns3::SatUtPhy::RxAntennaLossDb", DoubleValue(0));
1167 Config::SetDefault(
"ns3::SatUtPhy::DefaultFadingValue", DoubleValue(1));
1168 Config::SetDefault(
"ns3::SatUtPhy::OtherSysIfCOverIDb", DoubleValue(24.7));
1174 NS_LOG_FUNCTION(
this);
1180 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
1181 StringValue(
"BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
1182 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
1183 StringValue(
"BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
1189 Config::SetDefault(
"ns3::SatFadingExternalInputTraceContainer::UtInputMode",
1190 StringValue(
"ListMode"));
1193 Config::SetDefault(
"ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(
true));
1199 NS_LOG_FUNCTION(
this);
1205 Ptr<SatListPositionAllocator> posAllocator)
1207 NS_LOG_FUNCTION(
this << beamId);
1214 NS_LOG_FUNCTION(
this << inputFile);
1221 Config::SetDefault(
"ns3::SatConf::UtPositionInputFileName", StringValue(inputFile));
1226 Ptr<SatStatsHelperContainer>
1229 NS_LOG_FUNCTION(
this);
1233 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
1234 BooleanValue(
true));
1241 Ptr<SatTrafficHelper>
1244 NS_LOG_FUNCTION(
this);
1258 NS_LOG_FUNCTION(
this);
1271 NS_LOG_FUNCTION(
this);
1284 NS_LOG_FUNCTION(
this);
1287 m_outputPath = Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/sims/" +
1290 if (!Singleton<SatEnvVariables>::Get()->IsValidDirectory(
m_outputPath))
1292 Singleton<SatEnvVariables>::Get()->CreateDirectory(
m_outputPath);
1297 Config::SetDefault(
"ns3::SatEnvVariables::SimulationTag", StringValue(
m_simulationTag));
1301 if (!Singleton<SatEnvVariables>::Get()->IsValidDirectory(
m_outputPath))
1303 Singleton<SatEnvVariables>::Get()->CreateDirectory(
m_outputPath);
1307 Singleton<SatEnvVariables>::Get()->SetOutputPath(
m_outputPath);
1312 const std::string& mobileUtsFolder)
1314 NS_LOG_FUNCTION(
this);
1316 std::stringstream ss;
1317 ss <<
"Created scenario: " << std::endl;
1326 Ptr<SatAntennaGainPatternContainer> antennaGainPatterns =
m_satHelper->GetAntennaGainPatterns();
1327 m_satHelper->GetBeamHelper()->SetAntennaGainPatterns(antennaGainPatterns);
1338 m_satHelper->SetUtPositionAllocatorForBeam(it.first, it.second);
1345 for (uint32_t satId = 0; satId <
m_satHelper->GeoSatNodes().GetN(); satId++)
1348 for (uint32_t i = 1; i <=
m_satHelper->GetBeamCount(); i++)
1353 beamInfo.insert(std::make_pair(std::make_pair(satId, i), info));
1369 for (uint32_t i = 1; i <=
m_satHelper->GetBeamCount(); i++)
1376 ss <<
" Beam " << i <<
": UT count= " << utCount;
1378 for (uint32_t j = 1; j < utCount + 1; j++)
1382 ss <<
", " << j <<
". UT user count= " << utUserCount;
1385 beamInfo.insert(std::make_pair(std::make_pair(0, i), info));
1391 std::vector<std::pair<GeoCoordinate, uint32_t>> additionalNodesVector =
1393 std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>> additionalNodes;
1394 for (std::vector<std::pair<GeoCoordinate, uint32_t>>::iterator it =
1395 additionalNodesVector.begin();
1396 it != additionalNodesVector.end();
1399 uint32_t bestBeamId = antennaGainPatterns->GetBestBeamId(0, it->first,
false);
1400 additionalNodes[bestBeamId].push_back(*it);
1403 for (std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>>::iterator it =
1404 additionalNodes.begin();
1405 it != additionalNodes.end();
1410 NS_LOG_WARN(
"Beam ID " << it->first <<
" is not enabled, cannot add "
1411 << it->second.size() <<
" UTs from SatGroupHelper");
1412 std::cout <<
"Beam ID " << it->first <<
" is not enabled, cannot add "
1413 << it->second.size() <<
" UTs from SatGroupHelper" << std::endl;
1416 beamInfo[std::make_pair(0, it->first)].SetPositions(it->second);
1417 for (uint32_t i = 0; i < it->second.size(); i++)
1423 if (mobileUtsFolder !=
"")
1432 m_satHelper->CreateUserDefinedScenarioFromListPositions(
1447 NS_LOG_INFO(ss.str());
1457 NS_LOG_FUNCTION(
this << node->GetId() << port);
1459 for (uint32_t i = 0; i < node->GetNApplications(); i++)
1461 auto sink = DynamicCast<PacketSink>(node->GetApplication(i));
1465 sink->GetAttribute(
"Local", av);
1466 if (InetSocketAddress::ConvertFrom(av.Get()).GetPort() == port)
1484 NS_LOG_FUNCTION(
this);
1486 std::string socketFactory =
1490 NodeContainer utAllUsers =
m_satHelper->GetUtUsers();
1491 NodeContainer gwUsers =
m_satHelper->GetGwUsers();
1493 "The number of GW users configured was too low. " <<
m_gwUserId <<
" "
1497 Ptr<UniformRandomVariable> rng = CreateObject<UniformRandomVariable>();
1498 NodeContainer utUsers;
1499 for (uint32_t i = 0; i < utAllUsers.GetN(); ++i)
1501 if (rng->GetValue(0.0, 1.0) < percentage)
1503 utUsers.Add(utAllUsers.Get(i));
1507 std::cout <<
"Installing traffic model on " << utUsers.GetN() <<
"/" << utAllUsers.GetN()
1508 <<
" UT users" << std::endl;
1510 switch (trafficModel)
1514 InetSocketAddress gwUserAddr =
1517 PacketSinkHelper sinkHelper(socketFactory, Address());
1518 CbrHelper cbrHelper(socketFactory, Address());
1519 ApplicationContainer sinkContainer;
1520 ApplicationContainer cbrContainer;
1526 sinkHelper.SetAttribute(
"Local", AddressValue(Address(gwUserAddr)));
1527 sinkContainer.Add(sinkHelper.Install(gwUsers.Get(
m_gwUserId)));
1530 cbrHelper.SetAttribute(
"Remote", AddressValue(Address(gwUserAddr)));
1533 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1535 auto app = cbrHelper.Install(utUsers.Get(i)).Get(0);
1536 app->SetStartTime(startTime + (i + 1) * startDelay);
1537 cbrContainer.Add(app);
1543 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1545 InetSocketAddress utUserAddr =
1546 InetSocketAddress(
m_satHelper->GetUserAddress(utUsers.Get(i)), port);
1549 sinkHelper.SetAttribute(
"Local", AddressValue(Address(utUserAddr)));
1550 sinkContainer.Add(sinkHelper.Install(utUsers.Get(i)));
1553 cbrHelper.SetAttribute(
"Remote", AddressValue(Address(utUserAddr)));
1554 auto app = cbrHelper.Install(gwUsers.Get(
m_gwUserId)).Get(0);
1555 app->SetStartTime(startTime + (i + 1) * startDelay);
1556 cbrContainer.Add(app);
1559 sinkContainer.Start(startTime);
1560 sinkContainer.Stop(stopTime);
1566 InetSocketAddress gwUserAddr =
1569 PacketSinkHelper sinkHelper(socketFactory, Address());
1571 ApplicationContainer sinkContainer;
1572 ApplicationContainer onOffContainer;
1578 sinkHelper.SetAttribute(
"Local", AddressValue(Address(gwUserAddr)));
1579 sinkContainer.Add(sinkHelper.Install(gwUsers.Get(
m_gwUserId)));
1582 onOffHelper.
SetAttribute(
"Remote", AddressValue(Address(gwUserAddr)));
1585 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1587 auto app = onOffHelper.
Install(utUsers.Get(i)).Get(0);
1588 app->SetStartTime(startTime + (i + 1) * startDelay);
1589 onOffContainer.Add(app);
1595 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1597 InetSocketAddress utUserAddr =
1598 InetSocketAddress(
m_satHelper->GetUserAddress(utUsers.Get(i)), port);
1602 sinkHelper.SetAttribute(
"Local", AddressValue(Address(utUserAddr)));
1603 sinkContainer.Add(sinkHelper.Install(utUsers.Get(i)));
1606 onOffHelper.
SetAttribute(
"Remote", AddressValue(Address(utUserAddr)));
1608 app->SetStartTime(startTime + (i + 1) * startDelay);
1609 onOffContainer.Add(app);
1612 sinkContainer.Start(startTime);
1613 sinkContainer.Stop(stopTime);
1618 ThreeGppHttpHelper httpHelper;
1623 auto apps = httpHelper.InstallUsingIpv4(gwUsers.Get(
m_gwUserId), utUsers);
1624 for (uint32_t i = 1; i < apps.GetN(); i++)
1626 apps.Get(i)->SetStartTime(startTime + (i + 1) * startDelay);
1636 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1638 auto apps = httpHelper.InstallUsingIpv4(utUsers.Get(i), gwUsers.Get(
m_gwUserId));
1639 apps.Get(1)->SetStartTime(startTime + (i + 1) * startDelay);
1642 httpHelper.GetServer().Start(startTime);
1643 httpHelper.GetServer().Stop(stopTime);
1648 NrtvHelper nrtvHelper(TypeId::LookupByName(socketFactory));
1653 auto apps = nrtvHelper.InstallUsingIpv4(gwUsers.Get(
m_gwUserId), utUsers);
1654 for (uint32_t i = 1; i < apps.GetN(); i++)
1656 apps.Get(i)->SetStartTime(startTime + (i + 1) * startDelay);
1666 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1668 auto apps = nrtvHelper.InstallUsingIpv4(utUsers.Get(i), gwUsers.Get(
m_gwUserId));
1669 apps.Get(1)->SetStartTime(startTime + (i + 1) * startDelay);
1672 nrtvHelper.GetServer().Start(startTime);
1673 nrtvHelper.GetServer().Stop(stopTime);
1678 NS_FATAL_ERROR(
"Invalid traffic model");
1686 uint32_t packetSize,
1691 NS_LOG_FUNCTION(
this << trafficModel << interval << packetSize << startTime << stopTime);
1694 NodeContainer utUsers =
m_satHelper->GetUtUsers();
1697 std::cout <<
"Installing Lora traffic model on " << nodes.GetN() <<
" UTs" << std::endl;
1699 switch (trafficModel)
1702 for (uint32_t i = 0; i < nodes.GetN(); i++)
1704 node = nodes.Get(i);
1705 Ptr<LoraPeriodicSender> app = Create<LoraPeriodicSender>();
1707 app->SetInterval(interval);
1708 NS_LOG_DEBUG(
"Created an application with interval = " << interval.GetHours()
1711 app->SetStartTime(startTime + (i + 1) * startDelay);
1712 app->SetStopTime(stopTime);
1713 app->SetPacketSize(packetSize);
1716 node->AddApplication(app);
1721 NodeContainer gwUsers =
m_satHelper->GetGwUsers();
1724 InetSocketAddress gwUserAddr =
1727 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory", Address());
1728 CbrHelper cbrHelper(
"ns3::UdpSocketFactory", Address());
1729 ApplicationContainer sinkContainer;
1730 ApplicationContainer cbrContainer;
1735 sinkHelper.SetAttribute(
"Local", AddressValue(Address(gwUserAddr)));
1736 sinkContainer.Add(sinkHelper.Install(gwUsers.Get(
m_gwUserId)));
1739 cbrHelper.SetAttribute(
"Remote", AddressValue(Address(gwUserAddr)));
1742 for (uint32_t i = 0; i < utUsers.GetN(); i++)
1744 auto app = cbrHelper.Install(utUsers.Get(i)).Get(0);
1745 app->SetStartTime(startTime + (i + 1) * startDelay);
1746 cbrContainer.Add(app);
1749 sinkContainer.Start(startTime);
1750 sinkContainer.Stop(stopTime);
1755 NS_FATAL_ERROR(
"Traffic Model for Lora not implemented yet");
1765 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
1767 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
true));
1771 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
1773 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
1777 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
1779 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
1780 Config::SetDefault(
"ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(
false));
1784 NS_FATAL_ERROR(
"Unsupported crTxConf: " << crTxConf);
1793 NS_LOG_FUNCTION(
this << enabledBeams);
1797 std::stringstream bss(enabledBeams);
1806 std::string garbage;
1819 NS_LOG_FUNCTION(
this);
1822 std::stringstream bss;
1823 for (
auto beamId : beamSet)
1825 bss << beamId <<
" ";
1830 const std::set<uint32_t>&
1833 NS_LOG_FUNCTION(
this);
1841 NS_LOG_FUNCTION(
this << beamId);
1843 bool beamEnabled =
false;
1856 NS_LOG_FUNCTION(
this << beamId);
1861 return m_utCount.at(beamId)->GetInteger();
1870 NS_LOG_FUNCTION(
this);
1873 NS_LOG_INFO(
" Simulation length: " <<
m_simTime.GetSeconds());
1875 NS_LOG_INFO(
" Number of UTs: " <<
m_satHelper->GetGwUsers().GetN());
1876 NS_LOG_INFO(
" Number of end users: " <<
m_satHelper->GetUtUsers().GetN());
1881 Simulator::Destroy();
1887 NS_LOG_FUNCTION(
this);
1908 NS_LOG_FUNCTION(
this);
1916 bool overrideManualConfiguration)
1919 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
1921 if (overrideManualConfiguration)
1923 SetBeams(simulationConf->m_enabledBeams);
1931 if (simulationConf->m_activateProgressLogging)
1936 for (
const auto& trafficModel : simulationConf->m_trafficModel)
1939 if (trafficModel.first ==
"Cbr")
1943 else if (trafficModel.first ==
"OnOff")
1947 else if (trafficModel.first ==
"Http")
1951 else if (trafficModel.first ==
"Nrtv")
1957 NS_FATAL_ERROR(
"Unknown traffic model has been configured: " << trafficModel.first);
1960 std::vector<SimulationHelper::TransportLayerProtocol_t> protocols;
1961 switch (trafficModel.second.m_protocol)
1977 NS_FATAL_ERROR(
"Unknown traffic protocol");
1981 std::vector<SimulationHelper::TrafficDirection_t> directions;
1982 switch (trafficModel.second.m_direction)
1998 NS_FATAL_ERROR(
"Unknown traffic protocol");
2002 if (trafficModel.second.m_percentage > 0.0)
2004 Time startTime = trafficModel.second.m_startTime;
2007 NS_FATAL_ERROR(
"Traffic model "
2008 << trafficModel.first
2009 <<
" configured to start after the simulation ended");
2012 Time stopTime = trafficModel.second.m_stopTime;
2013 if (stopTime == Seconds(0))
2017 if (stopTime < startTime)
2019 NS_FATAL_ERROR(
"Traffic model " << trafficModel.first
2020 <<
" configured to stop before it is started");
2023 for (
auto& protocol : protocols)
2025 for (
auto& direction : directions)
2032 trafficModel.second.m_startDelay);
2038 if (simulationConf->m_activateStatistics)
2047 NS_LOG_FUNCTION(
this << filePath);
2050 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(filePath));
2051 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Load"));
2052 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
2053 ConfigStore inputConfig;
2054 inputConfig.ConfigureDefaults();
2060 NS_LOG_FUNCTION(
this);
2062 std::string outputPath;
2063 outputPath = Singleton<SatEnvVariables>::Get()->GetOutputPath();
2066 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(outputPath +
"/" + fileName));
2067 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
2068 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
2069 ConfigStore outputConfig;
2070 outputConfig.ConfigureDefaults();
2072 if (outputAttributes)
2074 outputConfig.ConfigureAttributes();
Class that holds information for each beam regarding UTs and their users camped in each beam.
void AppendUt(uint32_t userCount)
Appends new UT to end of the list with given user count for the appended UT.
SatLinkDir_t
Link direction used for packet tracing.
@ RA_MODEL_RCS2_SPECIFICATION
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
std::map< std::pair< uint32_t, uint32_t >, SatBeamUserInfo > BeamUserInfoMap_t
definition for beam map key is pair sat ID / beam ID and value is UT/user info.
A helper to make it easier to instantiate an ns3::SatOnOffApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::SatOnOffApplication on each node of the input container configured with all the attri...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
ErrorModel
Error model enum.
@ RA_COLLISION_CHECK_AGAINST_SINR
@ RA_COLLISION_NOT_DEFINED
InterferenceModel
Interference model enum.
Ptr< RandomVariableStream > m_utCount
Ptr< RandomVariableStream > m_utUserCount
std::string m_enabledBeams
bool m_activateStatistics
Ptr< RandomVariableStream > m_utMobileUserCount
std::string m_mobileUtsFolder
TypeId GetInstanceTypeId(void) const
Derived from Object.
SimulationHelperConf()
Default constructor.
static TypeId GetTypeId(void)
Derived from Object.
bool m_activateProgressLogging
virtual ~SimulationHelperConf()
Destructor.
A helper to make it easier to create example simulation cases.
uint32_t GetNextUtCount(uint32_t beamId=0) const
Get next UT count from internal random variable stream.
void EnableCrdsa()
Enable CRDSA random access.
Ptr< SatCnoHelper > m_cnoHelper
void ProgressCb()
Callback that prints simulation progress to stdout.
std::string m_simulationName
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction, Time startTime, Time stopTime, Time startDelay, double percentage)
Install simple traffic model from GW users to UT users or vice versa.
void SetErrorModel(SatPhyRxCarrierConf::ErrorModel em, double errorRate=0.0)
Set simulation error model.
Ptr< SatTrafficHelper > m_trafficHelper
void SetupOutputPath()
Check if output path has been set.
void SetUserCountPerMobileUt(uint32_t count)
Set user count per mobile UT.
void EnableAcm(SatEnums::SatLinkDir_t dir)
Enable ACM for a simulation direction.
Time & GetSimTime()
Get simulation time.
void DoDispose(void)
Disposing.
SimulationHelper()
Default constructor, which is not used.
void ConfigureFrequencyBands()
Configure the default setting for the forward and return link frequencies.
virtual ~SimulationHelper()
Destructor.
void DisableAcm(SatEnums::SatLinkDir_t dir)
Disable ACM for a simulation direction.
void ConfigureAttributesFromFile(std::string filePath, bool overrideManualConfiguration=true)
Configure this instance after reading input attributes from XML file.
std::map< uint32_t, Ptr< RandomVariableStream > > m_utCount
Ptr< SatCnoHelper > GetCnoHelper()
Get the C/N0 helper to customize C/N0 on some nodes.
void DisableProgressLogs()
Disables simulation progress logs.
void SetIdealPhyParameterization()
Set ideal channel/physical layer parameterization.
void DisableFca()
Disable free capacity allocation.
Ptr< SatHelper > m_satHelper
Ptr< SatHelper > CreateSatScenario(SatHelper::PreDefinedScenario_t scenario=SatHelper::NONE, const std::string &mobileUtsFolder="")
Create the satellite scenario.
void CreateDefaultRtnLinkStats()
Create stats collectors if needed and set default statistics settings for both RTN link.
Ptr< SatGroupHelper > m_groupHelper
Ptr< SatListPositionAllocator > m_commonUtPositions
void RunSimulation()
Run the simulation.
void SetSimulationTime(double seconds)
Set simulation time in seconds.
void EnableFca()
Enable free capacity allocation.
std::string StoreAttributesToFile(std::string fileName, bool outputAttributes=false)
Store all used attributes.
void SetCrTxConf(CrTxConf_t crTxConf)
bool m_enableInputFileUtListPositions
void SetGwUserCount(uint32_t gwUserCount)
Set the number of GW users in the scenario.
void EnableOnlyConstantRate(uint32_t rcIndex, double rateKbps)
Enable only CRA for a given RC index.
EventId m_progressReportEvent
void EnableExternalFadingInputTrace()
Enable external fading input.
void EnableOutputTraces()
Enable all output traces.
void ConfigureLinkBudget()
Configure all link budget related attributes.
void EnableSlottedAloha()
Enable slotted ALOHA random access.
void DisableAllCapacityAssignmentCategories()
Disable all capacity allocation categories: CRA/VBDC/RBDC.
void EnableArq(SatEnums::SatLinkDir_t dir)
Enable ARQ.
void ConfigureFrame(uint32_t superFrameId, double bw, double carrierBw, double rollOff, double carrierSpacing, bool isRandomAccess=false)
Configure a frame for a certain superframe id.
void EnableOnlyRbdc(uint32_t rcIndex)
Enable only RBDC for a given RC index.
void EnableOnlyVbdc(uint32_t rcIndex)
Enable only VBDC for a given RC index.
void SetUtPositionAllocatorForBeam(uint32_t beamId, Ptr< SatListPositionAllocator > posAllocator)
Set a list position allocator for UTs of a specific beam.
void SetUtCountPerBeam(uint32_t count)
Set UT count per beam.
Time m_progressUpdateInterval
bool m_progressLoggingEnabled
void InstallLoraTrafficModel(LoraTrafficModel_t trafficModel, Time interval, uint32_t packetSize, Time startTime, Time stopTime, Time startDelay)
Ptr< SatHelper > GetSatelliteHelper()
If lower layer API access is required, use this to access SatHelper.
Ptr< SatTrafficHelper > GetTrafficHelper()
Get the traffic helper to create more complex traffics.
TypeId GetInstanceTypeId(void) const
Derived from Object.
void ReadInputAttributesFromFile(std::string filePath)
Read input attributes from XML file.
void CreateDefaultFwdLinkStats()
Create stats collectors if needed and set default statistics settings for both FWD link.
void DisableRandomAccess()
Disable random access.
void EnablePeriodicalControlSlots(Time periodicity)
Enable periodical control slots.
Ptr< SatStatsHelperContainer > GetStatisticsContainer()
Get the statistics container of this helper.
void EnableRandomAccess()
Enable random access.
void EnableUtListPositionsFromInputFile(std::string inputFile, bool checkBeams=true)
Enable reading UT list positions from input file.
std::set< uint32_t > m_enabledBeams
void SetUserCountPerUt(uint32_t count)
Set user count per UT.
void CreateDefaultStats()
Create stats collectors and set default statistics settings for both FWD and RTN links.
std::string m_simulationTag
void SetOutputPath(std::string path)
Force a output file path to this simulation instead of default satellite/data/sims/.
uint32_t GetNextUtUserCount() const
Get next UT user count from internal random variable stream.
Ptr< SatGroupHelper > GetGroupHelper()
Get the group helper.
void SetInterferenceModel(SatPhyRxCarrierConf::InterferenceModel ifModel, double constantIf=0.0)
Set simulation interference model.
void SetBeams(const std::string &beamList)
Ptr< RandomVariableStream > m_utMobileUserCount
const std::set< uint32_t > & GetBeams()
Get enabled beams in integer format.
bool HasSinkInstalled(Ptr< Node > node, uint16_t port)
Check if node has a PacketSink installed at certain port.
std::map< uint32_t, Ptr< SatListPositionAllocator > > m_utPositionsByBeam
void EnableProgressLogs()
Enables simulation progress logging.
bool m_inputFileUtPositionsCheckBeams
bool IsBeamEnabled(uint32_t beamId) const
Check if a beam is enabled.
void SetCommonUtPositionAllocator(Ptr< SatListPositionAllocator > posAllocator)
Set common UT position allocator for all beams.
void ConfigureFwdLinkBeamHopping()
Configure the beam hopping functionality for the FWD link.
void AddDefaultUiArguments(CommandLine &cmd)
Add default command line arguments for the simulation.
Ptr< SatStatsHelperContainer > m_statContainer
void SetOutputTag(std::string tag)
Set simulation output tag, which is the basename of the directory where output files are stored.
Ptr< RandomVariableStream > m_utUserCount
bool m_randomAccessConfigured
uint32_t m_numberOfConfiguredFrames
static TypeId GetTypeId(void)
Derived from Object.
std::string m_enabledBeamsStr
void SetDefaultValues()
Set default values shared by all examples using SimulationHelper.
void SetBeamSet(std::set< uint32_t > beamSet)
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
#define SIM_ADD_TRAFFIC_MODEL_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6)
SIM_ADD_TRAFFIC_MODEL_ATTRIBUTES macro helps defining specific attribute for traffic models in method...