Use propagation loss

This commit is contained in:
Tim Schubert 2020-08-07 12:42:53 +02:00
parent 9fdd70166c
commit 582d6c58d0
6 changed files with 14 additions and 18 deletions

View file

@ -67,14 +67,13 @@ IslMockChannel::TransmitStart (
if (dst == nullptr) if (dst == nullptr)
{ {
if (src->IsBroadcast () || src->IsMulticast ()) if (Mac48Address::ConvertFrom (destAddr).IsBroadcast () || Mac48Address::ConvertFrom (destAddr).IsBroadcast ())
// try to deliver to every node in LOS // try to deliver to every node in LOS
{ {
for (size_t i = 0; i < GetNDevices (); i ++) for (size_t i = 0; i < GetNDevices (); i ++)
{ {
if (i == srcId) continue; if (i == srcId) continue;
dst = DynamicCast<MockNetDevice> (GetDevice (i)); dst = DynamicCast<MockNetDevice> (GetDevice (i));
// TODO check LOS using mobility model
Deliver (p, src, dst, txTime); Deliver (p, src, dst, txTime);
} }
return true; return true;

View file

@ -83,17 +83,13 @@ IslPropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a, Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const Ptr<MobilityModel> b) const
{ {
// TODO perform line-earth intersection (ray tracing or based on earth
// curvature + distance)
// primitivec cut-of at 1000 km // primitivec cut-of at 1000 km
if (!GetLos (a, b)) if (!GetLos (a, b))
{ {
return 0; return 0.0;
} }
double rxc = 0;//-m_variable->GetValue (); double rxc = 0.0;//-m_variable->GetValue ();
NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db"); NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db");
return txPowerDbm + rxc; return txPowerDbm + rxc;
} }

View file

@ -73,7 +73,6 @@ LeoMockChannel::TransmitStart (Ptr<const Packet> p,
return false; return false;
} }
// TODO deliver only to devices in the same beam
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); Deliver (p, srcDev, it->second, txTime);

View file

@ -61,13 +61,12 @@ LeoPropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a, Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const Ptr<MobilityModel> b) const
{ {
// TODO create attributes for max distance and angle
if (a->GetDistanceFrom (b) > m_cutoffDistance && GetAngle (a, b) > m_cutoffAngle) if (a->GetDistanceFrom (b) > m_cutoffDistance && GetAngle (a, b) > m_cutoffAngle)
{ {
return 0; return 0.0;
} }
double rxc = 0;//-m_variable->GetValue (); double rxc = 0.0;//-m_variable->GetValue ();
//NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db"); //NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db");
return txPowerDbm + rxc; return txPowerDbm + rxc;
} }

View file

@ -161,6 +161,13 @@ MockChannel::Deliver (
{ {
NS_LOG_FUNCTION (this << p << src->GetAddress () << dst->GetAddress () << txTime); NS_LOG_FUNCTION (this << p << src->GetAddress () << dst->GetAddress () << txTime);
double rxPower = GetPropagationLoss ()->CalcRxPower (1.0, src, dst);
if (rxPower == 0.0)
{
return false;
}
Time delay = GetDelay (src, dst, txTime); Time delay = GetDelay (src, dst, txTime);
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (), Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),

View file

@ -578,15 +578,11 @@ MockNetDevice::AddLinkChangeCallback (Callback<void> callback)
m_linkChangeCallbacks.ConnectWithoutContext (callback); m_linkChangeCallbacks.ConnectWithoutContext (callback);
} }
//
// This is a point-to-point device, so every transmission is a broadcast to
// all of the devices on the network.
//
bool bool
MockNetDevice::IsBroadcast (void) const MockNetDevice::IsBroadcast (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return true; return false;
} }
// //
@ -605,7 +601,7 @@ bool
MockNetDevice::IsMulticast (void) const MockNetDevice::IsMulticast (void) const
{ {
NS_LOG_FUNCTION (this); NS_LOG_FUNCTION (this);
return true; return false;
} }
Address Address