22 #include "ns3/applications-module.h"
23 #include "ns3/config-store-module.h"
24 #include "ns3/core-module.h"
25 #include "ns3/internet-module.h"
26 #include "ns3/network-module.h"
27 #include "ns3/satellite-module.h"
28 #include "ns3/traffic-module.h"
55 NS_LOG_COMPONENT_DEFINE(
"sat-training-example");
58 main(
int argc,
char* argv[])
61 LogComponentEnable(
"sat-training-example", LOG_LEVEL_INFO);
63 NS_LOG_INFO(
"--- sat-training-example ---");
70 uint32_t endUsersPerUt(1);
71 uint32_t utsPerBeam(1);
72 double simDuration(10.0);
76 std::set<uint32_t> coChannelBeams = {1, 3, 5, 7, 9, 22, 24, 26, 28, 30, 44, 46, 48, 50, 59, 61};
81 std::string simulationName =
"example-training";
82 auto simulationHelper = CreateObject<SimulationHelper>(simulationName);
85 std::string pathToFile = Singleton<SatEnvVariables>::Get()->LocateFile(
86 "contrib/satellite/examples/training-input-attributes.xml");
95 cmd.AddValue(
"utsPerBeam",
"Number of UTs per spot-beam", utsPerBeam);
96 cmd.AddValue(
"simDurationInSeconds",
"Simulation duration in seconds", simDuration);
97 simulationHelper->AddDefaultUiArguments(cmd, pathToFile);
98 cmd.Parse(argc, argv);
105 NS_LOG_INFO(
"Reading the XML input: training-input-attributes.xml");
107 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(pathToFile));
108 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Load"));
109 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
110 ConfigStore inputConfig;
111 inputConfig.ConfigureDefaults();
120 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
121 BooleanValue(
false));
122 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed", BooleanValue(
true));
123 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_MinimumServiceRate",
125 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
126 BooleanValue(
false));
127 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
true));
128 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotInterval", TimeValue(Seconds(1)));
131 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameCount", UintegerValue(3));
132 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(5e+06));
133 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame1_AllocatedBandwidthHz", DoubleValue(10e+06));
134 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame2_AllocatedBandwidthHz", DoubleValue(10e+06));
137 Config::SetDefault(
"ns3::SatChannel::EnableRxPowerOutputTrace", BooleanValue(
true));
138 Config::SetDefault(
"ns3::SatChannel::EnableFadingOutputTrace", BooleanValue(
true));
139 Config::SetDefault(
"ns3::SatPhyRxCarrier::EnableCompositeSinrOutputTrace", BooleanValue(
true));
140 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
142 Singleton<SatFadingOutputTraceContainer>::Get()->EnableFigureOutput(
false);
143 Singleton<SatInterferenceOutputTraceContainer>::Get()->EnableFigureOutput(
false);
144 Singleton<SatRxPowerOutputTraceContainer>::Get()->EnableFigureOutput(
false);
145 Singleton<SatCompositeSinrOutputTraceContainer>::Get()->EnableFigureOutput(
false);
148 Config::SetDefault(
"ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(
true));
151 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
159 NS_LOG_INFO(
"Creating the satellite scenario");
163 simulationHelper->SetUserCountPerUt(endUsersPerUt);
164 simulationHelper->SetUtCountPerBeam(utsPerBeam);
165 simulationHelper->SetBeamSet(coChannelBeams);
166 simulationHelper->SetSimulationTime(simDuration);
168 simulationHelper->CreateSatScenario();
178 NS_LOG_INFO(
"Configuring the on-off application!");
180 uint32_t packetSize(1280);
181 DataRate dataRate(128000);
185 Time appStartTime(MilliSeconds(100));
187 Config::SetDefault(
"ns3::OnOffApplication::PacketSize", UintegerValue(packetSize));
188 Config::SetDefault(
"ns3::OnOffApplication::DataRate", DataRateValue(dataRate));
189 Config::SetDefault(
"ns3::OnOffApplication::OnTime",
190 StringValue(
"ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]"));
191 Config::SetDefault(
"ns3::OnOffApplication::OffTime",
192 StringValue(
"ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]"));
198 Seconds(simDuration + 1),
206 NS_LOG_INFO(
"Setting up statistics");
210 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
235 NS_LOG_INFO(
"Storing the used attributes to XML file: training-output-attributes-ut-"
236 << utsPerBeam <<
".xml");
251 NS_LOG_INFO(
"Running network simulator 3");
253 simulationHelper->RunSimulation();
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.