21 #include "ns3/applications-module.h"
22 #include "ns3/config-store-module.h"
23 #include "ns3/core-module.h"
24 #include "ns3/internet-module.h"
25 #include "ns3/network-module.h"
26 #include "ns3/satellite-module.h"
45 NS_LOG_COMPONENT_DEFINE(
"sat-ra-sim-tn9");
48 main(
int argc,
char* argv[])
51 uint32_t endUsersPerUt(1);
53 uint32_t utsPerBeam(1);
54 uint32_t packetSize(64);
55 std::string dataRate =
"5kb/s";
56 std::string onTime =
"0.2";
57 std::string offTime =
"0.8";
59 double simLength(300.0);
62 auto simulationHelper = CreateObject<SimulationHelper>(
"example-ra-sim-tn9");
65 std::string inputFileNameWithPath =
66 Singleton<SatEnvVariables>::Get()->LocateDirectory(
"contrib/satellite/examples") +
67 "/tn9-ra-input-attributes.xml";
71 cmd.AddValue(
"utsPerBeam",
"Number of UTs per spot-beam", utsPerBeam);
72 cmd.AddValue(
"raMode",
"RA mode", raMode);
73 cmd.AddValue(
"simLength",
"Simulation duration in seconds", simLength);
74 cmd.AddValue(
"packetSize",
"Constant packet size in bytes", packetSize);
75 cmd.AddValue(
"dataRate",
"Data rate (e.g. 500kb/s)", dataRate);
76 cmd.AddValue(
"onTime",
"Time for packet sending is on in seconds", onTime);
77 cmd.AddValue(
"offTime",
"Time for packet sending is off in seconds", offTime);
78 simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
79 cmd.Parse(argc, argv);
81 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(inputFileNameWithPath));
82 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Load"));
83 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
84 ConfigStore inputConfig;
85 inputConfig.ConfigureDefaults();
88 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
92 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
96 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
100 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
101 BooleanValue(
false));
103 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
107 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
109 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
111 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
113 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
115 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
117 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
120 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
122 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
129 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
130 BooleanValue(
false));
131 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
132 BooleanValue(
false));
133 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
134 BooleanValue(
false));
135 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
136 BooleanValue(
false));
137 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
138 BooleanValue(
false));
139 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
140 BooleanValue(
false));
141 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
142 BooleanValue(
false));
143 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
144 BooleanValue(
false));
145 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
146 BooleanValue(
false));
147 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
148 BooleanValue(
false));
149 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
150 BooleanValue(
false));
151 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
155 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
160 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
161 BooleanValue(
false));
162 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
163 BooleanValue(
false));
164 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
165 BooleanValue(
false));
166 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
167 BooleanValue(
false));
168 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
169 BooleanValue(
false));
170 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
171 BooleanValue(
false));
172 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
173 BooleanValue(
false));
174 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
175 BooleanValue(
false));
176 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
177 BooleanValue(
false));
178 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
179 BooleanValue(
false));
180 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
181 BooleanValue(
false));
182 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
185 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
189 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
194 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
195 BooleanValue(
false));
196 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
197 BooleanValue(
false));
198 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
199 BooleanValue(
false));
200 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
201 BooleanValue(
false));
202 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
203 BooleanValue(
false));
204 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
205 BooleanValue(
false));
206 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
207 BooleanValue(
false));
208 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
209 BooleanValue(
false));
210 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
211 BooleanValue(
false));
212 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
213 BooleanValue(
false));
214 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
215 BooleanValue(
false));
216 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
219 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
222 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
true));
227 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
228 BooleanValue(
false));
229 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
230 BooleanValue(
false));
231 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
232 BooleanValue(
false));
233 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
234 BooleanValue(
false));
235 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
236 BooleanValue(
false));
237 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
238 BooleanValue(
false));
239 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
240 BooleanValue(
false));
241 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
242 BooleanValue(
false));
243 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
244 BooleanValue(
false));
245 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
246 BooleanValue(
false));
247 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
248 BooleanValue(
false));
249 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
250 BooleanValue(
false));
253 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
257 NS_FATAL_ERROR(
"Unsupported raMode: " << raMode);
263 simulationHelper->SetSimulationTime(simLength);
264 simulationHelper->SetUserCountPerUt(endUsersPerUt);
265 simulationHelper->SetUtCountPerBeam(utsPerBeam);
266 simulationHelper->SetBeamSet({beamId});
268 simulationHelper->LoadScenario(
"geo-33E");
270 simulationHelper->CreateSatScenario();
275 simulationHelper->GetTrafficHelper()->AddOnOffTraffic(
280 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
281 Singleton<SatTopology>::Get()->GetUtUserNodes(),
282 "ns3::ConstantRandomVariable[Constant=" + onTime +
"]",
283 "ns3::ConstantRandomVariable[Constant=" + offTime +
"]",
285 Seconds(simLength - 2.0),
291 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
343 NS_LOG_INFO(
"--- sat-ra-sim-tn9 ---");
344 NS_LOG_INFO(
" Packet size: " << packetSize);
345 NS_LOG_INFO(
" Simulation length: " << simLength);
346 NS_LOG_INFO(
" Number of UTs: " << utsPerBeam);
347 NS_LOG_INFO(
" Number of end users per UT: " << endUsersPerUt);
366 simulationHelper->RunSimulation();
@ RA_MODEL_RCS2_SPECIFICATION
@ RA_COLLISION_CHECK_AGAINST_SINR
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.