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-regenerative-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(500);
71 Time firstWindowAnswerDelay = Seconds(1);
72 Time secondWindowAnswerDelay = Seconds(2);
74 Ptr<SimulationHelper> simulationHelper =
75 CreateObject<SimulationHelper>(
"example-lora-regenerative");
79 cmd.AddValue(
"modelPP",
"interferenceModePerPacket", interferenceModePerPacket);
80 cmd.AddValue(
"traces",
"displayTraces", displayTraces);
81 cmd.AddValue(
"utsPerBeam",
"Number of UTs per spot-beam", nbUtsPerBeam);
82 cmd.AddValue(
"simLength",
"Simulation duration in seconds", simLength);
83 cmd.AddValue(
"packetSize",
"Constant packet size in bytes", packetSize);
84 cmd.AddValue(
"loraInterval",
85 "Interval between two transmissions for each UT in seconds",
87 cmd.AddValue(
"frameAllocatedBandwidthHz",
88 "Allocated bandwidth in Hz",
89 frameAllocatedBandwidthHz);
90 cmd.AddValue(
"frameCarrierAllocatedBandwidthHz",
91 "Allocated carrier bandwidth in Hz",
92 frameCarrierAllocatedBandwidthHz);
93 cmd.AddValue(
"frameCarrierRollOff",
"Roll-off factor", frameCarrierRollOff);
94 cmd.AddValue(
"frameCarrierSpacing",
"Carrier spacing factor", frameCarrierSpacing);
95 cmd.AddValue(
"frameSpreadingFactor",
"Carrier spreading factor", frameSpreadingFactor);
97 cmd.AddValue(
"firstWindowDelay",
98 "Delay between end of transmission and opening of first window on End Device",
100 cmd.AddValue(
"secondWindowDelay",
101 "Delay between end of transmission and opening of second window on End Device",
103 cmd.AddValue(
"firstWindowDuration",
"First window duration on End Device", firstWindowDuration);
104 cmd.AddValue(
"secondWindowDuration",
105 "Second window duration on End Device",
106 secondWindowDuration);
107 cmd.AddValue(
"firstWindowAnswerDelay",
108 "Delay between end of reception and start of ack on first window on Gateway",
109 firstWindowAnswerDelay);
110 cmd.AddValue(
"secondWindowAnswerDelay",
111 "Delay between end of reception and start of ack on second window on Gateway",
112 secondWindowAnswerDelay);
113 simulationHelper->AddDefaultUiArguments(cmd);
114 cmd.Parse(argc, argv);
117 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
119 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
123 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
124 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
130 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
131 TimeValue(firstWindowDelay));
132 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay",
133 TimeValue(secondWindowDelay));
134 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
135 TimeValue(firstWindowDuration));
136 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
137 TimeValue(secondWindowDuration));
138 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
139 TimeValue(firstWindowAnswerDelay));
140 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay",
141 TimeValue(secondWindowAnswerDelay));
144 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
145 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
148 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
150 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
152 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz",
153 DoubleValue(frameAllocatedBandwidthHz));
154 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
155 DoubleValue(frameCarrierAllocatedBandwidthHz));
156 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierRollOff",
157 DoubleValue(frameCarrierRollOff));
158 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierSpacing",
159 DoubleValue(frameCarrierSpacing));
160 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_SpreadingFactor",
161 UintegerValue(frameSpreadingFactor));
164 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaServiceCount", UintegerValue(4));
165 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
166 BooleanValue(
false));
167 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
168 BooleanValue(
false));
169 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
170 BooleanValue(
false));
171 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
172 BooleanValue(
false));
173 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
174 BooleanValue(
false));
175 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
176 BooleanValue(
false));
177 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
178 BooleanValue(
false));
179 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
180 BooleanValue(
false));
181 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
182 BooleanValue(
false));
183 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
184 BooleanValue(
false));
185 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
186 BooleanValue(
false));
187 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
188 BooleanValue(
false));
191 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
193 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
196 if (interferenceModePerPacket)
198 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
203 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
206 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
208 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
210 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
212 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
213 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
214 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDelay", StringValue(
"0s"));
215 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::FirstWindow", StringValue(
"0s"));
216 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
217 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::SpreadingFactor", UintegerValue(1));
218 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::DetectionThreshold", DoubleValue(0));
219 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
222 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
224 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
226 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
228 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
230 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
232 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
235 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
237 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
239 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_SlottedAlohaAllowed",
240 BooleanValue(
false));
241 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_CrdsaAllowed",
242 BooleanValue(
false));
243 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_EssaAllowed", BooleanValue(
true));
246 simulationHelper->SetSimulationTime(simLength);
248 simulationHelper->SetGwUserCount(nbGwUser);
249 simulationHelper->SetUtCountPerBeam(nbUtsPerBeam);
250 simulationHelper->SetUserCountPerUt(nbEndUsersPerUt);
251 simulationHelper->SetBeams(beams);
253 simulationHelper->LoadScenario(
"geo-33E-lora");
255 simulationHelper->CreateSatScenario();
266 simulationHelper->GetTrafficHelper()->AddLoraPeriodicTraffic(
269 Singleton<SatTopology>::Get()->GetUtNodes(),
275 simulationHelper->EnableProgressLogs();
277 std::string outputPath = Singleton<SatEnvVariables>::Get()->LocateDirectory(
278 "contrib/satellite/data/sims/example-lora-regenerative");
279 Config::SetDefault(
"ns3::ConfigStore::Filename",
280 StringValue(outputPath +
"/output-attributes.xml"));
281 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
282 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
283 ConfigStore outputConfig;
284 outputConfig.ConfigureDefaults();
288 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
351 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.