This commit is contained in:
Tim Schubert 2020-08-26 20:55:59 +02:00
parent f7bd15f1a8
commit 8d5cbfe8fe
9 changed files with 50 additions and 99 deletions

View file

@ -6,6 +6,7 @@
#include "ns3/network-module.h" #include "ns3/network-module.h"
#include "ns3/aodv-module.h" #include "ns3/aodv-module.h"
#include "ns3/udp-server.h" #include "ns3/udp-server.h"
#include "ns3/epidemic-routing-module.h"
using namespace ns3; using namespace ns3;
@ -34,6 +35,7 @@ int main (int argc, char *argv[])
uint64_t numGws; uint64_t numGws;
double interval; double interval;
double duration; double duration;
std::string routingProto = "aodv";
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);
cmd.AddValue("precision", "ns3::LeoCircularOrbitMobilityModel::Precision"); cmd.AddValue("precision", "ns3::LeoCircularOrbitMobilityModel::Precision");
@ -44,6 +46,7 @@ int main (int argc, char *argv[])
cmd.AddValue("islRate", "Throughput of the ISL link", islRate); cmd.AddValue("islRate", "Throughput of the ISL link", islRate);
cmd.AddValue("constellation", "LEO constellation link settings name", constellation); cmd.AddValue("constellation", "LEO constellation link settings name", constellation);
cmd.AddValue("interval", "Echo interval", interval); cmd.AddValue("interval", "Echo interval", interval);
cmd.AddValue("routing", "Routing protocol", routingProto);
cmd.AddValue("ttlThresh", "ns3::aodv::RoutingProtocol::TtlThreshold"); cmd.AddValue("ttlThresh", "ns3::aodv::RoutingProtocol::TtlThreshold");
cmd.AddValue("routeTimeout", "ns3::aodv::RoutingProtocol::ActiveRouteTimeout"); cmd.AddValue("routeTimeout", "ns3::aodv::RoutingProtocol::ActiveRouteTimeout");
cmd.Parse (argc, argv); cmd.Parse (argc, argv);
@ -80,18 +83,28 @@ int main (int argc, char *argv[])
utCh.SetConstellation (constellation); utCh.SetConstellation (constellation);
utNet = utCh.Install (satellites, stations); utNet = utCh.Install (satellites, stations);
//if (proto == "aodv")
// Install internet stack on nodes
AodvHelper aodv;
// This disabled is far better for performance (huge network)
aodv.Set ("EnableHello", BooleanValue (false));
//aodv.Set ("TtlThreshold", UintegerValue (ttlThresh));
aodv.Set ("RreqRateLimit", UintegerValue (1));
aodv.Set ("RerrRateLimit", UintegerValue (1));
//aodv.Set ("ActiveRouteTimeout", TimeValue (Seconds (routeTimeout)));
InternetStackHelper stack; InternetStackHelper stack;
stack.SetRoutingHelper (aodv); if (routingProto == "epidemic")
{
EpidemicHelper epidemic;
epidemic.Set ("HopCount", UintegerValue (50));
//epidemic.Set ("QueueLength", UintegerValue (50));
//epidemic.Set ("QueueEntryExpireTime", TimeValue (Seconds (100)));
//epidemic.Set ("BeaconInterval", TimeValue (Seconds (1)));
stack.SetRoutingHelper (epidemic);
}
else
{
// Install internet stack on nodes
AodvHelper aodv;
aodv.Set ("EnableHello", BooleanValue (false));
aodv.Set ("RreqRateLimit", UintegerValue (1));
aodv.Set ("RerrRateLimit", UintegerValue (1));
stack.SetRoutingHelper (aodv);
}
stack.Install (satellites); stack.Install (satellites);
stack.Install (stations); stack.Install (stations);

View file

@ -9,7 +9,7 @@ def build(bld):
obj.source = 'leo-circular-orbit-tracing-example.cc' obj.source = 'leo-circular-orbit-tracing-example.cc'
obj = bld.create_ns3_program('leo-delay', obj = bld.create_ns3_program('leo-delay',
['core', 'leo', 'mobility', 'aodv']) ['core', 'leo', 'mobility', 'aodv', 'epidemic-routing'])
obj.source = 'leo-delay-tracing-example.cc' obj.source = 'leo-delay-tracing-example.cc'
obj = bld.create_ns3_program('leo-bulk-send', obj = bld.create_ns3_program('leo-bulk-send',

View file

@ -9,6 +9,7 @@
#include "ns3/assert.h" #include "ns3/assert.h"
#include "ns3/string.h" #include "ns3/string.h"
#include "ns3/data-rate.h" #include "ns3/data-rate.h"
#include "ns3/net-device-queue-interface.h"
#include "../model/leo-mock-channel.h" #include "../model/leo-mock-channel.h"
#include "../model/leo-mock-net-device.h" #include "../model/leo-mock-net-device.h"
@ -347,6 +348,12 @@ LeoChannelHelper::Install (std::vector<Ptr<Node> > &satellites, std::vector<Ptr<
node->AddDevice (dev); node->AddDevice (dev);
Ptr<Queue<Packet> > queue = m_satQueueFactory.Create<Queue<Packet> > (); Ptr<Queue<Packet> > queue = m_satQueueFactory.Create<Queue<Packet> > ();
dev->SetQueue (queue); dev->SetQueue (queue);
// Aggregate NetDeviceQueueInterface objects
Ptr<NetDeviceQueueInterface> ndqi = CreateObject<NetDeviceQueueInterface> ();
ndqi->GetTxQueue (0)->ConnectQueueTraces (queue);
dev->AggregateObject (ndqi);
dev->Attach (channel); dev->Attach (channel);
container.Add (dev); container.Add (dev);
@ -360,6 +367,12 @@ LeoChannelHelper::Install (std::vector<Ptr<Node> > &satellites, std::vector<Ptr<
node->AddDevice (dev); node->AddDevice (dev);
Ptr<Queue<Packet> > queue = m_gndQueueFactory.Create<Queue<Packet> > (); Ptr<Queue<Packet> > queue = m_gndQueueFactory.Create<Queue<Packet> > ();
dev->SetQueue (queue); dev->SetQueue (queue);
// Aggregate NetDeviceQueueInterface objects
Ptr<NetDeviceQueueInterface> ndqi = CreateObject<NetDeviceQueueInterface> ();
ndqi->GetTxQueue (0)->ConnectQueueTraces (queue);
dev->AggregateObject (ndqi);
dev->Attach (channel); dev->Attach (channel);
container.Add (dev); container.Add (dev);

View file

@ -1,48 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#ifndef LEO_ORBIT_NODE_HELPER_H
#define LEO_ORBIT_NODE_HELPER_H
#include <string>
#include "ns3/object-factory.h"
#include "ns3/node-container.h"
#include "ns3/constant-position-mobility-model.h"
/**
* \brief Builds a node container of nodes with constant positions
*
* Adds waypoints from file for each node.
*/
namespace ns3
{
class LeoGndNodeHelper
{
public:
LeoGndNodeHelper ();
virtual ~LeoGndNodeHelper ();
/**
*
* \param wpFile path to waypoint file
* \returns a node container containing nodes using the specified attributes
*/
NodeContainer Install (const std::string &wpFile);
/**
* Set an attribute for each node
*
* \param name name of the attribute
* \param value value of the attribute
*/
void SetAttribute (std::string name, const AttributeValue &value);
private:
ObjectFactory m_gndNodeFactory;
};
}; // namespace ns3
#endif

View file

@ -6,15 +6,16 @@ namespace ns3 {
std::ostream &operator << (std::ostream &os, const LeoLatLong &l) std::ostream &operator << (std::ostream &os, const LeoLatLong &l)
{ {
os << l.latitude << ":" << l.longitude; os << l.label << "," << l.latitude << "," << l.longitude;
return os; return os;
} }
std::istream &operator >> (std::istream &is, LeoLatLong &l) std::istream &operator >> (std::istream &is, LeoLatLong &l)
{ {
char c1; char c1, c2;
is >> l.latitude >> c1 >> l.longitude; is >> l.label >> c1 >> l.latitude >> c2 >> l.longitude;
if (c1 != ':') if (c1 != ',' ||
c2 != ',')
{ {
is.setstate (std::ios_base::failbit); is.setstate (std::ios_base::failbit);
} }
@ -23,6 +24,7 @@ std::istream &operator >> (std::istream &is, LeoLatLong &l)
LeoLatLong::LeoLatLong () : latitude (0), longitude (0) {} LeoLatLong::LeoLatLong () : latitude (0), longitude (0) {}
LeoLatLong::LeoLatLong (double la, double lo) : latitude (la), longitude (lo) {} LeoLatLong::LeoLatLong (double la, double lo) : latitude (la), longitude (lo) {}
LeoLatLong::LeoLatLong (std::string label, double la, double lo) : latitude (la), longitude (lo) {}
LeoLatLong::~LeoLatLong () {} LeoLatLong::~LeoLatLong () {}
}; };

View file

@ -12,8 +12,10 @@ class LeoLatLong
public: public:
LeoLatLong (); LeoLatLong ();
LeoLatLong (double latitude, double longitude); LeoLatLong (double latitude, double longitude);
LeoLatLong (std::string label, double latitude, double longitude);
virtual ~LeoLatLong(); virtual ~LeoLatLong();
std::string label;
double latitude; double latitude;
double longitude; double longitude;
}; };

View file

@ -1,20 +1,4 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007, 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <ns3/trace-source-accessor.h> #include <ns3/trace-source-accessor.h>
#include <ns3/packet.h> #include <ns3/packet.h>

View file

@ -1,20 +1,4 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007, 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/log.h" #include "ns3/log.h"
#include "ns3/queue.h" #include "ns3/queue.h"

View file

@ -38,7 +38,7 @@ EmptyGndNodeHelperTestCase::DoRun (void)
std::vector<std::string> gndWps = {}; std::vector<std::string> gndWps = {};
LeoGndNodeHelper gndHelper; LeoGndNodeHelper gndHelper;
NodeContainer nodes = gndHelper.Install ("contrib/leo/data/test/empty"); NodeContainer nodes = gndHelper.Install ("hsksjhskjhs");
NS_ASSERT_MSG (nodes.GetN () == 0, "Empty position file produces non-empty node container"); NS_ASSERT_MSG (nodes.GetN () == 0, "Empty position file produces non-empty node container");
} }
@ -68,9 +68,10 @@ void
SomeGndNodeHelperTestCase::DoRun (void) SomeGndNodeHelperTestCase::DoRun (void)
{ {
LeoGndNodeHelper gndHelper; LeoGndNodeHelper gndHelper;
NodeContainer nodes = gndHelper.Install ("contrib/leo/data/test/ground-stations.txt"); NodeContainer nodes = gndHelper.Install (LeoLatLong ("station1", 50.1, 10.0),
LeoLatLong ("station2", -70.1, -21.0));
NS_ASSERT_MSG (nodes.GetN () > 1, "No ground stations"); NS_ASSERT_MSG (nodes.GetN () == 2, "No ground stations");
Ptr<MobilityModel> mob = nodes.Get (0)->GetObject<MobilityModel> (); Ptr<MobilityModel> mob = nodes.Get (0)->GetObject<MobilityModel> ();
NS_ASSERT_MSG (mob != Ptr<MobilityModel> (), "Mobility model is valid"); NS_ASSERT_MSG (mob != Ptr<MobilityModel> (), "Mobility model is valid");