Loading...
Searching...
No Matches
sat-mobility-position-generator.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: Mathias Ettinger <mettinger@toulouse.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
28#include <iostream>
29
30using namespace ns3;
31
41
42NS_LOG_COMPONENT_DEFINE("sat-mobility-position-generator");
43
44int
45main(int argc, char* argv[])
46{
47 std::string inputFileNameWithPath =
48 SatEnvVariables::GetInstance()->LocateDirectory("contrib/satellite/examples") +
49 "/generic-input-attributes.xml";
50 uint32_t posCount = 1;
51
52 Ptr<SimulationHelper> simulationHelper =
53 CreateObject<SimulationHelper>("sat-mobility-position-generator");
54 simulationHelper->DisableAllCapacityAssignmentCategories();
55 simulationHelper->EnableCrdsa();
56
57 simulationHelper->LoadScenario("geo-33E");
58
59 // Parse command-line and XML file
60 CommandLine cmd;
61 cmd.AddValue("PosCount", "Amount of positions to generate per beam", posCount);
62 simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
63 cmd.Parse(argc, argv);
64 simulationHelper->ConfigureAttributesFromFile(inputFileNameWithPath);
65
66 Ptr<SatHelper> satHelper = simulationHelper->GetSatelliteHelper();
67 for (uint32_t beamId : simulationHelper->GetBeamSet())
68 {
69 for (uint32_t posId = 0; posId < posCount; ++posId)
70 {
71 Ptr<SatSpotBeamPositionAllocator> positions = satHelper->GetBeamAllocator(beamId);
72 GeoCoordinate coords = positions->GetNextGeoPosition(0);
73 std::cout << "[" << beamId << "] " << coords << std::endl;
74 }
75 }
76
77 simulationHelper->SetSimulationTime(0.1);
78 simulationHelper->RunSimulation();
79
80 return 0;
81}
GeoCoordinate class is used to store and operate with geodetic coordinates.
static Ptr< SatEnvVariables > GetInstance()
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.