22 #include "ns3/applications-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"
27 #include "ns3/traffic-module.h"
31 #define CALL_SAT_STATS_BASIC_ELEMENT(id) \
32 s->Add##id(SatStatsHelper::OUTPUT_SCALAR_FILE); \
33 s->Add##id(SatStatsHelper::OUTPUT_SCATTER_FILE); \
34 s->Add##id(SatStatsHelper::OUTPUT_SCATTER_PLOT);
36 #define CALL_SAT_STATS_BASIC_SET(id) \
37 CALL_SAT_STATS_BASIC_ELEMENT(Global##id) \
38 CALL_SAT_STATS_BASIC_ELEMENT(PerGw##id) \
39 CALL_SAT_STATS_BASIC_ELEMENT(PerBeam##id) \
40 CALL_SAT_STATS_BASIC_ELEMENT(PerUt##id)
42 #define CALL_SAT_STATS_DISTRIBUTION_ELEMENT(id) \
43 s->Add##id(SatStatsHelper::OUTPUT_SCALAR_FILE); \
44 s->Add##id(SatStatsHelper::OUTPUT_SCATTER_FILE); \
45 s->Add##id(SatStatsHelper::OUTPUT_HISTOGRAM_FILE); \
46 s->Add##id(SatStatsHelper::OUTPUT_PDF_FILE); \
47 s->Add##id(SatStatsHelper::OUTPUT_CDF_FILE); \
48 s->Add##id(SatStatsHelper::OUTPUT_SCATTER_PLOT); \
49 s->Add##id(SatStatsHelper::OUTPUT_HISTOGRAM_PLOT); \
50 s->Add##id(SatStatsHelper::OUTPUT_PDF_PLOT); \
51 s->Add##id(SatStatsHelper::OUTPUT_CDF_PLOT);
53 #define CALL_SAT_STATS_DISTRIBUTION_SET(id) \
54 CALL_SAT_STATS_DISTRIBUTION_ELEMENT(Global##id) \
55 CALL_SAT_STATS_DISTRIBUTION_ELEMENT(PerGw##id) \
56 CALL_SAT_STATS_DISTRIBUTION_ELEMENT(PerBeam##id) \
57 CALL_SAT_STATS_DISTRIBUTION_ELEMENT(PerUt##id)
59 #define CALL_SAT_STATS_AVERAGED_DISTRIBUTION_SET(id) \
60 s->AddAverageBeam##id(SatStatsHelper::OUTPUT_HISTOGRAM_FILE); \
61 s->AddAverageBeam##id(SatStatsHelper::OUTPUT_PDF_FILE); \
62 s->AddAverageBeam##id(SatStatsHelper::OUTPUT_CDF_FILE); \
63 s->AddAverageBeam##id(SatStatsHelper::OUTPUT_HISTOGRAM_PLOT); \
64 s->AddAverageBeam##id(SatStatsHelper::OUTPUT_PDF_PLOT); \
65 s->AddAverageBeam##id(SatStatsHelper::OUTPUT_CDF_PLOT); \
67 s->AddAverageUt##id(SatStatsHelper::OUTPUT_HISTOGRAM_FILE); \
68 s->AddAverageUt##id(SatStatsHelper::OUTPUT_PDF_FILE); \
69 s->AddAverageUt##id(SatStatsHelper::OUTPUT_CDF_FILE); \
70 s->AddAverageUt##id(SatStatsHelper::OUTPUT_HISTOGRAM_PLOT); \
71 s->AddAverageUt##id(SatStatsHelper::OUTPUT_PDF_PLOT); \
72 s->AddAverageUt##id(SatStatsHelper::OUTPUT_CDF_PLOT);
87 NS_LOG_COMPONENT_DEFINE(
"sat-cbr-stats-example");
90 main(
int argc,
char* argv[])
92 uint32_t packetSize = 512;
93 std::string interval =
"1s";
94 std::string scenario =
"larger";
99 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
102 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
103 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"example-cbr-stats");
107 cmd.AddValue(
"packetSize",
"Size of constant packet (bytes)", packetSize);
108 cmd.AddValue(
"interval",
"Interval to sent packets in seconds, (e.g. (1s)", interval);
109 cmd.AddValue(
"duration",
"Simulation duration (in seconds)", duration);
110 cmd.AddValue(
"scenario",
"Test scenario to use. (simple, larger or full", scenario);
111 simulationHelper->AddDefaultUiArguments(cmd);
112 cmd.Parse(argc, argv);
114 if (scenario ==
"larger")
118 else if (scenario ==
"full")
124 simulationHelper->SetOutputTag(scenario);
125 simulationHelper->SetSimulationTime(duration);
130 LogComponentEnable(
"sat-cbr-stats-example", LOG_LEVEL_INFO);
136 simulationHelper->LoadScenario(
"geo-33E");
139 Config::SetDefault(
"ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(
true));
140 Ptr<SatHelper> helper = simulationHelper->CreateSatScenario(satScenario);
144 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
150 Config::SetDefault(
"ns3::CbrApplication::Interval", StringValue(interval));
151 Config::SetDefault(
"ns3::CbrApplication::PacketSize", UintegerValue(packetSize));
153 for (uint32_t i = 0; i < gwUsers.GetN(); i++)
155 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
160 Singleton<SatTopology>::Get()->GetGwUserNode(i),
161 Singleton<SatTopology>::Get()->GetUtUserNodes(),
166 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
171 Singleton<SatTopology>::Get()->GetGwUserNode(i),
172 Singleton<SatTopology>::Get()->GetUtUserNodes(),
178 simulationHelper->EnableProgressLogs();
223 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
383 NS_LOG_INFO(
"--- Cbr-stats-example ---");
384 NS_LOG_INFO(
" Scenario used: " << scenario);
385 NS_LOG_INFO(
" PacketSize: " << packetSize);
386 NS_LOG_INFO(
" Interval: " << interval);
389 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.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.