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"
41 NS_LOG_COMPONENT_DEFINE(
"sat-mobility-example");
44 main(
int argc,
char* argv[])
47 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::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
82 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
84 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionEachRequest",
85 BooleanValue(updatePositionEachRequest));
86 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionPeriod",
87 TimeValue(updatePositionPeriod));
89 simulationHelper->SetSimulationTime(simLength);
90 simulationHelper->SetUserCountPerUt(endUsersPerUt);
91 simulationHelper->SetUtCountPerBeam(utsPerBeam);
94 std::stringstream beamsEnabled;
95 beamsEnabled << beamId;
96 simulationHelper->SetBeams(beamsEnabled.str());
98 simulationHelper->LoadScenario(
"leo-iss");
101 simulationHelper->CreateSatScenario();
104 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
109 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
110 Singleton<SatTopology>::Get()->GetUtUserNodes(),
115 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
120 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
121 Singleton<SatTopology>::Get()->GetUtUserNodes(),
126 NS_LOG_INFO(
"--- sat-mobility-example ---");
127 NS_LOG_INFO(
" Packet size in bytes: " << packetSize);
128 NS_LOG_INFO(
" Packet sending interval: " << interval.GetSeconds());
129 NS_LOG_INFO(
" Simulation length: " << simLength.GetSeconds());
130 NS_LOG_INFO(
" Number of UTs: " << utsPerBeam);
131 NS_LOG_INFO(
" Number of end users per UT: " << endUsersPerUt);
135 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
136 simulationHelper->EnableProgressLogs();
138 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(
"output-attributes.xml"));
139 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
140 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
141 ConfigStore outputConfig;
142 outputConfig.ConfigureDefaults();
159 simulationHelper->RunSimulation();
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.