107 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
109 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
113 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionEachRequest", BooleanValue(
false));
114 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionPeriod",
115 TimeValue(MilliSeconds(10)));
116 Config::SetDefault(
"ns3::SatHelper::GwUsers", UintegerValue(3));
118 Ptr<SimulationHelper> simulationHelper =
119 CreateObject<SimulationHelper>(
"test-sat-constellation");
122 simulationHelper->SetBeamSet({43, 30});
123 simulationHelper->SetUserCountPerUt(5);
125 simulationHelper->LoadScenario(
"constellation-eutelsat-geo-2-sats-no-isls");
127 simulationHelper->CreateSatScenario();
129 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
130 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
131 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
132 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
133 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
135 uint32_t countNetDevices = 0;
136 for (uint32_t i = 0; i < sats.GetN(); i++)
138 for (uint32_t j = 0; j < sats.Get(i)->GetNDevices(); j++)
140 if (DynamicCast<SatOrbiterNetDevice>(sats.Get(i)->GetDevice(j)) !=
nullptr)
142 countNetDevices += 1;
147 NS_TEST_ASSERT_MSG_EQ(sats.GetN(), 2,
"Topology must contain 2 satellites");
148 NS_TEST_ASSERT_MSG_EQ(countNetDevices,
150 "Topology must contain 2 satellite Orbiter Net Devices");
151 NS_TEST_ASSERT_MSG_EQ(gws.GetN(), 2,
"Topology must contain 2 GWs");
152 NS_TEST_ASSERT_MSG_EQ(uts.GetN(), 3,
"Topology must contain 3 UTs");
153 NS_TEST_ASSERT_MSG_EQ(gwUsers.GetN(), 3,
"Topology must contain 3 GW users");
154 NS_TEST_ASSERT_MSG_EQ(utUsers.GetN(), 15,
"Topology must contain 15 UT users");
169 "Incorrect latitude for satellite 1");
173 "Incorrect longitude for satellite 1");
177 "Incorrect altitude for satellite 1");
182 "Incorrect latitude for satellite 2");
186 "Incorrect longitude for satellite 2");
190 "Incorrect altitude for satellite 2");
192 NS_TEST_ASSERT_MSG_EQ_TOL(gw1.
GetLatitude(), 48.85, 0.001,
"Incorrect latitude for GW 1");
193 NS_TEST_ASSERT_MSG_EQ_TOL(gw1.
GetLongitude(), 2.34, 0.001,
"Incorrect longitude for GW 1");
194 NS_TEST_ASSERT_MSG_EQ(gw1.
GetAltitude(), 0,
"Incorrect altitude for GW 1");
196 NS_TEST_ASSERT_MSG_EQ_TOL(gw2.
GetLatitude(), 55.75, 0.001,
"Incorrect latitude for GW 2");
197 NS_TEST_ASSERT_MSG_EQ_TOL(gw2.
GetLongitude(), 37.62, 0.001,
"Incorrect longitude for GW 2");
198 NS_TEST_ASSERT_MSG_EQ(gw2.
GetAltitude(), 0,
"Incorrect altitude for GW 2");
200 NS_TEST_ASSERT_MSG_EQ_TOL(ut1.
GetLatitude(), 48.8534, 0.001,
"Incorrect latitude for UT 1");
201 NS_TEST_ASSERT_MSG_EQ_TOL(ut1.
GetLongitude(), 2.3488, 0.001,
"Incorrect longitude for UT 1");
202 NS_TEST_ASSERT_MSG_EQ(ut1.
GetAltitude(), 0,
"Incorrect altitude for UT 1");
204 NS_TEST_ASSERT_MSG_EQ_TOL(ut2.
GetLatitude(), 55.755, 0.001,
"Incorrect latitude for UT 2");
205 NS_TEST_ASSERT_MSG_EQ_TOL(ut2.
GetLongitude(), 37.6218, 0.001,
"Incorrect longitude for UT 2");
206 NS_TEST_ASSERT_MSG_EQ(ut2.
GetAltitude(), 0,
"Incorrect altitude for UT 2");
208 NS_TEST_ASSERT_MSG_EQ_TOL(ut3.
GetLatitude(), 55.754, 0.001,
"Incorrect latitude for UT 3");
209 NS_TEST_ASSERT_MSG_EQ_TOL(ut3.
GetLongitude(), 37.621, 0.001,
"Incorrect longitude for UT 3");
210 NS_TEST_ASSERT_MSG_EQ(ut3.
GetAltitude(), 0,
"Incorrect altitude for UT 3");
212 Simulator::Destroy();
274 std::ifstream myfile(path);
275 std::string delimiter =
" ";
279 if (myfile.is_open())
282 while (std::getline(myfile, line))
284 std::vector<std::string> tokens =
Split(line,
' ');
285 if (tokens.size() == 2)
287 if ((uint32_t)std::stoi(tokens[0]) == time)
289 NS_TEST_ASSERT_MSG_EQ_TOL(std::stof(tokens[1]),
292 "Incorrect throughput for statistic " << path);
301 NS_TEST_ASSERT_MSG_EQ(0, 1,
"Cannot find time " << time <<
" for trace file " << path);
306 NS_TEST_ASSERT_MSG_EQ(0, 1,
"Cannot read trace file " << path);
317 Singleton<SatIdMapper>::Get()->Reset();
324 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
326 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
330 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionEachRequest", BooleanValue(
false));
331 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionPeriod",
332 TimeValue(MilliSeconds(10)));
333 Config::SetDefault(
"ns3::SatHelper::GwUsers", UintegerValue(3));
335 Ptr<SimulationHelper> simulationHelper =
336 CreateObject<SimulationHelper>(
"test-sat-constellation/test2");
339 simulationHelper->SetBeamSet({43, 30});
340 simulationHelper->SetUserCountPerUt(5);
342 simulationHelper->LoadScenario(
"constellation-eutelsat-geo-2-sats-no-isls");
344 simulationHelper->CreateSatScenario();
346 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
351 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
352 Singleton<SatTopology>::Get()->GetUtUserNodes(),
357 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
362 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
363 Singleton<SatTopology>::Get()->GetUtUserNodes(),
368 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
381 simulationHelper->SetSimulationTime(Seconds(10));
382 simulationHelper->RunSimulation();
384 Simulator::Destroy();
387 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
388 "stat-global-fwd-app-throughput-scatter-0.txt",
391 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
392 "stat-global-rtn-app-throughput-scatter-0.txt",
397 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
398 "stat-per-sat-fwd-app-throughput-scatter-1.txt",
401 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
402 "stat-per-sat-fwd-app-throughput-scatter-2.txt",
405 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
406 "stat-per-sat-rtn-app-throughput-scatter-1.txt",
409 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
410 "stat-per-sat-rtn-app-throughput-scatter-2.txt",
415 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
416 "stat-per-beam-fwd-app-throughput-scatter-1-30.txt",
419 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
420 "stat-per-beam-fwd-app-throughput-scatter-1-43.txt",
423 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
424 "stat-per-beam-fwd-app-throughput-scatter-2-30.txt",
427 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
428 "stat-per-beam-fwd-app-throughput-scatter-2-43.txt",
431 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
432 "stat-per-beam-rtn-app-throughput-scatter-1-30.txt",
435 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
436 "stat-per-beam-rtn-app-throughput-scatter-1-43.txt",
439 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
440 "stat-per-beam-rtn-app-throughput-scatter-2-30.txt",
443 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
444 "stat-per-beam-rtn-app-throughput-scatter-2-43.txt",
449 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
450 "stat-per-gw-fwd-app-throughput-scatter-1.txt",
453 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
454 "stat-per-gw-fwd-app-throughput-scatter-2.txt",
457 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
458 "stat-per-gw-rtn-app-throughput-scatter-1.txt",
461 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
462 "stat-per-gw-rtn-app-throughput-scatter-2.txt",
467 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
468 "stat-per-ut-fwd-app-throughput-scatter-1.txt",
471 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
472 "stat-per-ut-fwd-app-throughput-scatter-2.txt",
475 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
476 "stat-per-ut-fwd-app-throughput-scatter-3.txt",
479 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
480 "stat-per-ut-rtn-app-throughput-scatter-1.txt",
483 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
484 "stat-per-ut-rtn-app-throughput-scatter-2.txt",
487 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test2/"
488 "stat-per-ut-rtn-app-throughput-scatter-3.txt",
552 std::ifstream myfile(path);
553 std::string delimiter =
" ";
557 if (myfile.is_open())
560 while (std::getline(myfile, line))
562 std::vector<std::string> tokens =
Split(line,
' ');
563 if (tokens.size() == 2)
565 if ((uint32_t)std::stoi(tokens[0]) == time)
567 NS_TEST_ASSERT_MSG_EQ_TOL(std::stof(tokens[1]),
570 "Incorrect throughput for statistic " << path);
579 NS_TEST_ASSERT_MSG_EQ(0, 1,
"Cannot find time " << time <<
" for trace file " << path);
584 NS_TEST_ASSERT_MSG_EQ(0, 1,
"Cannot read trace file " << path);
595 Singleton<SatIdMapper>::Get()->Reset();
602 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
604 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
608 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionEachRequest", BooleanValue(
false));
609 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionPeriod",
610 TimeValue(MilliSeconds(10)));
611 Config::SetDefault(
"ns3::SatHelper::GwUsers", UintegerValue(3));
613 Ptr<SimulationHelper> simulationHelper =
614 CreateObject<SimulationHelper>(
"test-sat-constellation/test3");
617 simulationHelper->SetBeamSet({43, 30});
618 simulationHelper->SetUserCountPerUt(5);
620 simulationHelper->LoadScenario(
"constellation-eutelsat-geo-2-sats-isls");
622 simulationHelper->CreateSatScenario();
624 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
629 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
630 Singleton<SatTopology>::Get()->GetUtUserNodes(),
635 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
640 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
641 Singleton<SatTopology>::Get()->GetUtUserNodes(),
646 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
659 simulationHelper->SetSimulationTime(Seconds(10));
660 simulationHelper->RunSimulation();
662 Simulator::Destroy();
665 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
666 "stat-global-fwd-app-throughput-scatter-0.txt",
669 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
670 "stat-global-rtn-app-throughput-scatter-0.txt",
675 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
676 "stat-per-sat-fwd-app-throughput-scatter-1.txt",
679 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
680 "stat-per-sat-fwd-app-throughput-scatter-2.txt",
683 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
684 "stat-per-sat-rtn-app-throughput-scatter-1.txt",
687 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
688 "stat-per-sat-rtn-app-throughput-scatter-2.txt",
693 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
694 "stat-per-beam-fwd-app-throughput-scatter-1-30.txt",
697 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
698 "stat-per-beam-fwd-app-throughput-scatter-1-43.txt",
701 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
702 "stat-per-beam-fwd-app-throughput-scatter-2-30.txt",
705 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
706 "stat-per-beam-fwd-app-throughput-scatter-2-43.txt",
709 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
710 "stat-per-beam-rtn-app-throughput-scatter-1-30.txt",
713 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
714 "stat-per-beam-rtn-app-throughput-scatter-1-43.txt",
717 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
718 "stat-per-beam-rtn-app-throughput-scatter-2-30.txt",
721 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
722 "stat-per-beam-rtn-app-throughput-scatter-2-43.txt",
727 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
728 "stat-per-gw-fwd-app-throughput-scatter-1.txt",
731 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
732 "stat-per-gw-fwd-app-throughput-scatter-2.txt",
735 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
736 "stat-per-gw-rtn-app-throughput-scatter-1.txt",
739 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
740 "stat-per-gw-rtn-app-throughput-scatter-2.txt",
745 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
746 "stat-per-ut-fwd-app-throughput-scatter-1.txt",
749 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
750 "stat-per-ut-fwd-app-throughput-scatter-2.txt",
753 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
754 "stat-per-ut-fwd-app-throughput-scatter-3.txt",
757 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
758 "stat-per-ut-rtn-app-throughput-scatter-1.txt",
761 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
762 "stat-per-ut-rtn-app-throughput-scatter-2.txt",
765 TestFileValue(
"contrib/satellite/data/sims/test-sat-constellation/test3/"
766 "stat-per-ut-rtn-app-throughput-scatter-3.txt",
819 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
821 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
825 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionEachRequest", BooleanValue(
false));
826 Config::SetDefault(
"ns3::SatSGP4MobilityModel::UpdatePositionPeriod",
827 TimeValue(MilliSeconds(10)));
828 Config::SetDefault(
"ns3::SatOrbiterHelper::IslArbiterType", EnumValue(
SatEnums::UNICAST));
829 Config::SetDefault(
"ns3::SatHelper::GwUsers", UintegerValue(3));
832 Config::SetDefault(
"ns3::SatHelper::BeamNetworkAddress", Ipv4AddressValue(
"20.1.0.0"));
833 Config::SetDefault(
"ns3::SatHelper::GwNetworkAddress", Ipv4AddressValue(
"10.1.0.0"));
834 Config::SetDefault(
"ns3::SatHelper::UtNetworkAddress", Ipv4AddressValue(
"250.1.0.0"));
836 Ptr<SimulationHelper> simulationHelper =
837 CreateObject<SimulationHelper>(
"test-sat-constellation");
840 simulationHelper->SetBeamSet({1, 43, 60, 64});
841 simulationHelper->SetUserCountPerUt(5);
843 simulationHelper->LoadScenario(
"constellation-telesat-351-sats");
845 simulationHelper->CreateSatScenario();
847 NodeContainer sats = Singleton<SatTopology>::Get()->GetOrbiterNodes();
848 NodeContainer gws = Singleton<SatTopology>::Get()->GetGwNodes();
849 NodeContainer uts = Singleton<SatTopology>::Get()->GetUtNodes();
850 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
851 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
853 uint32_t countNetDevices = 0;
854 uint32_t countIslNetDevice = 0;
855 for (uint32_t i = 0; i < sats.GetN(); i++)
857 for (uint32_t j = 0; j < sats.Get(i)->GetNDevices(); j++)
859 if (DynamicCast<SatOrbiterNetDevice>(sats.Get(i)->GetDevice(j)) !=
nullptr)
861 countNetDevices += 1;
862 countIslNetDevice += DynamicCast<SatOrbiterNetDevice>(sats.Get(i)->GetDevice(j))
863 ->GetIslsNetDevices()
869 NS_TEST_ASSERT_MSG_EQ(sats.GetN(), 351,
"Topology must contain 351 satellites");
870 NS_TEST_ASSERT_MSG_EQ(countNetDevices,
872 "Topology must contain 351 satellite Orbiter Net Devices");
873 NS_TEST_ASSERT_MSG_EQ(countIslNetDevice,
875 "Topology must contain 1404 (351*4) satellite ISL Net Devices");
876 NS_TEST_ASSERT_MSG_EQ(gws.GetN(), 2,
"Topology must contain 2 GWs");
877 NS_TEST_ASSERT_MSG_EQ(uts.GetN(), 3,
"Topology must contain 3 UTs");
878 NS_TEST_ASSERT_MSG_EQ(gwUsers.GetN(), 3,
"Topology must contain 3 GW users");
879 NS_TEST_ASSERT_MSG_EQ(utUsers.GetN(), 15,
"Topology must contain 15 UT users");
881 for (uint32_t i = 0; i < sats.GetN(); i++)
883 Ptr<SatIslArbiter> arbiter =
884 DynamicCast<SatOrbiterNetDevice>(sats.Get(i)->GetDevice(0))->GetArbiter();
885 Ptr<SatIslArbiterUnicast> arbiterUnicast = DynamicCast<SatIslArbiterUnicast>(arbiter);
886 NS_TEST_ASSERT_MSG_NE(arbiterUnicast,
888 "Arbiter of satellite " << i
889 <<
" is not of type SatIslArbiterUnicast");
890 for (uint32_t j = 0; j < sats.GetN(); j++)
894 NS_TEST_ASSERT_MSG_NE(arbiterUnicast->Decide(i, j,
nullptr),
896 "No entry in arbiter of satellite " << i <<
" to satellite "
902 Simulator::Destroy();