mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-09 02:23:57 +02:00
Add constructor for channls wih params for constellations
This commit is contained in:
parent
27ee6a3697
commit
bb3bcb627c
7 changed files with 132 additions and 6 deletions
|
@ -31,7 +31,7 @@ namespace ns3 {
|
|||
#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 // dBm
|
||||
#define LEO_STARLINK_ATMOSPHERIC_LOSS 2.9 // dB
|
||||
#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
|
||||
|
|
|
@ -155,6 +155,12 @@ MockChannel::GetPropagationLoss () const
|
|||
return m_propagationLoss;
|
||||
}
|
||||
|
||||
void
|
||||
MockChannel::SetPropagationLoss (PropagationLossModel model)
|
||||
{
|
||||
m_propagationLoss = model;
|
||||
}
|
||||
|
||||
bool
|
||||
MockChannel::Deliver (
|
||||
Ptr<const Packet> p,
|
||||
|
@ -168,13 +174,17 @@ MockChannel::Deliver (
|
|||
Ptr<MobilityModel> srcMob = src->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> dstMob = dst->GetObject<MobilityModel> ();
|
||||
|
||||
double txPower = src->GetTxPower ();
|
||||
double rxPower = txPower;
|
||||
|
||||
if (srcMob != 0 && dstMob != 0)
|
||||
{
|
||||
Ptr<PropagationLossModel> pLoss = GetPropagationLoss ();
|
||||
if (pLoss != 0)
|
||||
{
|
||||
// check if Rx power is below link margin
|
||||
if (pLoss->CalcRxPower (src->GetTxPower (), srcMob, dstMob) == 0.0)
|
||||
// check if signal reaches destination
|
||||
rxPower = pLoss->CalcRxPower (txPower, srcMob, dstMob);
|
||||
if (rxPower == 0.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -187,7 +197,8 @@ MockChannel::Deliver (
|
|||
&MockNetDevice::Receive,
|
||||
dst,
|
||||
p->Copy (),
|
||||
src);
|
||||
src,
|
||||
rxPower);
|
||||
|
||||
// Call the tx anim callback on the net device
|
||||
m_txrxMock (p, src, dst, txTime, delay);
|
||||
|
|
|
@ -72,6 +72,9 @@ public:
|
|||
std::size_t GetNDevices (void) const;
|
||||
virtual bool TransmitStart (Ptr<const Packet> p, uint32_t devId, Address dst, Time txTime) = 0;
|
||||
|
||||
Ptr<PropagationLossModel> GetPropagationLoss () const;
|
||||
void SetPropagationLoss (PropagationLossModel model);
|
||||
|
||||
protected:
|
||||
TracedCallback<Ptr<const Packet>, // Packet being transmitted
|
||||
Ptr<NetDevice>, // Transmitting NetDevice
|
||||
|
@ -87,7 +90,6 @@ protected:
|
|||
Time GetPropagationDelay (Ptr<MobilityModel> first, Ptr<MobilityModel> second, Time txTime) const;
|
||||
|
||||
Ptr<PropagationDelayModel> GetPropagationDelay () const;
|
||||
Ptr<PropagationLossModel> GetPropagationLoss () const;
|
||||
Ptr<MockNetDevice> GetDevice (Address &addr) const;
|
||||
|
||||
bool Deliver ( Ptr<const Packet> p, Ptr<MockNetDevice> src, Ptr<MockNetDevice> dst, Time txTime);
|
||||
|
|
|
@ -70,6 +70,11 @@ MockNetDevice::GetTypeId (void)
|
|||
TimeValue (Seconds (0.0)),
|
||||
MakeTimeAccessor (&MockNetDevice::m_tInterframeGap),
|
||||
MakeTimeChecker ())
|
||||
.AddAttribute ("RxThreshold",
|
||||
"Receive threshold in dBm",
|
||||
DoubleValue (0.0),
|
||||
MakeDoubleAccessor (&MockNetDevice::m_rxThreshold),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("TxPower",
|
||||
"Transmit power in dBm",
|
||||
DoubleValue (1.0),
|
||||
|
@ -410,7 +415,9 @@ MockNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em)
|
|||
}
|
||||
|
||||
void
|
||||
MockNetDevice::Receive (Ptr<Packet> packet, Ptr<MockNetDevice> senderDevice)
|
||||
MockNetDevice::Receive (Ptr<Packet> packet,
|
||||
Ptr<MockNetDevice> senderDevice,
|
||||
double rxPower)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << senderDevice);
|
||||
|
||||
|
@ -421,6 +428,13 @@ MockNetDevice::Receive (Ptr<Packet> packet, Ptr<MockNetDevice> senderDevice)
|
|||
|
||||
m_phyRxEndTrace (packet);
|
||||
|
||||
if (rxPower < m_rxThreshold)
|
||||
{
|
||||
// Received power is below threshold
|
||||
m_phyRxDropTrace (packet);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) )
|
||||
{
|
||||
//
|
||||
|
@ -783,4 +797,16 @@ MockNetDevice::SetTxPower (double txPower)
|
|||
m_txPower = txPower;
|
||||
}
|
||||
|
||||
double
|
||||
MockNetDevice::GetRxTreshold () const
|
||||
{
|
||||
return m_rxThreshold;
|
||||
}
|
||||
|
||||
void
|
||||
MockNetDevice::SetRxThreshold (double rxThresh)
|
||||
{
|
||||
m_rxThreshold = rxThresh;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
|
|
@ -101,6 +101,16 @@ public:
|
|||
*/
|
||||
void SetTxPower (double txPower);
|
||||
|
||||
/**
|
||||
* Get the receive threshold in dBm
|
||||
*/
|
||||
double GetRxTreshold () const;
|
||||
|
||||
/**
|
||||
* Set the receive threshold in dBm
|
||||
*/
|
||||
void SetRxThreshold (double rxThresh);
|
||||
|
||||
/**
|
||||
* Attach a queue to the MockNetDevice.
|
||||
*
|
||||
|
@ -295,6 +305,11 @@ private:
|
|||
*/
|
||||
double m_txPower;
|
||||
|
||||
/**
|
||||
* Minimum threshold for received power
|
||||
*/
|
||||
double m_rxThreshold;
|
||||
|
||||
/**
|
||||
* The state of the Net Device transmit state machine.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue