mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Fix ground station allocator and trace mac drops
This commit is contained in:
parent
8d5cbfe8fe
commit
998b7fe2f2
15 changed files with 222 additions and 80 deletions
|
@ -158,7 +158,7 @@ given as pairs of longitude and latitude.
|
||||||
--duration=360.0 \
|
--duration=360.0 \
|
||||||
--numGws=120 \
|
--numGws=120 \
|
||||||
--source=54.4:77.1 \
|
--source=54.4:77.1 \
|
||||||
--destination=-10.0:25.8 \
|
--destination=40.58:-74.97 \
|
||||||
--islRate=1Gbps \
|
--islRate=1Gbps \
|
||||||
--constellation="StarlinkGateway" \
|
--constellation="StarlinkGateway" \
|
||||||
--interval=1 \
|
--interval=1 \
|
||||||
|
|
|
@ -22,6 +22,44 @@ EchoRx (std::string context, Ptr<const Packet> packet)
|
||||||
std::cout << context << "," << seqTs.GetSeq () << "," << seqTs.GetTs () << "," << Simulator::Now () - seqTs.GetTs () << std::endl;
|
std::cout << context << "," << seqTs.GetSeq () << "," << seqTs.GetTs () << "," << Simulator::Now () - seqTs.GetTs () << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
EchoTx (std::string context, Ptr<const Packet> packet)
|
||||||
|
{
|
||||||
|
SeqTsHeader seqTs;
|
||||||
|
Ptr<Packet> p = packet->Copy ();
|
||||||
|
p->RemoveHeader (seqTs);
|
||||||
|
// seqnr, timestamp, delay
|
||||||
|
std::cout << context << "," << seqTs.GetSeq () << "," << seqTs.GetTs () << "," << Simulator::Now () - seqTs.GetTs () << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
MacTxDrop (std::string context, Ptr<const Packet> packet)
|
||||||
|
{
|
||||||
|
Ptr<Packet> p = packet->Copy ();
|
||||||
|
std::cout << context << ",MacTxDrop," << p << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
MacRxDrop (std::string context, Ptr<const Packet> packet)
|
||||||
|
{
|
||||||
|
Ptr<Packet> p = packet->Copy ();
|
||||||
|
std::cout << context << ",MacRxDrop," << p << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PhyTxDrop (std::string context, Ptr<const Packet> packet)
|
||||||
|
{
|
||||||
|
Ptr<Packet> p = packet->Copy ();
|
||||||
|
std::cout << context << ",PhyTxDrop," << p << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PhyRxDrop (std::string context, Ptr<const Packet> packet)
|
||||||
|
{
|
||||||
|
Ptr<Packet> p = packet->Copy ();
|
||||||
|
std::cout << context << ",PhyRxDrop," << p << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -32,23 +70,29 @@ int main (int argc, char *argv[])
|
||||||
LeoLatLong destination;
|
LeoLatLong destination;
|
||||||
std::string islRate;
|
std::string islRate;
|
||||||
std::string constellation;
|
std::string constellation;
|
||||||
uint64_t numGws;
|
uint32_t latGws = 20;
|
||||||
|
uint32_t lonGws = 20;
|
||||||
double interval;
|
double interval;
|
||||||
double duration;
|
double duration;
|
||||||
|
bool islEnable = false;
|
||||||
|
bool traceDrops = false;
|
||||||
std::string routingProto = "aodv";
|
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");
|
||||||
cmd.AddValue("duration", "Duration of the simulation in seconds", duration);
|
cmd.AddValue("duration", "Duration of the simulation in seconds", 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", "ns3::MockNetDevice::DataRate");
|
||||||
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("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.AddValue("islEnable", "Enable inter-satellite links", islEnable);
|
||||||
|
cmd.AddValue("traceDrops", "Enable tracing of PHY and MAC drops", traceDrops);
|
||||||
|
cmd.AddValue("latGws", "Latitudal rows of gateways", latGws);
|
||||||
|
cmd.AddValue("latGws", "Longitudinal rows of gateways", lonGws);
|
||||||
cmd.Parse (argc, argv);
|
cmd.Parse (argc, argv);
|
||||||
|
|
||||||
std::streambuf *coutbuf = std::cout.rdbuf();
|
std::streambuf *coutbuf = std::cout.rdbuf();
|
||||||
|
@ -64,34 +108,19 @@ int main (int argc, char *argv[])
|
||||||
NodeContainer satellites = orbit.Install (orbitFile);
|
NodeContainer satellites = orbit.Install (orbitFile);
|
||||||
|
|
||||||
LeoGndNodeHelper ground;
|
LeoGndNodeHelper ground;
|
||||||
NodeContainer stations = ground.Install (numGws);
|
NodeContainer stations = ground.Install (latGws, lonGws);
|
||||||
|
|
||||||
NodeContainer users = ground.Install (source, destination);
|
NodeContainer users = ground.Install (source, destination);
|
||||||
stations.Add (users);
|
stations.Add (users);
|
||||||
|
|
||||||
Ptr<Node> client = users.Get (0);
|
|
||||||
Ptr<Node> server = users.Get (1);
|
|
||||||
|
|
||||||
NetDeviceContainer islNet, utNet;
|
|
||||||
|
|
||||||
IslHelper islCh;
|
|
||||||
islCh.SetDeviceAttribute ("DataRate", StringValue (islRate));
|
|
||||||
islCh.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
|
||||||
islCh.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::IslPropagationLossModel"));
|
|
||||||
islNet = islCh.Install (satellites);
|
|
||||||
|
|
||||||
LeoChannelHelper utCh;
|
LeoChannelHelper utCh;
|
||||||
utCh.SetConstellation (constellation);
|
utCh.SetConstellation (constellation);
|
||||||
utNet = utCh.Install (satellites, stations);
|
NetDeviceContainer utNet = utCh.Install (satellites, stations);
|
||||||
|
|
||||||
InternetStackHelper stack;
|
InternetStackHelper stack;
|
||||||
if (routingProto == "epidemic")
|
if (routingProto == "epidemic")
|
||||||
{
|
{
|
||||||
EpidemicHelper 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);
|
stack.SetRoutingHelper (epidemic);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -104,16 +133,24 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
stack.SetRoutingHelper (aodv);
|
stack.SetRoutingHelper (aodv);
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.Install (satellites);
|
stack.Install (satellites);
|
||||||
stack.Install (stations);
|
stack.Install (stations);
|
||||||
|
|
||||||
// Make all networks addressable for legacy protocol
|
|
||||||
Ipv4AddressHelper ipv4;
|
Ipv4AddressHelper ipv4;
|
||||||
|
|
||||||
ipv4.SetBase ("10.1.0.0", "255.255.0.0");
|
ipv4.SetBase ("10.1.0.0", "255.255.0.0");
|
||||||
Ipv4InterfaceContainer islIp = ipv4.Assign (islNet);
|
ipv4.Assign (utNet);
|
||||||
ipv4.SetBase ("10.3.0.0", "255.255.0.0");
|
|
||||||
Ipv4InterfaceContainer utIp = ipv4.Assign (utNet);
|
if (islEnable)
|
||||||
|
{
|
||||||
|
IslHelper islCh;
|
||||||
|
NetDeviceContainer islNet = islCh.Install (satellites);
|
||||||
|
ipv4.SetBase ("10.2.0.0", "255.255.0.0");
|
||||||
|
ipv4.Assign (islNet);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<Node> client = users.Get (0);
|
||||||
|
Ptr<Node> server = users.Get (1);
|
||||||
|
|
||||||
// we want to ping terminals
|
// we want to ping terminals
|
||||||
UdpServerHelper echoServer (9);
|
UdpServerHelper echoServer (9);
|
||||||
|
@ -130,9 +167,23 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::UdpServer/Rx",
|
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::UdpServer/Rx",
|
||||||
MakeCallback (&EchoRx));
|
MakeCallback (&EchoRx));
|
||||||
|
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::UdpServer/Tx",
|
||||||
|
MakeCallback (&EchoTx));
|
||||||
|
|
||||||
std::cout << "LOCAL =" << client->GetId () << std::endl;
|
if (traceDrops)
|
||||||
std::cout << "REMOTE=" << server->GetId () << std::endl;
|
{
|
||||||
|
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::MockNetDevice/MacTxDrop",
|
||||||
|
MakeCallback (&MacTxDrop));
|
||||||
|
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::MockNetDevice/PhyTxDrop",
|
||||||
|
MakeCallback (&PhyTxDrop));
|
||||||
|
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::MockNetDevice/MacRxDrop",
|
||||||
|
MakeCallback (&MacRxDrop));
|
||||||
|
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::MockNetDevice/PhyRxDrop",
|
||||||
|
MakeCallback (&PhyRxDrop));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "LOCAL =" << client->GetId () << std::endl;
|
||||||
|
std::cerr << "REMOTE=" << server->GetId () << ",addr=" << Ipv4Address::ConvertFrom (remote) << std::endl;
|
||||||
|
|
||||||
std::cout << "Context,Sequence Number,Timestamp,Delay" << std::endl;
|
std::cout << "Context,Sequence Number,Timestamp,Delay" << std::endl;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "ns3/config.h"
|
#include "ns3/config.h"
|
||||||
#include "ns3/waypoint.h"
|
#include "ns3/waypoint.h"
|
||||||
#include "ns3/double.h"
|
#include "ns3/double.h"
|
||||||
|
#include "ns3/uinteger.h"
|
||||||
#include "ns3/mobility-helper.h"
|
#include "ns3/mobility-helper.h"
|
||||||
|
|
||||||
#include "ground-node-helper.h"
|
#include "ground-node-helper.h"
|
||||||
|
@ -58,17 +59,18 @@ LeoGndNodeHelper::Install (const std::string &file)
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeContainer
|
NodeContainer
|
||||||
LeoGndNodeHelper::Install (uint64_t numNodes)
|
LeoGndNodeHelper::Install (uint32_t latNodes, uint32_t lonNodes)
|
||||||
{
|
{
|
||||||
NodeContainer nodes;
|
NodeContainer nodes;
|
||||||
for (uint64_t i = 0; i < numNodes; i++)
|
for (uint64_t i = 0; i < lonNodes * latNodes; i++)
|
||||||
{
|
{
|
||||||
nodes.Add (m_gndNodeFactory.Create<Node> ());
|
nodes.Add (m_gndNodeFactory.Create<Node> ());
|
||||||
}
|
}
|
||||||
MobilityHelper mobility;
|
MobilityHelper mobility;
|
||||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||||
mobility.SetPositionAllocator ("ns3::LeoPolarPositionAllocator",
|
mobility.SetPositionAllocator ("ns3::LeoPolarPositionAllocator",
|
||||||
"Step", DoubleValue (360.0 * 180.0 / numNodes));
|
"LatNum", UintegerValue (latNodes),
|
||||||
|
"LonNum", UintegerValue (lonNodes));
|
||||||
|
|
||||||
mobility.Install (nodes);
|
mobility.Install (nodes);
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,11 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* \param numNodes a number of nodes to uniformly distribute accross earth
|
* \param latNodes a number of nodes to in latitude direction
|
||||||
|
* \param lonNodes a number of nodes to in longitude direction
|
||||||
* \returns a node container containing nodes using the specified attributes
|
* \returns a node container containing nodes using the specified attributes
|
||||||
*/
|
*/
|
||||||
NodeContainer Install (uint64_t numNodes);
|
NodeContainer Install (uint32_t latNodes, uint32_t lonNodes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "ns3/packet.h"
|
#include "ns3/packet.h"
|
||||||
#include "ns3/names.h"
|
#include "ns3/names.h"
|
||||||
#include "ns3/trace-helper.h"
|
#include "ns3/trace-helper.h"
|
||||||
|
#include "ns3/string.h"
|
||||||
|
|
||||||
#include "../model/mock-net-device.h"
|
#include "../model/mock-net-device.h"
|
||||||
#include "../model/isl-mock-channel.h"
|
#include "../model/isl-mock-channel.h"
|
||||||
|
@ -43,6 +44,8 @@ IslHelper::IslHelper ()
|
||||||
m_queueFactory.SetTypeId ("ns3::DropTailQueue<Packet>");
|
m_queueFactory.SetTypeId ("ns3::DropTailQueue<Packet>");
|
||||||
m_deviceFactory.SetTypeId ("ns3::MockNetDevice");
|
m_deviceFactory.SetTypeId ("ns3::MockNetDevice");
|
||||||
m_channelFactory.SetTypeId ("ns3::IslMockChannel");
|
m_channelFactory.SetTypeId ("ns3::IslMockChannel");
|
||||||
|
m_channelFactory.Set ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
||||||
|
m_channelFactory.Set ("PropagationLoss", StringValue ("ns3::IslPropagationLossModel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -85,7 +85,7 @@ IslMockChannel::TransmitStart (
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NS_LOG_LOGIC ("destination address " << destAddr << " unknown on channel");
|
NS_LOG_ERROR ("destination address " << destAddr << " unknown on channel");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,15 @@ namespace ns3 {
|
||||||
|
|
||||||
std::ostream &operator << (std::ostream &os, const LeoLatLong &l)
|
std::ostream &operator << (std::ostream &os, const LeoLatLong &l)
|
||||||
{
|
{
|
||||||
os << l.label << "," << l.latitude << "," << l.longitude;
|
os << 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, c2;
|
char c1;
|
||||||
is >> l.label >> c1 >> l.latitude >> c2 >> l.longitude;
|
is >> l.latitude >> c1 >> l.longitude;
|
||||||
if (c1 != ',' ||
|
if (c1 != ':')
|
||||||
c2 != ',')
|
|
||||||
{
|
{
|
||||||
is.setstate (std::ios_base::failbit);
|
is.setstate (std::ios_base::failbit);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +23,6 @@ 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 () {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,10 +12,8 @@ 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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,11 +79,16 @@ LeoMockChannel::TransmitStart (Ptr<const Packet> p,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure to return false if packet has been delivered to *no* device
|
||||||
|
bool result = false;
|
||||||
for (DeviceIndex::iterator it = dests->begin (); it != dests->end(); it ++)
|
for (DeviceIndex::iterator it = dests->begin (); it != dests->end(); it ++)
|
||||||
{
|
{
|
||||||
Deliver (p, srcDev, it->second, txTime);
|
if (Deliver (p, srcDev, it->second, txTime))
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#include "ns3/double.h"
|
#include "ns3/double.h"
|
||||||
|
#include "ns3/uinteger.h"
|
||||||
|
#include "ns3/log.h"
|
||||||
|
|
||||||
#include "leo-polar-position-allocator.h"
|
#include "leo-polar-position-allocator.h"
|
||||||
|
|
||||||
|
@ -10,8 +12,10 @@ namespace ns3 {
|
||||||
|
|
||||||
NS_OBJECT_ENSURE_REGISTERED (LeoPolarPositionAllocator);
|
NS_OBJECT_ENSURE_REGISTERED (LeoPolarPositionAllocator);
|
||||||
|
|
||||||
|
NS_LOG_COMPONENT_DEFINE ("LeoPolarPositionAllocator");
|
||||||
|
|
||||||
LeoPolarPositionAllocator::LeoPolarPositionAllocator ()
|
LeoPolarPositionAllocator::LeoPolarPositionAllocator ()
|
||||||
: m_latStart (0), m_lonStart (0), m_latEnd (0), m_lonEnd (0), m_step (5), m_lat (-1000.0), m_lon (-1000.0)
|
: m_latStart (0), m_lonStart (0), m_latStop (0), m_lonStop (0), m_latNum (1), m_lonNum (1), m_lat (0), m_lon (0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
LeoPolarPositionAllocator::~LeoPolarPositionAllocator ()
|
LeoPolarPositionAllocator::~LeoPolarPositionAllocator ()
|
||||||
|
@ -27,28 +31,37 @@ LeoPolarPositionAllocator::GetTypeId (void)
|
||||||
.AddAttribute ("LatStart",
|
.AddAttribute ("LatStart",
|
||||||
"Start at this latitude",
|
"Start at this latitude",
|
||||||
DoubleValue (-90),
|
DoubleValue (-90),
|
||||||
MakeDoubleAccessor (&LeoPolarPositionAllocator::m_latStart),
|
MakeDoubleAccessor (&LeoPolarPositionAllocator::SetLatStart,
|
||||||
|
&LeoPolarPositionAllocator::GetLatStart),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
.AddAttribute ("LatStop",
|
.AddAttribute ("LatStop",
|
||||||
"Stop at this longitude",
|
"Stop at this longitude",
|
||||||
DoubleValue (90),
|
DoubleValue (90),
|
||||||
MakeDoubleAccessor (&LeoPolarPositionAllocator::m_latEnd),
|
MakeDoubleAccessor (&LeoPolarPositionAllocator::SetLatStop,
|
||||||
|
&LeoPolarPositionAllocator::GetLatStop),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
|
.AddAttribute ("LatNum",
|
||||||
|
"The number nodes along one latitude",
|
||||||
|
UintegerValue (10),
|
||||||
|
MakeUintegerAccessor (&LeoPolarPositionAllocator::m_latNum),
|
||||||
|
MakeUintegerChecker<uint32_t> ())
|
||||||
.AddAttribute ("LongStart",
|
.AddAttribute ("LongStart",
|
||||||
"Start at this longitude",
|
"Start at this longitude",
|
||||||
DoubleValue (-180),
|
DoubleValue (-180),
|
||||||
MakeDoubleAccessor (&LeoPolarPositionAllocator::m_lonStart),
|
MakeDoubleAccessor (&LeoPolarPositionAllocator::SetLonStart,
|
||||||
|
&LeoPolarPositionAllocator::GetLonStart),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
.AddAttribute ("LongStop",
|
.AddAttribute ("LongStop",
|
||||||
"Stop at this longitude",
|
"Stop at this longitude",
|
||||||
DoubleValue (180),
|
DoubleValue (180),
|
||||||
MakeDoubleAccessor (&LeoPolarPositionAllocator::m_lonEnd),
|
MakeDoubleAccessor (&LeoPolarPositionAllocator::SetLonStop,
|
||||||
MakeDoubleChecker<double> ())
|
&LeoPolarPositionAllocator::GetLonStop),
|
||||||
.AddAttribute ("Step",
|
|
||||||
"The degrees inbetween neighboring locations",
|
|
||||||
DoubleValue (5),
|
|
||||||
MakeDoubleAccessor (&LeoPolarPositionAllocator::m_step),
|
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
|
.AddAttribute ("LonNum",
|
||||||
|
"The number nodes along one longitude",
|
||||||
|
UintegerValue (10),
|
||||||
|
MakeUintegerAccessor (&LeoPolarPositionAllocator::m_lonNum),
|
||||||
|
MakeUintegerChecker<uint32_t> ())
|
||||||
;
|
;
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
|
@ -56,33 +69,88 @@ LeoPolarPositionAllocator::GetTypeId (void)
|
||||||
int64_t
|
int64_t
|
||||||
LeoPolarPositionAllocator::AssignStreams (int64_t stream)
|
LeoPolarPositionAllocator::AssignStreams (int64_t stream)
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this << stream);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector
|
Vector
|
||||||
LeoPolarPositionAllocator::GetNext () const
|
LeoPolarPositionAllocator::GetNext () const
|
||||||
{
|
{
|
||||||
m_lat = std::max (m_latStart, m_lat);
|
NS_LOG_FUNCTION (this);
|
||||||
m_lon = std::max (m_lonStart, m_lon);
|
|
||||||
|
|
||||||
double lat = m_lat * (M_PI / 90);
|
double lat = m_lat * (M_PI / m_latNum) - (M_PI / 2);
|
||||||
double lon = m_lon * (M_PI / 180);
|
double lon = m_lon * (2 * M_PI / m_lonNum) - M_PI;
|
||||||
Vector3D next = Vector3D (LEO_GND_RAD_EARTH * sin (lat) * cos (lon),
|
Vector3D next = Vector3D (LEO_GND_RAD_EARTH * cos (lat) * cos (lon),
|
||||||
LEO_GND_RAD_EARTH * sin (lat) * sin (lon),
|
LEO_GND_RAD_EARTH * cos (lat) * sin (lon),
|
||||||
LEO_GND_RAD_EARTH * cos (lat));
|
LEO_GND_RAD_EARTH * sin (lat));
|
||||||
|
|
||||||
m_lat = m_lat + m_step;
|
m_lat ++;
|
||||||
if (m_lat > m_latEnd)
|
if (m_lat > m_latNum)
|
||||||
{
|
{
|
||||||
m_lat = m_latStart;
|
m_lat = 0;
|
||||||
m_lon += m_step;
|
m_lon = (m_lon+1) % m_lonNum;
|
||||||
if (m_lon > m_lonEnd)
|
|
||||||
{
|
|
||||||
m_lon = m_lonStart;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_LOG_INFO ("Ground station at " << lat << ":" << lon << " -> " << next);
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
LeoPolarPositionAllocator::GetLatStart () const
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
return m_latStart * (180.0 / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
LeoPolarPositionAllocator::GetLonStart () const
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
return m_lonStart * (180.0 / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
LeoPolarPositionAllocator::GetLatStop () const
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
return m_latStop * (180.0 / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
LeoPolarPositionAllocator::GetLonStop () const
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
return m_lonStop * (180.0 / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LeoPolarPositionAllocator::SetLatStart (double lat)
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this << lat);
|
||||||
|
m_latStart = (lat / 180.0) * M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LeoPolarPositionAllocator::SetLonStart (double lon)
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this << lon);
|
||||||
|
m_lonStart = (lon / 180.0) * M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LeoPolarPositionAllocator::SetLatStop (double lat)
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this << lat);
|
||||||
|
m_latStop = (lat / 180.0) * M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LeoPolarPositionAllocator::SetLonStop (double lon)
|
||||||
|
{
|
||||||
|
NS_LOG_FUNCTION (this << lon);
|
||||||
|
m_lonStop = (lon / 180.0) * M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,17 +27,28 @@ public:
|
||||||
virtual Vector GetNext (void) const;
|
virtual Vector GetNext (void) const;
|
||||||
virtual int64_t AssignStreams (int64_t stream);
|
virtual int64_t AssignStreams (int64_t stream);
|
||||||
|
|
||||||
|
double GetLatStart () const;
|
||||||
|
double GetLonStart () const;
|
||||||
|
double GetLatStop () const;
|
||||||
|
double GetLonStop () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_latStart;
|
double m_latStart;
|
||||||
double m_lonStart;
|
double m_lonStart;
|
||||||
|
|
||||||
double m_latEnd;
|
double m_latStop;
|
||||||
double m_lonEnd;
|
double m_lonStop;
|
||||||
|
|
||||||
double m_step;
|
uint32_t m_latNum;
|
||||||
|
uint32_t m_lonNum;
|
||||||
|
|
||||||
mutable double m_lat;
|
mutable uint32_t m_lat;
|
||||||
mutable double m_lon;
|
mutable uint32_t m_lon;
|
||||||
|
|
||||||
|
void SetLatStart (double lat);
|
||||||
|
void SetLonStart (double lon);
|
||||||
|
void SetLatStop (double lat);
|
||||||
|
void SetLonStop (double lon);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ LeoPropagationLossModel::GetTypeId (void)
|
||||||
.AddConstructor<LeoPropagationLossModel> ()
|
.AddConstructor<LeoPropagationLossModel> ()
|
||||||
.AddAttribute ("MaxDistance",
|
.AddAttribute ("MaxDistance",
|
||||||
"Cut-off distance for signal propagation",
|
"Cut-off distance for signal propagation",
|
||||||
DoubleValue (2000.0),
|
DoubleValue (3000.0),
|
||||||
MakeDoubleAccessor (&LeoPropagationLossModel::SetCutoffDistance,
|
MakeDoubleAccessor (&LeoPropagationLossModel::SetCutoffDistance,
|
||||||
&LeoPropagationLossModel::GetCutoffDistance),
|
&LeoPropagationLossModel::GetCutoffDistance),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
|
|
|
@ -170,6 +170,7 @@ MockChannel::Deliver (
|
||||||
rxPower = pLoss->CalcRxPower (txPower, srcMob, dstMob);
|
rxPower = pLoss->CalcRxPower (txPower, srcMob, dstMob);
|
||||||
if (rxPower <= -1000.0)
|
if (rxPower <= -1000.0)
|
||||||
{
|
{
|
||||||
|
NS_LOG_WARN (this << "unable to reach destination " << dst->GetNode ()->GetId () << " from " << src->GetNode ()->GetId ());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,14 +102,12 @@ MockNetDevice::GetTypeId (void)
|
||||||
"This is a non-promiscuous trace,",
|
"This is a non-promiscuous trace,",
|
||||||
MakeTraceSourceAccessor (&MockNetDevice::m_macRxTrace),
|
MakeTraceSourceAccessor (&MockNetDevice::m_macRxTrace),
|
||||||
"ns3::Packet::TracedCallback")
|
"ns3::Packet::TracedCallback")
|
||||||
#if 0
|
|
||||||
// Not currently implemented for this device
|
// Not currently implemented for this device
|
||||||
.AddTraceSource ("MacRxDrop",
|
.AddTraceSource ("MacRxDrop",
|
||||||
"Trace source indicating a packet was dropped "
|
"Trace source indicating a packet was dropped "
|
||||||
"before being forwarded up the stack",
|
"before being forwarded up the stack",
|
||||||
MakeTraceSourceAccessor (&MockNetDevice::m_macRxDropTrace),
|
MakeTraceSourceAccessor (&MockNetDevice::m_macRxDropTrace),
|
||||||
"ns3::Packet::TracedCallback")
|
"ns3::Packet::TracedCallback")
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// Trace sources at the "bottom" of the net device, where packets transition
|
// Trace sources at the "bottom" of the net device, where packets transition
|
||||||
// to/from the channel.
|
// to/from the channel.
|
||||||
|
@ -413,6 +411,7 @@ MockNetDevice::Receive (Ptr<Packet> packet,
|
||||||
|
|
||||||
if (senderDevice == this)
|
if (senderDevice == this)
|
||||||
{
|
{
|
||||||
|
m_macRxDropTrace (packet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,10 +683,15 @@ MockNetDevice::Send (Ptr<Packet> packet,
|
||||||
m_snifferTrace (packet);
|
m_snifferTrace (packet);
|
||||||
TransmitStart (packet, dest);
|
TransmitStart (packet, dest);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NS_LOG_LOGIC (this << "channel not ready, postponing transmit start: " << m_queue->GetCurrentSize () << "/" << m_queue->GetMaxSize ());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enqueue may fail (overflow)
|
// Enqueue may fail (overflow)
|
||||||
|
NS_LOG_WARN ("queue overflowed: " << m_queue->GetCurrentSize () << "/" << m_queue->GetMaxSize ());
|
||||||
|
|
||||||
m_macTxDropTrace (packet);
|
m_macTxDropTrace (packet);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -68,8 +68,8 @@ void
|
||||||
SomeGndNodeHelperTestCase::DoRun (void)
|
SomeGndNodeHelperTestCase::DoRun (void)
|
||||||
{
|
{
|
||||||
LeoGndNodeHelper gndHelper;
|
LeoGndNodeHelper gndHelper;
|
||||||
NodeContainer nodes = gndHelper.Install (LeoLatLong ("station1", 50.1, 10.0),
|
NodeContainer nodes = gndHelper.Install (LeoLatLong (50.1, 10.0),
|
||||||
LeoLatLong ("station2", -70.1, -21.0));
|
LeoLatLong (-70.1, -21.0));
|
||||||
|
|
||||||
NS_ASSERT_MSG (nodes.GetN () == 2, "No ground stations");
|
NS_ASSERT_MSG (nodes.GetN () == 2, "No ground stations");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue