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 Ptr<SatHelper> helper = simulationHelper->CreateSatScenario(satScenario);
147 NodeContainer utUsers;
151 if (scenario ==
"full")
153 NodeContainer uts = helper->GetBeamHelper()->GetUtNodes(0, 1);
154 utUsers = helper->GetUserHelper()->GetUtUsers(uts.Get(0));
158 utUsers = helper->GetUtUsers();
162 NodeContainer gwUsers = helper->GetGwUsers();
167 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
168 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
169 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
170 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
173 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
174 gwSink.Start(Seconds(1.0));
175 gwSink.Stop(Seconds(10.0));
178 ApplicationContainer gwCbr = cbrHelper.Install(gwUsers.Get(0));
179 gwCbr.Start(Seconds(1.0));
180 gwCbr.Stop(Seconds(2.1));
183 sinkHelper.SetAttribute(
185 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port))));
186 cbrHelper.SetAttribute(
188 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port))));
191 ApplicationContainer utSink = sinkHelper.Install(utUsers.Get(0));
192 utSink.Start(Seconds(1.0));
193 utSink.Stop(Seconds(10.0));
196 ApplicationContainer utCbr = cbrHelper.Install(utUsers.Get(0));
197 utCbr.Start(Seconds(7.0));
198 utCbr.Stop(Seconds(9.1));
204 NS_LOG_INFO(
"--- Tutorial-example ---");
205 NS_LOG_INFO(
" Scenario used: " << scenario);
227 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.