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 
30 using namespace ns3;
31 
42 NS_LOG_COMPONENT_DEFINE("sat-mobility-position-generator");
43 
44 int
45 main(int argc, char* argv[])
46 {
47  std::string inputFileNameWithPath =
48  Singleton<SatEnvVariables>::Get()->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  // Parse command-line and XML file
58  CommandLine cmd;
59  cmd.AddValue("PosCount", "Amount of positions to generate per beam", posCount);
60  simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
61  cmd.Parse(argc, argv);
62  simulationHelper->ConfigureAttributesFromFile(inputFileNameWithPath);
63 
64  Ptr<SatHelper> satHelper = simulationHelper->GetSatelliteHelper();
65  for (uint32_t beamId : simulationHelper->GetBeamSet())
66  {
67  for (uint32_t posId = 0; posId < posCount; ++posId)
68  {
69  Ptr<SatSpotBeamPositionAllocator> positions = satHelper->GetBeamAllocator(beamId);
70  GeoCoordinate coords = positions->GetNextGeoPosition(0);
71  std::cout << "[" << beamId << "] " << coords << std::endl;
72  }
73  }
74 
75  simulationHelper->SetSimulationTime(0.1);
76  simulationHelper->RunSimulation();
77 
78  return 0;
79 }
GeoCoordinate class is used to store and operate with geodetic coordinates.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.