22 #include "ns3/core-module.h"
23 #include "ns3/internet-module.h"
24 #include "ns3/network-module.h"
25 #include "ns3/satellite-module.h"
26 #include "ns3/traffic-module.h"
55 NS_LOG_COMPONENT_DEFINE(
"sat-nrtv-example");
58 main(
int argc,
char* argv[])
64 std::string scenario =
"simple";
65 double duration = 100;
69 auto simulationHelper = CreateObject<SimulationHelper>(
"example-nrtv");
70 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
71 Config::SetDefault(
"ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(
true));
75 cmd.AddValue(
"scenario",
"Test scenario to use. (simple, larger or full)", scenario);
76 cmd.AddValue(
"duration",
"Simulation duration (in seconds)", duration);
77 simulationHelper->AddDefaultUiArguments(cmd);
78 cmd.Parse(argc, argv);
80 if (scenario ==
"larger")
84 else if (scenario ==
"full")
90 simulationHelper->SetOutputTag(scenario);
91 simulationHelper->SetSimulationTime(duration);
96 LogComponentEnable(
"sat-nrtv-example", LOG_LEVEL_INFO);
102 simulationHelper->LoadScenario(
"geo-33E");
105 simulationHelper->CreateSatScenario(satScenario);
108 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
109 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
111 NrtvHelper nrtvHelper(TypeId::LookupByName(
"ns3::TcpSocketFactory"));
112 nrtvHelper.InstallUsingIpv4(gwUsers.Get(0), utUsers);
113 nrtvHelper.GetServer().Start(Seconds(1.0));
115 auto apps = nrtvHelper.GetClients();
116 apps.Start(Seconds(3.0));
118 std::vector<Ptr<ClientRxTracePlot>> plots;
119 for (
auto app = apps.Begin(); app != apps.End(); app++, i++)
121 std::stringstream plotName;
122 plotName <<
"NRTV-TCP-client-" << i <<
"-trace";
123 plots.push_back(CreateObject<ClientRxTracePlot>(*app, plotName.str()));
126 NS_LOG_INFO(
"--- sat-nrtv-example ---");
127 NS_LOG_INFO(
" Scenario used: " << scenario);
130 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.