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"
64 NS_LOG_COMPONENT_DEFINE(
"sat-group-example");
79 s->AddPerBeamFwdAppDelay(outputType);
81 s->AddPerGroupFwdAppDelay(outputType);
82 s->AddPerGroupRtnAppDelay(outputType);
84 s->AddPerGroupFwdDevDelay(outputType);
85 s->AddPerGroupRtnDevDelay(outputType);
86 s->AddPerGroupFwdMacDelay(outputType);
87 s->AddPerGroupRtnMacDelay(outputType);
88 s->AddPerGroupFwdPhyDelay(outputType);
89 s->AddPerGroupRtnPhyDelay(outputType);
91 s->AddAverageGroupFwdAppDelay(outputType);
92 s->AddAverageGroupRtnAppDelay(outputType);
94 s->AddAverageGroupFwdDevDelay(outputType);
95 s->AddAverageGroupRtnDevDelay(outputType);
96 s->AddAverageGroupFwdMacDelay(outputType);
97 s->AddAverageGroupRtnMacDelay(outputType);
98 s->AddAverageGroupFwdPhyDelay(outputType);
99 s->AddAverageGroupRtnPhyDelay(outputType);
101 s->AddPerGroupFwdAppJitter(outputType);
102 s->AddPerGroupRtnAppJitter(outputType);
104 s->AddPerGroupFwdDevJitter(outputType);
105 s->AddPerGroupRtnDevJitter(outputType);
106 s->AddPerGroupFwdMacJitter(outputType);
107 s->AddPerGroupRtnMacJitter(outputType);
108 s->AddPerGroupFwdPhyJitter(outputType);
109 s->AddPerGroupRtnPhyJitter(outputType);
111 s->AddAverageGroupFwdAppJitter(outputType);
112 s->AddAverageGroupRtnAppJitter(outputType);
114 s->AddAverageGroupFwdDevJitter(outputType);
115 s->AddAverageGroupRtnDevJitter(outputType);
116 s->AddAverageGroupFwdMacJitter(outputType);
117 s->AddAverageGroupRtnMacJitter(outputType);
118 s->AddAverageGroupFwdPhyJitter(outputType);
119 s->AddAverageGroupRtnPhyJitter(outputType);
121 s->AddPerGroupFwdAppPlt(outputType);
122 s->AddPerGroupRtnAppPlt(outputType);
124 s->AddAverageGroupFwdAppPlt(outputType);
125 s->AddAverageGroupRtnAppPlt(outputType);
127 s->AddPerGroupFwdQueueBytes(outputType);
128 s->AddPerGroupRtnQueueBytes(outputType);
130 s->AddPerGroupFwdQueuePackets(outputType);
131 s->AddPerGroupRtnQueuePackets(outputType);
133 s->AddPerGroupFwdSignallingLoad(outputType);
134 s->AddPerGroupRtnSignallingLoad(outputType);
136 s->AddPerGroupFwdCompositeSinr(outputType);
137 s->AddPerGroupRtnCompositeSinr(outputType);
139 s->AddPerGroupFwdAppThroughput(outputType);
140 s->AddPerGroupRtnAppThroughput(outputType);
142 s->AddPerGroupFwdUserDevThroughput(outputType);
143 s->AddPerGroupRtnFeederDevThroughput(outputType);
144 s->AddPerGroupFwdUserMacThroughput(outputType);
145 s->AddPerGroupRtnFeederMacThroughput(outputType);
146 s->AddPerGroupFwdUserPhyThroughput(outputType);
147 s->AddPerGroupRtnFeederPhyThroughput(outputType);
149 s->AddAverageGroupFwdAppThroughput(outputType);
150 s->AddAverageGroupRtnAppThroughput(outputType);
152 s->AddAverageGroupFwdUserDevThroughput(outputType);
153 s->AddAverageGroupRtnFeederDevThroughput(outputType);
154 s->AddAverageGroupFwdUserMacThroughput(outputType);
155 s->AddAverageGroupRtnFeederMacThroughput(outputType);
156 s->AddAverageGroupFwdUserPhyThroughput(outputType);
157 s->AddAverageGroupRtnFeederPhyThroughput(outputType);
159 s->AddPerGroupFwdUserDaPacketError(outputType);
160 s->AddPerGroupRtnFeederDaPacketError(outputType);
161 s->AddPerGroupFeederSlottedAlohaPacketError(outputType);
162 s->AddPerGroupFeederCrdsaPacketError(outputType);
163 s->AddPerGroupFeederEssaPacketError(outputType);
165 s->AddPerGroupFeederSlottedAlohaPacketCollision(outputType);
166 s->AddPerGroupFeederCrdsaPacketCollision(outputType);
167 s->AddPerGroupFeederEssaPacketCollision(outputType);
169 s->AddPerGroupCapacityRequest(outputType);
171 s->AddPerGroupResourcesGranted(outputType);
175 main(
int argc,
char* argv[])
178 LogComponentEnable(
"sat-group-example", LOG_LEVEL_INFO);
182 uint32_t endUsersPerUt(1);
183 uint32_t utsPerBeam(20);
185 uint32_t packetSize(1500);
186 Time interval(Seconds(1.0));
188 Time appStartTime = Seconds(0.1);
189 Time simLength(Seconds(60.0));
191 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"sat-group-example");
195 cmd.AddValue(
"UtsPerBeam",
"Number of UTs per beam", utsPerBeam);
196 cmd.AddValue(
"PacketSize",
"UDP packet size (in bytes)", packetSize);
197 cmd.AddValue(
"Interval",
"CBR interval (in seconds, or add unit)", interval);
198 cmd.AddValue(
"SimLength",
"Simulation length (in seconds, or add unit)", simLength);
199 simulationHelper->AddDefaultUiArguments(cmd);
200 cmd.Parse(argc, argv);
203 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
204 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
206 simulationHelper->SetSimulationTime(simLength);
207 simulationHelper->SetUserCountPerUt(endUsersPerUt);
208 simulationHelper->SetUtCountPerBeam(utsPerBeam);
211 std::stringstream beamsEnabled;
212 beamsEnabled << beamId;
213 simulationHelper->SetBeams(beamsEnabled.str());
215 Ptr<SatGroupHelper> groupHelper = simulationHelper->GetGroupHelper();
219 groupHelper->CreateUtNodesFromPosition(5, 10,
GeoCoordinate(56.4243, -16.042, 122.427), 100000);
221 simulationHelper->LoadScenario(
"geo-33E");
224 simulationHelper->CreateSatScenario();
227 NodeContainer utNodes = Singleton<SatTopology>::Get()->GetUtNodes();
233 groupHelper->AddUtNodeToGroup(1, utNodes.Get(0));
235 NodeContainer nodes2To10;
236 for (uint32_t i = 2; i < 11; i++)
238 nodes2To10.Add(utNodes.Get(i));
240 groupHelper->AddUtNodesToGroup(2, nodes2To10);
245 groupHelper->CreateGroupFromPosition(
253 std::vector<uint32_t> groups = {1, 2, 3};
254 groupHelper->CreateGroupsUniformly(groups, utNodes);
258 NS_FATAL_ERROR(
"Unknown value of GroupCreationMethod_t: " << creationMethod);
262 Config::SetDefault(
"ns3::CbrApplication::Interval", TimeValue(interval));
263 Config::SetDefault(
"ns3::CbrApplication::PacketSize", UintegerValue(packetSize));
266 Ptr<SatTrafficHelper> trafficHelper = simulationHelper->GetTrafficHelper();
267 trafficHelper->AddCbrTraffic(
272 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
273 Singleton<SatTopology>::Get()->GetUtUserNodes(groupHelper->GetUtNodes(2)),
275 appStartTime + simLength,
278 trafficHelper->AddCbrTraffic(
283 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
284 Singleton<SatTopology>::Get()->GetUtUserNodes(groupHelper->GetUtNodes(0)),
286 appStartTime + simLength,
289 trafficHelper->AddHttpTraffic(
291 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
292 Singleton<SatTopology>::Get()->GetUtUserNodes(groupHelper->GetUtNodes(1)),
294 appStartTime + simLength,
297 trafficHelper->AddVoipTraffic(
300 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
301 Singleton<SatTopology>::Get()->GetUtUserNodes(groupHelper->GetUtNodes(5)),
303 appStartTime + simLength,
306 NS_LOG_INFO(
"--- sat-group-example ---");
307 NS_LOG_INFO(
" Packet size in bytes: " << packetSize);
308 NS_LOG_INFO(
" Packet sending interval: " << interval.GetSeconds());
309 NS_LOG_INFO(
" Simulation length: " << simLength.GetSeconds());
310 NS_LOG_INFO(
" Number total of UTs: " << Singleton<SatTopology>::Get()->GetNUtNodes());
311 NS_LOG_INFO(
" Number of end users per UT: " << endUsersPerUt);
312 NS_LOG_INFO(
" Number of groups: " << groupHelper->GetN());
313 NS_LOG_INFO(
" Nodes in default group: " << groupHelper->GetUtNodes(0).GetN());
314 std::list<uint32_t> groupIds = groupHelper->GetGroups();
316 for (uint32_t groupId : groupIds)
318 NS_LOG_INFO(
" Nodes in group " << groupId <<
": "
319 << groupHelper->GetUtNodes(groupId).GetN());
324 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
325 simulationHelper->EnableProgressLogs();
327 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(
"output-attributes.xml"));
328 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
329 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
330 ConfigStore outputConfig;
331 outputConfig.ConfigureDefaults();
335 simulationHelper->RunSimulation();
GeoCoordinate class is used to store and operate with geodetic coordinates.
Keep track of the current position and velocity of an object in satellite network.
GeoCoordinate GetGeoPosition(void) const
OutputType_t
Possible types and formats of statistics output.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
void ConfigureAllStats(Ptr< SatStatsHelperContainer > s)