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->LoadScenario(
"geo-33E");
170 simulationHelper->CreateSatScenario();
180 NS_LOG_INFO(
"Configuring the on-off application!");
182 uint32_t packetSize(1280);
183 DataRate dataRate(128000);
187 Time appStartTime(MilliSeconds(100));
189 simulationHelper->GetTrafficHelper()->AddOnOffTraffic(
194 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
195 Singleton<SatTopology>::Get()->GetUtUserNodes(),
196 "ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]",
197 "ns3::ExponentialRandomVariable[Mean=1.0|Bound=0.0]",
199 Seconds(simDuration + 1),
207 NS_LOG_INFO(
"Setting up statistics");
211 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
236 NS_LOG_INFO(
"Storing the used attributes to XML file: training-output-attributes-ut-"
237 << utsPerBeam <<
".xml");
252 NS_LOG_INFO(
"Running network simulator 3");
254 simulationHelper->RunSimulation();
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.