Loading...
Searching...
No Matches
sat-beam-position-tracer.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2018 CNES
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Bastien Tauran <bastien.tauran@viveris.fr>
19 */
20
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"
27
28using namespace ns3;
29
38
39NS_LOG_COMPONENT_DEFINE("sat-beam-position-tracer");
40
41void
42GetBeamPositions(Ptr<SatHelper> satHelper)
43{
44 Ptr<SatAntennaGainPatternContainer> antennaGainPatterns = satHelper->GetAntennaGainPatterns();
45 NodeContainer satNodes = Singleton<SatTopology>::Get()->GetOrbiterNodes();
46 uint32_t beamCount = satHelper->GetBeamCount();
47 for (uint32_t satId = 0; satId < satNodes.GetN(); satId++)
48 {
49 Ptr<SatMobilityModel> mobility = antennaGainPatterns->GetAntennaMobility(satId);
50 for (uint32_t beamId = 0; beamId < beamCount; beamId++)
51 {
52 Ptr<SatAntennaGainPattern> pattern =
53 antennaGainPatterns->GetAntennaGainPattern(beamId + 1);
54 std::cout << Simulator::Now().GetSeconds() << ";" << satId << ";" << beamId << ";"
55 << pattern->GetCenterLatitude(mobility) << ";"
56 << pattern->GetCenterLongitude(mobility) << std::endl;
57 }
58 }
59}
60
61int
62main(int argc, char* argv[])
63{
64 std::string scenario = "constellation-leo-2-satellites";
65 uint32_t simLength_s = 1000;
66 uint32_t simTraceStep_s = 10;
67
68 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
70 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
72
73 Config::SetDefault("ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(true));
74 Config::SetDefault("ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
75 BooleanValue(true));
76
77 Ptr<SimulationHelper> simulationHelper =
78 CreateObject<SimulationHelper>("sat-beam-position-tracer");
79
80 CommandLine cmd;
81 cmd.AddValue("Scenario", "Scenario to load", scenario);
82 simulationHelper->AddDefaultUiArguments(cmd);
83 cmd.Parse(argc, argv);
84
85 simulationHelper->LoadScenario(scenario);
86 simulationHelper->SetSimulationTime(simLength_s);
87 simulationHelper->SetUserCountPerUt(1);
88
89 Ptr<SatHelper> satHelper = simulationHelper->CreateSatScenario(SatHelper::FULL);
90
91 double t = 0.0;
92 while (t <= simLength_s)
93 {
94 Simulator::Schedule(Seconds(t), &GetBeamPositions, satHelper);
95 t = t + simTraceStep_s;
96 }
97
98 std::cout << "time;satId;beamId;latitude;longitude" << std::endl;
99
100 simulationHelper->RunSimulation();
101}
@ FULL
FULL Full scenario used as base.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
void GetBeamPositions(Ptr< SatHelper > satHelper)