diff --git a/examples/leo-delay-tracing-example.cc b/examples/leo-delay-tracing-example.cc index 7c26636..9b29b0b 100644 --- a/examples/leo-delay-tracing-example.cc +++ b/examples/leo-delay-tracing-example.cc @@ -26,20 +26,19 @@ int main (int argc, char *argv[]) CommandLine cmd; std::string orbitFile; - std::string groundFile; std::string traceFile; LeoLatLong source; LeoLatLong destination; std::string islRate; std::string constellation; + uint64_t numGws; Time interval; Time duration; cmd.AddValue("orbitFile", "CSV file with orbit parameters", orbitFile); 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("duration", "Duration of the simulation", duration); + cmd.AddValue("numGws", "Number of gateways", numGws); cmd.AddValue("source", "Traffic source", source); cmd.AddValue("destination", "Traffic destination", destination); cmd.AddValue("islRate", "Throughput of the ISL link", islRate); @@ -60,11 +59,10 @@ int main (int argc, char *argv[]) NodeContainer satellites = orbit.Install (orbitFile); LeoGndNodeHelper ground; - NodeContainer stations = ground.Install (groundFile); + NodeContainer stations = ground.Install (numGws); NodeContainer users = ground.Install (source, destination); stations.Add (users); - // TODO create source and sink with ConstantPosition MobilityHelper Ptr client = users.Get (0); Ptr server = users.Get (1); diff --git a/helper/ground-node-helper.cc b/helper/ground-node-helper.cc index a8293fd..1cc0f80 100644 --- a/helper/ground-node-helper.cc +++ b/helper/ground-node-helper.cc @@ -5,6 +5,8 @@ #include "ns3/log.h" #include "ns3/config.h" #include "ns3/waypoint.h" +#include "ns3/double.h" +#include "ns3/mobility-helper.h" #include "ground-node-helper.h" @@ -55,6 +57,24 @@ LeoGndNodeHelper::Install (const std::string &file) return nodes; } +NodeContainer +LeoGndNodeHelper::Install (uint64_t numNodes) +{ + NodeContainer nodes; + for (uint64_t i = 0; i < numNodes; i++) + { + nodes.Add (m_gndNodeFactory.Create ()); + } + MobilityHelper mobility; + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + mobility.SetPositionAllocator ("ns3::LeoPolarPositionAllocator", + "Step", DoubleValue (360.0 * 180.0 / numNodes)); + + mobility.Install (nodes); + + return nodes; +} + Vector3D LeoGndNodeHelper::GetEarthPosition (const LeoLatLong &loc) { diff --git a/helper/ground-node-helper.h b/helper/ground-node-helper.h index 31be233..cc26e6a 100644 --- a/helper/ground-node-helper.h +++ b/helper/ground-node-helper.h @@ -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 */ 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