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"
39 NS_LOG_COMPONENT_DEFINE(
"sat-vhts-example");
43 EnableRA(std::string raModel,
bool dynamicLoadControl)
46 if (raModel ==
"CRDSA")
48 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
51 else if (raModel ==
"MARSALA")
53 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
58 NS_FATAL_ERROR(
"Incorrect RA model");
62 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
66 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
70 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
71 BooleanValue(dynamicLoadControl));
73 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
80 auto tracedPosition = DynamicCast<const SatTracedMobilityModel>(position);
81 NS_ASSERT_MSG(tracedPosition !=
nullptr,
"Course changed for a non-mobile UT");
85 main(
int argc,
char* argv[])
88 std::string beams =
"8";
90 uint32_t nbUtsPerBeam = 10;
91 uint32_t nbEndUsersPerUt = 1;
93 Time appStartTime = Seconds(0.001);
94 Time simLength = Seconds(60.0);
96 std::string raModel =
"CRDSA";
97 bool dynamicLoadControl =
true;
98 bool utMobility =
false;
99 std::string mobilityPath =
"contrib/satellite/data/utpositions/mobiles/scenario0/trajectory";
100 std::string burstLengthStr =
"ShortBurst";
103 uint32_t superFrameConfForSeq0Int = 0;
106 uint32_t frameConfigTypeInt = 0;
109 std::string modcodsUsed =
110 "QPSK_1_TO_2 QPSK_3_TO_5 QPSK_2_TO_3 QPSK_3_TO_4 QPSK_4_TO_5 QPSK_5_TO_6 QPSK_8_TO_9 "
112 "8PSK_3_TO_5 8PSK_2_TO_3 8PSK_3_TO_4 8PSK_5_TO_6 8PSK_8_TO_9 8PSK_9_TO_10 "
113 "16APSK_2_TO_3 16APSK_3_TO_4 16APSK_4_TO_5 16APSK_5_TO_6 16APSK_8_TO_9 16APSK_9_TO_10 "
114 "32APSK_3_TO_4 32APSK_4_TO_5 32APSK_5_TO_6 32APSK_8_TO_9";
116 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"sat-vhts-example");
120 cmd.AddValue(
"Beams",
"Ids of beams used (each separated by _)", beams);
121 cmd.AddValue(
"NbGw",
"Number of GWs", nbGw);
122 cmd.AddValue(
"NbUtsPerBeam",
"Number of UTs per spot-beam", nbUtsPerBeam);
123 cmd.AddValue(
"NbEndUsersPerUt",
"Number of end users per UT", nbEndUsersPerUt);
124 cmd.AddValue(
"AppStartTime",
"Applications start time (in seconds, or add unit)", appStartTime);
125 cmd.AddValue(
"SimLength",
"Simulation length (in seconds, or add unit)", simLength);
126 cmd.AddValue(
"RaModel",
"Random Access model chosen (CRDSA or MARSALA)", raModel);
127 cmd.AddValue(
"DynamicLoadControl",
"Set true to use dynamic load control", dynamicLoadControl);
128 cmd.AddValue(
"UtMobility",
"Set true to use UT mobility", utMobility);
129 cmd.AddValue(
"mobilityPath",
130 "Path to the mobility file",
132 cmd.AddValue(
"BurstLength",
133 "Burst length (can be ShortBurst, LongBurst or ShortAndLongBurst)",
135 cmd.AddValue(
"SuperFrameConfForSeq0",
136 "Super frame configuration used for super frame sequence 0",
137 superFrameConfForSeq0Int);
138 cmd.AddValue(
"FrameConfigType",
139 "The frame configuration type used for super frame",
141 simulationHelper->AddDefaultUiArguments(cmd);
142 cmd.Parse(argc, argv);
144 std::replace(beams.begin(), beams.end(),
'_',
' ');
147 if (burstLengthStr ==
"ShortBurst")
151 else if (burstLengthStr ==
"LongBurst")
155 else if (burstLengthStr ==
"ShortAndLongBurst")
161 NS_FATAL_ERROR(
"Incorrect burst size");
164 switch (superFrameConfForSeq0Int)
179 NS_FATAL_ERROR(
"Incorrect super frame conf");
182 switch (frameConfigTypeInt)
197 NS_FATAL_ERROR(
"Incorrect frame type");
200 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
201 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
207 Config::SetDefault(
"ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(2e+09));
208 Config::SetDefault(
"ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(8e+09));
209 Config::SetDefault(
"ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(500e+06));
210 Config::SetDefault(
"ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.05));
213 Config::SetDefault(
"ns3::SatBeamHelper::DvbVersion", StringValue(
"DVB_S2"));
214 Config::SetDefault(
"ns3::SatBbFrameConf::ModCodsUsed", StringValue(modcodsUsed));
215 Config::SetDefault(
"ns3::SatBbFrameConf::DefaultModCod", StringValue(
"QPSK_1_TO_2"));
221 Config::SetDefault(
"ns3::SatConf::RtnUserLinkBandwidth", DoubleValue(500e+06));
222 Config::SetDefault(
"ns3::SatConf::RtnFeederLinkBandwidth", DoubleValue(2e+09));
223 Config::SetDefault(
"ns3::SatWaveformConf::BurstLength", EnumValue(burstLength));
225 EnableRA(raModel, dynamicLoadControl);
227 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0", EnumValue(superFrameConfForSeq0));
228 switch (superFrameConfForSeq0)
231 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType", EnumValue(frameConfigType));
234 Config::SetDefault(
"ns3::SatSuperframeConf1::FrameConfigType", EnumValue(frameConfigType));
237 Config::SetDefault(
"ns3::SatSuperframeConf2::FrameConfigType", EnumValue(frameConfigType));
240 Config::SetDefault(
"ns3::SatSuperframeConf3::FrameConfigType", EnumValue(frameConfigType));
243 NS_FATAL_ERROR(
"Impossible to reach here");
249 simulationHelper->SetSimulationTime(simLength);
251 simulationHelper->SetGwUserCount(nbGw);
252 simulationHelper->SetUtCountPerBeam(nbUtsPerBeam);
253 simulationHelper->SetUserCountPerUt(nbEndUsersPerUt);
254 simulationHelper->SetBeams(beams);
256 simulationHelper->LoadScenario(
"geo-33E");
258 simulationHelper->CreateSatScenario();
260 Ptr<SatHelper> satHelper = simulationHelper->GetSatelliteHelper();
261 Ptr<SatTrafficHelper> trafficHelper = simulationHelper->GetTrafficHelper();
264 Singleton<SatTopology>::Get()->GetGwUserNodes(),
265 Singleton<SatTopology>::Get()->GetUtUserNodes(),
270 Singleton<SatTopology>::Get()->GetGwUserNodes(),
271 Singleton<SatTopology>::Get()->GetUtUserNodes(),
295 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetObject<
SatMobilityModel>();
296 Ptr<Node> node = satHelper->LoadMobileUtFromFile(0, mobilityPath);
306 simulationHelper->EnableProgressLogs();
308 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(
"output-attributes.xml"));
309 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
310 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
311 ConfigStore outputConfig;
312 outputConfig.ConfigureDefaults();
314 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
369 if (raModel ==
"MARSALA")
375 simulationHelper->RunSimulation();
SatWaveFormBurstLength_t
Definition for different types of Capacity Request (CR) messages.
Keep track of the current position and velocity of an object in satellite network.
@ RA_COLLISION_CHECK_AGAINST_SINR
SuperFrameConfiguration_t
Configurable Super Frames.
@ SUPER_FRAME_CONFIG_0
SUPER_FRAME_CONFIG_0.
@ SUPER_FRAME_CONFIG_3
SUPER_FRAME_CONFIG_3.
@ SUPER_FRAME_CONFIG_1
SUPER_FRAME_CONFIG_1.
@ SUPER_FRAME_CONFIG_2
SUPER_FRAME_CONFIG_2.
ConfigType_t
Enum for configuration types.
@ CONFIG_TYPE_2
Configuration type 2.
@ CONFIG_TYPE_1
Configuration type 1.
@ CONFIG_TYPE_0
Configuration type 0.
@ CONFIG_TYPE_3
Configuration type 3.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Ptr< SatMobilityModel > satMobility
void EnableRA(std::string raModel, bool dynamicLoadControl)
static void SatCourseChange(std::string context, Ptr< const SatMobilityModel > position)