mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 01:53:58 +02:00
Fix ISL LOS
This commit is contained in:
parent
ae1d24ca80
commit
5aa6ec32b7
2 changed files with 33 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -35,15 +35,19 @@ IslPropagationLossModel::~IslPropagationLossModel ()
|
|||
bool
|
||||
IslPropagationLossModel::GetLos (Ptr<MobilityModel> moda, Ptr<MobilityModel> 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<MobilityModel> moda, Ptr<MobilityModel> mod
|
|||
<<";c="<<c
|
||||
<<";disc="<<discriminant);
|
||||
|
||||
return discriminant < 0;
|
||||
if (discriminant < 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// distances from oc (first sat)
|
||||
double t1 = (-b - sqrt (discriminant)) / (2.0 * a);
|
||||
double t2 = (-b + sqrt (discriminant)) / (2.0 * a);
|
||||
|
||||
NS_LOG_DEBUG ("t1="<<t1
|
||||
<<"t2="<<t2
|
||||
<<"s2="<<s2);
|
||||
|
||||
// check if second sat is behind earth
|
||||
return (s2 < abs (t1) && s2 < abs (t2));
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -65,14 +85,12 @@ IslPropagationLossModel::DoCalcRxPower (double txPowerDbm,
|
|||
Ptr<MobilityModel> a,
|
||||
Ptr<MobilityModel> b) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << txPowerDbm << a << b);
|
||||
if (!GetLos (a, b))
|
||||
{
|
||||
NS_LOG_DEBUG ("DROP;"<<a->GetPosition ()<<";"<<b->GetPosition ());
|
||||
return -1000.0;
|
||||
}
|
||||
|
||||
NS_LOG_DEBUG ("LOS;"<<a->GetPosition ()<<";"<<b->GetPosition ());
|
||||
|
||||
return txPowerDbm;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue