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"
40 NS_LOG_COMPONENT_DEFINE(
"sat-lora-handover-example");
43 main(
int argc,
char* argv[])
45 Time appStartTime = Seconds(0.001);
46 Time simLength = Seconds(100);
48 uint32_t packetSize = 24;
49 Time loraInterval = Seconds(10);
50 std::string interval =
"10s";
52 double frameAllocatedBandwidthHz = 15000;
53 double frameCarrierAllocatedBandwidthHz = 15000;
54 double frameCarrierRollOff = 0.22;
55 double frameCarrierSpacing = 0;
56 uint32_t frameSpreadingFactor = 256;
58 Time firstWindowDelay = MilliSeconds(1000);
59 Time secondWindowDelay = Seconds(2);
60 Time firstWindowDuration = MilliSeconds(900);
61 Time secondWindowDuration = MilliSeconds(400);
62 Time firstWindowAnswerDelay = Seconds(1);
63 Time secondWindowAnswerDelay = Seconds(2);
65 Ptr<SimulationHelper> simulationHelper =
66 CreateObject<SimulationHelper>(
"example-lora-handover");
69 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
71 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
75 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
76 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
82 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
83 TimeValue(firstWindowDelay));
84 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay",
85 TimeValue(secondWindowDelay));
86 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
87 TimeValue(firstWindowDuration));
88 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
89 TimeValue(secondWindowDuration));
90 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
91 TimeValue(firstWindowAnswerDelay));
92 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay",
93 TimeValue(secondWindowAnswerDelay));
96 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
97 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
100 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
102 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
104 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz",
105 DoubleValue(frameAllocatedBandwidthHz));
106 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
107 DoubleValue(frameCarrierAllocatedBandwidthHz));
108 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierRollOff",
109 DoubleValue(frameCarrierRollOff));
110 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierSpacing",
111 DoubleValue(frameCarrierSpacing));
112 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_SpreadingFactor",
113 UintegerValue(frameSpreadingFactor));
116 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaServiceCount", UintegerValue(4));
117 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
118 BooleanValue(
false));
119 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
120 BooleanValue(
false));
121 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
122 BooleanValue(
false));
123 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
124 BooleanValue(
false));
125 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
126 BooleanValue(
false));
127 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
128 BooleanValue(
false));
129 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
130 BooleanValue(
false));
131 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
132 BooleanValue(
false));
133 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
134 BooleanValue(
false));
135 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
136 BooleanValue(
false));
137 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
138 BooleanValue(
false));
139 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
140 BooleanValue(
false));
143 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
145 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
148 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
150 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
152 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
154 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
156 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
157 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
158 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDelay", StringValue(
"0s"));
159 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::FirstWindow", StringValue(
"0s"));
160 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
161 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::SpreadingFactor", UintegerValue(1));
162 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::DetectionThreshold", DoubleValue(0));
163 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
166 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
168 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
170 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
172 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
174 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
176 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
179 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
181 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
183 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_SlottedAlohaAllowed",
184 BooleanValue(
false));
185 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_CrdsaAllowed",
186 BooleanValue(
false));
187 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_EssaAllowed", BooleanValue(
true));
190 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
192 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
195 Config::SetDefault(
"ns3::SatHelper::HandoversEnabled", BooleanValue(
true));
196 Config::SetDefault(
"ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
198 Config::SetDefault(
"ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(
true));
199 Config::SetDefault(
"ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
203 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
206 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
208 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
209 simulationHelper->SetSimulationTime(simLength);
210 simulationHelper->SetGwUserCount(1);
211 simulationHelper->SetUserCountPerUt(1);
212 std::set<uint32_t> beamSetAll = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
213 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
214 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
215 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
216 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72};
217 simulationHelper->SetBeamSet(beamSetAll);
218 simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
220 simulationHelper->LoadScenario(
"constellation-leo-2-satellites-lora");
224 simulationHelper->GetTrafficHelper()->AddLoraCbrTraffic(
227 Singleton<SatTopology>::Get()->GetGwUserNode(0),
228 Singleton<SatTopology>::Get()->GetUtUserNodes(),
242 std::string outputPath = Singleton<SatEnvVariables>::Get()->LocateDirectory(
243 "contrib/satellite/data/sims/example-lora-handover");
244 Config::SetDefault(
"ns3::ConfigStore::Filename",
245 StringValue(outputPath +
"/output-attributes.xml"));
246 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
247 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
248 ConfigStore outputConfig;
249 outputConfig.ConfigureDefaults();
251 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
313 simulationHelper->EnableProgressLogs();
314 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.