22 #include "ns3/config-store-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"
41 NS_LOG_COMPONENT_DEFINE(
"sat-generic-launcher");
49 ChangeCno(
const std::vector<Ptr<SatUtPhy>>& utsPhysicalLayers)
54 for (
auto& phy : utsPhysicalLayers)
56 phy->SetAttribute(
"TxMaxPowerDbw", DoubleValue(
g_txMaxPower));
64 main(
int argc,
char* argv[])
66 bool varyingCno(
false);
67 uint32_t maxSubdivisions(0);
68 uint32_t frameConfigType(2);
69 double initialBandwidth(3.75e6);
70 Time superframeDuration(MicroSeconds(26500));
71 std::string inputFileNameWithPath =
72 Singleton<SatEnvVariables>::Get()->LocateDirectory(
"contrib/satellite/examples") +
73 "/generic-input-attributes.xml";
75 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"generic-launcher");
76 simulationHelper->SetDefaultValues();
79 cmd.AddValue(
"MaxCarrierSubdivision",
80 "The maximum amount of subdivision for a single carrier",
82 cmd.AddValue(
"FrameConfigType",
83 "The frame configuration type used for super frame",
85 cmd.AddValue(
"UseVaryingCno",
86 "Simulate varying C/N0 for UTs instead of changing their traffic overtime",
88 simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
89 cmd.Parse(argc, argv);
91 Config::SetDefault(
"ns3::SimulationHelperConf::BeamsIDs", StringValue(
"12"));
92 Config::SetDefault(
"ns3::SimulationHelperConf::UtCountPerBeam",
93 StringValue(
"ns3::ConstantRandomVariable[Constant=30]"));
94 Config::SetDefault(
"ns3::SimulationHelperConf::UserCountPerUt",
95 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"));
97 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
98 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType",
99 StringValue(
"ConfigType_" + std::to_string(frameConfigType)));
100 Config::SetDefault(
"ns3::SatSuperframeConf0::MaxCarrierSubdivision",
101 UintegerValue(maxSubdivisions));
102 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz",
103 DoubleValue(initialBandwidth));
104 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
105 DoubleValue(initialBandwidth));
106 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierRollOff", DoubleValue(0.2));
107 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierSpacing", DoubleValue(0.0));
108 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_RandomAccessFrame", BooleanValue(
false));
110 Config::SetDefault(
"ns3::SatSuperframeSeq::TargetDuration", TimeValue(superframeDuration));
111 Config::SetDefault(
"ns3::CbrApplication::Interval", TimeValue(superframeDuration));
113 Config::SetDefault(
"ns3::SatFwdLinkScheduler::CnoEstimationWindow",
114 TimeValue(MilliSeconds(500)));
115 Config::SetDefault(
"ns3::SatRequestManager::CnoReportInterval", TimeValue(
g_cnoInterval));
116 Config::SetDefault(
"ns3::SatBeamScheduler::CnoEstimationMode",
117 StringValue(
"MinimumValueInWindow"));
118 Config::SetDefault(
"ns3::SatBeamScheduler::CnoEstimationWindow", TimeValue(
g_cnoInterval));
120 Config::SetDefault(
"ns3::SatUtPhy::TxMaxPowerDbw", DoubleValue(
g_txMaxPower));
121 Config::SetDefault(
"ns3::SatOrbiterUserPhy::TxMaxPowerDbw", DoubleValue(15.0));
122 Config::SetDefault(
"ns3::SatOrbiterFeederPhy::FixedAmplificationGainDb", DoubleValue(200.0));
124 simulationHelper->ReadInputAttributesFromFile(inputFileNameWithPath);
127 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
129 simulationHelper->SetBeams(simulationConf->m_enabledBeams);
130 simulationHelper->SetUtCountPerBeam(simulationConf->m_utCount);
131 simulationHelper->SetUserCountPerUt(simulationConf->m_utUserCount);
132 simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
135 simulationHelper->LoadScenario(
"geo-33E");
137 simulationHelper->CreateSatScenario(
SatHelper::NONE, simulationConf->m_mobileUtsFolder);
138 if (simulationConf->m_activateProgressLogging)
140 simulationHelper->EnableProgressLogs();
143 simulationHelper->StoreAttributesToFile(
"parametersUsed.xml");
147 std::vector<Ptr<SatUtPhy>> utsPhysicalLayers;
148 NodeContainer utNodes = Singleton<SatTopology>::Get()->GetUtNodes();
150 for (NodeContainer::Iterator it = utNodes.Begin(); it != utNodes.End(); it++)
153 for (uint32_t j = 0; j < node->GetNDevices(); ++j)
155 Ptr<SatNetDevice> dev = DynamicCast<SatNetDevice>(node->GetDevice(j));
158 Ptr<SatUtPhy> phy = DynamicCast<SatUtPhy>(dev->GetPhy());
161 utsPhysicalLayers.push_back(phy);
166 Simulator::Schedule(Seconds(0), &
ChangeCno, utsPhysicalLayers);
168 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
173 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
174 Singleton<SatTopology>::Get()->GetUtUserNodes(),
182 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
187 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
188 Singleton<SatTopology>::Get()->GetUtUserNodes(),
193 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
198 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
199 Singleton<SatTopology>::Get()->GetUtUserNodes(),
205 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
210 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
211 Singleton<SatTopology>::Get()->GetUtUserNodes(),
217 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
222 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
223 Singleton<SatTopology>::Get()->GetUtUserNodes(),
229 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
234 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
235 Singleton<SatTopology>::Get()->GetUtUserNodes(),
241 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
246 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
247 Singleton<SatTopology>::Get()->GetUtUserNodes(),
253 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
258 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
259 Singleton<SatTopology>::Get()->GetUtUserNodes(),
265 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
270 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
271 Singleton<SatTopology>::Get()->GetUtUserNodes(),
277 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
282 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
283 Singleton<SatTopology>::Get()->GetUtUserNodes(),
289 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
294 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
295 Singleton<SatTopology>::Get()->GetUtUserNodes(),
301 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
306 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
307 Singleton<SatTopology>::Get()->GetUtUserNodes(),
313 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
318 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
319 Singleton<SatTopology>::Get()->GetUtUserNodes(),
326 if (simulationConf->m_activateStatistics)
328 simulationHelper->CreateDefaultStats();
329 Ptr<SatStatsHelperContainer> stats = simulationHelper->GetStatisticsContainer();
346 simulationHelper->RunSimulation();
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static Time g_simulationTime
static double g_txMaxPower
static Time g_cnoInterval
static void ChangeCno(const std::vector< Ptr< SatUtPhy >> &utsPhysicalLayers)