Add helper for uniform gw distribution

This commit is contained in:
Tim Schubert 2020-08-23 22:26:03 +02:00
parent ab7c9881f6
commit 1c96f7d2f6
3 changed files with 31 additions and 6 deletions

View file

@ -26,20 +26,19 @@ int main (int argc, char *argv[])
CommandLine cmd; CommandLine cmd;
std::string orbitFile; std::string orbitFile;
std::string groundFile;
std::string traceFile; std::string traceFile;
LeoLatLong source; LeoLatLong source;
LeoLatLong destination; LeoLatLong destination;
std::string islRate; std::string islRate;
std::string constellation; std::string constellation;
uint64_t numGws;
Time interval; Time interval;
Time duration; Time duration;
cmd.AddValue("orbitFile", "CSV file with orbit parameters", orbitFile); cmd.AddValue("orbitFile", "CSV file with orbit parameters", orbitFile);
cmd.AddValue("traceFile", "CSV file to store mobility trace in", traceFile); cmd.AddValue("traceFile", "CSV file to store mobility trace in", traceFile);
// TODO write position allocator for long,lat
cmd.AddValue("groundFile", "CSV file with ground station locations", groundFile);
cmd.AddValue("precision", "ns3::LeoCircularOrbitMobilityModel::Precision"); cmd.AddValue("precision", "ns3::LeoCircularOrbitMobilityModel::Precision");
cmd.AddValue("duration", "Duration of the simulation", duration); cmd.AddValue("duration", "Duration of the simulation", duration);
cmd.AddValue("numGws", "Number of gateways", numGws);
cmd.AddValue("source", "Traffic source", source); cmd.AddValue("source", "Traffic source", source);
cmd.AddValue("destination", "Traffic destination", destination); cmd.AddValue("destination", "Traffic destination", destination);
cmd.AddValue("islRate", "Throughput of the ISL link", islRate); cmd.AddValue("islRate", "Throughput of the ISL link", islRate);
@ -60,11 +59,10 @@ int main (int argc, char *argv[])
NodeContainer satellites = orbit.Install (orbitFile); NodeContainer satellites = orbit.Install (orbitFile);
LeoGndNodeHelper ground; LeoGndNodeHelper ground;
NodeContainer stations = ground.Install (groundFile); NodeContainer stations = ground.Install (numGws);
NodeContainer users = ground.Install (source, destination); NodeContainer users = ground.Install (source, destination);
stations.Add (users); stations.Add (users);
// TODO create source and sink with ConstantPosition MobilityHelper
Ptr<Node> client = users.Get (0); Ptr<Node> client = users.Get (0);
Ptr<Node> server = users.Get (1); Ptr<Node> server = users.Get (1);

View file

@ -5,6 +5,8 @@
#include "ns3/log.h" #include "ns3/log.h"
#include "ns3/config.h" #include "ns3/config.h"
#include "ns3/waypoint.h" #include "ns3/waypoint.h"
#include "ns3/double.h"
#include "ns3/mobility-helper.h"
#include "ground-node-helper.h" #include "ground-node-helper.h"
@ -55,6 +57,24 @@ LeoGndNodeHelper::Install (const std::string &file)
return nodes; return nodes;
} }
NodeContainer
LeoGndNodeHelper::Install (uint64_t numNodes)
{
NodeContainer nodes;
for (uint64_t i = 0; i < numNodes; i++)
{
nodes.Add (m_gndNodeFactory.Create<Node> ());
}
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.SetPositionAllocator ("ns3::LeoPolarPositionAllocator",
"Step", DoubleValue (360.0 * 180.0 / numNodes));
mobility.Install (nodes);
return nodes;
}
Vector3D Vector3D
LeoGndNodeHelper::GetEarthPosition (const LeoLatLong &loc) LeoGndNodeHelper::GetEarthPosition (const LeoLatLong &loc)
{ {

View file

@ -29,11 +29,18 @@ public:
/** /**
* *
* \param wpFile path to latitude longitude file * \param file path to latitude longitude file
* \returns a node container containing nodes using the specified attributes * \returns a node container containing nodes using the specified attributes
*/ */
NodeContainer Install (const std::string &file); NodeContainer Install (const std::string &file);
/**
*
* \param numNodes a number of nodes to uniformly distribute accross earth
* \returns a node container containing nodes using the specified attributes
*/
NodeContainer Install (uint64_t numNodes);
/** /**
* *
* \param location1 first location * \param location1 first location