130 std::ifstream myfile(path);
131 std::string delimiter =
" ";
135 if (myfile.is_open())
138 while (std::getline(myfile, line))
140 std::vector<std::string> tokens =
Split(line,
' ');
141 if (tokens.size() == 2)
143 if ((uint32_t)std::stoi(tokens[0]) == time)
145 NS_TEST_ASSERT_MSG_EQ_TOL(std::stof(tokens[1]),
148 "Incorrect throughput for statistic " << path);
157 NS_TEST_ASSERT_MSG_EQ(0, 1,
"Cannot find time " << time <<
" for trace file " << path);
162 NS_TEST_ASSERT_MSG_EQ(0, 1,
"Cannot read trace file " << path);
173 Singleton<SatIdMapper>::Get()->Reset();
180 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
182 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
185 Config::SetDefault(
"ns3::SatOrbiterFeederPhy::QueueSize", UintegerValue(100000));
187 Config::SetDefault(
"ns3::SatHelper::HandoversEnabled", BooleanValue(
true));
188 Config::SetDefault(
"ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
190 Config::SetDefault(
"ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(
true));
191 Config::SetDefault(
"ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
195 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
198 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
199 Ptr<SimulationHelper> simulationHelper =
200 CreateObject<SimulationHelper>(
"test-sat-handover/test1");
201 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
202 simulationHelper->SetGwUserCount(1);
203 simulationHelper->SetUserCountPerUt(1);
204 simulationHelper->SetBeamSet({0, 20, 21, 22, 32, 33, 34, 35, 36, 37, 44, 45, 46,
205 47, 53, 54, 55, 56, 59, 60, 61, 66, 67, 68, 71, 72});
206 simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
208 simulationHelper->LoadScenario(
"constellation-eutelsat-geo-2-sats-handovers");
211 "/additional-input/utpositions/mobiles/scenario6";
214 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
219 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
220 Singleton<SatTopology>::Get()->GetUtUserNodes(),
225 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
237 simulationHelper->SetSimulationTime(Seconds(30));
238 simulationHelper->RunSimulation();
240 Simulator::Destroy();
243 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
244 "stat-per-sat-fwd-app-throughput-scatter-1.txt",
247 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
248 "stat-per-sat-fwd-app-throughput-scatter-2.txt",
251 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
252 "stat-per-sat-fwd-app-throughput-scatter-1.txt",
255 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
256 "stat-per-sat-fwd-app-throughput-scatter-2.txt",
261 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
262 "stat-per-sat-fwd-user-mac-throughput-scatter-1.txt",
265 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
266 "stat-per-sat-fwd-user-mac-throughput-scatter-2.txt",
269 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
270 "stat-per-sat-fwd-user-mac-throughput-scatter-1.txt",
273 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
274 "stat-per-sat-fwd-user-mac-throughput-scatter-2.txt",
279 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
280 "stat-per-beam-fwd-app-throughput-scatter-1-35.txt",
283 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
284 "stat-per-beam-fwd-app-throughput-scatter-2-20.txt",
287 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
288 "stat-per-beam-fwd-app-throughput-scatter-1-35.txt",
291 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
292 "stat-per-beam-fwd-app-throughput-scatter-2-20.txt",
297 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
298 "stat-per-beam-fwd-user-mac-throughput-scatter-1-35.txt",
301 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
302 "stat-per-beam-fwd-user-mac-throughput-scatter-2-20.txt",
305 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
306 "stat-per-beam-fwd-user-mac-throughput-scatter-1-35.txt",
309 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
310 "stat-per-beam-fwd-user-mac-throughput-scatter-2-20.txt",
315 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
316 "stat-per-gw-fwd-app-throughput-scatter-1.txt",
319 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
320 "stat-per-gw-fwd-app-throughput-scatter-2.txt",
323 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
324 "stat-per-gw-fwd-app-throughput-scatter-1.txt",
327 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
328 "stat-per-gw-fwd-app-throughput-scatter-2.txt",
333 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
334 "stat-per-gw-fwd-user-mac-throughput-scatter-1.txt",
337 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
338 "stat-per-gw-fwd-user-mac-throughput-scatter-2.txt",
341 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
342 "stat-per-gw-fwd-user-mac-throughput-scatter-1.txt",
345 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
346 "stat-per-gw-fwd-user-mac-throughput-scatter-2.txt",
351 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
352 "stat-per-ut-fwd-app-throughput-scatter-1.txt",
355 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
356 "stat-per-ut-fwd-app-throughput-scatter-2.txt",
359 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
360 "stat-per-ut-fwd-app-throughput-scatter-3.txt",
363 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
364 "stat-per-ut-fwd-app-throughput-scatter-4.txt",
367 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
368 "stat-per-ut-fwd-app-throughput-scatter-1.txt",
371 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
372 "stat-per-ut-fwd-app-throughput-scatter-2.txt",
375 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
376 "stat-per-ut-fwd-app-throughput-scatter-3.txt",
379 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
380 "stat-per-ut-fwd-app-throughput-scatter-4.txt",
385 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
386 "stat-per-ut-fwd-user-mac-throughput-scatter-1.txt",
389 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
390 "stat-per-ut-fwd-user-mac-throughput-scatter-2.txt",
393 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
394 "stat-per-ut-fwd-user-mac-throughput-scatter-3.txt",
397 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
398 "stat-per-ut-fwd-user-mac-throughput-scatter-4.txt",
401 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
402 "stat-per-ut-fwd-user-mac-throughput-scatter-1.txt",
405 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
406 "stat-per-ut-fwd-user-mac-throughput-scatter-2.txt",
409 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
410 "stat-per-ut-fwd-user-mac-throughput-scatter-3.txt",
413 TestFileValue(
"contrib/satellite/data/sims/test-sat-handover/test1/"
414 "stat-per-ut-fwd-user-mac-throughput-scatter-4.txt",
474 Singleton<SatIdMapper>::Get()->Reset();
481 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
483 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
486 Config::SetDefault(
"ns3::SatOrbiterFeederPhy::QueueSize", UintegerValue(100000));
488 Config::SetDefault(
"ns3::SatHelper::HandoversEnabled", BooleanValue(
true));
489 Config::SetDefault(
"ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
491 Config::SetDefault(
"ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(
true));
492 Config::SetDefault(
"ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
496 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
499 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
500 Ptr<SimulationHelper> simulationHelper =
501 CreateObject<SimulationHelper>(
"test-sat-handover/test2");
502 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
503 simulationHelper->SetSimulationTime(Seconds(50));
504 simulationHelper->SetGwUserCount(1);
505 simulationHelper->SetUserCountPerUt(1);
506 std::set<uint32_t> beamSetAll = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
507 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
508 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
509 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
510 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72};
511 simulationHelper->SetBeamSet(beamSetAll);
512 simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
514 simulationHelper->LoadScenario(
"constellation-leo-2-satellites");
516 Ptr<SatHelper> helper = simulationHelper->CreateSatScenario(
SatHelper::NONE);
518 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
519 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
521 Config::SetDefault(
"ns3::CbrApplication::Interval", StringValue(
"100ms"));
522 Config::SetDefault(
"ns3::CbrApplication::PacketSize", UintegerValue(512));
525 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory", Address());
526 CbrHelper cbrHelper(
"ns3::UdpSocketFactory", Address());
527 ApplicationContainer sinkContainer;
528 ApplicationContainer cbrContainer;
530 for (uint32_t i = 0; i < utUsers.GetN(); i++)
532 InetSocketAddress utUserAddr =
533 InetSocketAddress(helper->GetUserAddress(utUsers.Get(i)), port);
536 sinkHelper.SetAttribute(
"Local", AddressValue(Address(utUserAddr)));
537 sinkContainer.Add(sinkHelper.Install(utUsers.Get(i)));
540 cbrHelper.SetAttribute(
"Remote", AddressValue(Address(utUserAddr)));
541 auto app = cbrHelper.Install(gwUsers.Get(0)).Get(0);
542 app->SetStartTime(Seconds(1.0));
543 cbrContainer.Add(app);
545 sinkContainer.Start(Seconds(1.0));
546 sinkContainer.Stop(Seconds(45.0));
548 simulationHelper->RunSimulation();
550 Simulator::Destroy();
552 for (uint32_t i = 0; i < 5; i++)
554 Ptr<PacketSink> utReceiver = DynamicCast<PacketSink>(sinkContainer.Get(i));
555 Ptr<CbrApplication> gwSender = DynamicCast<CbrApplication>(cbrContainer.Get(i));
557 NS_TEST_ASSERT_MSG_NE(gwSender->GetSent(), 0,
"Nothing sent by GW app " << i <<
"!");
559 NS_TEST_ASSERT_MSG_EQ_TOL(utReceiver->GetTotalRx(),
561 gwSender->GetSent() / 5,
562 "Too many packets were lost to UT!");