21 #include <ns3/config-store-module.h>
22 #include <ns3/core-module.h>
23 #include <ns3/internet-module.h>
24 #include <ns3/network-module.h>
25 #include <ns3/satellite-module.h>
26 #include <ns3/traffic-module.h>
39 auto tracedPosition = DynamicCast<const SatTracedMobilityModel>(position);
40 NS_ASSERT_MSG(tracedPosition !=
nullptr,
"Course changed for a non-mobile UT");
42 uint32_t sat = tracedPosition->GetSatId();
43 uint32_t beam = tracedPosition->GetBestBeamId(
true);
59 NS_LOG_COMPONENT_DEFINE(
"sat-mobility-beam-tracer");
62 main(
int argc,
char* argv[])
64 std::string inputFileNameWithPath =
65 Singleton<SatEnvVariables>::Get()->LocateDirectory(
"contrib/satellite/examples") +
66 "/generic-input-attributes.xml";
67 std::string mobileUtTraceFile =
"";
71 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
73 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
76 Ptr<SimulationHelper> simulationHelper =
77 CreateObject<SimulationHelper>(
"sat-mobility-position-generator");
78 simulationHelper->EnableProgressLogs();
79 simulationHelper->DisableAllCapacityAssignmentCategories();
80 simulationHelper->EnableCrdsa();
84 cmd.AddValue(
"TraceFile",
"Path to the trace file to check beams from", mobileUtTraceFile);
85 simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
86 cmd.Parse(argc, argv);
87 simulationHelper->ReadInputAttributesFromFile(inputFileNameWithPath);
88 simulationHelper->SetSimulationTime(Seconds(100));
90 simulationHelper->SetUserCountPerUt(1);
92 simulationHelper->LoadScenario(
"constellation-eutelsat-geo-2-sats-no-isls");
94 if (mobileUtTraceFile !=
"")
96 Ptr<SatHelper> satHelper =
97 simulationHelper->CreateSatScenario(
SatHelper::FULL, mobileUtTraceFile);
99 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetObject<
SatMobilityModel>();
101 uint32_t satNb = Singleton<SatTopology>::Get()->GetNOrbiterNodes();
102 for (uint32_t i = 0; i < satNb; i++)
104 Ptr<Node> node = satHelper->LoadMobileUtFromFile(mobileUtTraceFile);
105 DynamicCast<SatTracedMobilityModel>(node->GetObject<
SatMobilityModel>())->SetSatId(i);
111 simulationHelper->RunSimulation();
112 Simulator::Destroy();
114 std::cout <<
"Visited beams are:";
115 for (std::pair<uint32_t, uint32_t> satAndBeam :
visitedBeams)
117 std::cout <<
" (" << satAndBeam.first <<
", " << satAndBeam.second <<
")";
119 std::cout << std::endl;
121 for (uint32_t satId = 0; satId < satNb; satId++)
123 double minSpeed = 0.0, maxSpeed = 0.0, totalSpeed = 0.0;
124 uint32_t valuesCount = 0;
133 minSpeed = std::min(minSpeed, speed);
134 maxSpeed = std::max(maxSpeed, speed);
139 std::cout <<
"Speeding stats (m/s) for satellite " << satId <<
":\n\tmin: " << minSpeed
140 <<
"\n\tmax: " << maxSpeed <<
"\n\tmean: " << totalSpeed / valuesCount
@ FULL
FULL Full scenario used as base.
Keep track of the current position and velocity of an object in satellite network.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Ptr< SatMobilityModel > satMobility
std::map< uint32_t, std::vector< double > > relativeSpeeds
std::set< std::pair< uint32_t, uint32_t > > visitedBeams
static void SatCourseChange(std::string context, Ptr< const SatMobilityModel > position)