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-lora-example");
42 main(
int argc,
char* argv[])
45 std::string beams =
"3 4 5 6";
47 uint32_t nbGwUser = 1;
48 uint32_t nbUtsPerBeam = 5;
49 uint32_t nbEndUsersPerUt = 1;
51 Time appStartTime = Seconds(0.001);
52 Time simLength = Seconds(15.0);
54 uint32_t packetSize = 24;
55 Time loraInterval = Seconds(10);
56 std::string interval =
"10s";
58 double frameAllocatedBandwidthHz = 15000;
59 double frameCarrierAllocatedBandwidthHz = 15000;
60 double frameCarrierRollOff = 0.22;
61 double frameCarrierSpacing = 0;
62 uint32_t frameSpreadingFactor = 256;
64 bool interferenceModePerPacket =
true;
65 bool displayTraces =
true;
67 Time firstWindowDelay = MilliSeconds(1500);
68 Time secondWindowDelay = Seconds(2);
69 Time firstWindowDuration = MilliSeconds(400);
70 Time secondWindowDuration = MilliSeconds(400);
71 Time firstWindowAnswerDelay = Seconds(1);
72 Time secondWindowAnswerDelay = Seconds(2);
74 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"example-lora");
78 cmd.AddValue(
"modelPP",
"interferenceModePerPacket", interferenceModePerPacket);
79 cmd.AddValue(
"traces",
"displayTraces", displayTraces);
80 cmd.AddValue(
"utsPerBeam",
"Number of UTs per spot-beam", nbUtsPerBeam);
81 cmd.AddValue(
"simLength",
"Simulation duration in seconds", simLength);
82 cmd.AddValue(
"packetSize",
"Constant packet size in bytes", packetSize);
83 cmd.AddValue(
"loraInterval",
84 "Interval between two transmissions for each UT in seconds",
86 cmd.AddValue(
"frameAllocatedBandwidthHz",
87 "Allocated bandwidth in Hz",
88 frameAllocatedBandwidthHz);
89 cmd.AddValue(
"frameCarrierAllocatedBandwidthHz",
90 "Allocated carrier bandwidth in Hz",
91 frameCarrierAllocatedBandwidthHz);
92 cmd.AddValue(
"frameCarrierRollOff",
"Roll-off factor", frameCarrierRollOff);
93 cmd.AddValue(
"frameCarrierSpacing",
"Carrier spacing factor", frameCarrierSpacing);
94 cmd.AddValue(
"frameSpreadingFactor",
"Carrier spreading factor", frameSpreadingFactor);
96 cmd.AddValue(
"firstWindowDelay",
97 "Delay between end of transmission and opening of first window on End Device",
99 cmd.AddValue(
"secondWindowDelay",
100 "Delay between end of transmission and opening of second window on End Device",
102 cmd.AddValue(
"firstWindowDuration",
"First window duration on End Device", firstWindowDuration);
103 cmd.AddValue(
"secondWindowDuration",
104 "Second window duration on End Device",
105 secondWindowDuration);
106 cmd.AddValue(
"firstWindowAnswerDelay",
107 "Delay between end of reception and start of ack on first window on Gateway",
108 firstWindowAnswerDelay);
109 cmd.AddValue(
"secondWindowAnswerDelay",
110 "Delay between end of reception and start of ack on second window on Gateway",
111 secondWindowAnswerDelay);
112 simulationHelper->AddDefaultUiArguments(cmd);
113 cmd.Parse(argc, argv);
116 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
118 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
122 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
123 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
129 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
130 TimeValue(firstWindowDelay));
131 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay",
132 TimeValue(secondWindowDelay));
133 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
134 TimeValue(firstWindowDuration));
135 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
136 TimeValue(secondWindowDuration));
137 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
138 TimeValue(firstWindowAnswerDelay));
139 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay",
140 TimeValue(secondWindowAnswerDelay));
143 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
144 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
147 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
149 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
151 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz",
152 DoubleValue(frameAllocatedBandwidthHz));
153 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
154 DoubleValue(frameCarrierAllocatedBandwidthHz));
155 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierRollOff",
156 DoubleValue(frameCarrierRollOff));
157 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierSpacing",
158 DoubleValue(frameCarrierSpacing));
159 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_SpreadingFactor",
160 UintegerValue(frameSpreadingFactor));
163 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaServiceCount", UintegerValue(4));
164 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
165 BooleanValue(
false));
166 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
167 BooleanValue(
false));
168 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
169 BooleanValue(
false));
170 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
171 BooleanValue(
false));
172 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
173 BooleanValue(
false));
174 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
175 BooleanValue(
false));
176 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
177 BooleanValue(
false));
178 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
179 BooleanValue(
false));
180 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
181 BooleanValue(
false));
182 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
183 BooleanValue(
false));
184 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
185 BooleanValue(
false));
186 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
187 BooleanValue(
false));
190 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
192 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
195 if (interferenceModePerPacket)
197 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
202 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
205 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
207 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
209 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
211 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
212 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
213 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDelay", StringValue(
"0s"));
214 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::FirstWindow", StringValue(
"0s"));
215 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
216 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::SpreadingFactor", UintegerValue(1));
217 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::DetectionThreshold", DoubleValue(0));
218 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
221 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
223 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
225 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
227 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
229 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
231 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
234 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
236 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
238 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_SlottedAlohaAllowed",
239 BooleanValue(
false));
240 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_CrdsaAllowed",
241 BooleanValue(
false));
242 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_EssaAllowed", BooleanValue(
true));
245 simulationHelper->SetSimulationTime(simLength);
247 simulationHelper->SetGwUserCount(nbGwUser);
248 simulationHelper->SetUtCountPerBeam(nbUtsPerBeam);
249 simulationHelper->SetUserCountPerUt(nbEndUsersPerUt);
250 simulationHelper->SetBeams(beams);
252 simulationHelper->LoadScenario(
"geo-33E-lora");
254 simulationHelper->CreateSatScenario();
256 simulationHelper->GetTrafficHelper()->AddLoraCbrTraffic(
259 Singleton<SatTopology>::Get()->GetGwUserNodes(),
260 Singleton<SatTopology>::Get()->GetUtUserNodes(),
273 simulationHelper->EnableProgressLogs();
275 std::string outputPath = Singleton<SatEnvVariables>::Get()->LocateDirectory(
276 "contrib/satellite/data/sims/example-lora");
277 Config::SetDefault(
"ns3::ConfigStore::Filename",
278 StringValue(outputPath +
"/output-attributes.xml"));
279 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
280 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
281 ConfigStore outputConfig;
282 outputConfig.ConfigureDefaults();
286 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
349 simulationHelper->RunSimulation();
@ SATELLITE
For Satellite.
@ RA_COLLISION_CHECK_AGAINST_SINR
@ SUPER_FRAME_CONFIG_4
SUPER_FRAME_CONFIG_4.
@ CONFIG_TYPE_4
Configuration type 4 (ESSA)
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.