Add link params to model with attributes

This commit is contained in:
Tim Schubert 2020-08-10 13:31:01 +02:00
parent 1224169ff5
commit 27ee6a3697
8 changed files with 77 additions and 12 deletions

View file

@ -24,7 +24,7 @@ namespace ns3 {
#define LEO_ONEWEB_FREQUENCY 28.5 // GHz
#define LEO_ONEWEB_BANDWIDTH 0.25 // GHz
#define LEO_ONEWEB_TX_ANTENNA_D 2.4 // m
#define LEO_ONEWEB_EIRP 63.2 // dBW
#define LEO_ONEWEB_EIRP 93.2 // dBm
#define LEO_ONEWEB_MODCOD "256APSK 32/45" // -
#define LEO_ONEWEB_ROLL_OFF_FACTOR 0.1 // -
#define LEO_ONEWEB_SPECTRAL_EFF 5.1 // bps/Hz

View file

@ -26,10 +26,25 @@ LeoPropagationLossModel::GetTypeId (void)
DoubleValue (1000000.0),
MakeDoubleAccessor (&LeoPropagationLossModel::m_cutoffDistance),
MakeDoubleChecker<double> ())
.AddAttribute ("MaxAngle",
.AddAttribute ("ElevationAngle",
"Cut-off angle for signal propagation",
DoubleValue (20.0),
MakeDoubleAccessor (&LeoPropagationLossModel::m_cutoffAngle),
MakeDoubleAccessor (&LeoPropagationLossModel::m_elevationAngle),
MakeDoubleChecker<double> ())
.AddAttribute ("AtmosphericLoss",
"Atmospheric loss due to attenuation in dB",
DoubleValue (0.0),
MakeDoubleAccessor (&LeoPropagationLossModel::m_atmosphericLoss),
MakeDoubleChecker<double> ())
.AddAttribute ("FreeSpacePathLoss",
"Free space path loss in dB",
DoubleValue (0.0),
MakeDoubleAccessor (&LeoPropagationLossModel::m_atmosphericLoss),
MakeDoubleChecker<double> ())
.AddAttribute ("LinkMargin",
"Link margin in dB",
DoubleValue (0.0),
MakeDoubleAccessor (&LeoPropagationLossModel::m_linkMargin),
MakeDoubleChecker<double> ())
;
return tid;
@ -61,13 +76,14 @@ LeoPropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
{
if (a->GetDistanceFrom (b) > m_cutoffDistance && GetAngle (a, b) > m_cutoffAngle)
if (a->GetDistanceFrom (b) > m_cutoffDistance && GetAngle (a, b) > m_elevationAngle / 2.0)
{
return 0.0;
}
double rxc = 0.0;//-m_variable->GetValue ();
//NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db");
double rxc = -m_atmosphericLoss - m_freeSpacePathLoss;
NS_LOG_DEBUG ("attenuation coefficient= " << rxc << " dB");
return txPowerDbm + rxc;
}

View file

@ -25,9 +25,24 @@ private:
double m_cutoffDistance;
/**
* Cutoff angle for signal
* Maximum elevation angle
*/
double m_cutoffAngle;
double m_elevationAngle;
/**
* Atmospheric loss
*/
double m_atmosphericLoss;
/**
* Free space path loss (FSPL)
*/
double m_freeSpacePathLoss;
/**
* Link margin
*/
double m_linkMargin;
/**
* Returns the Rx Power taking into account only the particular

View file

@ -24,14 +24,14 @@ namespace ns3 {
#define LEO_STARLINK_FREQUENCY 28.5 // GHz
#define LEO_STARLINK_BANDWIDTH 0.5 // GHz
#define LEO_STARLINK_TX_ANTENNA_D 3.5 // m
#define LEO_STARLINK_EIRP 68.4 // dBW
#define LEO_STARLINK_EIRP 98.4 // dBm
#define LEO_STARLINK_MODCOD "256APSK 3/4" // -
#define LEO_STARLINK_ROLL_OFF_FACTOR 0.1 // -
#define LEO_STARLINK_SPECTRAL_EFF 5.4 // bps/Hz
#define LEO_STARLINK_PATH_DISTANCE 1684 // km
#define LEO_STARLINK_ELEVATION_ANGLE 40 // deg
#define LEO_STARLINK_FSPL 186.1 // dB
#define LEO_STARLINK_ATMOSPHERIC_LOSS 2.9 // dB
#define LEO_STARLINK_ATMOSPHERIC_LOSS 2.9 // dBm
#define LEO_STARLINK_RX_ANTENNA_GAIN 40.9 // dBi
#define LEO_STARLINK_SYSTEM_TEMP 535.9 // K
#define LEO_STARLINK_G_T 13.6 // dB/K

View file

@ -24,7 +24,7 @@ namespace ns3 {
#define LEO_TELESAT_FREQUENCY 28.5 // GHz
#define LEO_TELESAT_BANDWIDTH 2.1 // GHz
#define LEO_TELESAT_TX_ANTENNA_D 3.5 // m
#define LEO_TELESAT_EIRP 75.9 // dBW
#define LEO_TELESAT_EIRP 105.9 // dBm
#define LEO_TELESAT_MODCOD "64APSK 3/4" // -
#define LEO_TELESAT_ROLL_OFF_FACTOR 0.1 // -
#define LEO_TELESAT_SPECTRAL_EFF 4.1 // bps/Hz

View file

@ -173,7 +173,8 @@ MockChannel::Deliver (
Ptr<PropagationLossModel> pLoss = GetPropagationLoss ();
if (pLoss != 0)
{
if (pLoss->CalcRxPower (1.0, srcMob, dstMob) == 0.0)
// check if Rx power is below link margin
if (pLoss->CalcRxPower (src->GetTxPower (), srcMob, dstMob) == 0.0)
{
return false;
}

View file

@ -28,6 +28,7 @@
#include "ns3/net-device-queue-interface.h"
#include "ns3/ethernet-header.h"
#include "ns3/ethernet-trailer.h"
#include "ns3/double.h"
#include "mock-channel.h"
#include "mock-net-device.h"
@ -69,6 +70,11 @@ MockNetDevice::GetTypeId (void)
TimeValue (Seconds (0.0)),
MakeTimeAccessor (&MockNetDevice::m_tInterframeGap),
MakeTimeChecker ())
.AddAttribute ("TxPower",
"Transmit power in dBm",
DoubleValue (1.0),
MakeDoubleAccessor (&MockNetDevice::m_txPower),
MakeDoubleChecker<double> ())
//
// Transmit queueing discipline for the device which includes its own set
@ -765,4 +771,16 @@ MockNetDevice::IsPointToPoint() const
return false;
}
double
MockNetDevice::GetTxPower () const
{
return m_txPower;
}
void
MockNetDevice::SetTxPower (double txPower)
{
m_txPower = txPower;
}
} // namespace ns3

View file

@ -91,6 +91,16 @@ public:
*/
bool Attach (Ptr<MockChannel> ch);
/**
* Get the transmission power in dbm
*/
double GetTxPower () const;
/**
* Set the transmission power in dbm
*/
void SetTxPower (double txPower);
/**
* Attach a queue to the MockNetDevice.
*
@ -280,6 +290,11 @@ private:
READY, /**< The transmitter is ready to begin transmission of a packet */
BUSY /**< The transmitter is busy transmitting a packet */
};
/**
* Transmission power used for transmissions
*/
double m_txPower;
/**
* The state of the Net Device transmit state machine.
*/