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"
44 NS_LOG_COMPONENT_DEFINE(
"sat-tutorial-example");
47 main(
int argc,
char* argv[])
50 std::string scenario =
"Simple";
53 auto simulationHelper = CreateObject<SimulationHelper>(
"example-tutorial");
56 Config::SetDefault(
"ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(
true));
59 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
66 Config::SetDefault(
"ns3::SatEnvVariables::SimulationTag", StringValue(scenario));
67 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
87 cmd.AddValue(
"scenario",
"Scenario to be created", scenario);
88 simulationHelper->AddDefaultUiArguments(cmd);
89 cmd.Parse(argc, argv);
100 if (scenario ==
"larger")
104 else if (scenario ==
"full")
109 simulationHelper->SetOutputTag(scenario);
110 simulationHelper->SetSimulationTime(Seconds(11));
113 LogComponentEnable(
"CbrApplication", LOG_LEVEL_INFO);
114 LogComponentEnable(
"PacketSink", LOG_LEVEL_INFO);
115 LogComponentEnable(
"sat-tutorial-example", LOG_LEVEL_INFO);
134 simulationHelper->LoadScenario(
"geo-33E");
136 Ptr<SatHelper> helper = simulationHelper->CreateSatScenario(satScenario);
149 NodeContainer utUsers;
153 if (scenario ==
"full")
155 NodeContainer uts = helper->GetBeamHelper()->GetUtNodes(0, 1);
156 utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes(uts.Get(0));
160 utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
164 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
169 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
170 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
171 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
172 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
175 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
176 gwSink.Start(Seconds(1.0));
177 gwSink.Stop(Seconds(10.0));
180 ApplicationContainer gwCbr = cbrHelper.Install(gwUsers.Get(0));
181 gwCbr.Start(Seconds(1.0));
182 gwCbr.Stop(Seconds(2.1));
185 sinkHelper.SetAttribute(
187 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port))));
188 cbrHelper.SetAttribute(
190 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port))));
193 ApplicationContainer utSink = sinkHelper.Install(utUsers.Get(0));
194 utSink.Start(Seconds(1.0));
195 utSink.Stop(Seconds(10.0));
198 ApplicationContainer utCbr = cbrHelper.Install(utUsers.Get(0));
199 utCbr.Start(Seconds(7.0));
200 utCbr.Stop(Seconds(9.1));
206 NS_LOG_INFO(
"--- Tutorial-example ---");
207 NS_LOG_INFO(
" Scenario used: " << scenario);
229 simulationHelper->RunSimulation();
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
@ LARGER
LARGER Larger scenario used as base.
@ FULL
FULL Full scenario used as base.
@ SIMPLE
SIMPLE Simple scenario used as base.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.