From 5aa6ec32b7d137d7923ab10cbfe976196ce0330e Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Fri, 28 Aug 2020 13:10:21 +0200 Subject: [PATCH] Fix ISL LOS --- examples/leo-delay-tracing-example.cc | 9 ++++--- model/isl-propagation-loss-model.cc | 38 ++++++++++++++++++++------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/examples/leo-delay-tracing-example.cc b/examples/leo-delay-tracing-example.cc index 733c48a..e0058f6 100644 --- a/examples/leo-delay-tracing-example.cc +++ b/examples/leo-delay-tracing-example.cc @@ -44,7 +44,7 @@ int main (int argc, char *argv[]) uint32_t lonGws = 20; double interval; double duration; - bool islEnable = false; + bool islEnabled = false; bool traceDrops = false; bool traceTxRx = false; std::string routingProto = "aodv"; @@ -61,7 +61,7 @@ int main (int argc, char *argv[]) cmd.AddValue("ttlThresh", "ns3::aodv::RoutingProtocol::TtlThreshold"); cmd.AddValue("netDiameter", "ns3::aodv::RoutingProtocol::NetDiameter"); cmd.AddValue("routeTimeout", "ns3::aodv::RoutingProtocol::ActiveRouteTimeout"); - cmd.AddValue("islEnable", "Enable inter-satellite links", islEnable); + cmd.AddValue("islEnabled", "Enable inter-satellite links", islEnabled); cmd.AddValue("traceDrops", "Enable tracing of PHY and MAC drops", traceDrops); cmd.AddValue("traceTxRx", "Enable tracing of PHY and MAC transmits", traceTxRx); cmd.AddValue("latGws", "Latitudal rows of gateways", latGws); @@ -100,7 +100,8 @@ int main (int argc, char *argv[]) else { AodvHelper aodv; - //aodv.Set ("EnableHello", BooleanValue (false)); + aodv.Set ("EnableHello", BooleanValue (false)); + //aodv.Set ("RreqLimit", UintegerValue (2)); stack.SetRoutingHelper (aodv); } @@ -114,7 +115,7 @@ int main (int argc, char *argv[]) ipv4.SetBase ("10.1.0.0", "255.255.0.0"); ipv4.Assign (utNet); - if (islEnable) + if (islEnabled) { std::cerr << "ISL enabled" << std::endl; IslHelper islCh; diff --git a/model/isl-propagation-loss-model.cc b/model/isl-propagation-loss-model.cc index 3b453d6..11f365e 100644 --- a/model/isl-propagation-loss-model.cc +++ b/model/isl-propagation-loss-model.cc @@ -35,15 +35,19 @@ IslPropagationLossModel::~IslPropagationLossModel () bool IslPropagationLossModel::GetLos (Ptr moda, Ptr modb) { - // TODO get max distance with line-sphere intersection - // origin of LOS - Vector3D oc = moda->GetPosition (); - Vector3D bp = modb->GetPosition (); + Vector3D apos = moda->GetPosition (); + Vector3D bpos = modb->GetPosition (); + // select upper satellite as origin + Vector oc = apos.GetLength () > bpos.GetLength () ? apos : bpos; + Vector bp = apos.GetLength () > bpos.GetLength () ? bpos : apos; + + Vector3D u = bp - oc; + // distance from s1 to s2 + double s2 = u.GetLength (); // direction unit vector - Vector3D u = Vector3D (bp.x - oc.x, bp.y - oc.y, bp.z - oc.z); - u = Vector3D (u.x / u.GetLength (), u.y / u.GetLength (), u.z / u.GetLength ()); + u = Vector3D (u.x / s2, u.y / s2, u.z / s2); double a = u.x*u.x + u.y*u.y + u.z*u.z; double b = 2.0 * (oc.x*u.x + oc.y*u.y + oc.z*u.z); @@ -57,7 +61,23 @@ IslPropagationLossModel::GetLos (Ptr moda, Ptr mod <<";c="<GetPosition ()<<";"<GetPosition ()); return -1000.0; } - NS_LOG_DEBUG ("LOS;"<GetPosition ()<<";"<GetPosition ()); - return txPowerDbm; }