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"
42NS_LOG_COMPONENT_DEFINE(
"sat-mobility-example");
45main(
int argc,
char* argv[])
48 LogComponentEnable(
"sat-mobility-example", LOG_LEVEL_INFO);
51 uint32_t endUsersPerUt(1);
52 uint32_t utsPerBeam(1);
54 uint32_t packetSize(100);
55 Time interval(Seconds(10.0));
57 bool updatePositionEachRequest(
false);
58 Time updatePositionPeriod(Seconds(1));
60 Time appStartTime = Seconds(0.1);
61 Time simLength(Seconds(7200.0));
63 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"sat-mobility-example");
67 cmd.AddValue(
"PacketSize",
"UDP packet size (in bytes)", packetSize);
68 cmd.AddValue(
"Interval",
"CBR interval (in seconds, or add unit)", interval);
69 cmd.AddValue(
"SimLength",
"Simulation length (in seconds, or add unit)", simLength);
70 cmd.AddValue(
"UpdatePositionEachRequest",
71 "Enable position computation each time a packet is sent",
72 updatePositionEachRequest);
73 cmd.AddValue(
"UpdatePositionPeriod",
74 "Period of satellite position refresh, if not update on each request (in seconds, "
76 updatePositionPeriod);
77 simulationHelper->AddDefaultUiArguments(cmd);
78 cmd.Parse(argc, argv);
81 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
83 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
87 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
88 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
90 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionEachRequest",
91 BooleanValue(updatePositionEachRequest));
92 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionPeriod",
93 TimeValue(updatePositionPeriod));
95 Config::SetDefault(
"ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(
true));
96 Config::SetDefault(
"ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
99 simulationHelper->SetSimulationTime(simLength);
100 simulationHelper->SetUserCountPerUt(endUsersPerUt);
101 simulationHelper->SetUtCountPerBeam(utsPerBeam);
104 std::set<uint32_t> beamSetAll = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
105 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
106 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
107 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
108 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72};
109 simulationHelper->SetBeamSet(beamSetAll);
111 simulationHelper->LoadScenario(
"leo-iss");
114 simulationHelper->CreateSatScenario();
117 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
122 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
123 Singleton<SatTopology>::Get()->GetUtUserNodes(),
128 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
133 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
134 Singleton<SatTopology>::Get()->GetUtUserNodes(),
139 NS_LOG_INFO(
"--- sat-mobility-example ---");
140 NS_LOG_INFO(
" Packet size in bytes: " << packetSize);
141 NS_LOG_INFO(
" Packet sending interval: " << interval.GetSeconds());
142 NS_LOG_INFO(
" Simulation length: " << simLength.GetSeconds());
143 NS_LOG_INFO(
" Number of UTs: " << utsPerBeam);
144 NS_LOG_INFO(
" Number of end users per UT: " << endUsersPerUt);
148 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
149 simulationHelper->EnableProgressLogs();
151 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(
"output-attributes.xml"));
152 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
153 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
154 ConfigStore outputConfig;
155 outputConfig.ConfigureDefaults();
172 simulationHelper->RunSimulation();
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.