mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Bugfixes and performance optimizations
This commit is contained in:
parent
0f49ceb4aa
commit
dd55b495c4
7 changed files with 19 additions and 17 deletions
|
@ -114,11 +114,11 @@ LeoChannelHelper::SetConstellationAttributes (double eirp,
|
||||||
m_gndDeviceFactory.Set ("TxPower", DoubleValue (eirp));
|
m_gndDeviceFactory.Set ("TxPower", DoubleValue (eirp));
|
||||||
m_satDeviceFactory.Set ("TxPower", DoubleValue (eirp));
|
m_satDeviceFactory.Set ("TxPower", DoubleValue (eirp));
|
||||||
|
|
||||||
m_gndDeviceFactory.Set ("RxGain", DoubleValue (rxGain));
|
|
||||||
m_gndDeviceFactory.Set ("RxLoss", DoubleValue (rxLoss));
|
m_gndDeviceFactory.Set ("RxLoss", DoubleValue (rxLoss));
|
||||||
|
m_gndDeviceFactory.Set ("RxGain", DoubleValue (rxGain));
|
||||||
|
|
||||||
m_satDeviceFactory.Set ("RxLoss", DoubleValue (rxGain));
|
m_satDeviceFactory.Set ("RxLoss", DoubleValue (rxLoss));
|
||||||
m_satDeviceFactory.Set ("RxGain", DoubleValue (rxLoss));
|
m_satDeviceFactory.Set ("RxGain", DoubleValue (rxGain));
|
||||||
|
|
||||||
m_gndDeviceFactory.Set ("DataRate", DataRateValue (DataRate (dataRate)));
|
m_gndDeviceFactory.Set ("DataRate", DataRateValue (DataRate (dataRate)));
|
||||||
m_satDeviceFactory.Set ("DataRate", DataRateValue (DataRate (dataRate)));
|
m_satDeviceFactory.Set ("DataRate", DataRateValue (DataRate (dataRate)));
|
||||||
|
|
|
@ -67,8 +67,8 @@ IslMockChannel::TransmitStart (
|
||||||
NS_LOG_ERROR ("Source device unknown");
|
NS_LOG_ERROR ("Source device unknown");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Ptr<MockNetDevice> src = DynamicCast<MockNetDevice> (GetDevice (srcId));
|
Ptr<MockNetDevice> src = StaticCast<MockNetDevice> (GetDevice (srcId));
|
||||||
Ptr<MockNetDevice> dst = DynamicCast<MockNetDevice> (GetDevice (destAddr));
|
Ptr<MockNetDevice> dst = StaticCast<MockNetDevice> (GetDevice (destAddr));
|
||||||
|
|
||||||
if (dst == nullptr)
|
if (dst == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ IslMockChannel::TransmitStart (
|
||||||
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 = StaticCast<MockNetDevice> (GetDevice (i));
|
||||||
Deliver (p, src, dst, txTime);
|
Deliver (p, src, dst, txTime);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -89,7 +89,7 @@ IslPropagationLossModel::DoCalcRxPower (double txPowerDbm,
|
||||||
{
|
{
|
||||||
if (!GetLos (a, b))
|
if (!GetLos (a, b))
|
||||||
{
|
{
|
||||||
return 0.0;
|
return -1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_LOG_INFO ("LOS;"<<a->GetPosition ()<<";"<<b->GetPosition ());
|
NS_LOG_INFO ("LOS;"<<a->GetPosition ()<<";"<<b->GetPosition ());
|
||||||
|
|
|
@ -50,7 +50,7 @@ LeoMockChannel::TransmitStart (Ptr<const Packet> p,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<MockNetDevice> srcDev = DynamicCast<MockNetDevice> (GetDevice (devId));
|
Ptr<MockNetDevice> srcDev = StaticCast<MockNetDevice> (GetDevice (devId));
|
||||||
if (srcDev == 0)
|
if (srcDev == 0)
|
||||||
{
|
{
|
||||||
NS_LOG_ERROR ("Source device unknown");
|
NS_LOG_ERROR ("Source device unknown");
|
||||||
|
@ -89,7 +89,7 @@ LeoMockChannel::TransmitStart (Ptr<const Packet> p,
|
||||||
int32_t
|
int32_t
|
||||||
LeoMockChannel::Attach (Ptr<MockNetDevice> device)
|
LeoMockChannel::Attach (Ptr<MockNetDevice> device)
|
||||||
{
|
{
|
||||||
Ptr<LeoMockNetDevice> leodev = DynamicCast<LeoMockNetDevice> (device);
|
Ptr<LeoMockNetDevice> leodev = StaticCast<LeoMockNetDevice> (device);
|
||||||
|
|
||||||
// Add to index
|
// Add to index
|
||||||
switch (leodev->GetDeviceType ())
|
switch (leodev->GetDeviceType ())
|
||||||
|
|
|
@ -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 (100000.0),
|
DoubleValue (1000000.0),
|
||||||
MakeDoubleAccessor (&LeoPropagationLossModel::m_cutoffDistance),
|
MakeDoubleAccessor (&LeoPropagationLossModel::m_cutoffDistance),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
.AddAttribute ("ElevationAngle",
|
.AddAttribute ("ElevationAngle",
|
||||||
|
@ -78,13 +78,14 @@ LeoPropagationLossModel::DoCalcRxPower (double txPowerDbm,
|
||||||
{
|
{
|
||||||
if (a->GetDistanceFrom (b) > m_cutoffDistance || GetAngle (a, b) > m_elevationAngle / 2.0)
|
if (a->GetDistanceFrom (b) > m_cutoffDistance || GetAngle (a, b) > m_elevationAngle / 2.0)
|
||||||
{
|
{
|
||||||
return 0.0;
|
return -1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// txPowerDbm includes tx antenna gain and losses
|
// txPowerDbm includes tx antenna gain and losses
|
||||||
// receiver loss and gain added at net device
|
// receiver loss and gain added at net device
|
||||||
// P_{RX} = P_{TX} + G_{TX} - L_{TX} - L_{FS} - L_M + G_{RX} - L_{RX}
|
// P_{RX} = P_{TX} + G_{TX} - L_{TX} - L_{FS} - L_M + G_{RX} - L_{RX}
|
||||||
double rxc = txPowerDbm - m_atmosphericLoss - m_freeSpacePathLoss - m_linkMargin;
|
double rxc = txPowerDbm - m_atmosphericLoss - m_freeSpacePathLoss - m_linkMargin;
|
||||||
|
NS_LOG_DEBUG("rxc="<<rxc);
|
||||||
|
|
||||||
return rxc;
|
return rxc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,22 +179,23 @@ MockChannel::Deliver (
|
||||||
|
|
||||||
if (srcMob != 0 && dstMob != 0)
|
if (srcMob != 0 && dstMob != 0)
|
||||||
{
|
{
|
||||||
|
// performance optimization
|
||||||
|
if (srcMob->GetDistanceFrom (dstMob) > 3.0e6)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Ptr<PropagationLossModel> pLoss = GetPropagationLoss ();
|
Ptr<PropagationLossModel> pLoss = GetPropagationLoss ();
|
||||||
if (pLoss != 0)
|
if (pLoss != 0)
|
||||||
{
|
{
|
||||||
// check if signal reaches destination
|
// check if signal reaches destination
|
||||||
rxPower = pLoss->CalcRxPower (txPower, srcMob, dstMob);
|
rxPower = pLoss->CalcRxPower (txPower, srcMob, dstMob);
|
||||||
if (rxPower == 0.0)
|
if (rxPower == -1000.0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delay += GetPropagationDelay (srcMob, dstMob, txTime);
|
delay += GetPropagationDelay (srcMob, dstMob, txTime);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),
|
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),
|
||||||
delay,
|
delay,
|
||||||
|
|
|
@ -72,7 +72,7 @@ MockNetDevice::GetTypeId (void)
|
||||||
MakeTimeChecker ())
|
MakeTimeChecker ())
|
||||||
.AddAttribute ("RxThreshold",
|
.AddAttribute ("RxThreshold",
|
||||||
"Receive threshold in dBm",
|
"Receive threshold in dBm",
|
||||||
DoubleValue (0.0),
|
DoubleValue (-1000.0),
|
||||||
MakeDoubleAccessor (&MockNetDevice::m_rxThreshold),
|
MakeDoubleAccessor (&MockNetDevice::m_rxThreshold),
|
||||||
MakeDoubleChecker<double> ())
|
MakeDoubleChecker<double> ())
|
||||||
.AddAttribute ("TxPower",
|
.AddAttribute ("TxPower",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue