mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Fix LEO propagation loss
This commit is contained in:
parent
a92c54703f
commit
ad22221f42
6 changed files with 65 additions and 28 deletions
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
outfile << "Time,Satellite,x,y,z,Speed" << std::endl;
|
||||
|
||||
Simulator::Stop (Hours (24));
|
||||
Simulator::Stop (Hours (1));
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
|
|
@ -33,12 +33,11 @@ public:
|
|||
int main (int argc, char *argv[])
|
||||
{
|
||||
std::vector<Orbit> orbits = {
|
||||
Orbit (1.150, 53.0, 32, 50),
|
||||
Orbit (1.110, 53.8, 32, 50),
|
||||
Orbit (1.130, 74.0, 8, 50),
|
||||
Orbit (1.275, 81, 5, 75),
|
||||
Orbit (1.325, 70, 6, 75),
|
||||
|
||||
Orbit (1150, 53.0, 32, 50),
|
||||
Orbit (1110, 53.8, 32, 50),
|
||||
Orbit (1130, 74.0, 8, 50),
|
||||
Orbit (1275, 81, 5, 75),
|
||||
Orbit (1325, 70, 6, 75),
|
||||
};
|
||||
NodeContainer satellites;
|
||||
for (Orbit orb: orbits)
|
||||
|
@ -64,8 +63,7 @@ int main (int argc, char *argv[])
|
|||
NetDeviceContainer islNet, utNet;
|
||||
|
||||
IslHelper islCh;
|
||||
islCh.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||
islCh.SetDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||
islCh.SetDeviceAttribute ("DataRate", StringValue ("1Gbps"));
|
||||
islCh.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
||||
islCh.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::IslPropagationLossModel"));
|
||||
islNet = islCh.Install (satellites);
|
||||
|
@ -76,15 +74,15 @@ int main (int argc, char *argv[])
|
|||
|
||||
// Install internet stack on nodes
|
||||
AodvHelper aodv;
|
||||
aodv.Set ("HelloInterval", TimeValue (Seconds (10)));
|
||||
aodv.Set ("HelloInterval", TimeValue (Seconds (1)));
|
||||
aodv.Set ("TtlStart", UintegerValue (10));
|
||||
aodv.Set ("TtlIncrement", UintegerValue (10));
|
||||
aodv.Set ("TtlThreshold", UintegerValue (1000));
|
||||
aodv.Set ("TtlThreshold", UintegerValue (100));
|
||||
aodv.Set ("RreqRetries", UintegerValue (100));
|
||||
aodv.Set ("RreqRateLimit", UintegerValue (100));
|
||||
aodv.Set ("RerrRateLimit", UintegerValue (100));
|
||||
aodv.Set ("ActiveRouteTimeout", TimeValue (Seconds (10)));
|
||||
aodv.Set ("NextHopWait", TimeValue (MilliSeconds (100)));
|
||||
aodv.Set ("RreqRateLimit", UintegerValue (10));
|
||||
aodv.Set ("RerrRateLimit", UintegerValue (10));
|
||||
aodv.Set ("ActiveRouteTimeout", TimeValue (Minutes (1)));
|
||||
aodv.Set ("NextHopWait", TimeValue (MilliSeconds (200)));
|
||||
aodv.Set ("NetDiameter", UintegerValue (1000));
|
||||
aodv.Set ("PathDiscoveryTime", TimeValue (Seconds (1)));
|
||||
|
||||
|
@ -107,9 +105,10 @@ int main (int argc, char *argv[])
|
|||
// install a client on one of the terminals
|
||||
ApplicationContainer clientApps;
|
||||
Address remote = stations.Get (1)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();//utIp.GetAddress (1, 0);
|
||||
std::cout << "REMOTE=" << Ipv4Address::ConvertFrom (remote);
|
||||
UdpClientHelper echoClient (remote, 9);
|
||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (360));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds (10.0)));
|
||||
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
||||
clientApps.Add (echoClient.Install (stations.Get (3)));
|
||||
|
||||
|
|
|
@ -23,13 +23,15 @@ LeoPropagationLossModel::GetTypeId (void)
|
|||
.AddConstructor<LeoPropagationLossModel> ()
|
||||
.AddAttribute ("MaxDistance",
|
||||
"Cut-off distance for signal propagation",
|
||||
DoubleValue (1000000.0),
|
||||
MakeDoubleAccessor (&LeoPropagationLossModel::m_cutoffDistance),
|
||||
DoubleValue (3000),
|
||||
MakeDoubleAccessor (&LeoPropagationLossModel::SetCutoffDistance,
|
||||
&LeoPropagationLossModel::GetCutoffDistance),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("ElevationAngle",
|
||||
"Cut-off angle for signal propagation",
|
||||
DoubleValue (M_PI / 9),
|
||||
MakeDoubleAccessor (&LeoPropagationLossModel::m_elevationAngle),
|
||||
MakeDoubleAccessor (&LeoPropagationLossModel::SetElevationAngle,
|
||||
&LeoPropagationLossModel::GetElevationAngle),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("AtmosphericLoss",
|
||||
"Atmospheric loss due to attenuation in dB",
|
||||
|
@ -71,21 +73,56 @@ LeoPropagationLossModel::GetAngle (Ptr<MobilityModel> a, Ptr<MobilityModel> b)
|
|||
return acos (prod / norm);
|
||||
}
|
||||
|
||||
void
|
||||
LeoPropagationLossModel::SetElevationAngle (double angle)
|
||||
{
|
||||
m_elevationAngle = angle * (M_PI/180.0);
|
||||
}
|
||||
|
||||
double
|
||||
LeoPropagationLossModel::GetElevationAngle () const
|
||||
{
|
||||
return m_elevationAngle * (180.0/M_PI);
|
||||
}
|
||||
|
||||
void
|
||||
LeoPropagationLossModel::SetCutoffDistance (double d)
|
||||
{
|
||||
m_cutoffDistance = d * 1000.0;
|
||||
}
|
||||
|
||||
double
|
||||
LeoPropagationLossModel::GetCutoffDistance () const
|
||||
{
|
||||
return m_cutoffDistance / 1000.0;
|
||||
}
|
||||
|
||||
double
|
||||
LeoPropagationLossModel::DoCalcRxPower (double txPowerDbm,
|
||||
Ptr<MobilityModel> a,
|
||||
Ptr<MobilityModel> b) const
|
||||
{
|
||||
if (a->GetDistanceFrom (b) > m_cutoffDistance || GetAngle (a, b) > m_elevationAngle / 2.0)
|
||||
double distance = a->GetDistanceFrom (b);
|
||||
double angle = GetAngle (a, b);
|
||||
double rxc = txPowerDbm - m_atmosphericLoss - m_freeSpacePathLoss - m_linkMargin;
|
||||
|
||||
NS_LOG_DEBUG ("LEO propagation: a=" << a->GetPosition () << " b=" << b->GetPosition () << " m_cutOff="<<m_cutoffDistance<<" m_angle="<<m_elevationAngle<<" dist=" << distance << "angle=" << angle << "rxc=" << rxc);
|
||||
|
||||
if (distance > m_cutoffDistance)
|
||||
{
|
||||
NS_LOG_DEBUG ("LEO DROP DISTANCE: " << distance);
|
||||
return -1000.0;
|
||||
}
|
||||
|
||||
if (angle > m_elevationAngle / 2.0)
|
||||
{
|
||||
NS_LOG_DEBUG ("LEO DROP ANGLE: " << angle <<"; " << distance);
|
||||
return -1000.0;
|
||||
}
|
||||
|
||||
// txPowerDbm includes tx antenna gain and losses
|
||||
// receiver loss and gain added at net device
|
||||
// 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;
|
||||
NS_LOG_DEBUG("rxc="<<rxc);
|
||||
|
||||
return rxc;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ private:
|
|||
* can return zero
|
||||
*/
|
||||
virtual int64_t DoAssignStreams (int64_t stream);
|
||||
|
||||
void SetElevationAngle (double angle);
|
||||
double GetElevationAngle () const;
|
||||
|
||||
void SetCutoffDistance (double d);
|
||||
double GetCutoffDistance () const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -179,11 +179,6 @@ MockChannel::Deliver (
|
|||
|
||||
if (srcMob != 0 && dstMob != 0)
|
||||
{
|
||||
// performance optimization
|
||||
if (srcMob->GetDistanceFrom (dstMob) > 3.0e6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Ptr<PropagationLossModel> pLoss = GetPropagationLoss ();
|
||||
if (pLoss != 0)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,6 @@ numsamples=ARG4
|
|||
do for [j=0:numsamples-1] {
|
||||
splot [-pi:pi][-pi/2:pi/2] EARTH*cos(u)*cos(v), EARTH*sin(u)*cos(v), EARTH*sin(v), \
|
||||
ground using 1:2:3 lt rgb "green", \
|
||||
sats using 3:4:5:2 every ::(j*numsats)::((j+1)*numsats) lt rgb "blue"
|
||||
sats using 3:4:5:2 every ::(j*numsats)::((j+1)*numsats)
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue